@@ -93,20 +93,8 @@ const makeEslintConfig = ({ tsconfigRootDir, globals: globalsIn } = {}, ...moreC
93
93
return tseslint . config (
94
94
// Start with recommended rules from ESLint and TypeScript ESLint.
95
95
{
96
- extends : [
97
- eslint . configs . recommended ,
98
- tsconfigRootDir ? tseslint . configs . recommendedTypeChecked : tseslint . configs . recommended ,
99
- tsconfigRootDir ? tseslint . configs . stylisticTypeChecked : tseslint . configs . stylistic ,
100
- ] ,
96
+ extends : [ eslint . configs . recommended , tseslint . configs . recommended , tseslint . configs . stylistic ] ,
101
97
languageOptions : {
102
- parserOptions : {
103
- ...( tsconfigRootDir
104
- ? {
105
- projectService : true ,
106
- tsconfigRootDir,
107
- }
108
- : { } ) ,
109
- } ,
110
98
...( globalsIn ? { globals : flattenedGlobals } : { } ) ,
111
99
} ,
112
100
} ,
@@ -229,19 +217,27 @@ const makeEslintConfig = ({ tsconfigRootDir, globals: globalsIn } = {}, ...moreC
229
217
230
218
// https://typescript-eslint.io/rules/no-non-null-assertion
231
219
'@typescript-eslint/no-non-null-assertion' : [ 'error' ] ,
232
-
233
- // Rules that require type information
234
- ...( tsconfigRootDir
235
- ? {
236
- // https://typescript-eslint.io/rules/no-unnecessary-condition/
237
- '@typescript-eslint/no-unnecessary-condition' : [ 'error' ] ,
238
-
239
- // https://typescript-eslint.io/rules/require-await/
240
- '@typescript-eslint/require-await' : [ 'error' ] ,
241
- }
242
- : { } ) ,
243
220
} ,
244
221
} ,
222
+ tsconfigRootDir
223
+ ? {
224
+ files : [ '**/*.ts' , '**/*.tsx' , '**/*.mts' , '**/*.cts' ] ,
225
+ extends : [ tseslint . configs . recommendedTypeChecked , tseslint . configs . stylisticTypeChecked ] ,
226
+ languageOptions : {
227
+ parserOptions : {
228
+ projectService : true ,
229
+ tsconfigRootDir,
230
+ } ,
231
+ } ,
232
+ rules : {
233
+ // https://typescript-eslint.io/rules/no-unnecessary-condition/
234
+ '@typescript-eslint/no-unnecessary-condition' : [ 'error' ] ,
235
+
236
+ // https://typescript-eslint.io/rules/require-await/
237
+ '@typescript-eslint/require-await' : [ 'error' ] ,
238
+ } ,
239
+ }
240
+ : { } ,
245
241
// @eslint -community/eslint-plugin-eslint-comments
246
242
{
247
243
extends : [
0 commit comments