-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Expand file tree
/
Copy patheslint.config.mjs
More file actions
87 lines (75 loc) · 2.58 KB
/
eslint.config.mjs
File metadata and controls
87 lines (75 loc) · 2.58 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
import nextCoreWebVitals from "eslint-config-next/core-web-vitals";
import reactCompiler from "eslint-plugin-react-compiler";
import localRules from "eslint-plugin-local-rules";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import parser from "./eslint-local-rules/parser.js";
// Extract plugin instances from next's config to avoid
// "Cannot redefine plugin" errors in flat config.
function getNextPlugin(name) {
return nextCoreWebVitals.find((c) => c.plugins?.[name])?.plugins[name];
}
const tsPlugin = getNextPlugin("@typescript-eslint");
const reactHooksPlugin = getNextPlugin("react-hooks");
export default [
{
ignores: [
"**/scripts",
"**/plugins",
"**/next.config.js",
"**/.claude/",
"**/worker-bundle.dist.js",
],
},
...nextCoreWebVitals,
{
plugins: {
"@typescript-eslint": tsPlugin,
"react-hooks": reactHooksPlugin,
"react-compiler": reactCompiler,
"local-rules": localRules,
},
languageOptions: {
globals: Object.fromEntries(
Object.entries({
...globals.node,
...globals.commonjs,
...globals.browser,
}).map(([key, value]) => [key.trim(), value])
),
parser: tsParser,
},
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": ["error", {
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
}],
"react-hooks/exhaustive-deps": "error",
"react/no-unknown-property": ["error", {
ignore: ["meta"],
}],
// New rules in react-hooks plugin — pre-existing patterns need refactoring
"react-hooks/set-state-in-effect": "warn",
"react-hooks/refs": "warn",
"react-compiler/react-compiler": "error",
"local-rules/lint-markdown-code-blocks": "error",
},
},
{
files: ["src/content/**/*.md"],
languageOptions: {
parser: parser,
ecmaVersion: 5,
sourceType: "module",
},
rules: {
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": "off",
"react-hooks/exhaustive-deps": "off",
"react/no-unknown-property": "off",
"react-compiler/react-compiler": "off",
"local-rules/lint-markdown-code-blocks": "error",
},
},
];