1- // @ts -check
2-
3- import react from "@eslint-react/eslint-plugin" ;
41import js from "@eslint/js" ;
5- import reactHooks from "eslint-plugin-react-hooks" ;
6- import reactRefresh from "eslint-plugin-react-refresh" ;
72import tseslint from "typescript-eslint" ;
3+ import react from "@eslint-react/eslint-plugin" ;
4+ import reactHooks from "eslint-plugin-react-hooks" ;
5+ import gitignore from "eslint-config-flat-gitignore" ;
86
9- const GLOB_JS = [ "*.{js,jsx,cjs,mjs}" , "**/*.{js,jsx,cjs,mjs}" ] ;
10- const GLOB_TS = [ "*.{ts,tsx,cts,mts}" , "**/*.{ts,tsx,cts,mts}" ] ;
11- const GLOB_TEST = [
12- "**/*.spec.{ts,tsx,cts,mts}" ,
13- "**/*.test.{ts,tsx,cts,mts}" ,
14- "**/spec.{ts,tsx,cts,mts}" ,
15- "**/test.{ts,tsx,cts,mts}" ,
16- ] ;
17- const GLOB_CONFIG = [ "*.config.{ts,tsx,cts,mts}" , "**/*.config.{ts,tsx,cts,mts}" ] ;
18- const GLOB_SCRIPT = [ "scripts/**/*.{ts,cts,mts}" ] ;
7+ const GLOB_TS = [ "**/*.{ts,tsx}" ] ;
8+ const GLOB_JS = [ "**/*.{js,cjs,mjs}" ] ;
9+ const GLOB_CONFIG = [ "**/*.config.{js,mjs,cjs,ts,tsx}" ] ;
1910
20- export default [
21- {
22- ignores : [
23- "node_modules" ,
24- "dist" ,
25- "benchmark" ,
26- "eslint.config.mjs" ,
27- "eslint.config.d.ts" ,
28- ] ,
29- } ,
11+ export default tseslint . config (
3012 js . configs . recommended ,
31- ...tseslint . configs . recommendedTypeChecked ,
3213 {
14+ files : GLOB_TS ,
15+ extends : [
16+ tseslint . configs . recommendedTypeChecked ,
17+ ] ,
3318 languageOptions : {
19+ parser : tseslint . parser ,
3420 parserOptions : {
35- projectService : true ,
21+ project : "./tsconfig.json" ,
3622 tsconfigRootDir : import . meta. dirname ,
3723 } ,
3824 } ,
3925 } ,
4026 {
4127 files : GLOB_TS ,
42- ...react . configs [ " recommended-type-checked" ] ,
28+ ...react . configs . recommended ,
4329 } ,
4430 {
4531 files : GLOB_TS ,
@@ -49,35 +35,13 @@ export default [
4935 rules : reactHooks . configs . recommended . rules ,
5036 } ,
5137 {
52- files : [ "src/**/*.tsx" ] ,
53- plugins : {
54- "react-refresh" : reactRefresh ,
55- } ,
38+ files : [ ... GLOB_JS , ... GLOB_CONFIG ] ,
39+ extends : [
40+ tseslint . configs . disableTypeChecked ,
41+ ] ,
5642 rules : {
57- "react-refresh/only-export-components" : "warn" ,
58- } ,
59- } ,
60- {
61- files : [ "*.config.{js,cjs,mjs,ts,cts,mts}" , "*.d.ts" ] ,
62- languageOptions : {
63- parserOptions : {
64- project : "./tsconfig.node.json" ,
65- projectService : false ,
66- tsconfigRootDir : import . meta. dirname ,
67- } ,
68- } ,
69- } ,
70- {
71- files : [ ...GLOB_TEST , ...GLOB_CONFIG , ...GLOB_SCRIPT ] ,
72- languageOptions : {
73- parserOptions : {
74- project : "./tsconfig.node.json" ,
75- projectService : false ,
76- } ,
43+ "@typescript-eslint/no-require-imports" : "off" ,
7744 } ,
7845 } ,
79- {
80- files : GLOB_JS ,
81- ...tseslint . configs . disableTypeChecked ,
82- } ,
83- ] ;
46+ gitignore ( ) ,
47+ ) ;
0 commit comments