Skip to content

Commit

Permalink
update tsconfig.json and .eslintrc.json
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeesun Kim authored and Jeesun Kim committed Apr 2, 2024
1 parent 851f828 commit 2a58419
Show file tree
Hide file tree
Showing 16 changed files with 141 additions and 150 deletions.
17 changes: 11 additions & 6 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"],
"rules": {
"no-unused-vars": [
"error",
{ "vars": "all", "args": "after-used", "argsIgnorePattern": "^_" }
]
"extends": [
"eslint:recommended",
"plugin:react-hooks/recommended",
"plugin:@typescript-eslint/recommended",
"next/core-web-vitals",
"prettier"
],
"rules":{
// @TODO: ideally, these should be removed
"@typescript-eslint/no-explicit-any": "off",
"import/named": "off"
}
}
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@stellar/stellar-sdk": "^11.3.0",
"@tanstack/react-query": "^5.28.8",
"@tanstack/react-query-devtools": "^5.28.8",
"@typescript-eslint/eslint-plugin": "^7.5.0",
"dompurify": "^3.0.11",
"html-react-parser": "^5.1.10",
"immer": "^10.0.4",
Expand All @@ -36,14 +37,15 @@
"devDependencies": {
"@next/eslint-plugin-next": "^14.1.4",
"@playwright/test": "^1.42.1",
"@stellar/tsconfig": "^1.0.2",
"@types/dompurify": "^3.0.5",
"@types/node": "^20.11.30",
"@types/react": "^18.2.71",
"@types/react-dom": "^18.2.23",
"concurrently": "^8.2.2",
"eslint": "^8.57.0",
"eslint-config-next": "14.1.4",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-react-hooks": "^4.6.0",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
Expand Down
2 changes: 1 addition & 1 deletion src/app/(sidebar)/account/create/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export default function CreateAccount() {
const [secretKey, setSecretKey] = useState("");

const generateKeypair = () => {
let keypair = Keypair.random();
const keypair = Keypair.random();

account.updatePublicKey(keypair.publicKey());
setSecretKey(keypair.secret());
Expand Down
6 changes: 3 additions & 3 deletions src/components/FormElements/AssetPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type AssetPickerProps = {
labelSuffix?: string | React.ReactNode;
value: AssetObjectValue | undefined;
error: { code: string | undefined; issuer: string | undefined } | undefined;
onChange: (_asset: AssetObjectValue | undefined) => void;
onChange: (asset: AssetObjectValue | undefined) => void;
assetInput: "issued" | "alphanumeric";
fitContent?: boolean;
includeNative?: boolean;
Expand Down Expand Up @@ -136,12 +136,12 @@ type AssetPickerFieldsProps = {
code: {
value: string;
error: string;
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
};
issuer: {
value: string;
error: string;
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
};
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/FormElements/CursorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface CursorPickerProps extends Omit<InputProps, "fieldSize"> {
placeholder?: string;
value: string;
error: string | undefined;
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
}

export const CursorPicker = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormElements/IncludeFailedPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RadioPicker } from "@/components/RadioPicker";
type IncludeFailedPickerProps = {
id: string;
selectedOption: string | undefined;
onChange: (_optionId: string | undefined, _optionValue?: boolean) => void;
onChange: (optionId: string | undefined, optionValue?: boolean) => void;
labelSuffix?: string | React.ReactNode;
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/FormElements/LimitPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface LimitPickerProps extends Omit<InputProps, "fieldSize"> {
placeholder?: string;
value: string;
error: string | undefined;
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
}

export const LimitPicker = ({
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormElements/OrderPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { RadioPicker } from "@/components/RadioPicker";
type OrderPickerProps = {
id: string;
selectedOption: string | undefined;
onChange: (_optionId: string | undefined, _optionValue?: string) => void;
onChange: (optionId: string | undefined, optionValue?: string) => void;
labelSuffix?: string | React.ReactNode;
};

Expand Down
2 changes: 1 addition & 1 deletion src/components/FormElements/PubKeyPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface PubKeyPickerProps extends Omit<InputProps, "fieldSize"> {
readOnly?: boolean;
value: string;
error: string | undefined;
onChange?: (_e: React.ChangeEvent<any>) => void;
onChange?: (e: React.ChangeEvent<any>) => void;
}

export const PubKeyPicker = ({
Expand Down
4 changes: 2 additions & 2 deletions src/components/RadioPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ interface RadioPickerProps<TOptionValue = string> {
label?: string | React.ReactNode;
labelSuffix?: string | React.ReactNode;
onChange: (
_optionId: AssetType | undefined,
_optionValue?: TOptionValue,
optionId: AssetType | undefined,
optionValue?: TOptionValue,
) => void;
options: {
id: string;
Expand Down
2 changes: 1 addition & 1 deletion src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Tabs = ({
}: {
tabs: Tab[];
activeTabId: string;
onChange: (_id: string) => void;
onChange: (id: string) => void;
}) => {
return (
<div className="Tabs">
Expand Down
10 changes: 5 additions & 5 deletions src/components/formComponentTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,26 @@ import { AnyObject, AssetObjectValue } from "@/types/types";
type TemplateRenderProps = {
value: string | undefined;
error: string | undefined;
onChange: (_val: any) => void;
onChange: (val: any) => void;
isRequired?: boolean;
};

type TemplateRenderAssetProps = {
value: AssetObjectValue | undefined;
error: { code: string | undefined; issuer: string | undefined } | undefined;
onChange: (_asset: AssetObjectValue | undefined) => void;
onChange: (asset: AssetObjectValue | undefined) => void;
isRequired?: boolean;
};

type TemplateRenderOrderProps = {
value: string | undefined;
onChange: (_optionId: string | undefined, _optionValue?: string) => void;
onChange: (optionId: string | undefined, optionValue?: string) => void;
isRequired?: boolean;
};

type FormComponentTemplate = {
render: (..._args: any[]) => JSX.Element;
validate: ((..._args: any[]) => any) | null;
render: (...args: any[]) => JSX.Element;
validate: ((...args: any[]) => any) | null;
};

export const formComponentTemplate = (
Expand Down
18 changes: 9 additions & 9 deletions src/store/createStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { AnyObject, EmptyObj, Network, MuxedAccount } from "@/types/types";
export interface Store {
// Shared
network: Network | EmptyObj;
selectNetwork: (_network: Network) => void;
selectNetwork: (network: Network) => void;
resetStoredData: () => void;

// Account
Expand All @@ -18,11 +18,11 @@ export interface Store {
parsedMuxedAccountInput: string | undefined;
generatedMuxedAccount: MuxedAccount | EmptyObj;
parsedMuxedAccount: MuxedAccount | EmptyObj;
updatePublicKey: (_value: string) => void;
updateGeneratedMuxedAccountInput: (_value: Partial<MuxedAccount>) => void;
updateParsedMuxedAccountInput: (_value: string) => void;
updateGeneratedMuxedAccount: (_value: MuxedAccount) => void;
updateParsedMuxedAccount: (_value: MuxedAccount) => void;
updatePublicKey: (value: string) => void;
updateGeneratedMuxedAccountInput: (value: Partial<MuxedAccount>) => void;
updateParsedMuxedAccountInput: (value: string) => void;
updateGeneratedMuxedAccount: (value: MuxedAccount) => void;
updateParsedMuxedAccount: (value: MuxedAccount) => void;
reset: () => void;
};

Expand All @@ -31,9 +31,9 @@ export interface Store {
network: Network | EmptyObj;
currentEndpoint: string | undefined;
params: AnyObject;
updateNetwork: (_network: Network) => void;
updateCurrentEndpoint: (_endpoint: string) => void;
updateParams: (_params: AnyObject) => void;
updateNetwork: (network: Network) => void;
updateCurrentEndpoint: (endpoint: string) => void;
updateParams: (params: AnyObject) => void;
resetParams: () => void;
reset: () => void;
};
Expand Down
2 changes: 1 addition & 1 deletion src/store/useStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { useStore as useZustandStore } from "zustand";
import { Store } from "@/store/createStore";
import { ZustandContext } from "@/store/StoreProvider";

export const useStore = <T = Store>(selector?: (_state: Store) => T) => {
export const useStore = <T = Store>(selector?: (state: Store) => T) => {
selector ??= (state) => state as T;
const store = useContext(ZustandContext);
if (!store) throw new Error("Store is missing the provider");
Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "@stellar/tsconfig",
"compilerOptions": {
"target": "es5",
"lib": [
Expand Down Expand Up @@ -36,6 +37,6 @@
"build/types/**/*.ts"
],
"exclude": [
"node_modules"
"node_modules",
]
}
Loading

0 comments on commit 2a58419

Please sign in to comment.