Skip to content

Commit

Permalink
add 'ts tsc' lint; use underscore to bypass unused-var
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeesun Kim authored and Jeesun Kim committed Mar 29, 2024
1 parent db579f1 commit 5897b88
Show file tree
Hide file tree
Showing 15 changed files with 73 additions and 80 deletions.
8 changes: 7 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
{
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"]
"extends": ["eslint:recommended", "next/core-web-vitals", "prettier"],
"rules": {
"no-unused-vars": [
"error",
{ "vars": "all", "args": "after-used", "argsIgnorePattern": "^_" }
]
}
}
1 change: 1 addition & 0 deletions .lintstagedrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ const buildEslintCommand = (filenames) =>

module.exports = {
"*.{js,jsx,ts,tsx}": [buildEslintCommand],
"*.{ts,tsx}": () => ["yarn tsc --noEmit"],
};
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"lint": "next lint",
"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",
"lint:ts": "tsc --noEmit",
"prepare": "husky",
"pre-commit": "concurrently 'lint-staged'",
"pre-commit": "concurrently 'lint-staged' '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": {
Expand Down
9 changes: 3 additions & 6 deletions src/components/FormElements/AssetPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ 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;
onChange: (_asset: AssetObjectValue | undefined) => void;
assetInput: "issued" | "alphanumeric";
fitContent?: boolean;
includeNative?: boolean;
Expand Down Expand Up @@ -137,14 +136,12 @@ type AssetPickerFieldsProps = {
code: {
value: string;
error: string;
// eslint-disable-next-line no-unused-vars
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
};
issuer: {
value: string;
error: string;
// eslint-disable-next-line no-unused-vars
onChange: (e: React.ChangeEvent<HTMLInputElement>) => void;
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
};
};

Expand Down
3 changes: 1 addition & 2 deletions src/components/FormElements/CursorPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ 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;
onChange: (_e: React.ChangeEvent<HTMLInputElement>) => void;
}

