1
+ import { defineConfig } from "eslint/config" ;
2
+ import { fixupConfigRules , fixupPluginRules } from "@eslint/compat" ;
3
+ import prettier from "eslint-plugin-prettier" ;
4
+ import _import from "eslint-plugin-import" ;
5
+ import path from "node:path" ;
6
+ import { fileURLToPath } from "node:url" ;
7
+ import js from "@eslint/js" ;
8
+ import { FlatCompat } from "@eslint/eslintrc" ;
9
+
10
+ const __filename = fileURLToPath ( import . meta. url ) ;
11
+ const __dirname = path . dirname ( __filename ) ;
12
+ const compat = new FlatCompat ( {
13
+ baseDirectory : __dirname ,
14
+ recommendedConfig : js . configs . recommended ,
15
+ allConfig : js . configs . all
16
+ } ) ;
17
+
18
+ export default defineConfig ( [ {
19
+ extends : fixupConfigRules ( compat . extends (
20
+ "next/core-web-vitals" ,
21
+ "next/typescript" ,
22
+ "plugin:prettier/recommended" ,
23
+ "plugin:import/errors" ,
24
+ "plugin:import/warnings" ,
25
+ "plugin:import/typescript" ,
26
+ ) ) ,
27
+
28
+ plugins : {
29
+ prettier : fixupPluginRules ( prettier ) ,
30
+ import : fixupPluginRules ( _import ) ,
31
+ } ,
32
+
33
+ rules : {
34
+ // Code quality
35
+ "no-console" : "warn" ,
36
+ "no-debugger" : "error" ,
37
+ "no-unused-vars" : "off" , // Handled by TS version above
38
+
39
+ // Import sorting and cleanliness
40
+ "import/order" : [ "error" , {
41
+ groups : [
42
+ "builtin" ,
43
+ "external" ,
44
+ "internal" ,
45
+ "parent" ,
46
+ "sibling" ,
47
+ "index" ,
48
+ "object" ,
49
+ "type" ,
50
+ ] ,
51
+
52
+ "newlines-between" : "always" ,
53
+
54
+ alphabetize : {
55
+ order : "asc" ,
56
+ caseInsensitive : true ,
57
+ } ,
58
+ } ] ,
59
+
60
+ "import/newline-after-import" : "error" ,
61
+ "import/no-duplicates" : "error" ,
62
+
63
+ // Prettier takes over formatting rules now
64
+ "prettier/prettier" : "error" ,
65
+ } ,
66
+ } ] ) ;
0 commit comments