From 90b51205209c93ceddc70cdf18ab69755f951594 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Mon, 31 May 2021 21:20:21 -0400 Subject: [PATCH 1/5] chore: enable no-unsafe-member-access, no-unsafe-return internally --- .eslintrc.js | 2 -- packages/eslint-plugin/src/rules/no-loss-of-precision.ts | 4 +++- packages/eslint-plugin/tools/generate-rules-lists.ts | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 4dbde1fb20cf..095a65e8e091 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -64,8 +64,6 @@ module.exports = { ], // TODO - enable these new recommended rules - '@typescript-eslint/no-unsafe-member-access': 'off', - '@typescript-eslint/no-unsafe-return': 'off', '@typescript-eslint/restrict-template-expressions': 'off', // TODO - enable this '@typescript-eslint/naming-convention': 'off', diff --git a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts index f6b15c0430c1..e9d52852668f 100644 --- a/packages/eslint-plugin/src/rules/no-loss-of-precision.ts +++ b/packages/eslint-plugin/src/rules/no-loss-of-precision.ts @@ -4,7 +4,9 @@ import * as util from '../util'; const baseRule = ((): typeof BaseRule | null => { try { - return require('eslint/lib/rules/no-loss-of-precision'); + return require('eslint/lib/rules/no-loss-of-precision') as + | typeof BaseRule + | null; } catch { /* istanbul ignore next */ return null; diff --git a/packages/eslint-plugin/tools/generate-rules-lists.ts b/packages/eslint-plugin/tools/generate-rules-lists.ts index 65faf6f2aa20..a4d3f3af8e72 100644 --- a/packages/eslint-plugin/tools/generate-rules-lists.ts +++ b/packages/eslint-plugin/tools/generate-rules-lists.ts @@ -43,7 +43,7 @@ const staticElements = { emojiKey.fixable, emojiKey.requiresTypeChecking, ], - listSpacerRow: Array(5).fill('-'), + listSpacerRow: Array(5).fill('-'), }; const returnEmojiIfTrue = ( From b54a097ed28e35044f46f87a60759c23c21ffe13 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 4 Jun 2021 09:42:01 -0400 Subject: [PATCH 2/5] fix: a couple more places, and disabled on tests --- .eslintrc.js | 2 ++ packages/typescript-estree/src/convert.ts | 2 +- tools/generate-contributors.ts | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 095a65e8e091..cc72421eee67 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -64,6 +64,7 @@ module.exports = { ], // TODO - enable these new recommended rules + '@typescript-eslint/no-unsafe-member-access': 'off', '@typescript-eslint/restrict-template-expressions': 'off', // TODO - enable this '@typescript-eslint/naming-convention': 'off', @@ -170,6 +171,7 @@ module.exports = { }, rules: { '@typescript-eslint/no-unsafe-assignment': 'off', + '@typescript-eslint/no-unsafe-return': 'off', 'eslint-plugin/no-identical-tests': 'error', 'jest/no-disabled-tests': 'warn', 'jest/no-focused-tests': 'error', diff --git a/packages/typescript-estree/src/convert.ts b/packages/typescript-estree/src/convert.ts index 2a0c8ff4b2eb..e7ba4cb3226c 100644 --- a/packages/typescript-estree/src/convert.ts +++ b/packages/typescript-estree/src/convert.ts @@ -1,5 +1,5 @@ // There's lots of funny stuff due to the typing of ts.Node -/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call */ +/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-return */ import * as ts from 'typescript'; import { canContainDirective, diff --git a/tools/generate-contributors.ts b/tools/generate-contributors.ts index 07d59c394f00..c668ecf3da4a 100644 --- a/tools/generate-contributors.ts +++ b/tools/generate-contributors.ts @@ -78,9 +78,9 @@ async function main(): Promise { // fetch the user info const users = await Promise.all( - githubContributors.map>(async c => { + githubContributors.map(async c => { const response = await fetch(c.url, { method: 'GET' }); - return response.json(); + return (await response.json()) as User; }), ); From 3a46f1a3f1df4fbfc046bb7a06cb5cbc949e7ad5 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 4 Jun 2021 09:55:21 -0400 Subject: [PATCH 3/5] fix: last two places --- packages/scope-manager/tests/util/serializers/TSESTreeNode.ts | 2 +- packages/typescript-estree/tests/ast-alignment/utils.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts b/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts index 4611ddcce736..3d57ab11d73e 100644 --- a/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts +++ b/packages/scope-manager/tests/util/serializers/TSESTreeNode.ts @@ -18,7 +18,7 @@ const SEEN_NODES = new Map(); const serializer: NewPlugin = { test(val): boolean { - return ( + return !!( val && typeof val === 'object' && // make sure it's not one of the classes from the package diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 34b318898c11..19a78286b8bf 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -274,6 +274,7 @@ export function removeLocationDataAndSourceTypeFromProgramNode( if (ignoreSourceType) { delete ast.sourceType; } + // eslint-disable-next-line @typescript-eslint/no-unsafe-return return ast; } From 663edc6d94c844ff2760e3c57f0eaca0b7b185d2 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Fri, 4 Jun 2021 10:18:46 -0400 Subject: [PATCH 4/5] fix: one last disable I hope --- .eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.js b/.eslintrc.js index cc72421eee67..eaabfec0b576 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -197,6 +197,7 @@ module.exports = { rules: { '@typescript-eslint/explicit-function-return-type': 'off', '@typescript-eslint/no-unsafe-call': 'off', + '@typescript-eslint/no-unsafe-return': 'off', '@typescript-eslint/restrict-plus-operands': 'off', }, }, From 1f4eebb804f061d6b30a22f3dc6ca17f198f45c1 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Wed, 16 Jun 2021 21:10:03 -0400 Subject: [PATCH 5/5] chore: remove now-unnecessary lint disable --- packages/typescript-estree/tests/ast-alignment/utils.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/typescript-estree/tests/ast-alignment/utils.ts b/packages/typescript-estree/tests/ast-alignment/utils.ts index 19a78286b8bf..34b318898c11 100644 --- a/packages/typescript-estree/tests/ast-alignment/utils.ts +++ b/packages/typescript-estree/tests/ast-alignment/utils.ts @@ -274,7 +274,6 @@ export function removeLocationDataAndSourceTypeFromProgramNode( if (ignoreSourceType) { delete ast.sourceType; } - // eslint-disable-next-line @typescript-eslint/no-unsafe-return return ast; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy