From 2c35db3eecea3a925b5c08478d106438848f1c7b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 11 Sep 2024 15:59:46 +0200 Subject: [PATCH] Update typescript-eslint monorepo to v8 (major) (#31231) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renaud Chaput --- .eslintrc.js | 2 +- app/javascript/mastodon/actions/markers.ts | 2 +- app/javascript/mastodon/actions/streaming.js | 2 +- app/javascript/mastodon/common.js | 2 +- .../mastodon/components/error_boundary.jsx | 4 +- .../features/interaction_modal/index.jsx | 2 +- app/javascript/mastodon/features/ui/index.jsx | 4 +- .../mastodon/locales/intl_provider.tsx | 2 +- app/javascript/mastodon/settings.js | 7 +- .../mastodon/store/middlewares/errors.ts | 2 +- .../mastodon/store/middlewares/sounds.ts | 2 +- package.json | 4 +- yarn.lock | 141 ++++++++++-------- 13 files changed, 99 insertions(+), 77 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index d1182628263db2..b6e4253e61dfff 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -316,7 +316,7 @@ module.exports = defineConfig({ ], parserOptions: { - project: true, + projectService: true, tsconfigRootDir: __dirname, }, diff --git a/app/javascript/mastodon/actions/markers.ts b/app/javascript/mastodon/actions/markers.ts index 521859f6c25b42..6254e3f083ff12 100644 --- a/app/javascript/mastodon/actions/markers.ts +++ b/app/javascript/mastodon/actions/markers.ts @@ -65,7 +65,7 @@ export const synchronouslySubmitMarkers = createAppAsyncThunk( client.setRequestHeader('Content-Type', 'application/json'); client.setRequestHeader('Authorization', `Bearer ${accessToken}`); client.send(JSON.stringify(params)); - } catch (e) { + } catch { // Do not make the BeforeUnload handler error out } }, diff --git a/app/javascript/mastodon/actions/streaming.js b/app/javascript/mastodon/actions/streaming.js index bfdd894b81561d..03013110c38779 100644 --- a/app/javascript/mastodon/actions/streaming.js +++ b/app/javascript/mastodon/actions/streaming.js @@ -151,7 +151,7 @@ async function refreshHomeTimelineAndNotification(dispatch, getState) { // TODO: polling for merged notifications try { await dispatch(pollRecentGroupNotifications()); - } catch (error) { + } catch { // TODO } } else { diff --git a/app/javascript/mastodon/common.js b/app/javascript/mastodon/common.js index 28857de5346c20..c61e02250c234c 100644 --- a/app/javascript/mastodon/common.js +++ b/app/javascript/mastodon/common.js @@ -5,7 +5,7 @@ export function start() { try { Rails.start(); - } catch (e) { + } catch { // If called twice } } diff --git a/app/javascript/mastodon/components/error_boundary.jsx b/app/javascript/mastodon/components/error_boundary.jsx index 7fea08e85f6ef6..392a3ad61e26d1 100644 --- a/app/javascript/mastodon/components/error_boundary.jsx +++ b/app/javascript/mastodon/components/error_boundary.jsx @@ -60,8 +60,8 @@ export default class ErrorBoundary extends PureComponent { try { textarea.select(); document.execCommand('copy'); - } catch (e) { - + } catch { + // do nothing } finally { document.body.removeChild(textarea); } diff --git a/app/javascript/mastodon/features/interaction_modal/index.jsx b/app/javascript/mastodon/features/interaction_modal/index.jsx index 07f1e6fe5a1e31..723e27ae1c7857 100644 --- a/app/javascript/mastodon/features/interaction_modal/index.jsx +++ b/app/javascript/mastodon/features/interaction_modal/index.jsx @@ -131,7 +131,7 @@ class LoginForm extends React.PureComponent { try { new URL(url); return true; - } catch(_) { + } catch { return false; } }; diff --git a/app/javascript/mastodon/features/ui/index.jsx b/app/javascript/mastodon/features/ui/index.jsx index 657c9e9e583df0..a6e3640478464c 100644 --- a/app/javascript/mastodon/features/ui/index.jsx +++ b/app/javascript/mastodon/features/ui/index.jsx @@ -319,8 +319,8 @@ class UI extends PureComponent { try { e.dataTransfer.dropEffect = 'copy'; - } catch (err) { - + } catch { + // do nothing } return false; diff --git a/app/javascript/mastodon/locales/intl_provider.tsx b/app/javascript/mastodon/locales/intl_provider.tsx index 68d4fcbd965191..94372f95b0fc41 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/settings.js b/app/javascript/mastodon/settings.js index f31aee0afc0725..f4883dc406cdb5 100644 --- a/app/javascript/mastodon/settings.js +++ b/app/javascript/mastodon/settings.js @@ -14,7 +14,7 @@ export default class Settings { const encodedData = JSON.stringify(data); localStorage.setItem(key, encodedData); return data; - } catch (e) { + } catch { return null; } } @@ -24,7 +24,7 @@ export default class Settings { try { const rawData = localStorage.getItem(key); return JSON.parse(rawData); - } catch (e) { + } catch { return null; } } @@ -35,7 +35,8 @@ export default class Settings { const key = this.generateKey(id); try { localStorage.removeItem(key); - } catch (e) { + } catch { + // ignore if the key is not found } } return data; diff --git a/app/javascript/mastodon/store/middlewares/errors.ts b/app/javascript/mastodon/store/middlewares/errors.ts index e77cec34ed9fb6..3ad3844d5b7c2f 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 91407b1ec0a1dd..bb3a4aa4740d4f 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 ddf7ee75a2343b..ea0c0246cb7b0b 100644 --- a/package.json +++ b/package.json @@ -168,8 +168,8 @@ "@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", + "@typescript-eslint/eslint-plugin": "^8.0.0", + "@typescript-eslint/parser": "^8.0.0", "babel-jest": "^29.5.0", "eslint": "^8.41.0", "eslint-define-config": "^2.0.0", diff --git a/yarn.lock b/yarn.lock index 90e764f49c6bdc..f498a5560e69fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -82,7 +82,19 @@ __metadata: languageName: node linkType: hard -"@babel/generator@npm:^7.25.0, @babel/generator@npm:^7.25.4, @babel/generator@npm:^7.7.2": +"@babel/generator@npm:^7.25.0, @babel/generator@npm:^7.7.2": + version: 7.25.0 + resolution: "@babel/generator@npm:7.25.0" + dependencies: + "@babel/types": "npm:^7.25.0" + "@jridgewell/gen-mapping": "npm:^0.3.5" + "@jridgewell/trace-mapping": "npm:^0.3.25" + jsesc: "npm:^2.5.1" + checksum: 10c0/d0e2dfcdc8bdbb5dded34b705ceebf2e0bc1b06795a1530e64fb6a3ccf313c189db7f60c1616effae48114e1a25adc75855bc4496f3779a396b3377bae718ce7 + languageName: node + linkType: hard + +"@babel/generator@npm:^7.25.4": version: 7.25.4 resolution: "@babel/generator@npm:7.25.4" dependencies: @@ -1521,7 +1533,18 @@ __metadata: languageName: node linkType: hard -"@babel/types@npm:^7.0.0, @babel/types@npm:^7.0.0-beta.49, @babel/types@npm:^7.12.11, @babel/types@npm:^7.12.6, @babel/types@npm:^7.20.7, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.2, @babel/types@npm:^7.25.4, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": +"@babel/types@npm:^7.0.0, @babel/types@npm:^7.0.0-beta.49, @babel/types@npm:^7.12.11, @babel/types@npm:^7.12.6, @babel/types@npm:^7.20.7, @babel/types@npm:^7.24.7, @babel/types@npm:^7.24.8, @babel/types@npm:^7.25.0, @babel/types@npm:^7.25.2, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.4": + version: 7.25.2 + resolution: "@babel/types@npm:7.25.2" + dependencies: + "@babel/helper-string-parser": "npm:^7.24.8" + "@babel/helper-validator-identifier": "npm:^7.24.7" + to-fast-properties: "npm:^2.0.0" + checksum: 10c0/e489435856be239f8cc1120c90a197e4c2865385121908e5edb7223cfdff3768cba18f489adfe0c26955d9e7bbb1fb10625bc2517505908ceb0af848989bd864 + languageName: node + linkType: hard + +"@babel/types@npm:^7.25.4": version: 7.25.4 resolution: "@babel/types@npm:7.25.4" dependencies: @@ -2791,8 +2814,8 @@ __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" + "@typescript-eslint/eslint-plugin": "npm:^8.0.0" + "@typescript-eslint/parser": "npm:^8.0.0" arrow-key-navigation: "npm:^1.2.0" async-mutex: "npm:^0.5.0" axios: "npm:^1.4.0" @@ -4114,44 +4137,44 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/eslint-plugin@npm:^7.0.0": - version: 7.18.0 - resolution: "@typescript-eslint/eslint-plugin@npm:7.18.0" +"@typescript-eslint/eslint-plugin@npm:^8.0.0": + version: 8.1.0 + resolution: "@typescript-eslint/eslint-plugin@npm:8.1.0" dependencies: "@eslint-community/regexpp": "npm:^4.10.0" - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/type-utils": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" + "@typescript-eslint/scope-manager": "npm:8.1.0" + "@typescript-eslint/type-utils": "npm:8.1.0" + "@typescript-eslint/utils": "npm:8.1.0" + "@typescript-eslint/visitor-keys": "npm:8.1.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/2b37948fa1b0dab77138909dabef242a4d49ab93e4019d4ef930626f0a7d96b03e696cd027fa0087881c20e73be7be77c942606b4a76fa599e6b37f6985304c3 + checksum: 10c0/7bbeae588f859b59c34d6a76cac06ef0fa605921b40c5d3b65b94829984280ea84c4dd3f5cb9ce2eb326f5563e9abb4c90ebff05c47f83f4def296c2ea1fa86c languageName: node linkType: hard -"@typescript-eslint/parser@npm:^7.0.0": - version: 7.18.0 - resolution: "@typescript-eslint/parser@npm:7.18.0" +"@typescript-eslint/parser@npm:^8.0.0": + version: 8.1.0 + resolution: "@typescript-eslint/parser@npm:8.1.0" dependencies: - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/typescript-estree": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" + "@typescript-eslint/scope-manager": "npm:8.1.0" + "@typescript-eslint/types": "npm:8.1.0" + "@typescript-eslint/typescript-estree": "npm:8.1.0" + "@typescript-eslint/visitor-keys": "npm:8.1.0" debug: "npm:^4.3.4" peerDependencies: - eslint: ^8.56.0 + eslint: ^8.57.0 || ^9.0.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/370e73fca4278091bc1b657f85e7d74cd52b24257ea20c927a8e17546107ce04fbf313fec99aed0cc2a145ddbae1d3b12e9cc2c1320117636dc1281bcfd08059 + checksum: 10c0/b94b2d3ab5ca505484d100701fad6a04a5dc8d595029bac1b9f5b8a4a91d80fd605b0f65d230b36a97ab7e5d55eeb0c28af2ab63929a3e4ab8fdefd2a548c36b languageName: node linkType: hard @@ -4165,30 +4188,28 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/scope-manager@npm:7.18.0" +"@typescript-eslint/scope-manager@npm:8.1.0": + version: 8.1.0 + resolution: "@typescript-eslint/scope-manager@npm:8.1.0" dependencies: - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" - checksum: 10c0/038cd58c2271de146b3a594afe2c99290034033326d57ff1f902976022c8b0138ffd3cb893ae439ae41003b5e4bcc00cabf6b244ce40e8668f9412cc96d97b8e + "@typescript-eslint/types": "npm:8.1.0" + "@typescript-eslint/visitor-keys": "npm:8.1.0" + checksum: 10c0/2bcf8cd176a1819bddcae16c572e7da8fba821b995a91cd53d64d8d6b85a17f5a895522f281ba57e34929574bddd4d6684ee3e545ec4e8096be4c3198e253a9a languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/type-utils@npm:7.18.0" +"@typescript-eslint/type-utils@npm:8.1.0": + version: 8.1.0 + resolution: "@typescript-eslint/type-utils@npm:8.1.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.18.0" - "@typescript-eslint/utils": "npm:7.18.0" + "@typescript-eslint/typescript-estree": "npm:8.1.0" + "@typescript-eslint/utils": "npm:8.1.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.3.0" - peerDependencies: - eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/ad92a38007be620f3f7036f10e234abdc2fdc518787b5a7227e55fd12896dacf56e8b34578723fbf9bea8128df2510ba8eb6739439a3879eda9519476d5783fd + checksum: 10c0/62753941c4136e8d2daa72fe0410dea48e5317a6f12ece6382ca85e29912bd1b3f739b61d1060fc0a1f8c488dfc905beab4c8b8497951a21c3138a659c7271ec languageName: node linkType: hard @@ -4199,10 +4220,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/types@npm:7.18.0" - checksum: 10c0/eb7371ac55ca77db8e59ba0310b41a74523f17e06f485a0ef819491bc3dd8909bb930120ff7d30aaf54e888167e0005aa1337011f3663dc90fb19203ce478054 +"@typescript-eslint/types@npm:8.1.0": + version: 8.1.0 + resolution: "@typescript-eslint/types@npm:8.1.0" + checksum: 10c0/ceade44455f45974e68956016c4d1c6626580732f7f9675e14ffa63db80b551752b0df596b20473dae9f0dc6ed966e17417dc2cf36e1a82b6ab0edc97c5eaa50 languageName: node linkType: hard @@ -4225,12 +4246,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/typescript-estree@npm:7.18.0" +"@typescript-eslint/typescript-estree@npm:8.1.0": + version: 8.1.0 + resolution: "@typescript-eslint/typescript-estree@npm:8.1.0" dependencies: - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/visitor-keys": "npm:7.18.0" + "@typescript-eslint/types": "npm:8.1.0" + "@typescript-eslint/visitor-keys": "npm:8.1.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -4240,21 +4261,21 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/0c7f109a2e460ec8a1524339479cf78ff17814d23c83aa5112c77fb345e87b3642616291908dcddea1e671da63686403dfb712e4a4435104f92abdfddf9aba81 + checksum: 10c0/a7bc8275df1c79c4cb14ef086c56674316dd4907efec53eddca35d0b5220428b69c82178ce2d95138da2e398269c8bd0764cae8020a36417e411e35c3c47bc4b languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/utils@npm:7.18.0" +"@typescript-eslint/utils@npm:8.1.0": + version: 8.1.0 + resolution: "@typescript-eslint/utils@npm:8.1.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" - "@typescript-eslint/scope-manager": "npm:7.18.0" - "@typescript-eslint/types": "npm:7.18.0" - "@typescript-eslint/typescript-estree": "npm:7.18.0" + "@typescript-eslint/scope-manager": "npm:8.1.0" + "@typescript-eslint/types": "npm:8.1.0" + "@typescript-eslint/typescript-estree": "npm:8.1.0" peerDependencies: - eslint: ^8.56.0 - checksum: 10c0/a25a6d50eb45c514469a01ff01f215115a4725fb18401055a847ddf20d1b681409c4027f349033a95c4ff7138d28c3b0a70253dfe8262eb732df4b87c547bd1e + eslint: ^8.57.0 || ^9.0.0 + checksum: 10c0/c95503a6bdcd98b1ff04d1adbf46377b2036b1c510d90a4a056401f996f775f06c3108c95fb81cd6babc9c97b73b91b8e848f0337bc508de8a49c993582f0e75 languageName: node linkType: hard @@ -4285,13 +4306,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.18.0": - version: 7.18.0 - resolution: "@typescript-eslint/visitor-keys@npm:7.18.0" +"@typescript-eslint/visitor-keys@npm:8.1.0": + version: 8.1.0 + resolution: "@typescript-eslint/visitor-keys@npm:8.1.0" dependencies: - "@typescript-eslint/types": "npm:7.18.0" + "@typescript-eslint/types": "npm:8.1.0" eslint-visitor-keys: "npm:^3.4.3" - checksum: 10c0/538b645f8ff1d9debf264865c69a317074eaff0255e63d7407046176b0f6a6beba34a6c51d511f12444bae12a98c69891eb6f403c9f54c6c2e2849d1c1cb73c0 + checksum: 10c0/b7544dbb0eec1ddbfcd95c04b51b9a739c2e768c16d1c88508f976a2b0d1bc02fefb7491930e06e48073a5c07c6f488cd8403bba3a8b918888b93a88d5ac3869 languageName: node linkType: hard