Skip to content

Commit 329b4de

Browse files
committed
fix: don't try to check types in JS
1 parent 497bd28 commit 329b4de

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

lib/eslint.mjs

+20-24
Original file line numberDiff line numberDiff line change
@@ -93,20 +93,8 @@ const makeEslintConfig = ({ tsconfigRootDir, globals: globalsIn } = {}, ...moreC
9393
return tseslint.config(
9494
// Start with recommended rules from ESLint and TypeScript ESLint.
9595
{
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],
10197
languageOptions: {
102-
parserOptions: {
103-
...(tsconfigRootDir
104-
? {
105-
projectService: true,
106-
tsconfigRootDir,
107-
}
108-
: {}),
109-
},
11098
...(globalsIn ? { globals: flattenedGlobals } : {}),
11199
},
112100
},
@@ -229,19 +217,27 @@ const makeEslintConfig = ({ tsconfigRootDir, globals: globalsIn } = {}, ...moreC
229217

230218
// https://typescript-eslint.io/rules/no-non-null-assertion
231219
'@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-
: {}),
243220
},
244221
},
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+
: {},
245241
// @eslint-community/eslint-plugin-eslint-comments
246242
{
247243
extends: [

0 commit comments

Comments
 (0)