From 37d984b8bf19f86a8a371a97d8a1a000022448b3 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 3 Apr 2024 20:05:39 +0200 Subject: [PATCH] Update eslint (non-major) (#29820) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Renaud Chaput --- .eslintrc.js | 1 + .../mastodon/components/hashtag_bar.tsx | 2 +- app/javascript/mastodon/uuid.ts | 3 +- app/javascript/packs/admin.tsx | 2 +- app/javascript/packs/public.tsx | 8 +- yarn.lock | 108 +++++++++--------- 6 files changed, 63 insertions(+), 61 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 502b9cefed..759003b55e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -363,6 +363,7 @@ module.exports = defineConfig({ "message": "Use typed hooks `useAppDispatch` and `useAppSelector` instead." } ], + "@typescript-eslint/restrict-template-expressions": ['warn', { allowNumber: true }], 'jsdoc/require-jsdoc': 'off', // Those rules set stricter rules for TS files diff --git a/app/javascript/mastodon/components/hashtag_bar.tsx b/app/javascript/mastodon/components/hashtag_bar.tsx index 91fa922198..ed5de7d3a5 100644 --- a/app/javascript/mastodon/components/hashtag_bar.tsx +++ b/app/javascript/mastodon/components/hashtag_bar.tsx @@ -24,7 +24,7 @@ export type StatusLike = Record<{ function normalizeHashtag(hashtag: string) { return ( - hashtag && hashtag.startsWith('#') ? hashtag.slice(1) : hashtag + !!hashtag && hashtag.startsWith('#') ? hashtag.slice(1) : hashtag ).normalize('NFKC'); } diff --git a/app/javascript/mastodon/uuid.ts b/app/javascript/mastodon/uuid.ts index 4d0a8a8036..0b4d55beb6 100644 --- a/app/javascript/mastodon/uuid.ts +++ b/app/javascript/mastodon/uuid.ts @@ -4,5 +4,6 @@ export function uuid(a?: string): string { (a as unknown as number) ^ ((Math.random() * 16) >> ((a as unknown as number) / 4)) ).toString(16) - : ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); + : // eslint-disable-next-line @typescript-eslint/restrict-plus-operands + ('' + 1e7 + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, uuid); } diff --git a/app/javascript/packs/admin.tsx b/app/javascript/packs/admin.tsx index 9fee560565..225cb16330 100644 --- a/app/javascript/packs/admin.tsx +++ b/app/javascript/packs/admin.tsx @@ -363,6 +363,6 @@ ready(() => { document.querySelectorAll('[data-admin-component]').forEach((element) => { void mountReactComponent(element); }); -}).catch((reason) => { +}).catch((reason: unknown) => { throw reason; }); diff --git a/app/javascript/packs/public.tsx b/app/javascript/packs/public.tsx index 044faeb296..d45927226c 100644 --- a/app/javascript/packs/public.tsx +++ b/app/javascript/packs/public.tsx @@ -69,7 +69,7 @@ window.addEventListener('message', (e) => { }, '*', ); - }).catch((e) => { + }).catch((e: unknown) => { console.error('Error in setHeightMessage postMessage', e); }); }); @@ -206,7 +206,7 @@ function loaded() { return true; }) - .catch((error) => { + .catch((error: unknown) => { console.error(error); }); } @@ -448,7 +448,7 @@ Rails.delegate(document, '#registration_new_user,#new_user', 'submit', () => { }); function main() { - ready(loaded).catch((error) => { + ready(loaded).catch((error: unknown) => { console.error(error); }); } @@ -457,6 +457,6 @@ loadPolyfills() .then(loadLocale) .then(main) .then(loadKeyboardExtensions) - .catch((error) => { + .catch((error: unknown) => { console.error(error); }); diff --git a/yarn.lock b/yarn.lock index 8af9bfdb87..4475cbc5eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4028,14 +4028,14 @@ __metadata: linkType: hard "@typescript-eslint/eslint-plugin@npm:^7.0.0": - version: 7.1.1 - resolution: "@typescript-eslint/eslint-plugin@npm:7.1.1" + version: 7.5.0 + resolution: "@typescript-eslint/eslint-plugin@npm:7.5.0" dependencies: "@eslint-community/regexpp": "npm:^4.5.1" - "@typescript-eslint/scope-manager": "npm:7.1.1" - "@typescript-eslint/type-utils": "npm:7.1.1" - "@typescript-eslint/utils": "npm:7.1.1" - "@typescript-eslint/visitor-keys": "npm:7.1.1" + "@typescript-eslint/scope-manager": "npm:7.5.0" + "@typescript-eslint/type-utils": "npm:7.5.0" + "@typescript-eslint/utils": "npm:7.5.0" + "@typescript-eslint/visitor-keys": "npm:7.5.0" debug: "npm:^4.3.4" graphemer: "npm:^1.4.0" ignore: "npm:^5.2.4" @@ -4048,25 +4048,25 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/041799604176bbee01f6ff029c5e2fcf1196db2737ba219a20b095f095dc0064ea425d15dd6dc22eaef294daa838209601ec7bc19317258dfa89a13afb8126ba + checksum: 10c0/932a7b5a09c0138ef5a0bf00f8e6039fa209d4047092ffc187de048543c21f7ce24dc14f25f4c87b6f3bbb62335fc952e259e271fde88baf793217bde6460cfa languageName: node linkType: hard "@typescript-eslint/parser@npm:^7.0.0": - version: 7.1.1 - resolution: "@typescript-eslint/parser@npm:7.1.1" + version: 7.5.0 + resolution: "@typescript-eslint/parser@npm:7.5.0" dependencies: - "@typescript-eslint/scope-manager": "npm:7.1.1" - "@typescript-eslint/types": "npm:7.1.1" - "@typescript-eslint/typescript-estree": "npm:7.1.1" - "@typescript-eslint/visitor-keys": "npm:7.1.1" + "@typescript-eslint/scope-manager": "npm:7.5.0" + "@typescript-eslint/types": "npm:7.5.0" + "@typescript-eslint/typescript-estree": "npm:7.5.0" + "@typescript-eslint/visitor-keys": "npm:7.5.0" debug: "npm:^4.3.4" peerDependencies: eslint: ^8.56.0 peerDependenciesMeta: typescript: optional: true - checksum: 10c0/84eb44f3767aaa1d7b26176348c89bd6732bc711f7f24186b1354eba95bf9e9c65b5675838772b831391210e525ff1f3bd4b51a3130ec35413aa362920effc57 + checksum: 10c0/65521202ff024e79594272fbb7e4731ecf9d2fdd2f58fc81450bfd2bca94ce9c17b0eadd7338c01701f5cf16d38b6c025ed3fc322380b1e4b5424b7484098cda languageName: node linkType: hard @@ -4080,22 +4080,22 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/scope-manager@npm:7.1.1": - version: 7.1.1 - resolution: "@typescript-eslint/scope-manager@npm:7.1.1" +"@typescript-eslint/scope-manager@npm:7.5.0": + version: 7.5.0 + resolution: "@typescript-eslint/scope-manager@npm:7.5.0" dependencies: - "@typescript-eslint/types": "npm:7.1.1" - "@typescript-eslint/visitor-keys": "npm:7.1.1" - checksum: 10c0/a955c8529f24945d448b95982d06b5f15a74fc5df97307f5821d55e9861d6c26d61cbd118c1ca41634164ed1d4f6c74fcb8388761341c49e6902a6fb72036afc + "@typescript-eslint/types": "npm:7.5.0" + "@typescript-eslint/visitor-keys": "npm:7.5.0" + checksum: 10c0/a017b151a6b39ef591f8e2e65598e005e1b4b2d5494e4b91bddb5856b3a4d57dd8a58d2bc7a140e627eb574f93a2c8fe55f1307aa264c928ffd31d9e190bc5dd languageName: node linkType: hard -"@typescript-eslint/type-utils@npm:7.1.1": - version: 7.1.1 - resolution: "@typescript-eslint/type-utils@npm:7.1.1" +"@typescript-eslint/type-utils@npm:7.5.0": + version: 7.5.0 + resolution: "@typescript-eslint/type-utils@npm:7.5.0" dependencies: - "@typescript-eslint/typescript-estree": "npm:7.1.1" - "@typescript-eslint/utils": "npm:7.1.1" + "@typescript-eslint/typescript-estree": "npm:7.5.0" + "@typescript-eslint/utils": "npm:7.5.0" debug: "npm:^4.3.4" ts-api-utils: "npm:^1.0.1" peerDependencies: @@ -4103,7 +4103,7 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/6f19dc383718cce42ed7262d134f5f0221bcbf225fea28975cd714c90e57d861608d5187c7ad731f6281813f94b00f22282a99a8a852167366064abc6e256341 + checksum: 10c0/12915d4d1872638f5281e222a0d191676c478f250699c84864862e95a59e708222acefbf7ffdafc0872a007261219a3a2b1e667ff45eeafea7c4bcc5b955262c languageName: node linkType: hard @@ -4114,10 +4114,10 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/types@npm:7.1.1": - version: 7.1.1 - resolution: "@typescript-eslint/types@npm:7.1.1" - checksum: 10c0/2bef95ec0c60e67fada336db3e82fac2be16c21a9e54fc45c7aeda3291abcceefa12aa970025db88bc2b3e113b1e70abd7f89c2a651c16b816dff1a0c46e7907 +"@typescript-eslint/types@npm:7.5.0": + version: 7.5.0 + resolution: "@typescript-eslint/types@npm:7.5.0" + checksum: 10c0/f3394f71f422dbd89f63b230f20e9769c12e47a287ff30ca03a80714e57ea21279b6f12a8ab14bafb00b59926f20a88894b2d1e72679f7ff298bae112679d4b3 languageName: node linkType: hard @@ -4140,12 +4140,12 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/typescript-estree@npm:7.1.1": - version: 7.1.1 - resolution: "@typescript-eslint/typescript-estree@npm:7.1.1" +"@typescript-eslint/typescript-estree@npm:7.5.0": + version: 7.5.0 + resolution: "@typescript-eslint/typescript-estree@npm:7.5.0" dependencies: - "@typescript-eslint/types": "npm:7.1.1" - "@typescript-eslint/visitor-keys": "npm:7.1.1" + "@typescript-eslint/types": "npm:7.5.0" + "@typescript-eslint/visitor-keys": "npm:7.5.0" debug: "npm:^4.3.4" globby: "npm:^11.1.0" is-glob: "npm:^4.0.3" @@ -4155,24 +4155,24 @@ __metadata: peerDependenciesMeta: typescript: optional: true - checksum: 10c0/2cec9d21cfe46e523a6d29aff554e5450edf1ee30ce9cf644ee8f1f5e1cfd44b94afb3632db97a949c86c4a392ae80f264d56d8747b2b0fdbe5c54139433366a + checksum: 10c0/ea3a270c725d6be273188b86110e0393052cd64d1c54a56eb5ea405e6d3fbbe84fb3b1ce1b8496a4078ac1eefd37aedcf12be91876764f6de31d5aa5131c7bcd languageName: node linkType: hard -"@typescript-eslint/utils@npm:7.1.1": - version: 7.1.1 - resolution: "@typescript-eslint/utils@npm:7.1.1" +"@typescript-eslint/utils@npm:7.5.0": + version: 7.5.0 + resolution: "@typescript-eslint/utils@npm:7.5.0" dependencies: "@eslint-community/eslint-utils": "npm:^4.4.0" "@types/json-schema": "npm:^7.0.12" "@types/semver": "npm:^7.5.0" - "@typescript-eslint/scope-manager": "npm:7.1.1" - "@typescript-eslint/types": "npm:7.1.1" - "@typescript-eslint/typescript-estree": "npm:7.1.1" + "@typescript-eslint/scope-manager": "npm:7.5.0" + "@typescript-eslint/types": "npm:7.5.0" + "@typescript-eslint/typescript-estree": "npm:7.5.0" semver: "npm:^7.5.4" peerDependencies: eslint: ^8.56.0 - checksum: 10c0/3e70834c5b49e4643ec8da63fa2acaab54283a566af2cedcd4c2f4210833a59bf71c459dde69e738115633c7de9f1339130552ff246e8e1bb4db26910685408b + checksum: 10c0/c815ed6909769648953d6963c069038f7cac0c979051b25718feb30e0d3337b9647b75b8de00ac03fe960f0cc8dc4e8a81d4aac4719090a99785e0068712bd24 languageName: node linkType: hard @@ -4203,13 +4203,13 @@ __metadata: languageName: node linkType: hard -"@typescript-eslint/visitor-keys@npm:7.1.1": - version: 7.1.1 - resolution: "@typescript-eslint/visitor-keys@npm:7.1.1" +"@typescript-eslint/visitor-keys@npm:7.5.0": + version: 7.5.0 + resolution: "@typescript-eslint/visitor-keys@npm:7.5.0" dependencies: - "@typescript-eslint/types": "npm:7.1.1" + "@typescript-eslint/types": "npm:7.5.0" eslint-visitor-keys: "npm:^3.4.1" - checksum: 10c0/1ab19ec966ff0b86317eddcbfcda645856ec01c3b76a451298031f35e4da0a363e4888ce5ae9e2526e874799a502c49922d83d57d21cb6fef7f3912f51e4a271 + checksum: 10c0/eecf02b8dd54e83738a143aca87b902af4b357028a90fd34ed7a2f40a3ae2f6a188b9ba53903f23c80e868f1fffbb039e9ddb63525438d659707cc7bfb269317 languageName: node linkType: hard @@ -7793,8 +7793,8 @@ __metadata: linkType: hard "eslint-plugin-jsdoc@npm:^48.0.0": - version: 48.2.1 - resolution: "eslint-plugin-jsdoc@npm:48.2.1" + version: 48.2.2 + resolution: "eslint-plugin-jsdoc@npm:48.2.2" dependencies: "@es-joy/jsdoccomment": "npm:~0.42.0" are-docs-informative: "npm:^0.0.2" @@ -7807,7 +7807,7 @@ __metadata: spdx-expression-parse: "npm:^4.0.0" peerDependencies: eslint: ^7.0.0 || ^8.0.0 || ^9.0.0 - checksum: 10c0/92237f08b7dadb21f9eda50eda00bf69ac5e0bfcb9d179bf118e096178d7dc4a62b34fd01b3b7b0ba1142ff6e13814cfe2cf9a60c6cfcc879559b6b509d0d4e1 + checksum: 10c0/d6911e73d36757de5aef127e795116fbbcdef504f7e91d9c0863faf0b1693271d96188f0f1d54c0d74c56652bfa3fb4f1aa1a2f0876b0c6a5e57a874bcb3ac2b languageName: node linkType: hard @@ -7856,8 +7856,8 @@ __metadata: linkType: hard "eslint-plugin-react@npm:^7.33.2": - version: 7.34.0 - resolution: "eslint-plugin-react@npm:7.34.0" + version: 7.34.1 + resolution: "eslint-plugin-react@npm:7.34.1" dependencies: array-includes: "npm:^3.1.7" array.prototype.findlast: "npm:^1.2.4" @@ -7879,7 +7879,7 @@ __metadata: string.prototype.matchall: "npm:^4.0.10" peerDependencies: eslint: ^3 || ^4 || ^5 || ^6 || ^7 || ^8 - checksum: 10c0/9bf0b959373ace66e799adbbfb493a7ceae54751e8f90fcce1da1a2a67b277ee23ba845571eaa4d4f05d96dba4e4977bf938b350f18bad26201fa616ee6aa4b8 + checksum: 10c0/7c61b1314d37a4ac2f2474f9571f801f1a1a5d81dcd4abbb5d07145406518722fb792367267757ee116bde254be9753242d6b93c9619110398b3fe1746e4848c languageName: node linkType: hard