diff --git a/.eslintrc.js b/.eslintrc.js index d1182628263..e173633708e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -99,6 +99,7 @@ module.exports = defineConfig({ args: 'after-used', destructuredArrayIgnorePattern: '^_', ignoreRestSiblings: true, + caughtErrors: 'none', }, ], 'valid-typeof': 'error', @@ -316,7 +317,7 @@ module.exports = defineConfig({ ], parserOptions: { - project: true, + projectService: true, tsconfigRootDir: __dirname, }, diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 2cf7bec8eeb..fdec94dfcf4 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -95,8 +95,8 @@ { // Group all eslint-related packages with `eslint` in the same PR matchManagers: ['npm'], - matchPackageNames: ['eslint'], - matchPackagePrefixes: ['eslint-', '@typescript-eslint/'], + matchPackageNames: ['eslint', 'typescript-eslint'], + matchPackagePrefixes: ['eslint-'], matchUpdateTypes: ['patch', 'minor'], groupName: 'eslint (non-major)', }, diff --git a/app/javascript/mastodon/locales/intl_provider.tsx b/app/javascript/mastodon/locales/intl_provider.tsx index 68d4fcbd965..94372f95b0f 100644 --- a/app/javascript/mastodon/locales/intl_provider.tsx +++ b/app/javascript/mastodon/locales/intl_provider.tsx @@ -17,7 +17,7 @@ function onProviderError(error: unknown) { error && typeof error === 'object' && error instanceof Error && - error.message.match('MISSING_DATA') + /MISSING_DATA/.exec(error.message) ) { console.warn(error.message); } diff --git a/app/javascript/mastodon/store/middlewares/errors.ts b/app/javascript/mastodon/store/middlewares/errors.ts index e77cec34ed9..3ad3844d5b7 100644 --- a/app/javascript/mastodon/store/middlewares/errors.ts +++ b/app/javascript/mastodon/store/middlewares/errors.ts @@ -30,7 +30,7 @@ function isActionWithmaybeAlertParams( return isAction(action); } -// eslint-disable-next-line @typescript-eslint/ban-types -- we need to use `{}` here to ensure the dispatch types can be merged +// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- we need to use `{}` here to ensure the dispatch types can be merged export const errorsMiddleware: Middleware<{}, RootState> = ({ dispatch }) => (next) => diff --git a/app/javascript/mastodon/store/middlewares/sounds.ts b/app/javascript/mastodon/store/middlewares/sounds.ts index 91407b1ec0a..bb3a4aa4740 100644 --- a/app/javascript/mastodon/store/middlewares/sounds.ts +++ b/app/javascript/mastodon/store/middlewares/sounds.ts @@ -51,7 +51,7 @@ const play = (audio: HTMLAudioElement) => { }; export const soundsMiddleware = (): Middleware< - // eslint-disable-next-line @typescript-eslint/ban-types -- we need to use `{}` here to ensure the dispatch types can be merged + // eslint-disable-next-line @typescript-eslint/no-empty-object-type -- we need to use `{}` here to ensure the dispatch types can be merged {}, RootState > => { diff --git a/package.json b/package.json index 18983b43e34..57c4a511330 100644 --- a/package.json +++ b/package.json @@ -170,8 +170,6 @@ "@types/requestidlecallback": "^0.3.5", "@types/webpack": "^4.41.33", "@types/webpack-env": "^1.18.4", - "@typescript-eslint/eslint-plugin": "^7.0.0", - "@typescript-eslint/parser": "^7.0.0", "babel-jest": "^29.5.0", "eslint": "^8.41.0", "eslint-define-config": "^2.0.0", @@ -192,6 +190,7 @@ "stylelint": "^16.0.2", "stylelint-config-standard-scss": "^13.0.0", "typescript": "^5.0.4", + "typescript-eslint": "^8.0.0", "webpack-dev-server": "^3.11.3" }, "resolutions": { diff --git a/yarn.lock b/yarn.lock index f050110cd63..5580231645b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2810,8 +2810,6 @@ __metadata: "@types/requestidlecallback": "npm:^0.3.5" "@types/webpack": "npm:^4.41.33" "@types/webpack-env": "npm:^1.18.4" - "@typescript-eslint/eslint-plugin": "npm:^7.0.0" - "@typescript-eslint/parser": "npm:^7.0.0" arrow-key-navigation: "npm:^1.2.0" async-mutex: "npm:^0.5.0" autoprefixer: "npm:^10.4.14" @@ -2907,6 +2905,7 @@ __metadata: tiny-queue: "npm:^0.2.1" twitter-text: "npm:3.1.0" typescript: "npm:^5.0.4" + typescript-eslint: "npm:^8.0.0" use-debounce: "npm:^10.0.0" webpack: "npm:^4.47.0" webpack-assets-manifest: "npm:^4.0.6" @@ -4121,44 +4120,44 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^7.0.0": - version: 7.17.0 - resolution: "@typescript-eslint/eslint-plugin@npm:7.17.0" +"@typescript-eslint/eslint-plugin@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.0.0" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.17.0" - "@typescript-eslint/type-utils": "npm:7.17.0" - "@typescript-eslint/utils": "npm:7.17.0" - "@typescript-eslint/visitor-keys": "npm:7.17.0" + "@typescript-eslint/scope-manager": "npm:8.0.0" + "@typescript-eslint/type-utils": "npm:8.0.0" + "@typescript-eslint/utils": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" graphemer: "npm:^1.4.0" ignore: "npm:^5.3.1" natural-compare: "npm:^1.4.0" ts-api-utils: "npm:^1.3.0" peerDependencies: - "@typescript-eslint/parser": ^7.0.0 - eslint: ^8.56.0 + "@typescript-eslint/parser": ^8.0.0 || ^8.0.0-alpha.0 + eslint: ^8.57.0 || ^9.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/654d589531ae45b8ca8f3969e785926b2544100a985968d86c828e2a1ff50331250e19c8b4af83a4ba17847a0047479662eb317e4ad94f6279cac03acd5cda5a + checksum: 10c0/e98304410039bbb7104fdd8ad7a70f2fb81430c117b66d609b44d10cc8937c8a936a4e5993b0b6df5361c00df43a146e89632a37f2407ce9bed3555733c71fc2 languageName: node linkType: hard -"@typescript-eslint/parser@npm:^7.0.0": - version: 7.17.0 - resolution: "@typescript-eslint/parser@npm:7.17.0" +"@typescript-eslint/parser@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/parser@npm:8.0.0" dependencies: - "@typescript-eslint/scope-manager": "npm:7.17.0" - "@typescript-eslint/types": "npm:7.17.0" - "@typescript-eslint/typescript-estree": "npm:7.17.0" - "@typescript-eslint/visitor-keys": "npm:7.17.0" + "@typescript-eslint/scope-manager": "npm:8.0.0" + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/typescript-estree": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" debug: "npm:^4.3.4" peerDependencies: - eslint: ^8.56.0 + eslint: ^8.57.0 || ^9.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/0cf6922412517b4c005609b035119ddd2798e1b6e74e1bccd487aa53119d27067cfd89311f00b8e96b2b044a0fb7373418a16552be86079879158b260c397418 + checksum: 10c0/7b462bc975c8e0c0d9fbc4955186d61b73aad9d5b9392e8fa68ad4b7c631582edc05176fcbfbebee603695421225e8c5f5ee28812fa47e3060fc7854b84497d5 languageName: node linkType: hard @@ -4172,30 +4171,28 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.17.0": - version: 7.17.0 - resolution: "@typescript-eslint/scope-manager@npm:7.17.0" +"@typescript-eslint/scope-manager@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/scope-manager@npm:8.0.0" dependencies: - "@typescript-eslint/types": "npm:7.17.0" - "@typescript-eslint/visitor-keys": "npm:7.17.0" - checksum: 10c0/e1a693e19dc855fe6d04b46c6c205019bfc937eda5f8b255393f8267ebddd282165568336e37b04aab544b155a807784b9c4a92129dfc7c1eef5a9e9fe052685 + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" + checksum: 10c0/d8397055f046be54302b603a59d358c74292f72af3d12ca1e652316a785400d3e2fd20d79e3e316e3278ff7f1c1ffb271f9f6a7a265b88041c5a4e8332f550a0 languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.17.0": - version: 7.17.0 - resolution: "@typescript-eslint/type-utils@npm:7.17.0" +"@typescript-eslint/type-utils@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/type-utils@npm:8.0.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.17.0" - "@typescript-eslint/utils": "npm:7.17.0" + "@typescript-eslint/typescript-estree": "npm:8.0.0" + "@typescript-eslint/utils": "npm:8.0.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" - peerDependencies: - eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/b415cf37c0922cded78735c5049cb5a5b0065e1c0ce4a81ca2a26422763ccacca8945efa45480f40530f2ec414a14d35a88a6798258aa889f7a9cf4ca4a240cd + checksum: 10c0/96ba2a58ceff420dac79a9c3c2bde15e0a56e8c47baf441a62886c9d8df3db6e9d886cd5c717c6f9a8cfceb545a511c7d452aa1537c2cd3b127bd47509e559ae languageName: node linkType: hard @@ -4206,10 +4203,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:7.17.0": - version: 7.17.0 - resolution: "@typescript-eslint/types@npm:7.17.0" - checksum: 10c0/8f734294d432b37c534f17eb2befdfe43b76874d09118d6adf7e308e5a586e9e11b7021abe4f6692a6e6226de58a15b3cfe1300939556ce1c908d9af627b7400 +"@typescript-eslint/types@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/types@npm:8.0.0" + checksum: 10c0/c15efce96e4b80c2bef7ea4fa7f046609816ae8bc3a4e31d9d671e237520f6b96595e1330a891ec7042bc7b09fc16d265bad49fd878d5fb8be4b59b8a752e5b5 languageName: node linkType: hard @@ -4232,12 +4229,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.17.0": - version: 7.17.0 - resolution: "@typescript-eslint/typescript-estree@npm:7.17.0" +"@typescript-eslint/typescript-estree@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.0.0" dependencies: - "@typescript-eslint/types": "npm:7.17.0" - "@typescript-eslint/visitor-keys": "npm:7.17.0" + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/visitor-keys": "npm:8.0.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -4247,21 +4244,21 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/10967823ce00c9f8cd4a8b56bed3524c098e38cc0e27aaa49ffd8fad4e671c00226bf0330ba858948750b88dc55527ebeb62c74be8a30bac18a106d6c033ab59 + checksum: 10c0/a82f3eb2a66a4b2715d09f8f9547c1f0c27ea60c1d10d0777c8ce998b760dbb8ef14466fc2056220b8a236c2d2dc3ee99f482502f5c268bd40909b272bb47eb4 languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.17.0": - version: 7.17.0 - resolution: "@typescript-eslint/utils@npm:7.17.0" +"@typescript-eslint/utils@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/utils@npm:8.0.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:7.17.0" - "@typescript-eslint/types": "npm:7.17.0" - "@typescript-eslint/typescript-estree": "npm:7.17.0" + "@typescript-eslint/scope-manager": "npm:8.0.0" + "@typescript-eslint/types": "npm:8.0.0" + "@typescript-eslint/typescript-estree": "npm:8.0.0" peerDependencies: - eslint: ^8.56.0 - checksum: 10c0/1f3e22820b3ab3e47809c45e576614ad4a965f5c8634856eca5c70981386b9351a77fb172ba32345e7c5667479cf9526c673699dd38dccd0616ad6db21704e72 + eslint: ^8.57.0 || ^9.0.0 + checksum: 10c0/ecba01996d1aa330c640c41c1212fed2328a47768348ab6886080e0e55bc3b2041939a635a7440d47db533f0c4b21e1eb8b58535a9eaebbbe2c035906e12ba06 languageName: node linkType: hard @@ -4292,13 +4289,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.17.0": - version: 7.17.0 - resolution: "@typescript-eslint/visitor-keys@npm:7.17.0" +"@typescript-eslint/visitor-keys@npm:8.0.0": + version: 8.0.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.0.0" dependencies: - "@typescript-eslint/types": "npm:7.17.0" + "@typescript-eslint/types": "npm:8.0.0" eslint-visitor-keys: "npm:^3.4.3" - checksum: 10c0/fa6b339d51fc3710288bb2ffaa46d639551d77965cc42c36f96c4f43aed663ff12972e8a28652a280f6ce20b7a92dc2aea14b2b4049012799be2fc2d3cbb2c60 + checksum: 10c0/8c59a2e971370c2b9a5727541c72d6b64fd0448ab03dd8b4274a26bddea5e1b4c560dd7856e1f48577cd333f7bbbed7a0f1849d39e2d1b48a748a3668c1a3723 languageName: node linkType: hard @@ -17264,6 +17261,20 @@ __metadata: languageName: node linkType: hard +"typescript-eslint@npm:^8.0.0": + version: 8.0.0 + resolution: "typescript-eslint@npm:8.0.0" + dependencies: + "@typescript-eslint/eslint-plugin": "npm:8.0.0" + "@typescript-eslint/parser": "npm:8.0.0" + "@typescript-eslint/utils": "npm:8.0.0" + peerDependenciesMeta: + typescript: + optional: true + checksum: 10c0/138ba4767e16bcb1bde3e6becbe92a548091d27c5584cf60d5c78d599085e06172791ab297447b9245f5387c9777b76683c2afd0e0234ed20d67a1de1192a7c9 + languageName: node + linkType: hard + "typescript@npm:5, typescript@npm:^5.0.4": version: 5.5.4 resolution: "typescript@npm:5.5.4"