Skip to content

Commit

Permalink
update husky's lintstagedrc and linting rule (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeesunikim authored Apr 3, 2024
1 parent 9cdbed6 commit 87649d2
Show file tree
Hide file tree
Showing 17 changed files with 122 additions and 156 deletions.
13 changes: 12 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
{
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"]
"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"
}
}
1 change: 1 addition & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
yarn pre-push
8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,20 @@
"build": "next build",
"start": "next start",
"lint": "next lint",
"lint:ts": "tsc --noEmit",
"test": "playwright test",
"install-if-package-changed": "git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD | grep --quiet yarn.lock && yarn install || exit 0",
"prepare": "husky",
"pre-commit": "concurrently 'lint-staged'",
"pre-commit": "yarn lint-staged",
"pre-push": "yarn lint:ts",
"git-info": "rm -rf src/generated/ && mkdir src/generated/ && echo export default \"{\\\"commitHash\\\": \\\"$(git rev-parse --short HEAD)\\\", \\\"version\\\": \\\"$(git describe --tags --always)\\\"};\" > src/generated/gitInfo.ts"
},
"dependencies": {
"@stellar/design-system": "^2.0.0-beta.8",
"@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 @@ -34,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
3 changes: 0 additions & 3 deletions src/components/FormElements/AssetPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ type AssetPickerProps = {
labelSuffix?: string | React.ReactNode;
value: AssetObjectValue | undefined;
error: { code: string | undefined; issuer: string | undefined } | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (asset: AssetObjectValue | undefined) => void;
assetInput: "issued" | "alphanumeric";
fitContent?: boolean;
Expand Down Expand Up @@ -137,13 +136,11 @@ type AssetPickerFieldsProps = {
code: {
value: string;
error: string;
// eslint-disable-next-line no-unused-vars
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
};
issuer: {
value: string;
error: string;
// eslint-disable-next-line no-unused-vars
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
};
};
Expand Down
1 change: 0 additions & 1 deletion src/components/FormElements/CursorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ interface CursorPickerProps extends Omit<InputProps, "fieldSize"> {
placeholder?: string;
value: string;
error: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
}

Expand Down
1 change: 0 additions & 1 deletion src/components/FormElements/IncludeFailedPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { RadioPicker } from "@/components/RadioPicker";
type IncludeFailedPickerProps = {
id: string;
selectedOption: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (optionId: string | undefined, optionValue?: boolean) => void;
labelSuffix?: string | React.ReactNode;
};
Expand Down
1 change: 0 additions & 1 deletion src/components/FormElements/LimitPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ interface LimitPickerProps extends Omit<InputProps, "fieldSize"> {
value: string;
placeholder?: string;
error: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
}

Expand Down
1 change: 0 additions & 1 deletion src/components/FormElements/OrderPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { RadioPicker } from "@/components/RadioPicker";
type OrderPickerProps = {
id: string;
selectedOption: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (optionId: string | undefined, optionValue?: string) => void;
labelSuffix?: string | React.ReactNode;
};
Expand Down
1 change: 0 additions & 1 deletion src/components/FormElements/PubKeyPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ interface PubKeyPickerProps extends Omit<InputProps, "fieldSize"> {
readOnly?: boolean;
value: string;
error: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange?: (e: React.ChangeEvent<any>) => void;
}

Expand Down
2 changes: 0 additions & 2 deletions src/components/RadioPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ interface RadioPickerProps<TOptionValue = string> {
label?: string | React.ReactNode;
labelSuffix?: string | React.ReactNode;
onChange: (
// eslint-disable-next-line no-unused-vars
optionId: AssetType | undefined,
// eslint-disable-next-line no-unused-vars
optionValue?: TOptionValue,
) => void;
options: {
Expand Down
1 change: 0 additions & 1 deletion src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export const Tabs = ({
}: {
tabs: Tab[];
activeTabId: string;
// eslint-disable-next-line no-unused-vars
onChange: (id: string) => void;
}) => {
return (
Expand Down
5 changes: 0 additions & 5 deletions src/components/formComponentTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,19 @@ import { IncludeFailedPicker } from "./FormElements/IncludeFailedPicker";
type TemplateRenderProps = {
value: string | undefined;
error: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (val: any) => void;
isRequired?: boolean;
};

type TemplateRenderAssetProps = {
value: AssetObjectValue | undefined;
error: { code: string | undefined; issuer: string | undefined } | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (asset: AssetObjectValue | undefined) => void;
isRequired?: boolean;
};

type TemplateRenderOrderProps = {
value: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (optionId: string | undefined, optionValue?: string) => void;
isRequired?: boolean;
};
Expand All @@ -44,9 +41,7 @@ type TemplateRenderIncludeFailedProps = {
};

type FormComponentTemplate = {
// eslint-disable-next-line no-unused-vars
render: (...args: any[]) => JSX.Element;
// eslint-disable-next-line no-unused-vars
validate: ((...args: any[]) => any) | null;
};

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

Expand All @@ -19,15 +18,10 @@ export interface Store {
parsedMuxedAccountInput: string | undefined;
generatedMuxedAccount: MuxedAccount | EmptyObj;
parsedMuxedAccount: MuxedAccount | EmptyObj;
// eslint-disable-next-line no-unused-vars
updatePublicKey: (value: string) => void;
// eslint-disable-next-line no-unused-vars
updateGeneratedMuxedAccountInput: (value: Partial<MuxedAccount>) => void;
// eslint-disable-next-line no-unused-vars
updateParsedMuxedAccountInput: (value: string) => void;
// eslint-disable-next-line no-unused-vars
updateGeneratedMuxedAccount: (value: MuxedAccount) => void;
// eslint-disable-next-line no-unused-vars
updateParsedMuxedAccount: (value: MuxedAccount) => void;
reset: () => void;
};
Expand All @@ -37,11 +31,8 @@ export interface Store {
network: Network | EmptyObj;
currentEndpoint: string | undefined;
params: AnyObject;
// eslint-disable-next-line no-unused-vars
updateNetwork: (network: Network) => void;
// eslint-disable-next-line no-unused-vars
updateCurrentEndpoint: (endpoint: string) => void;
// eslint-disable-next-line no-unused-vars
updateParams: (params: AnyObject) => void;
resetParams: () => void;
reset: () => void;
Expand Down
1 change: 0 additions & 1 deletion src/store/useStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { useStore as useZustandStore } from "zustand";
import { Store } from "@/store/createStore";
import { ZustandContext } from "@/store/StoreProvider";

// eslint-disable-next-line no-unused-vars
export const useStore = <T = Store>(selector?: (state: Store) => T) => {
selector ??= (state) => state as T;
const store = useContext(ZustandContext);
Expand Down
15 changes: 4 additions & 11 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
{
"extends": "@stellar/tsconfig",
"compilerOptions": {
"target": "es5",
"lib": [
"dom",
"dom.iterable",
"esnext"
],
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
Expand All @@ -23,9 +20,7 @@
}
],
"paths": {
"@/*": [
"./src/*"
]
"@/*": ["./src/*"]
}
},
"include": [
Expand All @@ -35,7 +30,5 @@
".next/types/**/*.ts",
"build/types/**/*.ts"
],
"exclude": [
"node_modules"
]
"exclude": ["node_modules"]
}
Loading

0 comments on commit 87649d2

Please sign in to comment.