-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patheslint.config.js
More file actions
93 lines (85 loc) · 2.61 KB
/
Copy patheslint.config.js
File metadata and controls
93 lines (85 loc) · 2.61 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
// ESLint flat config for TypeScript/JavaScript
// https://eslint.org/docs/latest/use/configure/configuration-files
import { defineConfig } from "eslint/config";
import js from "@eslint/js";
import tseslint from "typescript-eslint";
import prettierConfig from "eslint-config-prettier";
export default defineConfig(
// Global ignores
{
ignores: [
"node_modules/**",
"internal/web/static/js/*.js", // Generated/minified JS
"internal/web/static/styles.css", // Generated CSS
"vendor/**",
"dist/**",
"coverage/**",
"*.min.js"
]
},
// Base JavaScript configuration for all JS/MJS/CJS files
{
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
...js.configs.recommended,
rules: {
"no-console": "off" // Config files can use console
}
},
// TypeScript strict type-checked configuration (only for TS files)
{
files: ["**/*.ts", "**/*.tsx"],
extends: [tseslint.configs.strictTypeChecked, tseslint.configs.stylisticTypeChecked]
},
// Project-specific TypeScript settings
{
files: ["**/*.ts", "**/*.tsx"],
languageOptions: {
parserOptions: {
projectService: true,
tsconfigRootDir: import.meta.dirname
}
},
rules: {
// TypeScript-specific rules
"@typescript-eslint/no-unused-vars": [
"error",
{
argsIgnorePattern: "^_",
varsIgnorePattern: "^_",
caughtErrorsIgnorePattern: "^_"
}
],
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/explicit-module-boundary-types": "off",
"@typescript-eslint/no-explicit-any": "error",
"@typescript-eslint/no-non-null-assertion": "error",
"@typescript-eslint/no-unnecessary-condition": "error",
"@typescript-eslint/prefer-nullish-coalescing": "error",
"@typescript-eslint/prefer-optional-chain": "error",
"@typescript-eslint/consistent-type-imports": [
"error",
{
prefer: "type-imports",
fixStyle: "inline-type-imports"
}
],
// General best practices
"no-console": ["warn", { allow: ["warn", "error"] }],
"no-debugger": "error",
"no-alert": "warn",
"prefer-const": "error",
"no-var": "error",
eqeqeq: ["error", "always", { null: "ignore" }],
curly: ["error", "all"],
"no-eval": "error",
"no-implied-eval": "error",
"no-script-url": "error",
"no-with": "error",
// Security
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error"
}
},
// Prettier compatibility (must be last)
prettierConfig
);