From c49723056acec489765acb54bae3889ac07f25af Mon Sep 17 00:00:00 2001 From: MCMXC <16797721+mcmxcdev@users.noreply.github.com> Date: Thu, 18 Apr 2024 08:18:36 -0600 Subject: refactor: bring down eslint warnings to zero (#1714) - install `@eslint-react/eslint-plugin` dependency - configure `@eslint-react/eslint-plugin` in eslint config - modernize `lint` command in `package.json` - disable or fix various reported lint issues - fix `div` being nested in `p` for settings - replace deprecated `event.keyCode` with `event.key` - update isEscKeyPress method and unit tests which used deprecated `event.keyCode` - allow `eslint` v8 as peer dependency for `@eslint-react/eslint-plugin` --- .eslintignore | 1 + .eslintrc.js | 13 +- package.json | 4 +- pnpm-lock.yaml | 280 +++++++++++++++++++-- scripts/link-readme.ts | 2 + src/I18n.tsx | 4 +- src/api/utils/auth.ts | 1 + src/components/auth/AuthLayout.tsx | 1 + .../downloadManager/DownloadManagerDashboard.tsx | 1 - .../downloadManager/DownloadManagerLayout.tsx | 4 +- src/components/settings/SettingsLayout.tsx | 2 +- .../releaseNotes/ReleaseNotesDashboard.tsx | 1 + .../settings/releaseNotes/ReleaseNotesLayout.tsx | 4 +- .../settings/settings/EditSettingsForm.tsx | 56 ++--- .../supportFerdium/SupportFerdiumDashboard.tsx | 14 +- src/components/ui/FAB.tsx | 1 + src/components/ui/SearchInput.tsx | 1 + src/components/ui/Tabs/Tabs.tsx | 7 +- src/components/ui/button/index.tsx | 2 +- src/components/ui/imageUpload/index.tsx | 2 + src/components/ui/input/index.tsx | 2 +- src/components/ui/select/index.tsx | 2 + src/components/ui/textarea/index.tsx | 7 +- src/containers/auth/AuthReleaseNotesScreen.tsx | 1 + .../download-manager/DownloadManagerScreen.tsx | 17 +- src/containers/settings/EditServiceScreen.tsx | 4 + src/containers/settings/ReleaseNotesScreen.tsx | 18 +- src/containers/settings/SupportScreen.tsx | 18 +- src/electron/ipc-api/autoUpdate.ts | 1 + src/electron/ipc-api/index.ts | 1 + src/electron/macOSPermissions.ts | 2 +- src/features/appearance/index.ts | 1 + src/features/basicAuth/Component.tsx | 2 + src/features/communityRecipes/store.ts | 1 + src/features/quickSwitch/Component.tsx | 2 + src/features/todos/actions.ts | 1 + src/features/todos/components/TodosWebview.tsx | 3 + src/features/todos/index.ts | 1 + .../webControls/containers/WebControlsScreen.tsx | 2 + .../workspaces/components/CreateWorkspaceForm.tsx | 2 + .../workspaces/components/EditWorkspaceForm.tsx | 7 +- .../workspaces/components/WorkspaceDrawer.tsx | 2 + .../workspaces/components/WorkspaceDrawerItem.tsx | 1 + .../components/WorkspaceServiceListItem.tsx | 1 + .../workspaces/components/WorkspacesDashboard.tsx | 50 ++-- src/features/workspaces/index.ts | 1 + src/index.ts | 1 + .../app/Controllers/Http/ImageController.js | 1 + src/internal-server/start/migrate.js | 1 + src/internal-server/test.ts | 2 +- src/jsUtils.ts | 2 +- src/routes.tsx | 3 + src/stores/AppStore.ts | 2 +- src/stores/ServicesStore.ts | 9 + src/stores/lib/Request.ts | 2 +- src/styles/settings.scss | 1 + src/themes/default/index.ts | 1 + src/webview/lib/RecipeWebview.ts | 1 - test/jsUtils.test.ts | 8 +- 59 files changed, 450 insertions(+), 135 deletions(-) diff --git a/.eslintignore b/.eslintignore index f1867f427..30357b9c4 100644 --- a/.eslintignore +++ b/.eslintignore @@ -10,6 +10,7 @@ pids # Coverage directory used by tools like istanbul coverage .eslintcache +.eslintrc.js # Dependency directory # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git diff --git a/.eslintrc.js b/.eslintrc.js index ed473c21b..f95bbbd9f 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -17,8 +17,9 @@ module.exports = { 'plugin:unicorn/recommended', 'plugin:sonar/recommended', 'plugin:prettier/recommended', + 'plugin:@eslint-react/recommended-legacy', ], - plugins: ['jest'], + plugins: ['@eslint-react', 'jest'], settings: { react: { pragma: 'React', // Pragma to use, default to "React" @@ -45,6 +46,7 @@ module.exports = { // TODO: Opt-in to a stricter ruleset in the future // 'plugin:@typescript-eslint/strict-type-checked', 'plugin:@typescript-eslint/stylistic-type-checked', + 'plugin:@eslint-react/recommended-type-checked-legacy', ], parser: '@typescript-eslint/parser', plugins: [], @@ -71,6 +73,12 @@ module.exports = { // eslint-plugin-import 'import/no-extraneous-dependencies': 0, + // @eslint-react + '@eslint-react/no-class-component': 0, + '@eslint-react/no-complicated-conditional-rendering': 0, + '@eslint-react/no-leaked-conditional-rendering': 0, + '@eslint-react/hooks-extra/ensure-custom-hooks-using-other-hooks': 0, + // sonar 'sonar/no-try-promise': 0, }, @@ -105,7 +113,7 @@ module.exports = { 'react/jsx-filename-extension': 1, 'react/jsx-no-bind': 1, 'react/jsx-props-no-spreading': 0, - 'react/prefer-stateless-function': 1, + 'react/prefer-stateless-function': 0, 'react/static-property-placement': 0, 'react/state-in-constructor': 1, 'react/sort-comp': 0, @@ -137,6 +145,7 @@ module.exports = { 'unicorn/import-style': 0, 'unicorn/consistent-destructuring': 0, 'unicorn/no-anonymous-default-export': 0, + 'unicorn/no-array-for-each': 0, // eslint-plugin-sonar 'sonar/function-name': 0, }, diff --git a/package.json b/package.json index 988791a98..f49c636ae 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "test": "jest", "test:watch": "jest --watch", "typecheck": "tsc --noEmit", - "lint": "eslint \"{src,test,scripts}/**/*.{js,jsx,mjs,ts,tsx}\" --quiet", + "lint": "eslint . --max-warnings 0", "lint:fix": "pnpm lint --cache --fix", "biome:check": "pnpm biome check .", "biome:check:fix": "pnpm biome:check --apply-unsafe", @@ -136,6 +136,7 @@ "@commitlint/cli": "19.2.1", "@commitlint/config-conventional": "19.1.0", "@electron/notarize": "2.3.0", + "@eslint-react/eslint-plugin": "1.5.8", "@formatjs/cli": "6.2.9", "@jest/types": "29.6.3", "@types/auto-launch": "5.0.5", @@ -201,6 +202,7 @@ "allowedVersions": { "@typescript-eslint/parser": "^7.0.0", "esbuild-sass-plugin>esbuild": "^0.16.7", + "eslint": "^8.0.0", "react-electron-web-view>react": "^18.0.0", "react-electron-web-view>react-dom": "^18.0.0", "react-sortable-hoc>react": "^18.0.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e88ccd691..1b8261174 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -270,6 +270,9 @@ devDependencies: '@electron/notarize': specifier: 2.3.0 version: 2.3.0 + '@eslint-react/eslint-plugin': + specifier: 1.5.8 + version: 1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5) '@formatjs/cli': specifier: 6.2.9 version: 6.2.9 @@ -1853,7 +1856,7 @@ packages: resolution: {integrity: sha512-1/sA4dwrzBAyeUoQ6oxahHKmrZvsnLCg4RfxW3ZFGGmQkSNQPFNLV9CUEFQP1x9EYXHTo5p6xdhZM1Ne9p/AfA==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: - eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 || ^8.0.0 dependencies: eslint: 8.57.0 eslint-visitor-keys: 3.4.3 @@ -1864,6 +1867,128 @@ packages: engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true + /@eslint-react/ast@1.5.8(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-bfhjJYByn/oql2H3xqlUwqsCrCsu7ItYTuSl7vU2VWuUaGTNm2DVLljje5prUq7z26mQ/96YzW16OFoSmGovjw==} + dependencies: + '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + string-ts: 2.1.0 + transitivePeerDependencies: + - eslint + - supports-color + - typescript + dev: true + + /@eslint-react/core@1.5.8(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-iJoWoD5+dPS0sZvyVhkeQi2K5tI/fviRavsXFAR4GDhiviI8tZvKQg8mj/OlHDPUlvA+Bz8P0d0dxEXM3nyolQ==} + dependencies: + '@eslint-react/ast': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/jsx': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/shared': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/type-utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + short-unique-id: 5.0.3 + transitivePeerDependencies: + - eslint + - supports-color + - typescript + dev: true + + /@eslint-react/eslint-plugin@1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-SQgGcd5DKK0zjOn6O1QztTolzRzw+VHP9qMWwlRkonoxau4T9U5RwsbBzl2Aojk9v3CtPOHtr1AQ8ZOUEi6d4A==} + engines: {bun: '>=1.0.15', node: '>=18.18.0'} + peerDependencies: + '@typescript-eslint/parser': '>=7.5.0 || ^7.0.0' + eslint: '>=9.0.0 || ^8.0.0' + typescript: '>=5.3.3' + dependencies: + '@eslint-react/shared': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/type-utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + eslint: 8.57.0 + eslint-plugin-react-core: 1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5) + eslint-plugin-react-dom: 1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5) + eslint-plugin-react-hooks-extra: 1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5) + eslint-plugin-react-naming-convention: 1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + + /@eslint-react/jsx@1.5.8(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-zQd239hspAJ9I9ejxKh7MuSW27HNVsXWiRHzit3azXRX95jwGZeeMRQeh9tS9290ANr8n2vBbSTePbl1FkuPKg==} + dependencies: + '@eslint-react/ast': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/shared': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/var': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + micro-memoize: 4.1.2 + transitivePeerDependencies: + - eslint + - supports-color + - typescript + dev: true + + /@eslint-react/shared@1.5.8(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-XE6tp39NACI9pFD1x5LRXE2NfcQoRDVsOEqzYfS1XQczTHann2ySzrPgTPJE4KlKT156uRxg8DqPkcpsioQIEw==} + dependencies: + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + deepmerge-ts: 5.1.0 + transitivePeerDependencies: + - eslint + - supports-color + - typescript + dev: true + + /@eslint-react/tools@1.5.8: + resolution: {integrity: sha512-Ye4HqrB6l8JomMRE7A8DUZsNNK5P28dDBXE69kR9UjWQqXU1xA2E5Pw7g9dn7CSNkPSi6IIm/1cFAPzPgMUqrQ==} + dev: true + + /@eslint-react/types@1.5.8(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-u1Y1G8+IRiNNZ+REMMkVvHAp+I3ruJoKRybHsM1DCoyT3xZZ85wNPwB5R+oBurEXG7vRi3A9CsUGKU7v+PCbfw==} + dependencies: + '@eslint-react/tools': 1.5.8 + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + transitivePeerDependencies: + - eslint + - supports-color + - typescript + dev: true + + /@eslint-react/var@1.5.8(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-RhQfA2oTGTX7d8aauU8pIqq+tAxv5bSl/8LxtvNx6UXQxQAuk/2Oss7ICdgm6GBMUGpbaBATTgIo3wOytLwqCw==} + dependencies: + '@eslint-react/ast': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + string-ts: 2.1.0 + transitivePeerDependencies: + - eslint + - supports-color + - typescript + dev: true + /@eslint/eslintrc@2.1.4: resolution: {integrity: sha512-269Z39MS6wVJtsoUl10L60WdkhJVdPG24Q4eZTH3nnF6lpvSShEK3wQjDX9JRWAUPvPh7COouPpU9IrqaZFvtQ==} engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} @@ -3219,7 +3344,7 @@ packages: engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 + eslint: ^8.56.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: @@ -3247,7 +3372,7 @@ packages: resolution: {integrity: sha512-usPMPHcwX3ZoPWnBnhhorc14NJw9J4HpSXQX4urF2TPKG0au0XhJoZyX62fmvdHONUkmyUe74Hzm1//XA+BoYg==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - eslint: ^8.56.0 + eslint: ^8.56.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: @@ -3312,7 +3437,7 @@ packages: resolution: {integrity: sha512-NxAfqAPNLG6LTmy7uZgpK8KcuiS2NZD/HlThPXQRGwz6u7MDBWRVliEEl1Gj6U7++kVJTpehkhZzCJLMK66Scw==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - eslint: ^8.56.0 + eslint: ^8.56.0 || ^8.0.0 typescript: '*' peerDependenciesMeta: typescript: @@ -3451,7 +3576,7 @@ packages: resolution: {integrity: sha512-x54gaSsRRI+Nwz59TXpCsr6harB98qjXYzsRxGqvA5Ue3kQH+FxS7FYU81g/omn22ML2pZJkisy6Q+ElK8pBCA==} engines: {node: ^18.18.0 || >=20.0.0} peerDependencies: - eslint: ^8.56.0 + eslint: ^8.56.0 || ^8.0.0 dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) '@types/json-schema': 7.0.15 @@ -5663,6 +5788,11 @@ packages: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} dev: true + /deepmerge-ts@5.1.0: + resolution: {integrity: sha512-eS8dRJOckyo9maw9Tu5O5RUi/4inFLrnoLkBe3cPfDMx3WZioXtmOew4TXQaxq7Rhl4xjDtR7c6x8nNTxOvbFw==} + engines: {node: '>=16.0.0'} + dev: true + /deepmerge@4.3.0: resolution: {integrity: sha512-z2wJZXrmeHdvYJp/Ux55wIjqo81G5Bp4c+oELTW+7ar6SogWHajt5a9gO3s3IDaGSAXjDk0vlQKN3rms8ab3og==} engines: {node: '>=0.10.0'} @@ -6477,7 +6607,7 @@ packages: resolution: {integrity: sha512-xaX3z4ZZIcFLvh2oUNvcX5oEofXda7giYmuplVxoOg5A7EXJMrUyqRgR+mhDhPK8LZ4PttFOBvCYDbX3sUoUig==} engines: {node: ^10.12.0 || >=12.0.0} peerDependencies: - eslint: ^7.32.0 || ^8.2.0 + eslint: ^7.32.0 || ^8.2.0 || ^8.0.0 eslint-plugin-import: ^2.25.2 dependencies: confusing-browser-globals: 1.0.11 @@ -6493,7 +6623,7 @@ packages: peerDependencies: '@typescript-eslint/eslint-plugin': ^7.0.0 '@typescript-eslint/parser': ^7.0.0 - eslint: ^8.56.0 + eslint: ^8.56.0 || ^8.0.0 dependencies: '@typescript-eslint/eslint-plugin': 7.6.0(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5) '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.5) @@ -6507,7 +6637,7 @@ packages: resolution: {integrity: sha512-T75QYQVQX57jiNgpF9r1KegMICE94VYwoFQyMGhrvc+lB8YF2E/M/PYDaQe1AJcWaEgqLE+ErXV1Og/+6Vyzew==} engines: {node: ^10.12.0 || ^12.22.0 || ^14.17.0 || >=16.0.0} peerDependencies: - eslint: ^7.32.0 || ^8.2.0 + eslint: ^7.32.0 || ^8.2.0 || ^8.0.0 eslint-plugin-import: ^2.25.3 eslint-plugin-jsx-a11y: ^6.5.1 eslint-plugin-react: ^7.28.0 @@ -6527,7 +6657,7 @@ packages: resolution: {integrity: sha512-NSWl5BFQWEPi1j4TjVNItzYV7dZXZ+wP6I6ZhrBGpChQhZRUaElihE9uRRkcbRnNb76UMKDF3r+WTmNcGPKsqw==} hasBin: true peerDependencies: - eslint: '>=7.0.0' + eslint: '>=7.0.0 || ^8.0.0' dependencies: eslint: 8.57.0 dev: true @@ -6576,7 +6706,7 @@ packages: engines: {node: '>=4'} peerDependencies: '@typescript-eslint/parser': '*' - eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 + eslint: ^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8 || ^8.0.0 peerDependenciesMeta: '@typescript-eslint/parser': optional: true @@ -6632,7 +6762,7 @@ packages: resolution: {integrity: sha512-Hdh937BS3KdwwbBaKd5+PLCOmYY6U4f2h9Z2ktwtNKvIdIEu137rjYbcb9ApSbVJfWxANNuiKTD/9tOKjK9qOA==} engines: {node: '>=4.0'} peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^8.0.0 dependencies: '@babel/runtime': 7.23.5 aria-query: 5.3.0 @@ -6658,7 +6788,7 @@ packages: engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: '@types/eslint': '>=8.0.0' - eslint: '>=8.0.0' + eslint: '>=8.0.0 || ^8.0.0' eslint-config-prettier: '*' prettier: '>=3.0.0' peerDependenciesMeta: @@ -6674,20 +6804,127 @@ packages: synckit: 0.8.6 dev: true + /eslint-plugin-react-core@1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-AWF0N07w3Tpkq2VKiZdvf1ItdQuYw/nJFmcs1ZZZOKq6eNSYpsSzKDpurwjAyMl4+WE+xL2b6lrUuVawfNpkMQ==} + engines: {bun: '>=1.0.15', node: '>=18.18.0'} + peerDependencies: + '@typescript-eslint/parser': '>=7.5.0 || ^7.0.0' + eslint: '>=9.0.0 || ^8.0.0' + typescript: '>=5.3.3' + dependencies: + '@eslint-react/ast': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/core': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/jsx': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/shared': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/var': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/type-utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + eslint: 8.57.0 + string-ts: 2.1.0 + ts-api-utils: 1.3.0(typescript@5.4.5) + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-plugin-react-dom@1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-xPCfuSvdccCnzyMHeBWCepi+SniXf5IszcQB0951Chvb4pSkwyemuN0xy4ux4cu0i5wyHzQZJk3jBqM1b49+YQ==} + engines: {bun: '>=1.0.15', node: '>=18.18.0'} + peerDependencies: + '@typescript-eslint/parser': '>=7.5.0 || ^7.0.0' + eslint: '>=9.0.0 || ^8.0.0' + typescript: '>=5.3.3' + dependencies: + '@eslint-react/ast': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/core': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/jsx': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/shared': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/var': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + eslint: 8.57.0 + string-ts: 2.1.0 + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + + /eslint-plugin-react-hooks-extra@1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-GDitayVrF51bDH+ASs9QCvw6YZOn5A99iQMH9wKCGlaGA+mUD0vFt8EHW4kALjmBNSjA/y5ZZ3/435mGwrIv8Q==} + engines: {bun: '>=1.0.15', node: '>=18.18.0'} + peerDependencies: + '@typescript-eslint/parser': '>=7.5.0 || ^7.0.0' + eslint: '>=9.0.0 || ^8.0.0' + typescript: '>=5.3.3' + dependencies: + '@eslint-react/ast': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/core': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/jsx': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/shared': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/var': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/type-utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + eslint: 8.57.0 + string-ts: 2.1.0 + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + /eslint-plugin-react-hooks@4.6.0(eslint@8.57.0): resolution: {integrity: sha512-oFc7Itz9Qxh2x4gNHStv3BqJq54ExXmfC+a1NjAta66IAN87Wu0R/QArgIS9qKzX3dXKPI9H5crl9QchNMY9+g==} engines: {node: '>=10'} peerDependencies: - eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 + eslint: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0 || ^8.0.0 dependencies: eslint: 8.57.0 dev: true + /eslint-plugin-react-naming-convention@1.5.8(@typescript-eslint/parser@7.6.0)(eslint@8.57.0)(typescript@5.4.5): + resolution: {integrity: sha512-1pZNudmoiaB4ZnfGauMoi9at4pSmzb0EMidfDXybmev09fEuO7mBUfpks/Fjs1PGDGogEhe0a9KQIVTPe4Ui2w==} + engines: {bun: '>=1.0.15', node: '>=18.18.0'} + peerDependencies: + '@typescript-eslint/parser': '>=7.5.0 || ^7.0.0' + eslint: '>=9.0.0 || ^8.0.0' + typescript: '>=5.3.3' + dependencies: + '@eslint-react/ast': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/core': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/jsx': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/shared': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@eslint-react/tools': 1.5.8 + '@eslint-react/types': 1.5.8(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/parser': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/scope-manager': 7.6.0 + '@typescript-eslint/type-utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + '@typescript-eslint/types': 7.6.0 + '@typescript-eslint/utils': 7.6.0(eslint@8.57.0)(typescript@5.4.5) + eslint: 8.57.0 + string-ts: 2.1.0 + typescript: 5.4.5 + transitivePeerDependencies: + - supports-color + dev: true + /eslint-plugin-react@7.34.1(eslint@8.57.0): resolution: {integrity: sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==} engines: {node: '>=4'} peerDependencies: - eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 + eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 || ^8.0.0 dependencies: array-includes: 3.1.7 array.prototype.findlast: 1.2.5 @@ -6754,7 +6991,7 @@ packages: resolution: {integrity: sha512-1Yzm7/m+0R4djH0tjDjfVei/ju2w3AzUGjG6q8JnuNIL5xIwsflyCooW5sfBvQp2pMYQFSWWCFONsjCax1EHng==} engines: {node: '>=16'} peerDependencies: - eslint: '>=8.56.0' + eslint: '>=8.56.0 || ^8.0.0' dependencies: '@babel/helper-validator-identifier': 7.22.20 '@eslint-community/eslint-utils': 4.4.0(eslint@8.57.0) @@ -10105,6 +10342,10 @@ packages: engines: {node: '>= 8'} dev: true + /micro-memoize@4.1.2: + resolution: {integrity: sha512-+HzcV2H+rbSJzApgkj0NdTakkC+bnyeiUxgT6/m7mjcz1CmM22KYFKp+EVj1sWe4UYcnriJr5uqHQD/gMHLD+g==} + dev: true + /micromatch@3.1.10: resolution: {integrity: sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==} engines: {node: '>=0.10.0'} @@ -12591,6 +12832,11 @@ packages: resolution: {integrity: sha512-6j1W9l1iAs/4xYBI1SYOVZyFcCis9b4KCLQ8fgAGG07QvzaRLVVRQvAy85yNmmZSjYjg4MWh4gNvlPujU/5LpA==} dev: true + /short-unique-id@5.0.3: + resolution: {integrity: sha512-yhniEILouC0s4lpH0h7rJsfylZdca10W9mDJRAFh3EpcSUanCHGb0R7kcFOIUCZYSAPo0PUD5ZxWQdW0T4xaug==} + hasBin: true + dev: true + /side-channel@1.0.4: resolution: {integrity: sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==} dependencies: @@ -12965,6 +13211,10 @@ packages: resolution: {integrity: sha512-Yptehjogou2xm4UJbxJ4CxgZx12HBfeystp0y3x7s4Dj32ltVVG1Gg8YhKjHZkHicuKpZX/ffilA8505VbUbpw==} dev: true + /string-ts@2.1.0: + resolution: {integrity: sha512-YpGEBxS3Qw1De+RO3Gdrsx2gwYU9b7WmPtKhRLTTKc3oKzbOxqGDYLRGkNeIXLL4BGVZMXY49hPpzP3RAwUFAA==} + dev: true + /string-width@2.1.1: resolution: {integrity: sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==} engines: {node: '>=4'} diff --git a/scripts/link-readme.ts b/scripts/link-readme.ts index 147ae22f7..d323d83f6 100644 --- a/scripts/link-readme.ts +++ b/scripts/link-readme.ts @@ -9,6 +9,7 @@ import path from 'node:path'; import fs from 'fs-extra'; +// eslint-disable-next-line no-console console.log('Linking issues and PRs in README.md'); const readmepath = path.join(__dirname, '..', 'README.md'); @@ -60,4 +61,5 @@ readme = readme.replaceAll(/(? { // Write to file fs.writeFileSync(readmepath, readme); +// eslint-disable-next-line no-console console.log(`Added ${replacements} strings`); diff --git a/src/I18n.tsx b/src/I18n.tsx index 2085f3e98..dc9c7d6b9 100644 --- a/src/I18n.tsx +++ b/src/I18n.tsx @@ -27,7 +27,9 @@ class I18N extends Component { return ( { window['ferdium'].intl = intlProvider ? intlProvider.state.intl diff --git a/src/api/utils/auth.ts b/src/api/utils/auth.ts index ce30e0132..0188675fc 100644 --- a/src/api/utils/auth.ts +++ b/src/api/utils/auth.ts @@ -39,6 +39,7 @@ export const prepareLocalToken = async (requestData: { await when(() => !needsToken() || !!localServerToken(), { timeout: 2000 }); const token = localServerToken(); if (token) { + // eslint-disable-next-line no-param-reassign requestData.headers['X-Ferdium-Local-Token'] = token; } }; diff --git a/src/components/auth/AuthLayout.tsx b/src/components/auth/AuthLayout.tsx index 67e898318..3952045b2 100644 --- a/src/components/auth/AuthLayout.tsx +++ b/src/components/auth/AuthLayout.tsx @@ -106,6 +106,7 @@ class AuthLayout extends Component { )}
{/* Inject globalError into children */} + {/* eslint-disable-next-line @eslint-react/no-clone-element */} {cloneElement(children, { error })}
{/* */} diff --git a/src/components/downloadManager/DownloadManagerDashboard.tsx b/src/components/downloadManager/DownloadManagerDashboard.tsx index 490be269d..aeaa94634 100644 --- a/src/components/downloadManager/DownloadManagerDashboard.tsx +++ b/src/components/downloadManager/DownloadManagerDashboard.tsx @@ -47,7 +47,6 @@ interface IState { data: string; } -// eslint-disable-next-line react/prefer-stateless-function class DownloadManagerDashboard extends Component { render() { const { intl, stores, actions } = this.props; diff --git a/src/components/downloadManager/DownloadManagerLayout.tsx b/src/components/downloadManager/DownloadManagerLayout.tsx index 08c0ace1e..43670355c 100644 --- a/src/components/downloadManager/DownloadManagerLayout.tsx +++ b/src/components/downloadManager/DownloadManagerLayout.tsx @@ -44,8 +44,8 @@ class DownloadManagerLayout extends Component { ); } - handleKeyDown(e) { - if (isEscKeyPress(e.keyCode)) { + handleKeyDown(e: KeyboardEvent) { + if (isEscKeyPress(e.key)) { this.props.actions!.ui.closeSettings(); } } diff --git a/src/components/settings/SettingsLayout.tsx b/src/components/settings/SettingsLayout.tsx index 17f8c3e33..a5fa13d71 100644 --- a/src/components/settings/SettingsLayout.tsx +++ b/src/components/settings/SettingsLayout.tsx @@ -41,7 +41,7 @@ class SettingsLayout extends Component> { } handleKeyDown(e: KeyboardEvent): void { - if (isEscKeyPress(e.keyCode)) { + if (isEscKeyPress(e.key)) { this.props.closeSettings(); } } diff --git a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx index e874b4469..e2867ab8e 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesDashboard.tsx @@ -49,6 +49,7 @@ class ReleaseNotesDashboard extends Component { intl, ); + // eslint-disable-next-line @eslint-react/no-set-state-in-component-did-mount this.setState({ data, }); diff --git a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx index 23db7141e..4fb31d053 100644 --- a/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx +++ b/src/components/settings/releaseNotes/ReleaseNotesLayout.tsx @@ -43,8 +43,8 @@ class ReleaseNotesLayout extends Component { ); } - handleKeyDown(e) { - if (isEscKeyPress(e.keyCode)) { + handleKeyDown(e: KeyboardEvent) { + if (isEscKeyPress(e.key)) { this.props.actions!.ui.closeSettings(); } } diff --git a/src/components/settings/settings/EditSettingsForm.tsx b/src/components/settings/settings/EditSettingsForm.tsx index 84057091d..c3e8d46a0 100644 --- a/src/components/settings/settings/EditSettingsForm.tsx +++ b/src/components/settings/settings/EditSettingsForm.tsx @@ -1087,34 +1087,34 @@ class EditSettingsForm extends Component {

{intl.formatMessage(messages.subheadlineFerdiumProfile)}

-

-

-
-

+ +
+
+

{intl.formatMessage(messages.serverHelp, { serverURL, diff --git a/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx b/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx index 065690fb5..3a4592666 100644 --- a/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx +++ b/src/components/settings/supportFerdium/SupportFerdiumDashboard.tsx @@ -33,7 +33,7 @@ const SupportFerdiumDashboard = () => { Twitter Follow { GitHub Stars - + Crowdin { Open Collective backers { GitHub contributors (non-exhaustive) { }; return ( + // eslint-disable-next-line @eslint-react/dom/no-missing-button-type diff --git a/src/components/ui/SearchInput.tsx b/src/components/ui/SearchInput.tsx index 2e70d1b35..d31463010 100644 --- a/src/components/ui/SearchInput.tsx +++ b/src/components/ui/SearchInput.tsx @@ -98,6 +98,7 @@ class SearchInput extends Component { /> {value.length > 0 && ( + // eslint-disable-next-line jsx-a11y/no-static-element-interactions this.reset()} onKeyDown={noop}> diff --git a/src/components/ui/Tabs/Tabs.tsx b/src/components/ui/Tabs/Tabs.tsx index a5ec148aa..d1e397122 100644 --- a/src/components/ui/Tabs/Tabs.tsx +++ b/src/components/ui/Tabs/Tabs.tsx @@ -35,6 +35,7 @@ class Tab extends Component { render(): ReactElement { const { children: childElements } = this.props; + // eslint-disable-next-line @eslint-react/no-children-to-array const children = Children.toArray(childElements); // removes all null values if (children.length === 1) { @@ -44,9 +45,10 @@ class Tab extends Component { return (

+ {/* eslint-disable-next-line @eslint-react/no-children-map */} {Children.map(children, (child, i) => (
+ {/* eslint-disable-next-line @eslint-react/no-children-map */} {Children.map(children, (child, i) => (
{ ) : (