11import { defineConfig , globalIgnores } from 'eslint/config' ;
22import eslint from '@eslint/js' ;
33import stylistic from '@stylistic/eslint-plugin' ;
4- import { configs , parser } from 'typescript-eslint' ;
4+ import react from 'eslint-plugin-react' ;
5+ import reactHooks from 'eslint-plugin-react-hooks' ;
56// @ts -expect-error ignore plugin type
67import pluginPromise from 'eslint-plugin-promise' ;
8+ // @ts -expect-error ignore type error
9+ import jsxA11yPlugin from 'eslint-plugin-jsx-a11y' ;
710import nextVitals from 'eslint-config-next/core-web-vitals' ;
811import nextTs from 'eslint-config-next/typescript' ;
12+ import globals from 'globals' ;
13+ import { configs , parser } from 'typescript-eslint' ;
914
1015import { includeIgnoreFile } from '@eslint/compat' ;
1116import path from 'node:path' ;
1217import { fileURLToPath } from 'node:url' ;
1318
1419const __filename = fileURLToPath ( import . meta. url ) ;
1520const __dirname = path . dirname ( __filename ) ;
16- const gitignorePath = path . resolve ( __dirname , '.gitignore' ) ;
21+ const gitignorePath = path . resolve ( __dirname , './. gitignore' ) ;
1722
1823
1924const eslintConfig = defineConfig ( [
@@ -28,34 +33,45 @@ const eslintConfig = defineConfig([
2833 'build/**' ,
2934 'next-env.d.ts' ,
3035 ] ) ,
36+ includeIgnoreFile ( gitignorePath ) ,
37+ {
38+ ignores : [
39+ '**/*.d.ts' ,
40+ '*.js' ,
41+ 'src/tsconfig.json' ,
42+ 'src/next-env.d.ts' ,
43+ 'src/stories' ,
44+ 'node_modules/**/*' ,
45+ './.next/*' ,
46+ ] ,
47+ } ,
3148 eslint . configs . recommended ,
3249 ...configs . strict ,
3350 ...configs . stylistic ,
3451 pluginPromise . configs [ 'flat/recommended' ] ,
52+ reactHooks . configs . flat . recommended ,
3553 {
54+ files : [ '**/*.ts' , '**/*.tsx' ] ,
55+ ...react . configs . flat . recommended ,
56+ ...react . configs . flat [ 'jsx-runtime' ] ,
57+ ...jsxA11yPlugin . flatConfigs . recommended ,
3658 languageOptions : {
37- ecmaVersion : 'latest' ,
38- sourceType : 'module' ,
59+ ... react . configs . flat . recommended . languageOptions ,
60+ ... jsxA11yPlugin . flatConfigs . recommended . languageOptions ,
3961 parser,
40- parserOptions : {
41- tsconfigRootDir : __dirname ,
42- allowDefaultProject : [ '*.ts' , '*.js' ] ,
62+ globals : {
63+ ... globals . serviceworker ,
64+ ... globals . browser ,
4365 } ,
4466 } ,
45-
46- } ,
47- {
48- files : [
49- '**/*.ts' ,
50- '**/*.tsx' ,
51- ] ,
5267 plugins : {
5368 '@stylistic' : stylistic ,
5469 } ,
5570 rules : {
56- '@stylistic/semi' : [ 'error' , 'always' ] ,
71+ '@stylistic/semi' : 'error' ,
5772 '@stylistic/indent' : [ 'error' , 2 ] ,
5873 '@stylistic/comma-dangle' : [ 'error' , 'always-multiline' ] ,
74+ '@stylistic/arrow-parens' : [ 'error' , 'always' ] ,
5975 '@stylistic/quotes' : [ 'error' , 'single' ] ,
6076 } ,
6177 } ,
0 commit comments