1- import { dirname } from "path " ;
2- import { fileURLToPath } from "url " ;
3- import { FlatCompat } from "@ eslint/eslintrc " ;
1+ import { defineConfig , globalIgnores } from "eslint/config " ;
2+ import nextVitals from "eslint-config-next/core-web-vitals " ;
3+ import nextTypeScript from "eslint-config-next/typescript " ;
44import unusedImports from "eslint-plugin-unused-imports" ;
55import tseslint from "typescript-eslint" ;
66
7- const __filename = fileURLToPath ( import . meta. url ) ;
8- const __dirname = dirname ( __filename ) ;
9-
10- const compat = new FlatCompat ( {
11- baseDirectory : __dirname ,
12- } ) ;
13-
14- const eslintConfig = [
15- {
16- ignores : [ ".next" , ".sanity" , "next-env.d.ts" ] ,
17- } ,
18- ...compat . extends ( "next/core-web-vitals" , "next/typescript" ) ,
7+ const eslintConfig = defineConfig ( [
8+ ...nextVitals ,
9+ ...nextTypeScript ,
1910 ...tseslint . configs . strict ,
2011 ...tseslint . configs . stylistic ,
2112 {
@@ -24,7 +15,6 @@ const eslintConfig = [
2415 } ,
2516 rules : {
2617 "@typescript-eslint/consistent-type-imports" : "error" ,
27- "unused-imports/no-unused-imports" : "error" ,
2818 "import/order" : [
2919 "error" ,
3020 {
@@ -44,20 +34,18 @@ const eslintConfig = [
4434 ] ,
4535 } ,
4636 ] ,
47- // Disable resolve checking as this is handled by typescript
4837 "import/no-unresolved" : "off" ,
49- // Import sorting is handled by the import/order rule.
50- // However, sort-imports also sorts symbols inside a multi-import
51- // e.g. import { a, b, c } from "d"
52- // Setting `ignoreDeclarationSort: true` restricts it to only this behavior.
38+ "react-hooks/set-state-in-effect" : "off" ,
5339 "sort-imports" : [
5440 "error" ,
5541 {
5642 ignoreDeclarationSort : true ,
5743 } ,
5844 ] ,
45+ "unused-imports/no-unused-imports" : "error" ,
5946 } ,
6047 } ,
61- ] ;
48+ globalIgnores ( [ ".next/**" , ".sanity/**" , "next-env.d.ts" ] ) ,
49+ ] ) ;
6250
6351export default eslintConfig ;
0 commit comments