-
Notifications
You must be signed in to change notification settings - Fork 42
Expand file tree
/
Copy patheslint.config.js
More file actions
53 lines (52 loc) · 1.89 KB
/
Copy patheslint.config.js
File metadata and controls
53 lines (52 loc) · 1.89 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
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
{
ignores: ["dist/", "node_modules/"],
},
// Source files - strict rules with type checking
{
files: ["src/**/*.ts"],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname,
},
},
rules: {
eqeqeq: "error",
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/consistent-type-imports": "error",
"@typescript-eslint/no-floating-promises": "error",
"@typescript-eslint/explicit-function-return-type": [
"error",
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
allowHigherOrderFunctions: true,
},
],
// Allow numbers in template literals (common in CLI output)
"@typescript-eslint/restrict-template-expressions": ["error", { allowNumber: true }],
// Allow void returns in arrow shorthands (event handlers)
"@typescript-eslint/no-confusing-void-expression": ["error", { ignoreArrowShorthand: true }],
// Non-null assertions are used after validation guards
"@typescript-eslint/no-non-null-assertion": "warn",
},
},
// Test files - relaxed rules without type checking
{
files: ["tests/**/*.ts"],
...tseslint.configs.disableTypeChecked,
rules: {
...tseslint.configs.disableTypeChecked.rules,
"@typescript-eslint/no-unused-vars": ["error", { argsIgnorePattern: "^_" }],
"@typescript-eslint/consistent-type-imports": ["error", { disallowTypeAnnotations: false }],
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-dynamic-delete": "off",
},
}
);