Skip to content

Commit d5a1ba8

Browse files
ESLint: enable all TS rules that require running compiler (#2388)
1 parent e90d827 commit d5a1ba8

File tree

2 files changed

+22
-19
lines changed

2 files changed

+22
-19
lines changed

.eslintrc.yml

+21-17
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,9 @@ rules:
424424
overrides:
425425
- files: '**/*.ts'
426426
parser: '@typescript-eslint/parser'
427+
parserOptions:
428+
tsconfigRootDir: './src/'
429+
project: ['tsconfig.json']
427430
plugins:
428431
- '@typescript-eslint'
429432
rules:
@@ -447,7 +450,7 @@ overrides:
447450
# https://github.com/typescript-eslint/typescript-eslint/tree/master/packages/eslint-plugin#supported-rules
448451
'@typescript-eslint/adjacent-overload-signatures': error
449452
'@typescript-eslint/array-type': [error, { default: generic }]
450-
'@typescript-eslint/await-thenable': off # TODO error
453+
'@typescript-eslint/await-thenable': error
451454
'@typescript-eslint/ban-ts-ignore': error
452455
'@typescript-eslint/ban-types': error
453456
'@typescript-eslint/consistent-type-assertions':
@@ -462,39 +465,40 @@ overrides:
462465
'@typescript-eslint/no-explicit-any': off # TODO error
463466
'@typescript-eslint/no-extra-non-null-assertion': error
464467
'@typescript-eslint/no-extraneous-class': off # TODO consider
465-
'@typescript-eslint/no-floating-promises': off # TODO error
468+
'@typescript-eslint/no-floating-promises': error
466469
'@typescript-eslint/no-for-in-array': error
467-
'@typescript-eslint/no-implied-eval': off # TODO error
470+
'@typescript-eslint/no-implied-eval': error
468471
'@typescript-eslint/no-inferrable-types':
469472
[error, { ignoreParameters: true, ignoreProperties: true }]
470473
'@typescript-eslint/no-misused-new': error
471-
'@typescript-eslint/no-misused-promises': off # TODO error
474+
'@typescript-eslint/no-misused-promises': error
472475
'@typescript-eslint/no-namespace': error
473-
'@typescript-eslint/no-non-null-assertion': off # TODO error
476+
'@typescript-eslint/no-non-null-assertion': error
474477
'@typescript-eslint/no-parameter-properties': error
475478
'@typescript-eslint/no-require-imports': error
476479
'@typescript-eslint/no-this-alias': error
477-
'@typescript-eslint/no-throw-literal': off # TODO error
480+
'@typescript-eslint/no-throw-literal': error
478481
'@typescript-eslint/no-type-alias': off # TODO consider
479-
'@typescript-eslint/no-unnecessary-condition': off # TODO error
480-
'@typescript-eslint/no-unnecessary-qualifier': off # TODO error
482+
'@typescript-eslint/no-unnecessary-condition': error
483+
'@typescript-eslint/no-unnecessary-qualifier': error
481484
'@typescript-eslint/no-unnecessary-type-arguments': off # TODO error
482-
'@typescript-eslint/no-unnecessary-type-assertion': off # TODO error
485+
'@typescript-eslint/no-unnecessary-type-assertion': error
483486
'@typescript-eslint/no-unused-vars-experimental': off
484487
'@typescript-eslint/no-var-requires': error
485488
'@typescript-eslint/prefer-for-of': off # TODO switch to error after TS migration
486489
'@typescript-eslint/prefer-function-type': error
487490
'@typescript-eslint/prefer-includes': off # TODO switch to error after IE11 drop
488491
'@typescript-eslint/prefer-namespace-keyword': error
489-
'@typescript-eslint/prefer-nullish-coalescing': off # TODO error
492+
'@typescript-eslint/prefer-nullish-coalescing': error
490493
'@typescript-eslint/prefer-optional-chain': error
491-
'@typescript-eslint/prefer-readonly': off # TODO error
492-
'@typescript-eslint/prefer-regexp-exec': off # TODO error
494+
'@typescript-eslint/prefer-readonly': error
495+
'@typescript-eslint/prefer-regexp-exec': error
493496
'@typescript-eslint/prefer-string-starts-ends-with': off # TODO switch to error after IE11 drop
494497
'@typescript-eslint/promise-function-async': off
495-
'@typescript-eslint/require-array-sort-compare': off # TODO error
496-
'@typescript-eslint/restrict-plus-operands': off # TODO [error, { checkCompoundAssignments: true }]
497-
'@typescript-eslint/restrict-template-expressions': off # TODO error
498+
'@typescript-eslint/require-array-sort-compare': error
499+
'@typescript-eslint/restrict-plus-operands':
500+
[error, { checkCompoundAssignments: true }]
501+
'@typescript-eslint/restrict-template-expressions': error
498502
'@typescript-eslint/strict-boolean-expressions': off # TODO consider
499503
'@typescript-eslint/triple-slash-reference': error
500504
'@typescript-eslint/typedef': off
@@ -520,8 +524,8 @@ overrides:
520524
'@typescript-eslint/no-unused-vars':
521525
[error, { vars: all, args: all, argsIgnorePattern: '^_' }]
522526
'@typescript-eslint/no-useless-constructor': error
523-
'@typescript-eslint/require-await': off # TODO
524-
'@typescript-eslint/return-await': off # TODO
527+
'@typescript-eslint/require-await': error
528+
'@typescript-eslint/return-await': error
525529

526530
# Disable for JS, Flow and TS
527531
'@typescript-eslint/no-magic-numbers': off

src/tsconfig.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,5 @@
1111
"types": [],
1212
"noEmit": true,
1313
"forceConsistentCasingInFileNames": true
14-
},
15-
"files": ["index.d.ts"]
14+
}
1615
}

0 commit comments

Comments
 (0)