-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy path.eslintrc.cjs
More file actions
82 lines (82 loc) · 2.59 KB
/
Copy path.eslintrc.cjs
File metadata and controls
82 lines (82 loc) · 2.59 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
module.exports = {
root: true,
env: {
es2020: true,
node: true,
},
parser: "@typescript-eslint/parser",
parserOptions: {
sourceType: "module",
ecmaVersion: 2020,
},
plugins: ["@typescript-eslint", "unicorn"],
extends: ["eslint:recommended", "prettier"],
ignorePatterns: ["dist/", "node_modules/", "prod/", "docs/"],
rules: {
// Allow unused vars with underscore prefix
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"warn",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_",
},
],
// Complexity budgets — fights over-abstraction and over-engineering
complexity: ["warn", 10],
"max-depth": ["warn", 4],
"max-lines-per-function": ["warn", { max: 50, skipBlankLines: true, skipComments: true }],
"max-params": ["warn", 4],
"max-nested-callbacks": ["warn", 3],
// Consistency
eqeqeq: ["error", "always", { null: "ignore" }],
"no-var": "error",
"prefer-const": "warn",
// No console in production code (warn, not error)
"no-console": "warn",
},
overrides: [
{
files: [
"src/**/*.{ts,js}",
"test/**/*.{ts,js}",
"scripts/**/*.{ts,js}",
"types/**/*.{ts,js}",
],
rules: {
"unicorn/filename-case": ["error", { case: "kebabCase" }],
"no-restricted-syntax": [
"error",
{
selector: "MemberExpression[property.name='prototype']",
message:
"Prototype mutation is forbidden; use instance composition instead.",
},
],
},
},
{
// Allow console in scripts and tests
files: ["scripts/**/*.{ts,js}", "test/**/*.{ts,js}"],
env: {
mocha: true,
},
rules: {
"no-console": "off",
"no-restricted-syntax": "off",
},
},
{
// Legacy JS files - relax rules
files: ["src/external/**/*.js"],
rules: {
"no-var": "off",
"no-redeclare": "off",
"no-useless-escape": "off",
"@typescript-eslint/no-unused-vars": "off",
"no-console": "off",
},
},
],
};