1
1
module . exports = {
2
- extends : [ 'next/core-web-vitals' , 'plugin:@typescript-eslint/recommended' , 'prettier' ] ,
2
+ extends : [ 'next/core-web-vitals' , 'plugin:@typescript-eslint/recommended-type-checked' , 'prettier' ] ,
3
+ plugins : [
4
+ // This plugin automatically removes unused imports
5
+ "unused-imports"
6
+ ] ,
3
7
rules : {
4
8
'curly' : 'error' ,
5
9
'no-console' : 2 ,
6
- '@typescript-eslint/ban-ts-comment' : 1 ,
7
- '@typescript-eslint/no-unused-vars' : 2 ,
8
- "@typescript-eslint/no-empty-function" : "off"
9
- }
10
- }
10
+ // Sometimes ts-ignore is handy if we justify it
11
+ '@typescript-eslint/ban-ts-comment' : [
12
+ 'warn' ,
13
+ {
14
+ 'ts-check' : 'allow-with-description' ,
15
+ 'ts-expect-error' : 'allow-with-description' ,
16
+ 'ts-ignore' : 'allow-with-description' ,
17
+ 'ts-nocheck' : 'allow-with-description' ,
18
+ } ,
19
+ ] ,
20
+ "@typescript-eslint/no-empty-function" : "off" ,
21
+ '@typescript-eslint/no-unused-vars' : 'off' , // delegate to plugin below that handles both vars and imports
22
+ 'unused-imports/no-unused-imports' : 'error' ,
23
+ 'unused-imports/no-unused-vars' : [
24
+ 'warn' ,
25
+ { vars : 'all' , varsIgnorePattern : '^_' , args : 'after-used' , argsIgnorePattern : '^_' } ,
26
+ ] ,
27
+ } ,
28
+
29
+ parserOptions : {
30
+ project : true ,
31
+ tsconfigRootDir : "./tsconfig.json" ,
32
+ } ,
33
+ overrides : [
34
+ {
35
+ files : [ '**/*.test.ts' , '**/*/test-stubs.ts' , '**/*/test-helpers.ts' ] ,
36
+ rules : {
37
+ // Handy to have all tests be async even if we don't use it in them
38
+ '@typescript-eslint/require-await' : 'off' ,
39
+ // No need to be super strict with anys in test code
40
+ // Also these don't seem to work well with snapshot matchers
41
+ '@typescript-eslint/no-unsafe-argument' : 'off' ,
42
+ '@typescript-eslint/no-unsafe-assignment' : 'off' ,
43
+ } ,
44
+ } ,
45
+ {
46
+ //see https://typescript-eslint.io/troubleshooting/#i-get-errors-telling-me-eslint-was-configured-to-run--however-that-tsconfig-does-not--none-of-those-tsconfigs-include-this-file
47
+ // This is to avoid errors about this not being in the TSConfig
48
+ extends : [ 'plugin:@typescript-eslint/disable-type-checked' ] ,
49
+ files : [ './**/*.js' ] ,
50
+ }
51
+ ] ,
52
+ }
0 commit comments