-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy patheslint.config.mjs
More file actions
54 lines (53 loc) · 1.54 KB
/
eslint.config.mjs
File metadata and controls
54 lines (53 loc) · 1.54 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
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import reactHooks from "eslint-plugin-react-hooks";
import prettierConfig from "eslint-config-prettier";
export default tseslint.config(
// Base recommended rules from ESLint
js.configs.recommended,
// TypeScript recommended rules
...tseslint.configs.recommended,
// Custom project rules
{
rules: {
// CLI project allows console
"no-console": "off",
// Allow dynamic require for package.json (cli.tsx)
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-require-imports": "off",
// Allow control regex for ANSI stripping (markdown.test.ts)
"no-control-regex": "off",
// Enforce consistent type imports
"@typescript-eslint/consistent-type-imports": "warn",
// Unused vars: allow _-prefixed parameters
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
destructuredArrayIgnorePattern: "^_",
},
],
},
},
// React hooks rules
{
plugins: {
"react-hooks": reactHooks,
},
rules: {
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
},
},
// Test files: relaxed rules
{
files: ["src/tests/**/*.ts"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-unused-vars": "off",
},
},
// Prettier config: disable conflicting ESLint rules, MUST be last
prettierConfig,
);