From 8e6e2a94dba1bdbc275512f77a699c0ab3553f38 Mon Sep 17 00:00:00 2001 From: Dan Hedgecock Date: Sat, 5 Sep 2020 08:43:45 -0700 Subject: [PATCH] =?UTF-8?q?Fix:=20TS=20scope=20rules=20=F0=9F=8E=8A=20(#23?= =?UTF-8?q?8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/__snapshots__/index.spec.js.snap | 8 ++++++-- src/rules/plugin-typescript.js | 18 +++++++++++------- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/src/__snapshots__/index.spec.js.snap b/src/__snapshots__/index.spec.js.snap index 0156e94..4eb3274 100644 --- a/src/__snapshots__/index.spec.js.snap +++ b/src/__snapshots__/index.spec.js.snap @@ -69,7 +69,7 @@ Object { "@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-extra-non-null-assertion": "error", "@typescript-eslint/no-extra-parens": "off", - "@typescript-eslint/no-extra-semi": "error", + "@typescript-eslint/no-extra-semi": "off", "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", "@typescript-eslint/no-namespace": "error", @@ -100,11 +100,13 @@ Object { "no-obj-calls": "off", "no-redeclare": "off", "no-setter-return": "off", + "no-shadow": "off", "no-this-before-super": "off", "no-undef": "off", "no-unreachable": "off", "no-unsafe-negation": "off", "no-unused-vars": "off", + "no-use-before-define": "off", "no-var": "error", "prefer-const": "error", "prefer-rest-params": "error", @@ -1090,7 +1092,7 @@ Object { "@typescript-eslint/no-explicit-any": "warn", "@typescript-eslint/no-extra-non-null-assertion": "error", "@typescript-eslint/no-extra-parens": "off", - "@typescript-eslint/no-extra-semi": "error", + "@typescript-eslint/no-extra-semi": "off", "@typescript-eslint/no-inferrable-types": "error", "@typescript-eslint/no-misused-new": "error", "@typescript-eslint/no-namespace": "error", @@ -1121,11 +1123,13 @@ Object { "no-obj-calls": "off", "no-redeclare": "off", "no-setter-return": "off", + "no-shadow": "off", "no-this-before-super": "off", "no-undef": "off", "no-unreachable": "off", "no-unsafe-negation": "off", "no-unused-vars": "off", + "no-use-before-define": "off", "no-var": "error", "prefer-const": "error", "prefer-rest-params": "error", diff --git a/src/rules/plugin-typescript.js b/src/rules/plugin-typescript.js index 16d96e3..5dade51 100644 --- a/src/rules/plugin-typescript.js +++ b/src/rules/plugin-typescript.js @@ -14,17 +14,23 @@ module.exports = { 'no-import-assign': 'off', // ts(2539) & ts(2540) 'no-new-symbol': 'off', // ts(2588) 'no-obj-calls': 'off', // ts(2349) - 'no-redeclare': 'off', // ts(2451) 'no-setter-return': 'off', // ts(2408) 'no-this-before-super': 'off', // ts(2376) - 'no-undef': 'off', // ts(2304) 'no-unreachable': 'off', // ts(7027) 'no-unsafe-negation': 'off', // ts(2365) & ts(2360) & ts(2358) - 'valid-typeof': 'off', // ts(2367) 'no-var': 'error', // ts transpiles let/const to var, so no need for vars any more 'prefer-const': 'error', // ts provides better types with const 'prefer-rest-params': 'error', // ts provides better types with rest args over arguments 'prefer-spread': 'error', // ts transpiles spread to apply, so no need for manual apply + 'valid-typeof': 'off', // ts(2367) + + // Disable ESLint scope analysis, see "TypeScript Scope Analysis" + // https://github.com/typescript-eslint/typescript-eslint/releases/tag/v4.0.0 + 'no-redeclare': 'off', + 'no-shadow': 'off', + 'no-undef': 'off', + 'no-unused-vars': 'off', + 'no-use-before-define': 'off', // --- Recommended rules -------------------------- // https://github.com/typescript-eslint/typescript-eslint/blob/master/packages/eslint-plugin/src/configs/recommended.ts @@ -32,9 +38,8 @@ module.exports = { 'no-array-constructor': 'off', 'no-empty-function': 'off', 'no-extra-semi': 'off', - 'no-unused-vars': 'off', - '@typescript-eslint/adjacent-overload-signatures': 'error', + '@typescript-eslint/adjacent-overload-signatures': 'error', // Bans using `// @ts-*` directives unless a comment is included (to explain // why the directive is needed) '@typescript-eslint/ban-ts-comment': [ @@ -46,7 +51,6 @@ module.exports = { 'ts-check': 'allow-with-description', }, ], - '@typescript-eslint/ban-types': 'error', '@typescript-eslint/explicit-module-boundary-types': 'warn', '@typescript-eslint/no-array-constructor': 'error', @@ -54,7 +58,6 @@ module.exports = { '@typescript-eslint/no-empty-interface': 'error', '@typescript-eslint/no-explicit-any': 'warn', '@typescript-eslint/no-extra-non-null-assertion': 'error', - '@typescript-eslint/no-extra-semi': 'error', '@typescript-eslint/no-inferrable-types': 'error', '@typescript-eslint/no-misused-new': 'error', '@typescript-eslint/no-namespace': 'error', @@ -76,6 +79,7 @@ module.exports = { '@typescript-eslint/keyword-spacing': 'off', '@typescript-eslint/member-delimiter-style': 'off', '@typescript-eslint/no-extra-parens': 'off', + '@typescript-eslint/no-extra-semi': 'off', '@typescript-eslint/quotes': 'off', '@typescript-eslint/semi': 'off', '@typescript-eslint/space-before-function-paren': 'off',