11import { defineConfig } from 'eslint/config' ;
22import eslint from '@eslint/js' ;
3- import reactHooks from 'eslint-plugin-react-hooks' ;
4- // @ts -expect-error ignore type error
5- import jsxA11yPlugin from 'eslint-plugin-jsx-a11y' ;
3+ import nextVitals from 'eslint-config-next/core-web-vitals' ;
4+ import { configs , parser } from 'typescript-eslint' ;
65import stylistic from '@stylistic/eslint-plugin' ;
6+ // @ts -expect-error ignore type errors
7+ import pluginPromise from 'eslint-plugin-promise' ;
78
8- import tseslint from 'typescript-eslint' ;
9- import { FlatCompat } from '@eslint/eslintrc' ;
9+ import { includeIgnoreFile } from '@eslint/compat' ;
10+ import path from 'node:path' ;
11+ import { fileURLToPath } from 'node:url' ;
1012
11- const compat = new FlatCompat ( ) ;
13+ const __filename = fileURLToPath ( import . meta. url ) ;
14+ const __dirname = path . dirname ( __filename ) ;
15+ const gitignorePath = path . resolve ( __dirname , '.gitignore' ) ;
1216
1317export default defineConfig (
18+ includeIgnoreFile ( gitignorePath ) ,
1419 {
1520 ignores : [
21+ '.next' ,
1622 '**/*.d.ts' ,
17- '*.{js,jsx}' ,
18- 'src/tsconfig.json' ,
19- 'src/stories' ,
20- '**/*.css' ,
21- 'node_modules/**/*' ,
22- './.next/*' ,
2323 'out' ,
24+ '**/gql/**/*' ,
25+ 'cdk.out' ,
26+ '**/generated/**/*.*' ,
27+ 'src/gql/*.ts' ,
28+ 'public/**/*.js' ,
29+ 'cdk/**/*' ,
30+ 'storybook-static' ,
2431 ] ,
2532 } ,
33+ ...nextVitals ,
2634 eslint . configs . recommended ,
27- ...tseslint . configs . strict ,
28- ...tseslint . configs . stylistic ,
29- // ...compat.config({
30- // extends: ['next'],
31- // settings: {
32- // next: {
33- // rootDir: '.',
34- // },
35- // },
36- // }),
37- reactHooks . configs . flat . recommended ,
35+ ...configs . strict ,
36+ ...configs . stylistic ,
37+ pluginPromise . configs [ 'flat/recommended' ] ,
3838 {
39- files : [ 'src/**/*.{jsx,tsx}' ] ,
40- plugins : {
41- 'jsx-a11y' : jsxA11yPlugin ,
42- '@stylistic' : stylistic ,
43- } ,
44- extends : [
45- ...compat . config ( jsxA11yPlugin . configs . recommended ) ,
39+ files : [
40+ 'src/**/*.ts' ,
41+ 'src/**/*.tsx' ,
42+ '*.ts' ,
43+ '*.tsx' ,
44+ '.storybook/**/*.ts' ,
4645 ] ,
46+ languageOptions : {
47+ ecmaVersion : 'latest' ,
48+ sourceType : 'module' ,
49+ parser,
50+ parserOptions : {
51+ projectService : true ,
52+ tsconfigRootDir : __dirname ,
53+ } ,
54+ } ,
4755 settings : {
4856 react : {
4957 version : 'detect' ,
@@ -53,16 +61,22 @@ export default defineConfig(
5361 { name : 'Link' , linkAttribute : 'to' } ,
5462 { name : 'NavLink' , linkAttribute : 'to' } ,
5563 ] ,
64+ 'import/internal-regex' : '^~/' ,
5665 'import/resolver' : {
57- typescript : { } ,
66+ node : true ,
67+ typescript : true ,
5868 } ,
5969 } ,
70+ plugins : {
71+ '@stylistic' : stylistic ,
72+ } ,
6073 rules : {
61- '@stylistic/indent' : [ 'error' , 2 ] ,
62- '@stylistic/comma-dangle' : [ 'error' , 'always-multiline' ] ,
63- '@stylistic/arrow-parens' : [ 'error' , 'always' ] ,
64- '@stylistic/semi' : [ 'error' , 'always' ] ,
74+ '@next/next/no-duplicate-head' : 'off' ,
75+ '@next/next/no-img-element' : 'error' ,
76+ '@next/next/no-page-custom-font' : 'off' ,
6577 '@stylistic/quotes' : [ 'error' , 'single' ] ,
78+ '@stylistic/semi' : [ 'error' , 'always' ] ,
79+ '@stylistic/comma-dangle' : [ 'error' , 'always-multiline' ] ,
6680 } ,
6781 } ,
6882) ;
0 commit comments