Skip to content

Commit 4558949

Browse files
committed
Simplify eslint.config.mts
1 parent 8297b2e commit 4558949

File tree

1 file changed

+7
-47
lines changed

1 file changed

+7
-47
lines changed

codemods/eslint.config.mts

Lines changed: 7 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,37 @@
11
import js from '@eslint/js'
22
import prettierConfig from 'eslint-config-prettier'
3-
import globals from 'globals'
4-
import { config, configs, parser, plugin } from 'typescript-eslint'
5-
6-
const { browser, node, nodeBuiltin } = globals
7-
8-
export const vitestGlobals = {
9-
suite: false,
10-
test: false,
11-
describe: false,
12-
it: false,
13-
expectTypeOf: false,
14-
assertType: false,
15-
expect: false,
16-
assert: false,
17-
vitest: false,
18-
vi: false,
19-
beforeAll: false,
20-
afterAll: false,
21-
beforeEach: false,
22-
afterEach: false,
23-
onTestFailed: false,
24-
onTestFinished: false,
25-
} satisfies Record<string, boolean>
3+
import { config, configs, parser } from 'typescript-eslint'
264

275
const ESLintConfig = config(
28-
{ name: 'ignores', ignores: ['**/dist/', '**/__testfixtures__/'] },
6+
{ name: 'ignores', ignores: ['**/dist/'] },
297
{ name: 'javascript', ...js.configs.recommended },
308
...configs.recommended,
319
...configs.stylistic,
3210
{ name: 'prettier-config', ...prettierConfig },
3311
{
3412
name: 'main',
3513
languageOptions: {
36-
globals: {
37-
...vitestGlobals,
38-
...nodeBuiltin,
39-
...browser,
40-
...node,
41-
},
4214
parser,
4315
parserOptions: {
44-
projectService: true,
16+
projectService: {
17+
defaultProject: './tsconfig.json',
18+
},
4519
ecmaVersion: 'latest',
4620
},
4721
},
4822
rules: {
49-
'prefer-const': [2],
5023
'no-undef': [0],
5124
'@typescript-eslint/consistent-type-imports': [
5225
2,
5326
{ fixStyle: 'separate-type-imports', disallowTypeAnnotations: false },
5427
],
5528
'@typescript-eslint/consistent-type-exports': [2],
5629
'@typescript-eslint/no-unused-vars': [0],
57-
'@typescript-eslint/array-type': [2, { default: 'array-simple' }],
5830
'@typescript-eslint/no-explicit-any': [0],
59-
'@typescript-eslint/no-empty-interface': [
31+
'@typescript-eslint/no-empty-object-type': [
6032
2,
61-
{ allowSingleExtends: true },
33+
{ allowInterfaces: 'with-single-extends' },
6234
],
63-
'@typescript-eslint/no-unsafe-argument': [0],
64-
'@typescript-eslint/no-restricted-types': [2],
65-
'@typescript-eslint/no-empty-object-type': [2],
66-
'@typescript-eslint/no-unsafe-function-type': [2],
67-
'@typescript-eslint/no-wrapper-object-types': [2],
6835
'@typescript-eslint/no-namespace': [
6936
2,
7037
{ allowDeclarations: true, allowDefinitionFiles: true },
@@ -81,23 +48,16 @@ const ESLintConfig = config(
8148
},
8249
],
8350
},
84-
plugins: { '@typescript-eslint': plugin },
8551
linterOptions: { reportUnusedDisableDirectives: 2 },
8652
},
8753
{
8854
name: 'commonjs',
8955
files: ['**/*.c[jt]s'],
9056
languageOptions: { sourceType: 'commonjs' },
9157
rules: {
92-
'@typescript-eslint/no-var-requires': [0],
9358
'@typescript-eslint/no-require-imports': [0],
9459
},
9560
},
96-
{
97-
name: 'typescript-declaration-files',
98-
files: ['**/*.d.?(c|m)ts'],
99-
rules: { '@typescript-eslint/no-empty-object-type': [0] },
100-
},
10161
)
10262

10363
export default ESLintConfig

0 commit comments

Comments
 (0)