-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheslint.config.js
More file actions
93 lines (83 loc) · 2.68 KB
/
eslint.config.js
File metadata and controls
93 lines (83 loc) · 2.68 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
88
89
90
91
92
93
import love from "eslint-config-love";
import prettier from "eslint-config-prettier";
export default [
// Apply to TypeScript and JavaScript files
{
files: ["**/*.{js,mjs,cjs,ts,tsx}"],
...love,
},
// Prettier integration (disables conflicting rules)
prettier,
// Custom rules and overrides
{
files: ["**/*.{js,mjs,cjs,ts,tsx}"],
rules: {
"@typescript-eslint/no-non-null-assertion": "warn", // Only warn on non-null assertions
"@typescript-eslint/max-params": ["warn", { max: 4 }], // Warn on too many constructor/function parameters
"@typescript-eslint/no-magic-numbers": [
"warn",
{
ignore: [0], // Common numbers that are OK
ignoreArrayIndexes: true,
ignoreDefaultValues: true,
ignoreClassFieldInitialValues: true,
ignoreNumericLiteralTypes: true,
ignoreReadonlyClassProperties: true,
ignoreEnums: true,
ignoreTypeIndexes: true,
},
],
"@typescript-eslint/no-unnecessary-condition": "warn",
"@typescript-eslint/no-unsafe-type-assertion": "warn",
"@typescript-eslint/no-unsafe-member-access": "warn",
"@typescript-eslint/prefer-nullish-coalescing": "warn",
"logical-assignment-operators": "warn",
// Unsafe assignments are ok for this exercise
"@typescript-eslint/no-unsafe-assignment": "off",
// Allow console.log in development
"no-console": process.env.NODE_ENV === "production" ? "error" : "warn",
// Node.js specific adjustments
"@typescript-eslint/no-var-requires": "off", // Allow require() in config files
// Promise handling (common in Express apps)
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/no-misused-promises": [
"error",
{
checksVoidReturn: {
arguments: false, // Allow async functions as Express middleware
attributes: false,
},
},
],
},
},
// Configuration files (less strict)
{
files: ["*.config.{js,mjs,cjs,ts}", "*.{js,mjs,cjs}"],
rules: {
"@typescript-eslint/no-var-requires": "off",
"import/no-default-export": "off",
"@typescript-eslint/no-require-imports": "off",
},
},
// Test files (if you have them)
{
files: ["**/*.{test,spec}.{js,ts,tsx}", "**/__tests__/**/*.{js,ts,tsx}"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"no-console": "off",
},
},
// Ignore patterns
{
ignores: [
"node_modules/**",
"dist/**",
"build/**",
".pnpm-store/**",
"coverage/**",
"*.min.js",
],
},
];