From 1f7419d6dd84939acb75e49feabb4e8a90be9d97 Mon Sep 17 00:00:00 2001 From: ioay Date: Tue, 9 Jan 2024 16:39:45 +0100 Subject: [PATCH 1/6] Thesis - eslint config --- dapp/package.json | 2 +- pnpm-lock.yaml | 33 ++------------------------------- 2 files changed, 3 insertions(+), 32 deletions(-) diff --git a/dapp/package.json b/dapp/package.json index 8345eb7e2..d2d3e6458 100644 --- a/dapp/package.json +++ b/dapp/package.json @@ -26,7 +26,7 @@ "react-number-format": "^5.3.1" }, "devDependencies": { - "@thesis-co/eslint-config": "^0.6.1", + "@thesis-co/eslint-config": "github:thesis/eslint-config#7b9bc8c", "@types/react": "^18.2.38", "@types/react-dom": "^18.2.17", "@typescript-eslint/eslint-plugin": "^6.12.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b5614ee89..9465bed28 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -143,8 +143,8 @@ importers: version: 5.3.1(react-dom@18.2.0)(react@18.2.0) devDependencies: '@thesis-co/eslint-config': - specifier: ^0.6.1 - version: 0.6.1(eslint@8.54.0)(prettier@3.1.0)(typescript@5.3.2) + specifier: github:thesis/eslint-config#7b9bc8c + version: github.com/thesis/eslint-config/7b9bc8c(eslint@8.54.0)(prettier@3.1.0)(typescript@5.3.2) '@types/react': specifier: ^18.2.38 version: 18.2.38 @@ -5425,35 +5425,6 @@ packages: dependencies: defer-to-connect: 2.0.1 - /@thesis-co/eslint-config@0.6.1(eslint@8.54.0)(prettier@3.1.0)(typescript@5.3.2): - resolution: {integrity: sha512-0vJCCI4UwUdniDCQeTFlMBT+bSp5pGkrtHrZrG2vmyLZwSVdJNtInjkBc/Jd0sGfMtPo3pqQRwA40Zo80lPi+Q==} - engines: {node: '>=14.0.0'} - peerDependencies: - eslint: '>=6.8.0' - dependencies: - '@thesis-co/prettier-config': github.com/thesis/prettier-config/daeaac564056a7885e4366ce12bfde6fd823fc90(prettier@3.1.0) - '@typescript-eslint/eslint-plugin': 6.12.0(@typescript-eslint/parser@6.12.0)(eslint@8.54.0)(typescript@5.3.2) - '@typescript-eslint/parser': 6.12.0(eslint@8.54.0)(typescript@5.3.2) - eslint: 8.54.0 - eslint-config-airbnb: 19.0.4(eslint-plugin-import@2.29.0)(eslint-plugin-jsx-a11y@6.8.0)(eslint-plugin-react-hooks@4.6.0)(eslint-plugin-react@7.33.2)(eslint@8.54.0) - eslint-config-airbnb-base: 15.0.0(eslint-plugin-import@2.29.0)(eslint@8.54.0) - eslint-config-airbnb-typescript: 17.1.0(@typescript-eslint/eslint-plugin@6.12.0)(@typescript-eslint/parser@6.12.0)(eslint-plugin-import@2.29.0)(eslint@8.54.0) - eslint-config-prettier: 9.0.0(eslint@8.54.0) - eslint-plugin-import: 2.29.0(@typescript-eslint/parser@6.12.0)(eslint@8.54.0) - eslint-plugin-jsx-a11y: 6.8.0(eslint@8.54.0) - eslint-plugin-no-only-tests: 3.1.0 - eslint-plugin-prettier: 5.0.1(eslint-config-prettier@9.0.0)(eslint@8.54.0)(prettier@3.1.0) - eslint-plugin-react: 7.33.2(eslint@8.54.0) - eslint-plugin-react-hooks: 4.6.0(eslint@8.54.0) - transitivePeerDependencies: - - '@types/eslint' - - eslint-import-resolver-typescript - - eslint-import-resolver-webpack - - prettier - - supports-color - - typescript - dev: true - /@tokenizer/token@0.3.0: resolution: {integrity: sha512-OvjF+z51L3ov0OyAU0duzsYuvO01PH7x4t6DJx+guahgTnBHkhJdG7soQeTSFLWN3efnHyibZ4Z8l2EuWwJN3A==} From 1c5a9604f0998d6f05ad1eb2477042033e8b5136 Mon Sep 17 00:00:00 2001 From: ioay Date: Tue, 9 Jan 2024 22:16:39 +0100 Subject: [PATCH 2/6] Added eslint rules --- dapp/.eslintrc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/dapp/.eslintrc b/dapp/.eslintrc index 4317c87a7..a1c6935a5 100644 --- a/dapp/.eslintrc +++ b/dapp/.eslintrc @@ -15,6 +15,9 @@ 2, { "allowRequiredDefaults": true } ], - "react/require-default-props": [0] + "react/require-default-props": [0], + "@typescript-eslint/no-misused-promises": "off", + "@typescript-eslint/unbound-method": "off", + "@typescript-eslint/no-unsafe-member-access": "off" } } From 1cf230937dbcf50594c377d4d70924ac4b6402f6 Mon Sep 17 00:00:00 2001 From: ioay Date: Wed, 10 Jan 2024 10:39:16 +0100 Subject: [PATCH 3/6] Added comments to eslint config --- dapp/.eslintrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dapp/.eslintrc b/dapp/.eslintrc index a1c6935a5..b8736f5e6 100644 --- a/dapp/.eslintrc +++ b/dapp/.eslintrc @@ -16,8 +16,12 @@ { "allowRequiredDefaults": true } ], "react/require-default-props": [0], + // Regarding the fact we are using now: @thesis-co/eslint-config": "github:thesis/eslint-config#7b9bc8c" + // Promise-returning function provided to attribute where a void return was expected. + // Avoid referencing unbound methods which may cause unintentional scoping of `this`, used in theme files. "@typescript-eslint/no-misused-promises": "off", "@typescript-eslint/unbound-method": "off", + // Computed name [status] resolves to any value (related to external chakra-ui package) "@typescript-eslint/no-unsafe-member-access": "off" } } From 25884ef5d921de010adda4da289ac3737f51a5ac Mon Sep 17 00:00:00 2001 From: ioay Date: Wed, 10 Jan 2024 12:34:03 +0100 Subject: [PATCH 4/6] Added new eslint rule related with the last #105 changes --- dapp/.eslintrc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/dapp/.eslintrc b/dapp/.eslintrc index b8736f5e6..63815d434 100644 --- a/dapp/.eslintrc +++ b/dapp/.eslintrc @@ -22,6 +22,8 @@ "@typescript-eslint/no-misused-promises": "off", "@typescript-eslint/unbound-method": "off", // Computed name [status] resolves to any value (related to external chakra-ui package) - "@typescript-eslint/no-unsafe-member-access": "off" + "@typescript-eslint/no-unsafe-member-access": "off", + // Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator + "@typescript-eslint/no-floating-promises": "off" } } From bc983bed7c6ed9f17d9f666074d7912069926414 Mon Sep 17 00:00:00 2001 From: ioay Date: Thu, 11 Jan 2024 19:44:12 +0100 Subject: [PATCH 5/6] Removal of global exclusion rules, added temporary overrides rules for existing files --- dapp/.eslintrc | 51 ++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) diff --git a/dapp/.eslintrc b/dapp/.eslintrc index 63815d434..de11435fb 100644 --- a/dapp/.eslintrc +++ b/dapp/.eslintrc @@ -16,14 +16,45 @@ { "allowRequiredDefaults": true } ], "react/require-default-props": [0], - // Regarding the fact we are using now: @thesis-co/eslint-config": "github:thesis/eslint-config#7b9bc8c" - // Promise-returning function provided to attribute where a void return was expected. - // Avoid referencing unbound methods which may cause unintentional scoping of `this`, used in theme files. - "@typescript-eslint/no-misused-promises": "off", - "@typescript-eslint/unbound-method": "off", - // Computed name [status] resolves to any value (related to external chakra-ui package) - "@typescript-eslint/no-unsafe-member-access": "off", - // Promises must be awaited, end with a call to .catch, end with a call to .then with a rejection handler or be explicitly marked as ignored with the `void` operator - "@typescript-eslint/no-floating-promises": "off" - } + }, + // FIXME: + // This is temporary solution after changes of the eslint-config version: @thesis-co/eslint-config: "github:thesis/eslint-config#7b9bc8c" + // Overrides rules should be fixed file by file. + "overrides": [ + { + "files": [ + "src/components/Header/ConnectWallet.tsx", + "src/components/Modals/Support/MissingAccount.tsx", + "src/components/Modals/Staking/SignMessage.tsx", + "src/hooks/useDepositBTCTransaction.ts" + ], + "rules": { + "@typescript-eslint/no-misused-promises": "off" + } + }, + { + "files": [ + "src/hooks/useSignMessage.ts" + ], + "rules": { + "@typescript-eslint/no-floating-promises": "off" + } + }, + { + "files": [ + "src/theme/*" + ], + "rules": { + "@typescript-eslint/unbound-method": "off" + } + }, + { + "files": [ + "src/theme/Alert.ts" + ], + "rules": { + "@typescript-eslint/no-unsafe-member-access": "off" + } + } + ] } From f903ed1905df488ce58431435ec03919eddb0fe0 Mon Sep 17 00:00:00 2001 From: ioay Date: Thu, 11 Jan 2024 19:59:12 +0100 Subject: [PATCH 6/6] Eslint rules extension after last changes on main branch --- dapp/.eslintrc | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/dapp/.eslintrc b/dapp/.eslintrc index 67b8362d7..35437e4ed 100644 --- a/dapp/.eslintrc +++ b/dapp/.eslintrc @@ -26,7 +26,8 @@ "src/components/Header/ConnectWallet.tsx", "src/components/Modals/Support/MissingAccount.tsx", "src/components/Modals/Staking/SignMessage.tsx", - "src/hooks/useDepositBTCTransaction.ts" + "src/hooks/useDepositBTCTransaction.ts", + "src/components/shared/Form/FormTokenBalanceInput.tsx" ], "rules": { "@typescript-eslint/no-misused-promises": "off" @@ -55,6 +56,22 @@ "rules": { "@typescript-eslint/no-unsafe-member-access": "off" } + }, + { + "files": [ + "src/components/shared/Form/FormTokenBalanceInput.tsx" + ], + "rules": { + "@typescript-eslint/no-unsafe-assignment": "off" + } + }, + { + "files": [ + "src/components/shared/TokenAmountForm/index.tsx" + ], + "rules": { + "@typescript-eslint/require-await": "off" + } } ], "settings": {