-
Notifications
You must be signed in to change notification settings - Fork 106
Expand file tree
/
Copy patheslint.config.js
More file actions
75 lines (68 loc) · 2.33 KB
/
Copy patheslint.config.js
File metadata and controls
75 lines (68 loc) · 2.33 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
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import tsParser from "@typescript-eslint/parser";
export default [
{
files: ["**/*.ts"],
plugins: {
"@typescript-eslint": typescriptEslint,
},
languageOptions: {
parser: tsParser,
ecmaVersion: "latest",
sourceType: "module",
parserOptions: {
project: "./tsconfig.json",
},
},
rules: {
// ESLint recommended rules
...typescriptEslint.configs.recommended.rules,
// Custom rules from .eslintrc
"no-unused-vars": "off",
"@typescript-eslint/no-unused-vars": [
"error",
{
args: "none",
varsIgnorePattern: "^_", // Allow variables starting with underscore
argsIgnorePattern: "^_", // Allow function arguments starting with underscore
caughtErrorsIgnorePattern: "^_", // Allow caught errors starting with underscore
},
],
// Type safety rules - warn for now, can upgrade to error later
"@typescript-eslint/no-explicit-any": "warn",
"@typescript-eslint/no-unsafe-assignment": "off",
"@typescript-eslint/no-unsafe-member-access": "off",
"@typescript-eslint/no-unsafe-call": "off",
// Enforce explicit return types for better documentation
"@typescript-eslint/explicit-function-return-type": "off",
// Prevent common async mistakes
"@typescript-eslint/no-floating-promises": "warn",
"@typescript-eslint/no-misused-promises": "warn",
"@typescript-eslint/await-thenable": "warn",
// Code complexity limits
complexity: ["warn", 15],
"max-lines-per-function": ["warn", { max: 50, skipBlankLines: true, skipComments: true }],
"max-depth": ["warn", 4],
// Other useful rules
"@typescript-eslint/ban-ts-comment": "off",
"no-prototype-builtins": "off",
"@typescript-eslint/no-empty-function": "off",
},
},
{
// Global ignores (replaces .eslintignore)
ignores: [
"node_modules/",
"main.js",
"*.js", // Ignore JS files in root
"!eslint.config.js", // But allow linting this file
"!jest.config.js", // And jest config
"dist/",
"build/",
"coverage/",
"**/*.min.js",
"**/*.test.ts", // Ignore test files from strict rules
"src/__mocks__/", // Ignore mock files
],
},
];