Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: TS scope rules 馃帄 #238

Merged
merged 3 commits into from Sep 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/__snapshots__/index.spec.js.snap
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
18 changes: 11 additions & 7 deletions src/rules/plugin-typescript.js
Expand Up @@ -14,27 +14,32 @@ 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

'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': [
Expand All @@ -46,15 +51,13 @@ 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',
'@typescript-eslint/no-empty-function': 'error',
'@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',
Expand All @@ -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',
Expand Down