|
1 | | -import path from "node:path"; |
2 | | -import { fileURLToPath } from "node:url"; |
3 | | - |
4 | | -import { fixupConfigRules } from "@eslint/compat"; |
5 | | -import { FlatCompat } from "@eslint/eslintrc"; |
6 | | -import js from "@eslint/js"; |
7 | | - |
8 | | -const __filename = fileURLToPath(import.meta.url); |
9 | | -const __dirname = path.dirname(__filename); |
10 | | -const compat = new FlatCompat({ |
11 | | - baseDirectory: __dirname, |
12 | | - recommendedConfig: js.configs.recommended, |
13 | | - allConfig: js.configs.all, |
14 | | -}); |
15 | | - |
16 | | -const eslintConfig = [ |
17 | | - ...fixupConfigRules(compat.extends("next/core-web-vitals", "next/typescript")), |
18 | | - { |
19 | | - rules: { |
20 | | - "import/order": [ |
21 | | - "error", |
22 | | - { |
23 | | - alphabetize: { |
24 | | - order: "asc", |
25 | | - caseInsensitive: true, |
26 | | - }, |
27 | | - |
28 | | - "newlines-between": "always", |
29 | | - |
30 | | - pathGroups: [ |
31 | | - { |
32 | | - pattern: "react", |
33 | | - group: "builtin", |
34 | | - position: "before", |
35 | | - }, |
36 | | - { |
37 | | - pattern: "@/**", |
38 | | - group: "external", |
39 | | - position: "after", |
40 | | - }, |
41 | | - ], |
42 | | - |
43 | | - pathGroupsExcludedImportTypes: ["react"], |
44 | | - |
45 | | - groups: ["builtin", "external", "internal", "unknown", "parent", "sibling", "index", "object", "type"], |
46 | | - }, |
47 | | - ], |
48 | | - |
49 | | - "@typescript-eslint/no-unused-vars": [ |
50 | | - "error", |
51 | | - { |
52 | | - vars: "all", |
53 | | - args: "after-used", |
54 | | - ignoreRestSiblings: true, |
55 | | - argsIgnorePattern: "^_", |
56 | | - varsIgnorePattern: "^_", |
57 | | - }, |
58 | | - ], |
59 | | - }, |
60 | | - }, |
61 | | -]; |
| 1 | +import { defineConfig, globalIgnores } from "eslint/config"; |
| 2 | +import nextVitals from "eslint-config-next/core-web-vitals"; |
| 3 | +import nextTs from "eslint-config-next/typescript"; |
| 4 | +import prettier from "eslint-config-prettier/flat"; |
| 5 | + |
| 6 | +const eslintConfig = defineConfig([ |
| 7 | + ...nextVitals, |
| 8 | + ...nextTs, |
| 9 | + prettier, |
| 10 | + // Override default ignores of eslint-config-next. |
| 11 | + globalIgnores([ |
| 12 | + // Default ignores of eslint-config-next: |
| 13 | + ".next/**", |
| 14 | + "out/**", |
| 15 | + "build/**", |
| 16 | + "next-env.d.ts", |
| 17 | + ]), |
| 18 | +]); |
62 | 19 |
|
63 | 20 | export default eslintConfig; |
0 commit comments