@dimensional-innovations/tool-config 5.0.1 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/astro-6WHBKQFX.js +43 -0
- package/dist/astro-6WHBKQFX.js.map +1 -0
- package/dist/chunk-AKQIWLRC.js +446 -0
- package/dist/chunk-AKQIWLRC.js.map +1 -0
- package/dist/chunk-HAVDVZO3.js +624 -0
- package/dist/chunk-HAVDVZO3.js.map +1 -0
- package/dist/chunk-HUYPX7RZ.js +125 -0
- package/dist/chunk-HUYPX7RZ.js.map +1 -0
- package/dist/chunk-L7IN57ZC.js +167 -0
- package/dist/chunk-L7IN57ZC.js.map +1 -0
- package/dist/chunk-LRQFF2N5.js +141 -0
- package/dist/chunk-LRQFF2N5.js.map +1 -0
- package/dist/chunk-NRDWX5HH.js +363 -0
- package/dist/chunk-NRDWX5HH.js.map +1 -0
- package/dist/chunk-OMQFJOZZ.js +48 -0
- package/dist/chunk-OMQFJOZZ.js.map +1 -0
- package/dist/cli/index.js +72 -55
- package/dist/cli/index.js.map +1 -1
- package/dist/eslint-DXHSX6VW.js +5 -0
- package/dist/eslint-DXHSX6VW.js.map +1 -0
- package/dist/index.js +14 -2589
- package/dist/index.js.map +1 -1
- package/dist/prettier-EYWEBRIS.js +4 -0
- package/dist/prettier-EYWEBRIS.js.map +1 -0
- package/dist/react-YIKJI3VA.js +91 -0
- package/dist/react-YIKJI3VA.js.map +1 -0
- package/dist/semantic-release-7XCPBEKO.js +4 -0
- package/dist/semantic-release-7XCPBEKO.js.map +1 -0
- package/dist/solid-F44BEBBP.js +54 -0
- package/dist/solid-F44BEBBP.js.map +1 -0
- package/dist/stylelint-UAZHFIUD.js +5 -0
- package/dist/stylelint-UAZHFIUD.js.map +1 -0
- package/dist/svelte-XEOX6WAQ.js +56 -0
- package/dist/svelte-XEOX6WAQ.js.map +1 -0
- package/dist/typescript-G4HYJJ7T.js +4 -0
- package/dist/typescript-G4HYJJ7T.js.map +1 -0
- package/dist/vue-DP7MCMOU.js +144 -0
- package/dist/vue-DP7MCMOU.js.map +1 -0
- package/package.json +12 -11
|
@@ -0,0 +1,624 @@
|
|
|
1
|
+
import { getEslintIgnores } from './chunk-OMQFJOZZ.js';
|
|
2
|
+
import { autoDetect } from './chunk-L7IN57ZC.js';
|
|
3
|
+
import js from '@eslint/js';
|
|
4
|
+
import tseslint from 'typescript-eslint';
|
|
5
|
+
import globals3 from 'globals';
|
|
6
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
7
|
+
import importPlugin from 'eslint-plugin-import-x';
|
|
8
|
+
|
|
9
|
+
// src/tools/eslint/presets/base.ts
|
|
10
|
+
var basePreset = {
|
|
11
|
+
rules: {
|
|
12
|
+
// ============================================================
|
|
13
|
+
// MODERN JAVASCRIPT RULES
|
|
14
|
+
// Best practices for ES2015+ code
|
|
15
|
+
// Documentation: https://eslint.org/docs/rules/
|
|
16
|
+
// ============================================================
|
|
17
|
+
// Console and debugging
|
|
18
|
+
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
19
|
+
// Warn on console.log but allow console.warn/error for logging
|
|
20
|
+
"no-debugger": "warn",
|
|
21
|
+
// Warn on debugger statements (should be removed before commit)
|
|
22
|
+
"no-alert": "error",
|
|
23
|
+
// Disallow alert/confirm/prompt (use proper UI)
|
|
24
|
+
// Modern syntax preferences
|
|
25
|
+
"prefer-const": "error",
|
|
26
|
+
// Use const for variables that are never reassigned
|
|
27
|
+
"no-var": "error",
|
|
28
|
+
// Use let/const instead of var
|
|
29
|
+
"prefer-arrow-callback": "error",
|
|
30
|
+
// Use arrow functions for callbacks
|
|
31
|
+
"prefer-template": "error",
|
|
32
|
+
// Use template literals instead of string concatenation
|
|
33
|
+
"prefer-destructuring": [
|
|
34
|
+
"error",
|
|
35
|
+
{
|
|
36
|
+
array: true,
|
|
37
|
+
object: true
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
enforceForRenamedProperties: false
|
|
41
|
+
}
|
|
42
|
+
],
|
|
43
|
+
// Use destructuring where possible
|
|
44
|
+
"prefer-rest-params": "error",
|
|
45
|
+
// Use rest parameters instead of arguments object
|
|
46
|
+
"prefer-spread": "error",
|
|
47
|
+
// Use spread operator instead of .apply()
|
|
48
|
+
"object-shorthand": "error",
|
|
49
|
+
// Use object shorthand syntax {x} instead of {x: x}
|
|
50
|
+
// Note: arrow-body-style is a formatting rule disabled by eslint-config-prettier
|
|
51
|
+
// Code quality
|
|
52
|
+
eqeqeq: ["error", "always"],
|
|
53
|
+
// Always use === and !== instead of == and !=
|
|
54
|
+
"no-duplicate-imports": "off",
|
|
55
|
+
// Handled by import/no-duplicates (better type + value import support)
|
|
56
|
+
"no-useless-computed-key": "error",
|
|
57
|
+
// Disallow unnecessary computed property keys
|
|
58
|
+
"no-useless-constructor": "error",
|
|
59
|
+
// Disallow unnecessary constructors
|
|
60
|
+
"no-useless-rename": "error",
|
|
61
|
+
// Disallow renaming import/export/destructured assignments to same name
|
|
62
|
+
"no-nested-ternary": "error",
|
|
63
|
+
// Disallow nested ternary expressions (hard to read)
|
|
64
|
+
"no-unneeded-ternary": "error",
|
|
65
|
+
// Disallow ternary operators when simpler alternatives exist
|
|
66
|
+
"prefer-object-spread": "error",
|
|
67
|
+
// Use object spread instead of Object.assign
|
|
68
|
+
// Async/Promise best practices
|
|
69
|
+
"no-return-await": "error",
|
|
70
|
+
// Disallow unnecessary return await
|
|
71
|
+
"require-await": "warn",
|
|
72
|
+
// Warn on async functions without await (allow for plugin patterns)
|
|
73
|
+
"no-promise-executor-return": "error",
|
|
74
|
+
// Disallow returning values from Promise executor functions
|
|
75
|
+
// ============================================================
|
|
76
|
+
// CODE QUALITY & COMPLEXITY
|
|
77
|
+
// Maintainability and readability rules
|
|
78
|
+
// Documentation: https://eslint.org/docs/rules/
|
|
79
|
+
// ============================================================
|
|
80
|
+
// Complexity (warnings to identify areas needing refactoring)
|
|
81
|
+
complexity: ["warn", 15],
|
|
82
|
+
// Warn on high cyclomatic complexity
|
|
83
|
+
"max-depth": ["warn", 4],
|
|
84
|
+
// Warn on deeply nested blocks
|
|
85
|
+
"max-lines": ["warn", 500],
|
|
86
|
+
// Warn on files exceeding 500 lines
|
|
87
|
+
"max-lines-per-function": [
|
|
88
|
+
"warn",
|
|
89
|
+
{
|
|
90
|
+
max: 100,
|
|
91
|
+
skipBlankLines: true,
|
|
92
|
+
skipComments: true
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
// Warn on functions exceeding 100 lines
|
|
96
|
+
"max-params": ["warn", 4]
|
|
97
|
+
// Warn on functions with more than 4 parameters
|
|
98
|
+
// Note: spaced-comment is a formatting rule disabled by eslint-config-prettier
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
var base_default = basePreset;
|
|
102
|
+
var browserEnv = {
|
|
103
|
+
languageOptions: {
|
|
104
|
+
ecmaVersion: 2025,
|
|
105
|
+
sourceType: "module",
|
|
106
|
+
globals: {
|
|
107
|
+
...globals3.browser
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
var browser_default = browserEnv;
|
|
112
|
+
var nodeEnv = {
|
|
113
|
+
languageOptions: {
|
|
114
|
+
ecmaVersion: 2025,
|
|
115
|
+
sourceType: "module",
|
|
116
|
+
globals: {
|
|
117
|
+
...globals3.node
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
rules: {
|
|
121
|
+
// Node.js-specific rule adjustments
|
|
122
|
+
"no-console": "off",
|
|
123
|
+
// Console is normal in Node.js
|
|
124
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
125
|
+
// Allow require() in .js files
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
var node_default = nodeEnv;
|
|
129
|
+
var universalEnv = {
|
|
130
|
+
languageOptions: {
|
|
131
|
+
ecmaVersion: 2025,
|
|
132
|
+
sourceType: "module",
|
|
133
|
+
globals: {
|
|
134
|
+
...globals3.browser,
|
|
135
|
+
...globals3.node
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
var universal_default = universalEnv;
|
|
140
|
+
function createAngularPreset() {
|
|
141
|
+
return [
|
|
142
|
+
{
|
|
143
|
+
files: ["**/*.ts"],
|
|
144
|
+
rules: {
|
|
145
|
+
// ============================================================
|
|
146
|
+
// ANGULAR-FRIENDLY TYPESCRIPT RULES
|
|
147
|
+
// Basic rules that work well with Angular patterns
|
|
148
|
+
// ============================================================
|
|
149
|
+
// Angular uses decorators extensively
|
|
150
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
151
|
+
// Angular components often have empty constructors for DI
|
|
152
|
+
"@typescript-eslint/no-empty-function": [
|
|
153
|
+
"error",
|
|
154
|
+
{
|
|
155
|
+
allow: ["constructors"]
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
// Angular uses ! for definite assignment (properties set by Angular)
|
|
159
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
160
|
+
// Angular services and components use 'any' in some cases
|
|
161
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
162
|
+
// Parameter properties are common in Angular (constructor(private foo: Foo))
|
|
163
|
+
"@typescript-eslint/parameter-properties": "off",
|
|
164
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
165
|
+
// Angular uses both interfaces and types
|
|
166
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
167
|
+
// Naming conventions for Angular
|
|
168
|
+
"@typescript-eslint/naming-convention": [
|
|
169
|
+
"error",
|
|
170
|
+
{
|
|
171
|
+
selector: "default",
|
|
172
|
+
format: ["camelCase"],
|
|
173
|
+
leadingUnderscore: "allow",
|
|
174
|
+
trailingUnderscore: "allow"
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
selector: "variable",
|
|
178
|
+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
|
|
179
|
+
leadingUnderscore: "allow"
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
selector: "typeLike",
|
|
183
|
+
format: ["PascalCase"]
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
selector: "enumMember",
|
|
187
|
+
format: ["PascalCase", "UPPER_CASE"]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
selector: "property",
|
|
191
|
+
format: null
|
|
192
|
+
// Allow any format for properties (Angular templates use various patterns)
|
|
193
|
+
}
|
|
194
|
+
]
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
// Disable all formatting rules that conflict with Prettier
|
|
198
|
+
// This must be last to override any formatting rules from above
|
|
199
|
+
prettierConfig
|
|
200
|
+
];
|
|
201
|
+
}
|
|
202
|
+
function createNodePreset() {
|
|
203
|
+
return [
|
|
204
|
+
{
|
|
205
|
+
files: ["**/*.js", "**/*.ts", "**/*.mjs"],
|
|
206
|
+
rules: {
|
|
207
|
+
// ============================================================
|
|
208
|
+
// NODE.JS BACKEND RULES
|
|
209
|
+
// Best practices for server-side JavaScript/TypeScript
|
|
210
|
+
// ============================================================
|
|
211
|
+
// Console usage is normal in Node.js
|
|
212
|
+
"no-console": "off",
|
|
213
|
+
// Process and __dirname are standard in Node
|
|
214
|
+
"no-process-env": "off",
|
|
215
|
+
"no-process-exit": "warn",
|
|
216
|
+
// Async patterns
|
|
217
|
+
"no-async-promise-executor": "error",
|
|
218
|
+
"require-atomic-updates": "error",
|
|
219
|
+
// Error handling
|
|
220
|
+
"no-throw-literal": "error",
|
|
221
|
+
"prefer-promise-reject-errors": "error",
|
|
222
|
+
// Node.js specific
|
|
223
|
+
"callback-return": "off",
|
|
224
|
+
// Modern Node uses async/await
|
|
225
|
+
"handle-callback-err": "off",
|
|
226
|
+
// Modern Node uses async/await
|
|
227
|
+
"no-mixed-requires": "off",
|
|
228
|
+
// ES modules don't have this issue
|
|
229
|
+
"no-new-require": "error",
|
|
230
|
+
"no-path-concat": "error",
|
|
231
|
+
// Use path.join() instead
|
|
232
|
+
// Security
|
|
233
|
+
"no-eval": "error",
|
|
234
|
+
"no-implied-eval": "error",
|
|
235
|
+
"no-new-func": "error",
|
|
236
|
+
// Best practices for backend
|
|
237
|
+
"no-unused-vars": [
|
|
238
|
+
"error",
|
|
239
|
+
{
|
|
240
|
+
args: "after-used",
|
|
241
|
+
argsIgnorePattern: "^_",
|
|
242
|
+
varsIgnorePattern: "^_"
|
|
243
|
+
}
|
|
244
|
+
],
|
|
245
|
+
// Allow both require and import
|
|
246
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
247
|
+
}
|
|
248
|
+
},
|
|
249
|
+
// Disable all formatting rules that conflict with Prettier
|
|
250
|
+
// This must be last to override any formatting rules from above
|
|
251
|
+
prettierConfig
|
|
252
|
+
];
|
|
253
|
+
}
|
|
254
|
+
function createVanillaPreset() {
|
|
255
|
+
return [
|
|
256
|
+
{
|
|
257
|
+
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
|
|
258
|
+
rules: {
|
|
259
|
+
// No framework-specific rules
|
|
260
|
+
// All rules come from base.js and typescript.js presets
|
|
261
|
+
}
|
|
262
|
+
},
|
|
263
|
+
// Disable all formatting rules that conflict with Prettier
|
|
264
|
+
// This must be last to override any formatting rules from above
|
|
265
|
+
prettierConfig
|
|
266
|
+
];
|
|
267
|
+
}
|
|
268
|
+
var importsPreset = {
|
|
269
|
+
plugins: {
|
|
270
|
+
import: importPlugin
|
|
271
|
+
},
|
|
272
|
+
rules: {
|
|
273
|
+
// ============================================================
|
|
274
|
+
// IMPORT/MODULE RULES
|
|
275
|
+
// Module import/export best practices
|
|
276
|
+
// Documentation: https://github.com/un-ts/eslint-plugin-import-x
|
|
277
|
+
// ============================================================
|
|
278
|
+
"import/order": [
|
|
279
|
+
"error",
|
|
280
|
+
{
|
|
281
|
+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
282
|
+
"newlines-between": "always",
|
|
283
|
+
alphabetize: {
|
|
284
|
+
order: "asc",
|
|
285
|
+
caseInsensitive: true
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
],
|
|
289
|
+
// Enforce consistent import order with alphabetization
|
|
290
|
+
"import/no-duplicates": [
|
|
291
|
+
"error",
|
|
292
|
+
{
|
|
293
|
+
"prefer-inline": true,
|
|
294
|
+
considerQueryString: false
|
|
295
|
+
}
|
|
296
|
+
],
|
|
297
|
+
// Prevent duplicate imports (allows type + value imports from same module)
|
|
298
|
+
"import/no-unresolved": "off",
|
|
299
|
+
// TypeScript handles this better
|
|
300
|
+
"import/named": "off",
|
|
301
|
+
// TypeScript handles this better
|
|
302
|
+
"import/namespace": "off",
|
|
303
|
+
// TypeScript handles this better
|
|
304
|
+
"import/default": "off",
|
|
305
|
+
// TypeScript handles this better
|
|
306
|
+
"import/no-named-as-default": "warn",
|
|
307
|
+
// Warn on potentially confusing imports
|
|
308
|
+
"import/no-named-as-default-member": "warn",
|
|
309
|
+
// Warn on confusing member access
|
|
310
|
+
"import/newline-after-import": "error",
|
|
311
|
+
// Require blank line after imports
|
|
312
|
+
"import/no-webpack-loader-syntax": "error",
|
|
313
|
+
// No webpack loader syntax in imports
|
|
314
|
+
"import/first": "error"
|
|
315
|
+
// Imports must be at the top of the file
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
var imports_default = importsPreset;
|
|
319
|
+
|
|
320
|
+
// src/tools/eslint/presets/typescript.ts
|
|
321
|
+
var typescriptPreset = {
|
|
322
|
+
rules: {
|
|
323
|
+
// ============================================================
|
|
324
|
+
// TYPESCRIPT RULES
|
|
325
|
+
// TypeScript-specific linting and type safety
|
|
326
|
+
// Documentation: https://typescript-eslint.io/rules/
|
|
327
|
+
// ============================================================
|
|
328
|
+
// Type safety
|
|
329
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
330
|
+
// Warn on any usage (allow when necessary)
|
|
331
|
+
// Note: Type-checked rules (no-unsafe-*) require TypeScript project configuration
|
|
332
|
+
// They are disabled here but available in recommended-type-checked preset
|
|
333
|
+
// Type annotations
|
|
334
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
335
|
+
// Too strict - TS can infer return types
|
|
336
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
337
|
+
// Too strict - TS can infer exports
|
|
338
|
+
"@typescript-eslint/typedef": [
|
|
339
|
+
"error",
|
|
340
|
+
{
|
|
341
|
+
arrayDestructuring: false,
|
|
342
|
+
arrowParameter: false,
|
|
343
|
+
memberVariableDeclaration: false,
|
|
344
|
+
objectDestructuring: false,
|
|
345
|
+
parameter: false,
|
|
346
|
+
propertyDeclaration: true,
|
|
347
|
+
// Require type annotations on class properties
|
|
348
|
+
variableDeclaration: false,
|
|
349
|
+
variableDeclarationIgnoreFunction: true
|
|
350
|
+
}
|
|
351
|
+
],
|
|
352
|
+
// Require type annotations in specific places
|
|
353
|
+
// Best practices
|
|
354
|
+
"@typescript-eslint/no-unused-vars": [
|
|
355
|
+
"error",
|
|
356
|
+
{
|
|
357
|
+
argsIgnorePattern: "^_",
|
|
358
|
+
// Allow unused args prefixed with _
|
|
359
|
+
varsIgnorePattern: "^_"
|
|
360
|
+
// Allow unused vars prefixed with _
|
|
361
|
+
}
|
|
362
|
+
],
|
|
363
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
364
|
+
// Prefer for-of over standard for loop with index
|
|
365
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
366
|
+
// Warn on non-null assertions (! operator)
|
|
367
|
+
// Consistency
|
|
368
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
369
|
+
// Prefer interface over type alias
|
|
370
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
371
|
+
"error",
|
|
372
|
+
{
|
|
373
|
+
prefer: "type-imports",
|
|
374
|
+
// Use import type for type-only imports
|
|
375
|
+
disallowTypeAnnotations: false
|
|
376
|
+
}
|
|
377
|
+
],
|
|
378
|
+
// ============================================================
|
|
379
|
+
// NAMING CONVENTIONS
|
|
380
|
+
// Enforce consistent naming patterns across the codebase
|
|
381
|
+
// Documentation: https://typescript-eslint.io/rules/naming-convention/
|
|
382
|
+
//
|
|
383
|
+
// Patterns enforced:
|
|
384
|
+
// - camelCase: variables, functions, methods, parameters
|
|
385
|
+
// - PascalCase: classes, interfaces, types, enums
|
|
386
|
+
// - UPPER_CASE: constants and enum members
|
|
387
|
+
// - underscore prefix: private members, unused parameters
|
|
388
|
+
// ============================================================
|
|
389
|
+
"@typescript-eslint/naming-convention": [
|
|
390
|
+
"error",
|
|
391
|
+
// Default: camelCase for most identifiers
|
|
392
|
+
{
|
|
393
|
+
selector: "default",
|
|
394
|
+
format: ["camelCase"],
|
|
395
|
+
leadingUnderscore: "allow",
|
|
396
|
+
trailingUnderscore: "forbid"
|
|
397
|
+
},
|
|
398
|
+
// Variables: camelCase or UPPER_CASE for constants
|
|
399
|
+
{
|
|
400
|
+
selector: "variable",
|
|
401
|
+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
|
|
402
|
+
// PascalCase for components
|
|
403
|
+
leadingUnderscore: "allow"
|
|
404
|
+
},
|
|
405
|
+
// Functions and methods: camelCase
|
|
406
|
+
{
|
|
407
|
+
selector: ["function", "method"],
|
|
408
|
+
format: ["camelCase"]
|
|
409
|
+
},
|
|
410
|
+
// Classes, interfaces, types, enums: PascalCase
|
|
411
|
+
{
|
|
412
|
+
selector: "typeLike",
|
|
413
|
+
format: ["PascalCase"]
|
|
414
|
+
},
|
|
415
|
+
// Type parameters: PascalCase with T prefix
|
|
416
|
+
{
|
|
417
|
+
selector: "typeParameter",
|
|
418
|
+
format: ["PascalCase"],
|
|
419
|
+
prefix: ["T"]
|
|
420
|
+
},
|
|
421
|
+
// Enum members: PascalCase or UPPER_CASE
|
|
422
|
+
{
|
|
423
|
+
selector: "enumMember",
|
|
424
|
+
format: ["PascalCase", "UPPER_CASE"]
|
|
425
|
+
},
|
|
426
|
+
// Object properties: allow camelCase, PascalCase, or UPPER_CASE (for API responses, component props, env vars)
|
|
427
|
+
{
|
|
428
|
+
selector: "property",
|
|
429
|
+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
430
|
+
leadingUnderscore: "allow",
|
|
431
|
+
filter: {
|
|
432
|
+
// Allow properties with special characters (ESLint rule names, path aliases, env vars)
|
|
433
|
+
regex: "^(@|no-|prefer-|max-|vue/|import/|spaced-|react/|[A-Z_]+).*$",
|
|
434
|
+
match: false
|
|
435
|
+
}
|
|
436
|
+
},
|
|
437
|
+
// Object literal properties: allow any format (path aliases like @renderer, @main, @preload)
|
|
438
|
+
{
|
|
439
|
+
selector: "objectLiteralProperty",
|
|
440
|
+
format: null
|
|
441
|
+
},
|
|
442
|
+
// Imports: allow camelCase or PascalCase (Vue component imports)
|
|
443
|
+
{
|
|
444
|
+
selector: "import",
|
|
445
|
+
format: ["camelCase", "PascalCase"],
|
|
446
|
+
leadingUnderscore: "allow"
|
|
447
|
+
},
|
|
448
|
+
// Private class members: require underscore prefix
|
|
449
|
+
{
|
|
450
|
+
selector: "memberLike",
|
|
451
|
+
modifiers: ["private"],
|
|
452
|
+
format: ["camelCase"],
|
|
453
|
+
leadingUnderscore: "require"
|
|
454
|
+
},
|
|
455
|
+
// Unused parameters: require underscore prefix
|
|
456
|
+
{
|
|
457
|
+
selector: "parameter",
|
|
458
|
+
modifiers: ["unused"],
|
|
459
|
+
format: ["camelCase"],
|
|
460
|
+
leadingUnderscore: "require"
|
|
461
|
+
}
|
|
462
|
+
]
|
|
463
|
+
}
|
|
464
|
+
};
|
|
465
|
+
var typescript_default = typescriptPreset;
|
|
466
|
+
|
|
467
|
+
// src/tools/eslint/index.ts
|
|
468
|
+
var SOURCE_FILES = [
|
|
469
|
+
"**/*.js",
|
|
470
|
+
"**/*.ts",
|
|
471
|
+
"**/*.tsx",
|
|
472
|
+
"**/*.vue",
|
|
473
|
+
"**/*.jsx",
|
|
474
|
+
"**/*.svelte",
|
|
475
|
+
"**/*.astro"
|
|
476
|
+
];
|
|
477
|
+
async function addFrameworkConfig(config, framework) {
|
|
478
|
+
switch (framework) {
|
|
479
|
+
case "react": {
|
|
480
|
+
const { default: createReactPreset } = await import('./react-YIKJI3VA.js');
|
|
481
|
+
config.push(...createReactPreset());
|
|
482
|
+
break;
|
|
483
|
+
}
|
|
484
|
+
case "vue": {
|
|
485
|
+
const { default: createVuePreset } = await import('./vue-DP7MCMOU.js');
|
|
486
|
+
config.push(...createVuePreset());
|
|
487
|
+
break;
|
|
488
|
+
}
|
|
489
|
+
case "svelte": {
|
|
490
|
+
const { default: createSveltePreset } = await import('./svelte-XEOX6WAQ.js');
|
|
491
|
+
config.push(...createSveltePreset());
|
|
492
|
+
break;
|
|
493
|
+
}
|
|
494
|
+
case "solid": {
|
|
495
|
+
const { default: createSolidPreset } = await import('./solid-F44BEBBP.js');
|
|
496
|
+
config.push(...createSolidPreset());
|
|
497
|
+
break;
|
|
498
|
+
}
|
|
499
|
+
case "astro": {
|
|
500
|
+
const { default: createAstroPreset } = await import('./astro-6WHBKQFX.js');
|
|
501
|
+
config.push(...createAstroPreset());
|
|
502
|
+
break;
|
|
503
|
+
}
|
|
504
|
+
case "vanilla":
|
|
505
|
+
config.push(...createVanillaPreset());
|
|
506
|
+
break;
|
|
507
|
+
case "node":
|
|
508
|
+
config.push(...createNodePreset());
|
|
509
|
+
break;
|
|
510
|
+
case "angular":
|
|
511
|
+
config.push(...createAngularPreset());
|
|
512
|
+
break;
|
|
513
|
+
default:
|
|
514
|
+
console.warn(`\u26A0\uFE0F Unknown framework "${framework}", defaulting to vanilla JavaScript`);
|
|
515
|
+
config.push(...createVanillaPreset());
|
|
516
|
+
break;
|
|
517
|
+
}
|
|
518
|
+
}
|
|
519
|
+
function getEnvironmentConfig(environment) {
|
|
520
|
+
switch (environment) {
|
|
521
|
+
case "node":
|
|
522
|
+
return node_default;
|
|
523
|
+
case "universal":
|
|
524
|
+
return universal_default;
|
|
525
|
+
case "browser":
|
|
526
|
+
default:
|
|
527
|
+
return browser_default;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
function addTypeScriptConfig(config) {
|
|
531
|
+
config.push(...tseslint.configs.recommended);
|
|
532
|
+
config.push({
|
|
533
|
+
files: SOURCE_FILES,
|
|
534
|
+
...typescript_default
|
|
535
|
+
});
|
|
536
|
+
config.push({
|
|
537
|
+
files: ["**/*.d.ts"],
|
|
538
|
+
rules: {
|
|
539
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
540
|
+
}
|
|
541
|
+
});
|
|
542
|
+
config.push({
|
|
543
|
+
files: ["**/*.js"],
|
|
544
|
+
rules: {
|
|
545
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
546
|
+
}
|
|
547
|
+
});
|
|
548
|
+
}
|
|
549
|
+
function addOverrides(config, options) {
|
|
550
|
+
config.push({
|
|
551
|
+
files: ["tests/**/*.{js,ts,jsx,tsx,vue,svelte,astro}"],
|
|
552
|
+
rules: {
|
|
553
|
+
"no-console": "off",
|
|
554
|
+
"max-lines-per-function": "off",
|
|
555
|
+
complexity: "off",
|
|
556
|
+
"max-statements": "off",
|
|
557
|
+
"max-nested-callbacks": "off",
|
|
558
|
+
"no-magic-numbers": "off",
|
|
559
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
config.push({
|
|
563
|
+
files: ["**/bin/**/*.js", "**/scripts/**/*.js"],
|
|
564
|
+
languageOptions: {
|
|
565
|
+
globals: {
|
|
566
|
+
...node_default.languageOptions?.globals
|
|
567
|
+
}
|
|
568
|
+
},
|
|
569
|
+
rules: {
|
|
570
|
+
"no-console": "off",
|
|
571
|
+
"max-lines-per-function": "off"
|
|
572
|
+
}
|
|
573
|
+
});
|
|
574
|
+
if (options.rules && Object.keys(options.rules).length > 0) {
|
|
575
|
+
config.push({
|
|
576
|
+
files: SOURCE_FILES,
|
|
577
|
+
rules: options.rules
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
async function createEslintConfig(options = {}) {
|
|
582
|
+
const cwd = options.cwd || process.cwd();
|
|
583
|
+
const detected = autoDetect(cwd);
|
|
584
|
+
const framework = options.framework === "auto" || !options.framework ? detected.framework : options.framework;
|
|
585
|
+
const environment = options.environment === "auto" || !options.environment ? detected.environment : options.environment;
|
|
586
|
+
const typescript = options.typescript === "auto" || options.typescript === void 0 ? detected.typescript : options.typescript;
|
|
587
|
+
console.log(
|
|
588
|
+
`\u{1F4E6} ESLint Config: ${framework} | ${environment} | TypeScript: ${typescript ? "Yes" : "No"}`
|
|
589
|
+
);
|
|
590
|
+
if (framework === "angular") {
|
|
591
|
+
console.warn(
|
|
592
|
+
"\n\u26A0\uFE0F Angular detected. This package provides basic TypeScript linting.\n For Angular-specific rules, install: @angular-eslint/eslint-plugin\n See: https://github.com/angular-eslint/angular-eslint\n"
|
|
593
|
+
);
|
|
594
|
+
}
|
|
595
|
+
const defaultIgnorePaths = getEslintIgnores();
|
|
596
|
+
const allIgnorePaths = [...defaultIgnorePaths, ...options.ignorePaths || []];
|
|
597
|
+
const config = [];
|
|
598
|
+
config.push({ ignores: allIgnorePaths });
|
|
599
|
+
config.push(js.configs.recommended);
|
|
600
|
+
if (typescript) {
|
|
601
|
+
addTypeScriptConfig(config);
|
|
602
|
+
}
|
|
603
|
+
const envConfig = getEnvironmentConfig(environment);
|
|
604
|
+
config.push({
|
|
605
|
+
files: SOURCE_FILES,
|
|
606
|
+
...envConfig
|
|
607
|
+
});
|
|
608
|
+
config.push({
|
|
609
|
+
files: SOURCE_FILES,
|
|
610
|
+
...base_default
|
|
611
|
+
});
|
|
612
|
+
config.push({
|
|
613
|
+
files: SOURCE_FILES,
|
|
614
|
+
...imports_default
|
|
615
|
+
});
|
|
616
|
+
await addFrameworkConfig(config, framework);
|
|
617
|
+
addOverrides(config, options);
|
|
618
|
+
return config;
|
|
619
|
+
}
|
|
620
|
+
var eslint_default = createEslintConfig;
|
|
621
|
+
|
|
622
|
+
export { createEslintConfig, eslint_default };
|
|
623
|
+
//# sourceMappingURL=chunk-HAVDVZO3.js.map
|
|
624
|
+
//# sourceMappingURL=chunk-HAVDVZO3.js.map
|