-
Notifications
You must be signed in to change notification settings - Fork 396
/
Copy patheslint.config.js
49 lines (45 loc) · 1.46 KB
/
eslint.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const simpleImportSort = require("eslint-plugin-simple-import-sort");
const path = require("node:path");
const js = require("@eslint/js");
const { FlatCompat } = require("@eslint/eslintrc");
const baseDirectory = __dirname;
const compat = new FlatCompat({
baseDirectory: baseDirectory,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all,
});
module.exports = [
// Default ignores - node_modules is ignored by default in recent ESLint, but good to be explicit.
// Add other ignores if needed (e.g., build output directories like .next)
{
ignores: ["**/node_modules/**", "**/.next/**", "**/out/**"],
},
// Spread the configurations from extended configs
...compat.extends("next/core-web-vitals", "prettier"),
// Configuration for JS/JSX/TS/TSX files
{
files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
plugins: {
// Use the imported object directly as the key
simpleImportSort: simpleImportSort,
},
rules: {
"react-hooks/exhaustive-deps": "error",
"import/newline-after-import": ["error", { count: 1 }],
"simpleImportSort/imports": [
"error",
{
groups: [
["^react", "^@?\\w"],
["^(@)(/.*|$)"],
["^\\u0000"],
["^\\.\\.(?!/?$)", "^\\.\\./?$"],
["^\\./(?=.*/)(?!/?$)", "^\\.(?!/?$)", "^\\./?$"],
["^.+\\.?(css)$"],
],
},
],
"simpleImportSort/exports": "error",
},
},
];