export const CursorPicker = ({
Expand Down
3 changes: 1 addition & 2 deletions src/components/FormElements/IncludeFailedPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ 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;
onChange: (_optionId: string | undefined, _optionValue?: boolean) => void;
labelSuffix?: string | React.ReactNode;
};

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

export const LimitPicker = ({
Expand Down
3 changes: 1 addition & 2 deletions src/components/FormElements/OrderPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ 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;
onChange: (_optionId: string | undefined, _optionValue?: string) => void;
labelSuffix?: string | React.ReactNode;
};

Expand Down
3 changes: 1 addition & 2 deletions src/components/FormElements/PubKeyPicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ interface PubKeyPickerProps extends Omit<InputProps, "fieldSize"> {
placeholder?: string;
value: string;
error: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (e: React.ChangeEvent<any>) => void;
onChange: (_e: React.ChangeEvent<any>) => void;
}

export const PubKeyPicker = ({
Expand Down
6 changes: 2 additions & 4 deletions src/components/RadioPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ 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,
_optionId: AssetType | undefined,
_optionValue?: TOptionValue,
) => void;
options: {
id: string;
Expand Down
3 changes: 1 addition & 2 deletions src/components/Tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ export const Tabs = ({
}: {
tabs: Tab[];
activeTabId: string;
// eslint-disable-next-line no-unused-vars
onChange: (id: string) => void;
onChange: (_id: string) => void;
}) => {
return (
<div className="Tabs">
Expand Down
15 changes: 5 additions & 10 deletions src/components/formComponentTemplate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,26 @@ import { AnyObject, AssetObjectValue } from "@/types/types";
type TemplateRenderProps = {
value: string | undefined;
error: string | undefined;
// eslint-disable-next-line no-unused-vars
onChange: (val: any) => void;
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;
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;
onChange: (_optionId: string | undefined, _optionValue?: string) => void;
isRequired?: boolean;
};

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;
render: (..._args: any[]) => JSX.Element;
validate: ((..._args: any[]) => any) | null;
};

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

// Account
account: {
publicKey: string;
// eslint-disable-next-line no-unused-vars
update: (value: string) => void;
update: (_value: string) => void;
reset: () => void;
};

Expand All @@ -25,12 +23,9 @@ 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;
updateNetwork: (_network: Network) => void;
updateCurrentEndpoint: (_endpoint: string) => void;
updateParams: (_params: AnyObject) => void;
resetParams: () => void;
reset: () => void;
};
Expand Down
3 changes: 1 addition & 2 deletions src/store/useStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ 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) => {
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
75 changes: 41 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -188,9 +188,9 @@
playwright "1.42.1"

"@rushstack/eslint-patch@^1.3.3":
version "1.8.0"
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.8.0.tgz#c5545e6a5d2bd5c26b4021c357177a28698c950e"
integrity sha512-0HejFckBN2W+ucM6cUOlwsByTKt9/+0tWhqUffNIcHqCXkthY/mZ7AuYPK/2IIaGWhdl0h+tICDO0ssLMd6XMQ==
version "1.10.1"
resolved "https://registry.yarnpkg.com/@rushstack/eslint-patch/-/eslint-patch-1.10.1.tgz#7ca168b6937818e9a74b47ac4e2112b2e1a024cf"
integrity sha512-S3Kq8e7LqxkA9s7HKLqXGTGck1uwis5vAXan3FnU5yw1Ec5hsSGnq4s/UCaSqABPOnOTg7zASLyst7+ohgWexg==

"@stellar/design-system@^2.0.0-beta.8":
version "2.0.0-beta.8"
Expand Down Expand Up @@ -291,9 +291,9 @@
integrity sha512-5zvhXYtRNRluoE/jAp4GVsSduVUzNWKkOZrCDBWYtE7biZywwdC2AcEzg+cSMLFRfVgeAFqpfNabiPjxFddV1Q==

"@types/react-dom@^18.2.22":
version "18.2.22"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.22.tgz#d332febf0815403de6da8a97e5fe282cbe609bae"
integrity sha512-fHkBXPeNtfvri6gdsMYyW+dW7RXFo6Ad09nLFK0VQWR7yGLai/Cyvyj696gbwYvBnhGtevUG9cET0pmUbMtoPQ==
version "18.2.23"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.23.tgz#112338760f622a16d64271b408355f2f27f6302c"
integrity sha512-ZQ71wgGOTmDYpnav2knkjr3qXdAFu0vsk8Ci5w3pGAIdj7/kKAyn+VsQDhXsmzzzepAiI9leWMmubXz690AI/A==
dependencies:
"@types/react" "*"

Expand Down Expand Up @@ -1624,14 +1624,14 @@ [email protected]:
htmlparser2 "9.1.0"

html-react-parser@^5.1.9:
version "5.1.9"
resolved "https://registry.yarnpkg.com/html-react-parser/-/html-react-parser-5.1.9.tgz#7a8eb3a0b243bddf68f1a77bba5e423933b64161"
integrity sha512-MP0MQDEGlzkJT0OwY//tKYrgIzBM1frYLxx9RF7ALdIjI+MCMumydcNovXDX4X/iDi1zfgaU28VxoNXZn7EPjQ==
version "5.1.10"
resolved "https://registry.yarnpkg.com/html-react-parser/-/html-react-parser-5.1.10.tgz#e65bf68df9b505756680d2cae842f7add3da5305"
integrity sha512-gV22PvLij4wdEdtrZbGVC7Zy2OVWnQ0bYhX63S196ZRSx4+K0TuutCreHSXr+saUia8KeKB+2TYziVfijpH4Tw==
dependencies:
domhandler "5.0.3"
html-dom-parser "5.0.8"
react-property "2.0.2"
style-to-js "1.1.11"
style-to-js "1.1.12"

[email protected]:
version "9.1.0"
Expand Down Expand Up @@ -1699,10 +1699,10 @@ inherits@2, inherits@^2.0.1:
resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c"
integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==

[email protected].2:
version "0.2.2"
resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.2.2.tgz#d498b4e6de0373458fc610ff793f6b14ebf45633"
integrity sha512-EcKzdTHVe8wFVOGEYXiW9WmJXPjqi1T+234YpJr98RiFYKHV3cdy1+3mkTE+KHTHxFFLH51SfaGOoUdW+v7ViQ==
[email protected].3:
version "0.2.3"
resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.2.3.tgz#e35c5fb45f3a83ed7849fe487336eb7efa25971c"
integrity sha512-qlD8YNDqyTKTyuITrDOffsl6Tdhv+UC4hcdAVuQsK4IMQ99nSgd1MIA/Q+jQYoh9r3hVUXhYh7urSRmXPkW04g==

internal-slot@^1.0.7:
version "1.0.7"
Expand Down Expand Up @@ -2086,18 +2086,18 @@ loose-envify@^1.1.0, loose-envify@^1.4.0:
dependencies:
js-tokens "^3.0.0 || ^4.0.0"

lru-cache@^10.2.0:
version "10.2.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3"
integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==

lru-cache@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-6.0.0.tgz#6d6fe6570ebd96aaf90fcad1dafa3b2566db3a94"
integrity sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==
dependencies:
yallist "^4.0.0"

"lru-cache@^9.1.1 || ^10.0.0":
version "10.2.0"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-10.2.0.tgz#0bd445ca57363465900f4d1f9bd8db343a4d95c3"
integrity sha512-2bIM8x+VAf6JT4bKAljS1qUWgMsqZRPGJS6FSahIMPVvctcNhyVp7AJu7quxOW9jwkryBReKZY5tY5JYv2n/7Q==

merge-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
Expand Down Expand Up @@ -2138,7 +2138,7 @@ mimic-fn@^4.0.0:
resolved "https://registry.yarnpkg.com/mimic-fn/-/mimic-fn-4.0.0.tgz#60a90550d5cb0b239cca65d893b1a53b29871ecc"
integrity sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==

[email protected], minimatch@^9.0.1:
[email protected]:
version "9.0.3"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.3.tgz#a6e00c3de44c3a542bfaae70abfc22420a6da825"
integrity sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==
Expand All @@ -2152,6 +2152,13 @@ minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
dependencies:
brace-expansion "^1.1.7"

minimatch@^9.0.1:
version "9.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-9.0.4.tgz#8e49c731d1749cbec05050ee5145147b32496a51"
integrity sha512-KqWh+VchfxcMNRAJjj2tnsSJdNbHsVgnkBhTNrW7AjVo6OvLtxw8zfT9oLw1JSohlFzJ8jCoTgaoXvJ+kHt6fw==
dependencies:
brace-expansion "^2.0.1"

minimist@^1.2.0, minimist@^1.2.6:
version "1.2.8"
resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.8.tgz#c1a464e7693302e082a075cee0c057741ac4772c"
Expand Down Expand Up @@ -2373,11 +2380,11 @@ path-parse@^1.0.7:
integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==

path-scurry@^1.10.1:
version "1.10.1"
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.1.tgz#9ba6bf5aa8500fe9fd67df4f0d9483b2b0bfc698"
integrity sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==
version "1.10.2"
resolved "https://registry.yarnpkg.com/path-scurry/-/path-scurry-1.10.2.tgz#8f6357eb1239d5fa1da8b9f70e9c080675458ba7"
integrity sha512-7xTavNy5RQXnsjANvVvMkEjvloOinkAjv/Z6Ildz9v2RinZ4SBKTWFOVRbaF8p0vpHnyjV/UwNDdKuUv6M5qcA==
dependencies:
lru-cache "^9.1.1 || ^10.0.0"
lru-cache "^10.2.0"
minipass "^5.0.0 || ^6.0.2 || ^7.0.0"

path-type@^4.0.0:
Expand Down Expand Up @@ -2878,19 +2885,19 @@ strip-json-comments@^3.1.1:
resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==

[email protected].11:
version "1.1.11"
resolved "https://registry.yarnpkg.com/style-to-js/-/style-to-js-1.1.11.tgz#7ba66214cab556fdded4786e80de0baccfa0e942"
integrity sha512-yHpYzXzEkx7iDjGEmE8Eyl4K/hWIm36FXPdRsl2NHEpbigLeawLVsv6tcYp+2xNhfpCrut4w08dYqeCxWMdRxw==
[email protected].12:
version "1.1.12"
resolved "https://registry.yarnpkg.com/style-to-js/-/style-to-js-1.1.12.tgz#112dd054231e71643514013a4475d4649bb2b581"
integrity sha512-tv+/FkgNYHI2fvCoBMsqPHh5xovwiw+C3X0Gfnss/Syau0Nr3IqGOJ9XiOYXoPnToHVbllKFf5qCNFJGwFg5mg==
dependencies:
style-to-object "1.0.5"
style-to-object "1.0.6"

[email protected].5:
version "1.0.5"
resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-1.0.5.tgz#5e918349bc3a39eee3a804497d97fcbbf2f0d7c0"
integrity sha512-rDRwHtoDD3UMMrmZ6BzOW0naTjMsVZLIjsGleSKS/0Oz+cgCfAPRspaqJuE8rDzpKha/nEvnM0IF4seEAZUTKQ==
[email protected].6:
version "1.0.6"
resolved "https://registry.yarnpkg.com/style-to-object/-/style-to-object-1.0.6.tgz#0c28aed8be1813d166c60d962719b2907c26547b"
integrity sha512-khxq+Qm3xEyZfKd/y9L3oIWQimxuc4STrQKtQn8aSDRHb8mFgpukgX1hdzfrMEW6JCjyJ8p89x+IUMVnCBI1PA==
dependencies:
inline-style-parser "0.2.2"
inline-style-parser "0.2.3"

[email protected]:
version "5.1.1"
Expand Down

0 comments on commit 5897b88

Please sign in to comment.