11import path from 'node:path'
22import { fileURLToPath } from 'node:url'
33
4+ import tseslint from 'typescript-eslint'
5+ import vitest from '@vitest/eslint-plugin'
6+
47import globals from 'globals'
58
69import { FlatCompat } from '@eslint/eslintrc'
@@ -16,7 +19,7 @@ const compat = new FlatCompat({
1619} )
1720
1821
19- export default [
22+ export default tseslint . config (
2023 {
2124 ignores : [
2225 '.yarn/' ,
@@ -28,46 +31,38 @@ export default [
2831 } ,
2932
3033 ...fixupConfigRules ( compat . config ( {
31- parserOptions : {
32- project : 'tsconfig.json' ,
33- } ,
3434 extends : [
3535 '@jenssimon/base' ,
3636 ] ,
37- overrides : [
38- {
39- files : [
40- '*.ts' ,
41- ] ,
42- extends : [
43- '@jenssimon/typescript' ,
44- ] ,
45- rules : {
46- '@typescript-eslint/naming-convention' : 'off' ,
37+ } ) ) ,
38+
39+ tseslint . configs . recommendedTypeChecked ,
40+ tseslint . configs . stylisticTypeChecked ,
41+ {
42+ languageOptions : {
43+ parserOptions : {
44+ projectService : {
45+ allowDefaultProject : [
46+ '*.js' ,
47+ 'demo/*.js' ,
48+ ] ,
4749 } ,
50+ tsconfigRootDir : import . meta. dirname ,
4851 } ,
49- {
50- files : [
51- '**/*.test.*' ,
52- '**/*.spec.*' ,
53- '**/__tests__/**' ,
54- '**/__mocks__/**' ,
55- ] ,
56- plugins : [
57- '@vitest' ,
58- ] ,
59- extends : [
60- 'plugin:@vitest/legacy-recommended' ,
61- ] ,
62- } ,
63- ] ,
64- } ) ) . map ( ( rule ) => ( {
52+ } ,
53+ } ,
54+
55+ {
6556 files : [
66- '**/*.js' ,
67- '**/*.ts' ,
57+ 'src/loader.ts' ,
58+ 'src/__tests__/loader.test.ts' ,
59+ 'demo/index.js' ,
6860 ] ,
69- ...rule ,
70- } ) ) ,
61+ rules : {
62+ 'no-void' : 'off' ,
63+ 'sonarjs/void-use' : 'off' ,
64+ } ,
65+ } ,
7166
7267 {
7368 files : [
@@ -84,6 +79,26 @@ export default [
8479 'no-restricted-syntax' : 'off' ,
8580 'promise/prefer-await-to-then' : 'off' ,
8681 'unicorn/prefer-top-level-await' : 'off' ,
82+ '@typescript-eslint/no-unsafe-argument' : 'off' ,
83+ '@typescript-eslint/no-unsafe-assignment' : 'off' ,
84+ '@typescript-eslint/no-unsafe-call' : 'off' ,
85+ '@typescript-eslint/no-unsafe-member-access' : 'off' ,
86+ '@typescript-eslint/no-unsafe-return' : 'off' ,
87+ } ,
88+ } ,
89+
90+ {
91+ files : [
92+ '**/*.test.*' ,
93+ '**/*.spec.*' ,
94+ '**/__tests__/**' ,
95+ '**/__mocks__/**' ,
96+ ] ,
97+ plugins : {
98+ vitest,
99+ } ,
100+ rules : {
101+ ...vitest . configs . recommended . rules ,
87102 } ,
88103 } ,
89- ]
104+ )
0 commit comments