@@ -16,9 +16,10 @@ const banConstEnum = {
16
16
module . exports = {
17
17
parser : '@typescript-eslint/parser' ,
18
18
parserOptions : {
19
- sourceType : 'module'
19
+ sourceType : 'module' ,
20
+ project : './tsconfig.eslint.json'
20
21
} ,
21
- plugins : [ 'jest' , 'import' ] ,
22
+ plugins : [ 'jest' , 'import' , '@typescript-eslint' ] ,
22
23
rules : {
23
24
'no-debugger' : 'error' ,
24
25
// most of the codebase are expected to be env agnostic
@@ -38,7 +39,23 @@ module.exports = {
38
39
'import/no-nodejs-modules' : [
39
40
'error' ,
40
41
{ allow : builtinModules . map ( mod => `node:${ mod } ` ) }
41
- ]
42
+ ] ,
43
+ // This rule enforces the preference for using '@ts-expect-error' comments in TypeScript
44
+ // code to indicate intentional type errors, improving code clarity and maintainability.
45
+ '@typescript-eslint/prefer-ts-expect-error' : 'error' ,
46
+ // Avoid unnecessary type assertions
47
+ '@typescript-eslint/no-unnecessary-type-assertion' : 'error' ,
48
+ // Enforce the use of 'import type' for importing types
49
+ '@typescript-eslint/consistent-type-imports' : [
50
+ 'error' ,
51
+ {
52
+ fixStyle : 'inline-type-imports'
53
+ }
54
+ ] ,
55
+ // Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
56
+ '@typescript-eslint/no-import-type-side-effects' : 'error' ,
57
+ // Ensure consistent usage of indexed object access style in TypeScript code.
58
+ '@typescript-eslint/consistent-indexed-object-style' : 'error'
42
59
} ,
43
60
overrides : [
44
61
// tests, no restrictions (runs in Node / jest with jsdom)
@@ -103,6 +120,11 @@ module.exports = {
103
120
rules : {
104
121
'import/no-nodejs-modules' : [ 'error' , { allow : builtinModules } ]
105
122
}
123
+ } ,
124
+ {
125
+ // disable type checking for JS files
126
+ files : [ '*.js' ] ,
127
+ extends : [ 'plugin:@typescript-eslint/disable-type-checked' ]
106
128
}
107
129
]
108
130
}
0 commit comments