Repository navigation
Expand file tree
/
Copy patheslint.config.js
More file actions
210 lines (200 loc) · 4.99 KB
/
Copy patheslint.config.js
File metadata and controls
210 lines (200 loc) · 4.99 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
// @ts-check
import js from "@eslint/js";
import tseslint from "@typescript-eslint/eslint-plugin";
import tsparser from "@typescript-eslint/parser";
import vuePlugin from "eslint-plugin-vue";
import vueParser from "vue-eslint-parser";
import prettierConfig from "eslint-config-prettier";
import globals from "globals";
const baseRules = {
"block-scoped-var": "error",
curly: ["error", "all"],
"dot-notation": "error",
eqeqeq: "error",
"handle-callback-err": "error",
"no-alert": "error",
"no-catch-shadow": "error",
"no-control-regex": "off",
"no-console": "error",
"no-duplicate-imports": "error",
"no-else-return": "error",
"no-implicit-globals": "error",
"no-restricted-globals": ["error", "event", "fdescribe"],
"no-template-curly-in-string": "error",
"no-unsafe-negation": "error",
"no-useless-computed-key": "error",
"no-useless-constructor": "error",
"no-useless-return": "error",
"no-use-before-define": [
"error",
{
functions: false,
},
],
"no-var": "error",
"object-shorthand": [
"error",
"methods",
{
avoidExplicitReturnArrows: true,
},
],
"padding-line-between-statements": [
"error",
{
blankLine: "always",
prev: ["block", "block-like"],
next: "*",
},
{
blankLine: "always",
prev: "*",
next: ["block", "block-like"],
},
],
"prefer-const": "error",
"prefer-rest-params": "error",
"prefer-spread": "error",
"spaced-comment": ["error", "always"],
strict: "off",
yoda: "error",
};
const vueRules = {
"import/no-default-export": 0,
"import/unambiguous": 0, // vue SFC can miss script tags
"@typescript-eslint/prefer-readonly": 0, // can be used in template
"vue/block-order": [
"error",
{
order: ["template", "style", "script"],
},
],
"vue/multi-word-component-names": "off",
"vue/no-mutating-props": "off",
"vue/no-v-html": "off",
"vue/require-default-prop": "off",
"vue/v-slot-style": ["error", "longform"],
};
const tsRules = {
// note you must disable the base rule as it can report incorrect errors
"no-shadow": "off",
"@typescript-eslint/no-shadow": ["error"],
"@typescript-eslint/no-redundant-type-constituents": "off",
};
// Type Safety - deferred to FAZA 10: TypeScript Strict Mode
// These rules require extensive manual refactoring of type definitions
// across the codebase (~2000+ errors). Deferring to dedicated phase after
// core migrations (Express 5, ESM) are complete.
// FAZA 6 completed: All quick-fix rules resolved (ban-types, empty-object,
// throw-error, promise-reject, unused-expressions, this-alias, etc.)
const tsRulesTypeStrictness = {
"@typescript-eslint/no-unsafe-assignment": "off", // 349 errors - defer to FAZA 10
"@typescript-eslint/no-unsafe-call": "off", // 315 errors - defer to FAZA 10
"@typescript-eslint/no-unsafe-member-access": "off", // 800 errors - defer to FAZA 10
"@typescript-eslint/no-unsafe-argument": "off", // 397 errors - defer to FAZA 10
"@typescript-eslint/no-explicit-any": "warn", // 287 errors - keep as WARNING for visibility
};
export default [
// Global ignores (replaces .eslintignore)
{
ignores: [
"node_modules/**",
"dist/**",
"public/**",
"test/public/**",
"coverage/**",
"webpack.config.mjs",
"*.min.js",
],
},
// Base JavaScript config for all files
{
files: ["**/*.js", "**/*.cjs", "**/*.mjs"],
languageOptions: {
ecmaVersion: "latest",
sourceType: "module",
globals: {
...globals.es2021,
...globals.browser,
...globals.node,
...globals.mocha,
},
},
...js.configs.recommended,
rules: {
...baseRules,
},
},
// TypeScript files - use flat config from typescript-eslint
...tseslint.configs["flat/recommended-type-checked"].map((config) => ({
...config,
files: ["**/*.ts"],
})),
{
files: ["**/*.ts"],
languageOptions: {
parser: tsparser,
parserOptions: {
projectService: {
allowDefaultProject: ["*.ts", "*.mjs"],
defaultProject: "./tsconfig.json",
},
tsconfigRootDir: import.meta.dirname,
},
globals: {
...globals.es2021,
...globals.browser,
...globals.node,
...globals.mocha,
},
},
rules: {
...baseRules,
...tsRules,
...tsRulesTypeStrictness,
},
},
// Vue files - use flat config
...vuePlugin.configs["flat/recommended"],
...tseslint.configs["flat/recommended-type-checked"].map((config) => ({
...config,
files: ["**/*.vue"],
})),
{
files: ["**/*.vue"],
languageOptions: {
parser: vueParser,
parserOptions: {
parser: tsparser,
projectService: {
allowDefaultProject: ["*.vue"],
defaultProject: "./tsconfig.json",
},
tsconfigRootDir: import.meta.dirname,
extraFileExtensions: [".vue"],
ecmaFeatures: {
jsx: true,
},
},
globals: {
...globals.es2021,
...globals.browser,
...globals.node,
...globals.mocha,
},
},
rules: {
...baseRules,
...tsRules,
...tsRulesTypeStrictness,
...vueRules,
},
},
// Test files - no special rules needed
{
files: ["test/**/*.ts"],
rules: {},
},
// Prettier must be last to override any conflicting rules
prettierConfig,
];