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