@dimensional-innovations/tool-config 5.0.0 → 5.0.1
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/cli/index.js +1812 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/index.d.ts +401 -0
- package/dist/index.js +2644 -0
- package/dist/index.js.map +1 -0
- package/package.json +3 -2
package/dist/index.js
ADDED
|
@@ -0,0 +1,2644 @@
|
|
|
1
|
+
import globals3 from 'globals';
|
|
2
|
+
import prettierConfig from 'eslint-config-prettier';
|
|
3
|
+
import react from 'eslint-plugin-react';
|
|
4
|
+
import reactHooks from 'eslint-plugin-react-hooks';
|
|
5
|
+
import vuePlugin from 'eslint-plugin-vue';
|
|
6
|
+
import tseslint from 'typescript-eslint';
|
|
7
|
+
import vueParser from 'vue-eslint-parser';
|
|
8
|
+
import { fixupPluginRules } from '@eslint/compat';
|
|
9
|
+
import importPlugin from 'eslint-plugin-import';
|
|
10
|
+
import { existsSync, readFileSync } from 'fs';
|
|
11
|
+
import { join } from 'path';
|
|
12
|
+
import { execSync } from 'child_process';
|
|
13
|
+
import svelte from 'eslint-plugin-svelte';
|
|
14
|
+
import svelteParser from 'svelte-eslint-parser';
|
|
15
|
+
import solid from 'eslint-plugin-solid/configs/typescript';
|
|
16
|
+
import { configs } from 'eslint-plugin-astro';
|
|
17
|
+
import js from '@eslint/js';
|
|
18
|
+
|
|
19
|
+
var __defProp = Object.defineProperty;
|
|
20
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
21
|
+
var __esm = (fn, res) => function __init() {
|
|
22
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
23
|
+
};
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
// src/core/types.ts
|
|
30
|
+
var ConfigError;
|
|
31
|
+
var init_types = __esm({
|
|
32
|
+
"src/core/types.ts"() {
|
|
33
|
+
ConfigError = class _ConfigError extends Error {
|
|
34
|
+
context;
|
|
35
|
+
constructor(message, context) {
|
|
36
|
+
super(message);
|
|
37
|
+
this.name = "ConfigError";
|
|
38
|
+
this.context = context;
|
|
39
|
+
if (Error.captureStackTrace) {
|
|
40
|
+
Error.captureStackTrace(this, _ConfigError);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// src/tools/eslint/presets/base.ts
|
|
48
|
+
var basePreset, base_default;
|
|
49
|
+
var init_base = __esm({
|
|
50
|
+
"src/tools/eslint/presets/base.ts"() {
|
|
51
|
+
basePreset = {
|
|
52
|
+
rules: {
|
|
53
|
+
// ============================================================
|
|
54
|
+
// MODERN JAVASCRIPT RULES
|
|
55
|
+
// Best practices for ES2015+ code
|
|
56
|
+
// Documentation: https://eslint.org/docs/rules/
|
|
57
|
+
// ============================================================
|
|
58
|
+
// Console and debugging
|
|
59
|
+
"no-console": ["warn", { allow: ["warn", "error"] }],
|
|
60
|
+
// Warn on console.log but allow console.warn/error for logging
|
|
61
|
+
"no-debugger": "warn",
|
|
62
|
+
// Warn on debugger statements (should be removed before commit)
|
|
63
|
+
"no-alert": "error",
|
|
64
|
+
// Disallow alert/confirm/prompt (use proper UI)
|
|
65
|
+
// Modern syntax preferences
|
|
66
|
+
"prefer-const": "error",
|
|
67
|
+
// Use const for variables that are never reassigned
|
|
68
|
+
"no-var": "error",
|
|
69
|
+
// Use let/const instead of var
|
|
70
|
+
"prefer-arrow-callback": "error",
|
|
71
|
+
// Use arrow functions for callbacks
|
|
72
|
+
"prefer-template": "error",
|
|
73
|
+
// Use template literals instead of string concatenation
|
|
74
|
+
"prefer-destructuring": [
|
|
75
|
+
"error",
|
|
76
|
+
{
|
|
77
|
+
array: true,
|
|
78
|
+
object: true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
enforceForRenamedProperties: false
|
|
82
|
+
}
|
|
83
|
+
],
|
|
84
|
+
// Use destructuring where possible
|
|
85
|
+
"prefer-rest-params": "error",
|
|
86
|
+
// Use rest parameters instead of arguments object
|
|
87
|
+
"prefer-spread": "error",
|
|
88
|
+
// Use spread operator instead of .apply()
|
|
89
|
+
"object-shorthand": "error",
|
|
90
|
+
// Use object shorthand syntax {x} instead of {x: x}
|
|
91
|
+
// Note: arrow-body-style is a formatting rule disabled by eslint-config-prettier
|
|
92
|
+
// Code quality
|
|
93
|
+
eqeqeq: ["error", "always"],
|
|
94
|
+
// Always use === and !== instead of == and !=
|
|
95
|
+
"no-duplicate-imports": "off",
|
|
96
|
+
// Handled by import/no-duplicates (better type + value import support)
|
|
97
|
+
"no-useless-computed-key": "error",
|
|
98
|
+
// Disallow unnecessary computed property keys
|
|
99
|
+
"no-useless-constructor": "error",
|
|
100
|
+
// Disallow unnecessary constructors
|
|
101
|
+
"no-useless-rename": "error",
|
|
102
|
+
// Disallow renaming import/export/destructured assignments to same name
|
|
103
|
+
"no-nested-ternary": "error",
|
|
104
|
+
// Disallow nested ternary expressions (hard to read)
|
|
105
|
+
"no-unneeded-ternary": "error",
|
|
106
|
+
// Disallow ternary operators when simpler alternatives exist
|
|
107
|
+
"prefer-object-spread": "error",
|
|
108
|
+
// Use object spread instead of Object.assign
|
|
109
|
+
// Async/Promise best practices
|
|
110
|
+
"no-return-await": "error",
|
|
111
|
+
// Disallow unnecessary return await
|
|
112
|
+
"require-await": "warn",
|
|
113
|
+
// Warn on async functions without await (allow for plugin patterns)
|
|
114
|
+
"no-promise-executor-return": "error",
|
|
115
|
+
// Disallow returning values from Promise executor functions
|
|
116
|
+
// ============================================================
|
|
117
|
+
// CODE QUALITY & COMPLEXITY
|
|
118
|
+
// Maintainability and readability rules
|
|
119
|
+
// Documentation: https://eslint.org/docs/rules/
|
|
120
|
+
// ============================================================
|
|
121
|
+
// Complexity (warnings to identify areas needing refactoring)
|
|
122
|
+
complexity: ["warn", 15],
|
|
123
|
+
// Warn on high cyclomatic complexity
|
|
124
|
+
"max-depth": ["warn", 4],
|
|
125
|
+
// Warn on deeply nested blocks
|
|
126
|
+
"max-lines": ["warn", 500],
|
|
127
|
+
// Warn on files exceeding 500 lines
|
|
128
|
+
"max-lines-per-function": [
|
|
129
|
+
"warn",
|
|
130
|
+
{
|
|
131
|
+
max: 100,
|
|
132
|
+
skipBlankLines: true,
|
|
133
|
+
skipComments: true
|
|
134
|
+
}
|
|
135
|
+
],
|
|
136
|
+
// Warn on functions exceeding 100 lines
|
|
137
|
+
"max-params": ["warn", 4]
|
|
138
|
+
// Warn on functions with more than 4 parameters
|
|
139
|
+
// Note: spaced-comment is a formatting rule disabled by eslint-config-prettier
|
|
140
|
+
}
|
|
141
|
+
};
|
|
142
|
+
base_default = basePreset;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
var browserEnv, browser_default;
|
|
146
|
+
var init_browser = __esm({
|
|
147
|
+
"src/tools/eslint/presets/environments/browser.ts"() {
|
|
148
|
+
browserEnv = {
|
|
149
|
+
languageOptions: {
|
|
150
|
+
ecmaVersion: 2025,
|
|
151
|
+
sourceType: "module",
|
|
152
|
+
globals: {
|
|
153
|
+
...globals3.browser
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
};
|
|
157
|
+
browser_default = browserEnv;
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
var nodeEnv, node_default;
|
|
161
|
+
var init_node = __esm({
|
|
162
|
+
"src/tools/eslint/presets/environments/node.ts"() {
|
|
163
|
+
nodeEnv = {
|
|
164
|
+
languageOptions: {
|
|
165
|
+
ecmaVersion: 2025,
|
|
166
|
+
sourceType: "module",
|
|
167
|
+
globals: {
|
|
168
|
+
...globals3.node
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
rules: {
|
|
172
|
+
// Node.js-specific rule adjustments
|
|
173
|
+
"no-console": "off",
|
|
174
|
+
// Console is normal in Node.js
|
|
175
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
176
|
+
// Allow require() in .js files
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
node_default = nodeEnv;
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
var universalEnv, universal_default;
|
|
183
|
+
var init_universal = __esm({
|
|
184
|
+
"src/tools/eslint/presets/environments/universal.ts"() {
|
|
185
|
+
universalEnv = {
|
|
186
|
+
languageOptions: {
|
|
187
|
+
ecmaVersion: 2025,
|
|
188
|
+
sourceType: "module",
|
|
189
|
+
globals: {
|
|
190
|
+
...globals3.browser,
|
|
191
|
+
...globals3.node
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
universal_default = universalEnv;
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
function createAngularPreset() {
|
|
199
|
+
return [
|
|
200
|
+
{
|
|
201
|
+
files: ["**/*.ts"],
|
|
202
|
+
rules: {
|
|
203
|
+
// ============================================================
|
|
204
|
+
// ANGULAR-FRIENDLY TYPESCRIPT RULES
|
|
205
|
+
// Basic rules that work well with Angular patterns
|
|
206
|
+
// ============================================================
|
|
207
|
+
// Angular uses decorators extensively
|
|
208
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
209
|
+
// Angular components often have empty constructors for DI
|
|
210
|
+
"@typescript-eslint/no-empty-function": [
|
|
211
|
+
"error",
|
|
212
|
+
{
|
|
213
|
+
allow: ["constructors"]
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
// Angular uses ! for definite assignment (properties set by Angular)
|
|
217
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
218
|
+
// Angular services and components use 'any' in some cases
|
|
219
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
220
|
+
// Parameter properties are common in Angular (constructor(private foo: Foo))
|
|
221
|
+
"@typescript-eslint/parameter-properties": "off",
|
|
222
|
+
"@typescript-eslint/explicit-member-accessibility": "off",
|
|
223
|
+
// Angular uses both interfaces and types
|
|
224
|
+
"@typescript-eslint/consistent-type-definitions": "off",
|
|
225
|
+
// Naming conventions for Angular
|
|
226
|
+
"@typescript-eslint/naming-convention": [
|
|
227
|
+
"error",
|
|
228
|
+
{
|
|
229
|
+
selector: "default",
|
|
230
|
+
format: ["camelCase"],
|
|
231
|
+
leadingUnderscore: "allow",
|
|
232
|
+
trailingUnderscore: "allow"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
selector: "variable",
|
|
236
|
+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
|
|
237
|
+
leadingUnderscore: "allow"
|
|
238
|
+
},
|
|
239
|
+
{
|
|
240
|
+
selector: "typeLike",
|
|
241
|
+
format: ["PascalCase"]
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
selector: "enumMember",
|
|
245
|
+
format: ["PascalCase", "UPPER_CASE"]
|
|
246
|
+
},
|
|
247
|
+
{
|
|
248
|
+
selector: "property",
|
|
249
|
+
format: null
|
|
250
|
+
// Allow any format for properties (Angular templates use various patterns)
|
|
251
|
+
}
|
|
252
|
+
]
|
|
253
|
+
}
|
|
254
|
+
},
|
|
255
|
+
// Disable all formatting rules that conflict with Prettier
|
|
256
|
+
// This must be last to override any formatting rules from above
|
|
257
|
+
prettierConfig
|
|
258
|
+
];
|
|
259
|
+
}
|
|
260
|
+
var init_angular = __esm({
|
|
261
|
+
"src/tools/eslint/presets/frameworks/angular.ts"() {
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
function createNodePreset() {
|
|
265
|
+
return [
|
|
266
|
+
{
|
|
267
|
+
files: ["**/*.js", "**/*.ts", "**/*.mjs"],
|
|
268
|
+
rules: {
|
|
269
|
+
// ============================================================
|
|
270
|
+
// NODE.JS BACKEND RULES
|
|
271
|
+
// Best practices for server-side JavaScript/TypeScript
|
|
272
|
+
// ============================================================
|
|
273
|
+
// Console usage is normal in Node.js
|
|
274
|
+
"no-console": "off",
|
|
275
|
+
// Process and __dirname are standard in Node
|
|
276
|
+
"no-process-env": "off",
|
|
277
|
+
"no-process-exit": "warn",
|
|
278
|
+
// Async patterns
|
|
279
|
+
"no-async-promise-executor": "error",
|
|
280
|
+
"require-atomic-updates": "error",
|
|
281
|
+
// Error handling
|
|
282
|
+
"no-throw-literal": "error",
|
|
283
|
+
"prefer-promise-reject-errors": "error",
|
|
284
|
+
// Node.js specific
|
|
285
|
+
"callback-return": "off",
|
|
286
|
+
// Modern Node uses async/await
|
|
287
|
+
"handle-callback-err": "off",
|
|
288
|
+
// Modern Node uses async/await
|
|
289
|
+
"no-mixed-requires": "off",
|
|
290
|
+
// ES modules don't have this issue
|
|
291
|
+
"no-new-require": "error",
|
|
292
|
+
"no-path-concat": "error",
|
|
293
|
+
// Use path.join() instead
|
|
294
|
+
// Security
|
|
295
|
+
"no-eval": "error",
|
|
296
|
+
"no-implied-eval": "error",
|
|
297
|
+
"no-new-func": "error",
|
|
298
|
+
// Best practices for backend
|
|
299
|
+
"no-unused-vars": [
|
|
300
|
+
"error",
|
|
301
|
+
{
|
|
302
|
+
args: "after-used",
|
|
303
|
+
argsIgnorePattern: "^_",
|
|
304
|
+
varsIgnorePattern: "^_"
|
|
305
|
+
}
|
|
306
|
+
],
|
|
307
|
+
// Allow both require and import
|
|
308
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
309
|
+
}
|
|
310
|
+
},
|
|
311
|
+
// Disable all formatting rules that conflict with Prettier
|
|
312
|
+
// This must be last to override any formatting rules from above
|
|
313
|
+
prettierConfig
|
|
314
|
+
];
|
|
315
|
+
}
|
|
316
|
+
var init_node2 = __esm({
|
|
317
|
+
"src/tools/eslint/presets/frameworks/node.ts"() {
|
|
318
|
+
}
|
|
319
|
+
});
|
|
320
|
+
function createReactPreset() {
|
|
321
|
+
return [
|
|
322
|
+
// React recommended configuration
|
|
323
|
+
react.configs.flat.recommended,
|
|
324
|
+
react.configs.flat["jsx-runtime"],
|
|
325
|
+
// Disable React-in-scope for React 17+
|
|
326
|
+
// React Hooks rules
|
|
327
|
+
{
|
|
328
|
+
files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
|
|
329
|
+
plugins: {
|
|
330
|
+
"react-hooks": reactHooks
|
|
331
|
+
},
|
|
332
|
+
rules: reactHooks.configs.recommended.rules
|
|
333
|
+
},
|
|
334
|
+
// Custom opinionated React rules
|
|
335
|
+
{
|
|
336
|
+
files: ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"],
|
|
337
|
+
settings: {
|
|
338
|
+
react: {
|
|
339
|
+
version: "detect"
|
|
340
|
+
// Automatically detect React version
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
rules: {
|
|
344
|
+
// ============================================================
|
|
345
|
+
// REACT RULES (Conservative - Essential Only)
|
|
346
|
+
// React best practices for modern React 17+
|
|
347
|
+
// Documentation: https://github.com/jsx-eslint/eslint-plugin-react
|
|
348
|
+
// ============================================================
|
|
349
|
+
// Modern React (17+) adjustments
|
|
350
|
+
"react/react-in-jsx-scope": "off",
|
|
351
|
+
// Not needed in React 17+ with new JSX transform
|
|
352
|
+
"react/jsx-uses-react": "off",
|
|
353
|
+
// Not needed in React 17+ with new JSX transform
|
|
354
|
+
// TypeScript integration
|
|
355
|
+
"react/prop-types": "off",
|
|
356
|
+
// TypeScript handles prop validation
|
|
357
|
+
// JSX best practices
|
|
358
|
+
"react/jsx-uses-vars": "error",
|
|
359
|
+
// Prevent variables used in JSX being marked as unused
|
|
360
|
+
"react/jsx-curly-brace-presence": ["error", { props: "never", children: "never" }],
|
|
361
|
+
// Use strings when possible: prop="value" not prop={"value"}
|
|
362
|
+
"react/self-closing-comp": "error",
|
|
363
|
+
// Use <Component /> instead of <Component></Component>
|
|
364
|
+
"react/jsx-boolean-value": ["error", "never"],
|
|
365
|
+
// Use prop instead of prop={true}
|
|
366
|
+
"react/jsx-fragments": ["error", "syntax"],
|
|
367
|
+
// Use <> instead of <Fragment>
|
|
368
|
+
"react/jsx-no-useless-fragment": "error",
|
|
369
|
+
// Disallow unnecessary fragments
|
|
370
|
+
// Component definition
|
|
371
|
+
"react/function-component-definition": [
|
|
372
|
+
"error",
|
|
373
|
+
{
|
|
374
|
+
namedComponents: "arrow-function",
|
|
375
|
+
// const Component = () => ...
|
|
376
|
+
unnamedComponents: "arrow-function"
|
|
377
|
+
}
|
|
378
|
+
],
|
|
379
|
+
// Hooks (enforced by react-hooks plugin)
|
|
380
|
+
// - react-hooks/rules-of-hooks: error
|
|
381
|
+
// - react-hooks/exhaustive-deps: warn
|
|
382
|
+
// Best practices
|
|
383
|
+
"react/no-array-index-key": "warn",
|
|
384
|
+
// Warn when using array index as key (can cause issues)
|
|
385
|
+
"react/jsx-key": "error",
|
|
386
|
+
// Require key prop in iterators
|
|
387
|
+
"react/no-children-prop": "error",
|
|
388
|
+
// Prevent passing children as props
|
|
389
|
+
"react/no-danger": "warn",
|
|
390
|
+
// Warn on dangerouslySetInnerHTML (XSS risk)
|
|
391
|
+
"react/no-deprecated": "error",
|
|
392
|
+
// Prevent usage of deprecated methods
|
|
393
|
+
"react/no-unknown-property": "error"
|
|
394
|
+
// Prevent usage of unknown DOM properties
|
|
395
|
+
}
|
|
396
|
+
},
|
|
397
|
+
// Disable all formatting rules that conflict with Prettier
|
|
398
|
+
// This must be last to override any formatting rules from above
|
|
399
|
+
prettierConfig
|
|
400
|
+
];
|
|
401
|
+
}
|
|
402
|
+
var init_react = __esm({
|
|
403
|
+
"src/tools/eslint/presets/frameworks/react.ts"() {
|
|
404
|
+
}
|
|
405
|
+
});
|
|
406
|
+
function createVanillaPreset() {
|
|
407
|
+
return [
|
|
408
|
+
{
|
|
409
|
+
files: ["**/*.js", "**/*.ts", "**/*.tsx"],
|
|
410
|
+
rules: {
|
|
411
|
+
// No framework-specific rules
|
|
412
|
+
// All rules come from base.js and typescript.js presets
|
|
413
|
+
}
|
|
414
|
+
},
|
|
415
|
+
// Disable all formatting rules that conflict with Prettier
|
|
416
|
+
// This must be last to override any formatting rules from above
|
|
417
|
+
prettierConfig
|
|
418
|
+
];
|
|
419
|
+
}
|
|
420
|
+
var init_vanilla = __esm({
|
|
421
|
+
"src/tools/eslint/presets/frameworks/vanilla.ts"() {
|
|
422
|
+
}
|
|
423
|
+
});
|
|
424
|
+
function createVuePreset() {
|
|
425
|
+
return [
|
|
426
|
+
// Vue recommended configuration (flat config)
|
|
427
|
+
...vuePlugin.configs["flat/recommended"],
|
|
428
|
+
// Vue-specific custom rules
|
|
429
|
+
{
|
|
430
|
+
files: ["**/*.vue", "**/*.js", "**/*.ts", "**/*.tsx"],
|
|
431
|
+
rules: vueCustomRules
|
|
432
|
+
},
|
|
433
|
+
// Vue-specific parser configuration for TypeScript in <script> tags
|
|
434
|
+
// We must explicitly set vue-eslint-parser as the main parser, then configure
|
|
435
|
+
// it to use TypeScript parser for <script> blocks via parserOptions.parser
|
|
436
|
+
{
|
|
437
|
+
files: ["**/*.vue"],
|
|
438
|
+
languageOptions: {
|
|
439
|
+
parser: vueParser,
|
|
440
|
+
parserOptions: {
|
|
441
|
+
parser: tseslint.parser,
|
|
442
|
+
extraFileExtensions: [".vue"],
|
|
443
|
+
ecmaVersion: "latest",
|
|
444
|
+
sourceType: "module"
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
// Disable TypeScript naming convention for Vue files (allows onUpdate:modelValue pattern)
|
|
449
|
+
// IMPORTANT: Must also set parser to maintain vue-eslint-parser
|
|
450
|
+
{
|
|
451
|
+
files: ["**/*.vue"],
|
|
452
|
+
languageOptions: {
|
|
453
|
+
parser: vueParser,
|
|
454
|
+
parserOptions: {
|
|
455
|
+
parser: tseslint.parser,
|
|
456
|
+
extraFileExtensions: [".vue"],
|
|
457
|
+
ecmaVersion: "latest",
|
|
458
|
+
sourceType: "module"
|
|
459
|
+
}
|
|
460
|
+
},
|
|
461
|
+
rules: {
|
|
462
|
+
"@typescript-eslint/naming-convention": "off"
|
|
463
|
+
}
|
|
464
|
+
},
|
|
465
|
+
// Disable all formatting rules that conflict with Prettier
|
|
466
|
+
// This must be last to override any formatting rules from above
|
|
467
|
+
prettierConfig
|
|
468
|
+
];
|
|
469
|
+
}
|
|
470
|
+
var vueCustomRules;
|
|
471
|
+
var init_vue = __esm({
|
|
472
|
+
"src/tools/eslint/presets/frameworks/vue.ts"() {
|
|
473
|
+
vueCustomRules = {
|
|
474
|
+
// Component naming
|
|
475
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
476
|
+
"vue/multi-word-component-names": "off",
|
|
477
|
+
"vue/component-definition-name-casing": ["error", "PascalCase"],
|
|
478
|
+
// Template best practices
|
|
479
|
+
"vue/html-self-closing": [
|
|
480
|
+
"error",
|
|
481
|
+
{
|
|
482
|
+
html: {
|
|
483
|
+
void: "any",
|
|
484
|
+
normal: "always",
|
|
485
|
+
component: "always"
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
],
|
|
489
|
+
"vue/max-attributes-per-line": [
|
|
490
|
+
"error",
|
|
491
|
+
{
|
|
492
|
+
singleline: 3,
|
|
493
|
+
multiline: 1
|
|
494
|
+
}
|
|
495
|
+
],
|
|
496
|
+
"vue/first-attribute-linebreak": [
|
|
497
|
+
"error",
|
|
498
|
+
{
|
|
499
|
+
singleline: "ignore",
|
|
500
|
+
multiline: "below"
|
|
501
|
+
}
|
|
502
|
+
],
|
|
503
|
+
"vue/html-closing-bracket-newline": [
|
|
504
|
+
"error",
|
|
505
|
+
{
|
|
506
|
+
singleline: "never",
|
|
507
|
+
multiline: "always"
|
|
508
|
+
}
|
|
509
|
+
],
|
|
510
|
+
// Disable formatting rules that conflict with Prettier
|
|
511
|
+
"vue/multiline-html-element-content-newline": "off",
|
|
512
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
513
|
+
// Vue 3 Composition API
|
|
514
|
+
"vue/no-deprecated-v-on-native-modifier": "error",
|
|
515
|
+
"vue/no-deprecated-slot-attribute": "error",
|
|
516
|
+
"vue/require-explicit-emits": "error",
|
|
517
|
+
"vue/no-setup-props-reactivity-loss": "error",
|
|
518
|
+
"vue/component-api-style": ["error", ["script-setup"]],
|
|
519
|
+
"vue/define-macros-order": [
|
|
520
|
+
"error",
|
|
521
|
+
{
|
|
522
|
+
order: ["defineProps", "defineEmits"]
|
|
523
|
+
}
|
|
524
|
+
],
|
|
525
|
+
"vue/define-emits-declaration": ["error", "type-based"],
|
|
526
|
+
// Directives
|
|
527
|
+
"vue/no-v-html": "warn",
|
|
528
|
+
"vue/v-on-event-hyphenation": ["error", "always"],
|
|
529
|
+
"vue/v-bind-style": ["error", "shorthand"],
|
|
530
|
+
"vue/v-on-style": ["error", "shorthand"],
|
|
531
|
+
// Attributes
|
|
532
|
+
"vue/attribute-hyphenation": ["error", "always"],
|
|
533
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
534
|
+
// Order and organization
|
|
535
|
+
"vue/order-in-components": [
|
|
536
|
+
"error",
|
|
537
|
+
{
|
|
538
|
+
order: [
|
|
539
|
+
"el",
|
|
540
|
+
"name",
|
|
541
|
+
"parent",
|
|
542
|
+
"functional",
|
|
543
|
+
["delimiters", "comments"],
|
|
544
|
+
["components", "directives", "filters"],
|
|
545
|
+
"extends",
|
|
546
|
+
"mixins",
|
|
547
|
+
"inheritAttrs",
|
|
548
|
+
"model",
|
|
549
|
+
["props", "propsData"],
|
|
550
|
+
"data",
|
|
551
|
+
"computed",
|
|
552
|
+
"watch",
|
|
553
|
+
"LIFECYCLE_HOOKS",
|
|
554
|
+
"methods",
|
|
555
|
+
["template", "render"],
|
|
556
|
+
"renderError"
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
]
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
var importsPreset, imports_default;
|
|
564
|
+
var init_imports = __esm({
|
|
565
|
+
"src/tools/eslint/presets/imports.ts"() {
|
|
566
|
+
importsPreset = {
|
|
567
|
+
plugins: {
|
|
568
|
+
import: fixupPluginRules(importPlugin)
|
|
569
|
+
},
|
|
570
|
+
rules: {
|
|
571
|
+
// ============================================================
|
|
572
|
+
// IMPORT/MODULE RULES
|
|
573
|
+
// Module import/export best practices
|
|
574
|
+
// Documentation: https://github.com/import-js/eslint-plugin-import
|
|
575
|
+
// ============================================================
|
|
576
|
+
"import/order": [
|
|
577
|
+
"error",
|
|
578
|
+
{
|
|
579
|
+
groups: ["builtin", "external", "internal", "parent", "sibling", "index"],
|
|
580
|
+
"newlines-between": "always",
|
|
581
|
+
alphabetize: {
|
|
582
|
+
order: "asc",
|
|
583
|
+
caseInsensitive: true
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
],
|
|
587
|
+
// Enforce consistent import order with alphabetization
|
|
588
|
+
"import/no-duplicates": [
|
|
589
|
+
"error",
|
|
590
|
+
{
|
|
591
|
+
"prefer-inline": true,
|
|
592
|
+
considerQueryString: false
|
|
593
|
+
}
|
|
594
|
+
],
|
|
595
|
+
// Prevent duplicate imports (allows type + value imports from same module)
|
|
596
|
+
"import/no-unresolved": "off",
|
|
597
|
+
// TypeScript handles this better
|
|
598
|
+
"import/named": "off",
|
|
599
|
+
// TypeScript handles this better
|
|
600
|
+
"import/namespace": "off",
|
|
601
|
+
// TypeScript handles this better
|
|
602
|
+
"import/default": "off",
|
|
603
|
+
// TypeScript handles this better
|
|
604
|
+
"import/no-named-as-default": "warn",
|
|
605
|
+
// Warn on potentially confusing imports
|
|
606
|
+
"import/no-named-as-default-member": "warn",
|
|
607
|
+
// Warn on confusing member access
|
|
608
|
+
"import/newline-after-import": "error",
|
|
609
|
+
// Require blank line after imports
|
|
610
|
+
"import/no-webpack-loader-syntax": "error",
|
|
611
|
+
// No webpack loader syntax in imports
|
|
612
|
+
"import/first": "error"
|
|
613
|
+
// Imports must be at the top of the file
|
|
614
|
+
}
|
|
615
|
+
};
|
|
616
|
+
imports_default = importsPreset;
|
|
617
|
+
}
|
|
618
|
+
});
|
|
619
|
+
|
|
620
|
+
// src/tools/eslint/presets/typescript.ts
|
|
621
|
+
var typescriptPreset, typescript_default;
|
|
622
|
+
var init_typescript = __esm({
|
|
623
|
+
"src/tools/eslint/presets/typescript.ts"() {
|
|
624
|
+
typescriptPreset = {
|
|
625
|
+
rules: {
|
|
626
|
+
// ============================================================
|
|
627
|
+
// TYPESCRIPT RULES
|
|
628
|
+
// TypeScript-specific linting and type safety
|
|
629
|
+
// Documentation: https://typescript-eslint.io/rules/
|
|
630
|
+
// ============================================================
|
|
631
|
+
// Type safety
|
|
632
|
+
"@typescript-eslint/no-explicit-any": "warn",
|
|
633
|
+
// Warn on any usage (allow when necessary)
|
|
634
|
+
// Note: Type-checked rules (no-unsafe-*) require TypeScript project configuration
|
|
635
|
+
// They are disabled here but available in recommended-type-checked preset
|
|
636
|
+
// Type annotations
|
|
637
|
+
"@typescript-eslint/explicit-function-return-type": "off",
|
|
638
|
+
// Too strict - TS can infer return types
|
|
639
|
+
"@typescript-eslint/explicit-module-boundary-types": "off",
|
|
640
|
+
// Too strict - TS can infer exports
|
|
641
|
+
"@typescript-eslint/typedef": [
|
|
642
|
+
"error",
|
|
643
|
+
{
|
|
644
|
+
arrayDestructuring: false,
|
|
645
|
+
arrowParameter: false,
|
|
646
|
+
memberVariableDeclaration: false,
|
|
647
|
+
objectDestructuring: false,
|
|
648
|
+
parameter: false,
|
|
649
|
+
propertyDeclaration: true,
|
|
650
|
+
// Require type annotations on class properties
|
|
651
|
+
variableDeclaration: false,
|
|
652
|
+
variableDeclarationIgnoreFunction: true
|
|
653
|
+
}
|
|
654
|
+
],
|
|
655
|
+
// Require type annotations in specific places
|
|
656
|
+
// Best practices
|
|
657
|
+
"@typescript-eslint/no-unused-vars": [
|
|
658
|
+
"error",
|
|
659
|
+
{
|
|
660
|
+
argsIgnorePattern: "^_",
|
|
661
|
+
// Allow unused args prefixed with _
|
|
662
|
+
varsIgnorePattern: "^_"
|
|
663
|
+
// Allow unused vars prefixed with _
|
|
664
|
+
}
|
|
665
|
+
],
|
|
666
|
+
"@typescript-eslint/prefer-for-of": "error",
|
|
667
|
+
// Prefer for-of over standard for loop with index
|
|
668
|
+
"@typescript-eslint/no-non-null-assertion": "warn",
|
|
669
|
+
// Warn on non-null assertions (! operator)
|
|
670
|
+
// Consistency
|
|
671
|
+
"@typescript-eslint/consistent-type-definitions": ["error", "interface"],
|
|
672
|
+
// Prefer interface over type alias
|
|
673
|
+
"@typescript-eslint/consistent-type-imports": [
|
|
674
|
+
"error",
|
|
675
|
+
{
|
|
676
|
+
prefer: "type-imports",
|
|
677
|
+
// Use import type for type-only imports
|
|
678
|
+
disallowTypeAnnotations: false
|
|
679
|
+
}
|
|
680
|
+
],
|
|
681
|
+
// ============================================================
|
|
682
|
+
// NAMING CONVENTIONS
|
|
683
|
+
// Enforce consistent naming patterns across the codebase
|
|
684
|
+
// Documentation: https://typescript-eslint.io/rules/naming-convention/
|
|
685
|
+
//
|
|
686
|
+
// Patterns enforced:
|
|
687
|
+
// - camelCase: variables, functions, methods, parameters
|
|
688
|
+
// - PascalCase: classes, interfaces, types, enums
|
|
689
|
+
// - UPPER_CASE: constants and enum members
|
|
690
|
+
// - underscore prefix: private members, unused parameters
|
|
691
|
+
// ============================================================
|
|
692
|
+
"@typescript-eslint/naming-convention": [
|
|
693
|
+
"error",
|
|
694
|
+
// Default: camelCase for most identifiers
|
|
695
|
+
{
|
|
696
|
+
selector: "default",
|
|
697
|
+
format: ["camelCase"],
|
|
698
|
+
leadingUnderscore: "allow",
|
|
699
|
+
trailingUnderscore: "forbid"
|
|
700
|
+
},
|
|
701
|
+
// Variables: camelCase or UPPER_CASE for constants
|
|
702
|
+
{
|
|
703
|
+
selector: "variable",
|
|
704
|
+
format: ["camelCase", "UPPER_CASE", "PascalCase"],
|
|
705
|
+
// PascalCase for components
|
|
706
|
+
leadingUnderscore: "allow"
|
|
707
|
+
},
|
|
708
|
+
// Functions and methods: camelCase
|
|
709
|
+
{
|
|
710
|
+
selector: ["function", "method"],
|
|
711
|
+
format: ["camelCase"]
|
|
712
|
+
},
|
|
713
|
+
// Classes, interfaces, types, enums: PascalCase
|
|
714
|
+
{
|
|
715
|
+
selector: "typeLike",
|
|
716
|
+
format: ["PascalCase"]
|
|
717
|
+
},
|
|
718
|
+
// Type parameters: PascalCase with T prefix
|
|
719
|
+
{
|
|
720
|
+
selector: "typeParameter",
|
|
721
|
+
format: ["PascalCase"],
|
|
722
|
+
prefix: ["T"]
|
|
723
|
+
},
|
|
724
|
+
// Enum members: PascalCase or UPPER_CASE
|
|
725
|
+
{
|
|
726
|
+
selector: "enumMember",
|
|
727
|
+
format: ["PascalCase", "UPPER_CASE"]
|
|
728
|
+
},
|
|
729
|
+
// Object properties: allow camelCase, PascalCase, or UPPER_CASE (for API responses, component props, env vars)
|
|
730
|
+
{
|
|
731
|
+
selector: "property",
|
|
732
|
+
format: ["camelCase", "PascalCase", "UPPER_CASE"],
|
|
733
|
+
leadingUnderscore: "allow",
|
|
734
|
+
filter: {
|
|
735
|
+
// Allow properties with special characters (ESLint rule names, path aliases, env vars)
|
|
736
|
+
regex: "^(@|no-|prefer-|max-|vue/|import/|spaced-|react/|[A-Z_]+).*$",
|
|
737
|
+
match: false
|
|
738
|
+
}
|
|
739
|
+
},
|
|
740
|
+
// Object literal properties: allow any format (path aliases like @renderer, @main, @preload)
|
|
741
|
+
{
|
|
742
|
+
selector: "objectLiteralProperty",
|
|
743
|
+
format: null
|
|
744
|
+
},
|
|
745
|
+
// Imports: allow camelCase or PascalCase (Vue component imports)
|
|
746
|
+
{
|
|
747
|
+
selector: "import",
|
|
748
|
+
format: ["camelCase", "PascalCase"],
|
|
749
|
+
leadingUnderscore: "allow"
|
|
750
|
+
},
|
|
751
|
+
// Private class members: require underscore prefix
|
|
752
|
+
{
|
|
753
|
+
selector: "memberLike",
|
|
754
|
+
modifiers: ["private"],
|
|
755
|
+
format: ["camelCase"],
|
|
756
|
+
leadingUnderscore: "require"
|
|
757
|
+
},
|
|
758
|
+
// Unused parameters: require underscore prefix
|
|
759
|
+
{
|
|
760
|
+
selector: "parameter",
|
|
761
|
+
modifiers: ["unused"],
|
|
762
|
+
format: ["camelCase"],
|
|
763
|
+
leadingUnderscore: "require"
|
|
764
|
+
}
|
|
765
|
+
]
|
|
766
|
+
}
|
|
767
|
+
};
|
|
768
|
+
typescript_default = typescriptPreset;
|
|
769
|
+
}
|
|
770
|
+
});
|
|
771
|
+
function readPackageJson(cwd) {
|
|
772
|
+
const packagePath = join(cwd, "package.json");
|
|
773
|
+
if (!existsSync(packagePath)) {
|
|
774
|
+
return null;
|
|
775
|
+
}
|
|
776
|
+
try {
|
|
777
|
+
const content = readFileSync(packagePath, "utf8");
|
|
778
|
+
return JSON.parse(content);
|
|
779
|
+
} catch (error) {
|
|
780
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
781
|
+
console.warn(`Warning: Failed to read package.json: ${message}`);
|
|
782
|
+
return null;
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
function getAllDependencies(pkg) {
|
|
786
|
+
if (!pkg) {
|
|
787
|
+
return {};
|
|
788
|
+
}
|
|
789
|
+
return {
|
|
790
|
+
...pkg.dependencies,
|
|
791
|
+
...pkg.devDependencies
|
|
792
|
+
};
|
|
793
|
+
}
|
|
794
|
+
var init_package_reader = __esm({
|
|
795
|
+
"src/core/package-reader.ts"() {
|
|
796
|
+
}
|
|
797
|
+
});
|
|
798
|
+
function detectReactMetaFramework(deps) {
|
|
799
|
+
return !!(deps.next || deps["@next/core"] || deps.remix || deps["@remix-run/react"] || deps["@remix-run/node"] || deps.gatsby || deps["gatsby-link"]);
|
|
800
|
+
}
|
|
801
|
+
function detectVueMetaFramework(deps) {
|
|
802
|
+
return !!(deps.nuxt || deps["nuxt3"]);
|
|
803
|
+
}
|
|
804
|
+
function detectSvelteMetaFramework(deps) {
|
|
805
|
+
return !!deps["@sveltejs/kit"];
|
|
806
|
+
}
|
|
807
|
+
function detectBaseFramework(deps) {
|
|
808
|
+
if (deps.react || deps["react-dom"]) return "react";
|
|
809
|
+
if (deps.vue || deps["@vue/runtime-core"] || deps["vue-router"] || deps.pinia) return "vue";
|
|
810
|
+
if (deps["@angular/core"]) return "angular";
|
|
811
|
+
if (deps.svelte) return "svelte";
|
|
812
|
+
if (deps["solid-js"]) return "solid";
|
|
813
|
+
if (deps.astro) return "astro";
|
|
814
|
+
return null;
|
|
815
|
+
}
|
|
816
|
+
function isNodeBackend(pkg, deps, cwd) {
|
|
817
|
+
if (pkg.type !== "module") return false;
|
|
818
|
+
const hasNodeFramework = !!(deps.express || deps.fastify || deps.koa || deps["@hapi/hapi"]);
|
|
819
|
+
const hasServerFiles = existsSync(join(cwd, "server.js")) || existsSync(join(cwd, "app.js")) || existsSync(join(cwd, "index.js")) && existsSync(join(cwd, "routes"));
|
|
820
|
+
return hasNodeFramework || hasServerFiles;
|
|
821
|
+
}
|
|
822
|
+
function detectFramework(cwd = process.cwd()) {
|
|
823
|
+
const pkg = readPackageJson(cwd);
|
|
824
|
+
if (!pkg) {
|
|
825
|
+
console.warn("Could not find package.json, defaulting to vanilla JavaScript");
|
|
826
|
+
return "vanilla";
|
|
827
|
+
}
|
|
828
|
+
const deps = getAllDependencies(pkg);
|
|
829
|
+
if (detectReactMetaFramework(deps)) return "react";
|
|
830
|
+
if (detectVueMetaFramework(deps)) return "vue";
|
|
831
|
+
if (detectSvelteMetaFramework(deps)) return "svelte";
|
|
832
|
+
const baseFramework = detectBaseFramework(deps);
|
|
833
|
+
if (baseFramework) return baseFramework;
|
|
834
|
+
if (isNodeBackend(pkg, deps, cwd)) return "node";
|
|
835
|
+
return "vanilla";
|
|
836
|
+
}
|
|
837
|
+
function detectEnvironment(framework, cwd = process.cwd()) {
|
|
838
|
+
if (framework === "node") {
|
|
839
|
+
return "node";
|
|
840
|
+
}
|
|
841
|
+
if (["react", "vue", "svelte", "solid", "angular"].includes(framework)) {
|
|
842
|
+
return "browser";
|
|
843
|
+
}
|
|
844
|
+
if (framework === "astro") {
|
|
845
|
+
return "universal";
|
|
846
|
+
}
|
|
847
|
+
const hasServerCode = existsSync(join(cwd, "server")) || existsSync(join(cwd, "api")) || existsSync(join(cwd, "backend"));
|
|
848
|
+
if (hasServerCode) {
|
|
849
|
+
return "universal";
|
|
850
|
+
}
|
|
851
|
+
return "browser";
|
|
852
|
+
}
|
|
853
|
+
function detectTypeScript(cwd = process.cwd()) {
|
|
854
|
+
if (existsSync(join(cwd, "tsconfig.json"))) {
|
|
855
|
+
return true;
|
|
856
|
+
}
|
|
857
|
+
const pkg = readPackageJson(cwd);
|
|
858
|
+
if (!pkg) return false;
|
|
859
|
+
return !!(pkg.dependencies?.typescript || pkg.devDependencies?.typescript);
|
|
860
|
+
}
|
|
861
|
+
function detectGitProvider(cwd = process.cwd()) {
|
|
862
|
+
const pkg = readPackageJson(cwd);
|
|
863
|
+
if (pkg?.repository) {
|
|
864
|
+
const repoUrl = typeof pkg.repository === "string" ? pkg.repository : pkg.repository.url || "";
|
|
865
|
+
if (repoUrl.includes("gitlab.com")) return "gitlab";
|
|
866
|
+
if (repoUrl.includes("github.com")) return "github";
|
|
867
|
+
if (repoUrl.includes("bitbucket.org")) return "bitbucket";
|
|
868
|
+
return null;
|
|
869
|
+
}
|
|
870
|
+
try {
|
|
871
|
+
const remoteUrl = execSync("git remote get-url origin", {
|
|
872
|
+
cwd,
|
|
873
|
+
encoding: "utf8",
|
|
874
|
+
stdio: ["pipe", "pipe", "ignore"]
|
|
875
|
+
}).trim();
|
|
876
|
+
if (remoteUrl.includes("gitlab.com")) return "gitlab";
|
|
877
|
+
if (remoteUrl.includes("github.com")) return "github";
|
|
878
|
+
if (remoteUrl.includes("bitbucket.org")) return "bitbucket";
|
|
879
|
+
} catch (error) {
|
|
880
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
881
|
+
console.warn(`Warning: Could not detect git provider from remote: ${message}`);
|
|
882
|
+
}
|
|
883
|
+
return null;
|
|
884
|
+
}
|
|
885
|
+
function detectCssType(cwd = process.cwd()) {
|
|
886
|
+
const pkg = readPackageJson(cwd);
|
|
887
|
+
const results = {
|
|
888
|
+
preprocessor: null,
|
|
889
|
+
// 'scss', 'sass', 'less', null
|
|
890
|
+
tailwind: false,
|
|
891
|
+
modules: false,
|
|
892
|
+
postcss: false
|
|
893
|
+
};
|
|
894
|
+
const hasSass = pkg?.dependencies?.sass || pkg?.devDependencies?.sass || pkg?.dependencies?.["node-sass"] || pkg?.devDependencies?.["node-sass"] || pkg?.dependencies?.["sass-embedded"] || pkg?.devDependencies?.["sass-embedded"];
|
|
895
|
+
if (hasSass) {
|
|
896
|
+
results.preprocessor = "scss";
|
|
897
|
+
}
|
|
898
|
+
const hasLess = pkg?.dependencies?.less || pkg?.devDependencies?.less;
|
|
899
|
+
if (hasLess && !hasSass) {
|
|
900
|
+
results.preprocessor = "less";
|
|
901
|
+
}
|
|
902
|
+
const hasTailwind = pkg?.dependencies?.tailwindcss || pkg?.devDependencies?.tailwindcss;
|
|
903
|
+
if (hasTailwind) {
|
|
904
|
+
results.tailwind = existsSync(join(cwd, "tailwind.config.js")) || existsSync(join(cwd, "tailwind.config.ts")) || existsSync(join(cwd, "tailwind.config.mjs")) || existsSync(join(cwd, "tailwind.config.cjs"));
|
|
905
|
+
}
|
|
906
|
+
results.postcss = existsSync(join(cwd, "postcss.config.js")) || existsSync(join(cwd, "postcss.config.cjs")) || existsSync(join(cwd, "postcss.config.mjs")) || existsSync(join(cwd, ".postcssrc")) || existsSync(join(cwd, ".postcssrc.json"));
|
|
907
|
+
return results;
|
|
908
|
+
}
|
|
909
|
+
function detectElectron(cwd = process.cwd()) {
|
|
910
|
+
const pkg = readPackageJson(cwd);
|
|
911
|
+
if (!pkg) return false;
|
|
912
|
+
const deps = getAllDependencies(pkg);
|
|
913
|
+
return !!(deps.electron || deps["@electron-toolkit/utils"] || deps["@electron-toolkit/preload"]);
|
|
914
|
+
}
|
|
915
|
+
function autoDetect(cwd = process.cwd()) {
|
|
916
|
+
const framework = detectFramework(cwd);
|
|
917
|
+
const environment = detectEnvironment(framework, cwd);
|
|
918
|
+
const typescript = detectTypeScript(cwd);
|
|
919
|
+
const gitProvider = detectGitProvider(cwd);
|
|
920
|
+
const cssType = detectCssType(cwd);
|
|
921
|
+
const electron = detectElectron(cwd);
|
|
922
|
+
return {
|
|
923
|
+
framework,
|
|
924
|
+
environment,
|
|
925
|
+
typescript,
|
|
926
|
+
gitProvider,
|
|
927
|
+
cssType,
|
|
928
|
+
electron
|
|
929
|
+
};
|
|
930
|
+
}
|
|
931
|
+
var init_detectors = __esm({
|
|
932
|
+
"src/core/detectors.ts"() {
|
|
933
|
+
init_package_reader();
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
|
|
937
|
+
// src/core/ignore-patterns.ts
|
|
938
|
+
function getIgnorePatterns(customIgnores = []) {
|
|
939
|
+
return [
|
|
940
|
+
...COMMON_IGNORE_DIRS.map((dir) => `**/${dir}/**`),
|
|
941
|
+
...FRAMEWORK_BUILD_DIRS.map((dir) => `**/${dir}/**`),
|
|
942
|
+
...MINIFIED_FILES.map((pattern) => `**/${pattern}`),
|
|
943
|
+
...customIgnores
|
|
944
|
+
];
|
|
945
|
+
}
|
|
946
|
+
var COMMON_IGNORE_DIRS, FRAMEWORK_BUILD_DIRS, MINIFIED_FILES, getEslintIgnores, getStylelintIgnores;
|
|
947
|
+
var init_ignore_patterns = __esm({
|
|
948
|
+
"src/core/ignore-patterns.ts"() {
|
|
949
|
+
COMMON_IGNORE_DIRS = [
|
|
950
|
+
"node_modules",
|
|
951
|
+
"dist",
|
|
952
|
+
"build",
|
|
953
|
+
"out",
|
|
954
|
+
"coverage",
|
|
955
|
+
".nyc_output"
|
|
956
|
+
];
|
|
957
|
+
FRAMEWORK_BUILD_DIRS = [
|
|
958
|
+
".next",
|
|
959
|
+
// Next.js
|
|
960
|
+
".nuxt",
|
|
961
|
+
// Nuxt
|
|
962
|
+
".output",
|
|
963
|
+
// Nitro/Nuxt3
|
|
964
|
+
".vercel",
|
|
965
|
+
// Vercel
|
|
966
|
+
".netlify",
|
|
967
|
+
// Netlify
|
|
968
|
+
".cache",
|
|
969
|
+
// Gatsby/Parcel
|
|
970
|
+
".parcel-cache",
|
|
971
|
+
// Parcel
|
|
972
|
+
".turbo",
|
|
973
|
+
// Turborepo
|
|
974
|
+
".vite",
|
|
975
|
+
// Vite
|
|
976
|
+
".vitepress",
|
|
977
|
+
// VitePress
|
|
978
|
+
".svelte-kit"
|
|
979
|
+
// SvelteKit
|
|
980
|
+
];
|
|
981
|
+
MINIFIED_FILES = ["*.min.js", "*.min.css", "*.min.mjs"];
|
|
982
|
+
getEslintIgnores = getIgnorePatterns;
|
|
983
|
+
getStylelintIgnores = getIgnorePatterns;
|
|
984
|
+
}
|
|
985
|
+
});
|
|
986
|
+
|
|
987
|
+
// src/tools/eslint/presets/frameworks/svelte.ts
|
|
988
|
+
var svelte_exports = {};
|
|
989
|
+
__export(svelte_exports, {
|
|
990
|
+
default: () => createSveltePreset
|
|
991
|
+
});
|
|
992
|
+
function createSveltePreset() {
|
|
993
|
+
return [
|
|
994
|
+
...svelte.configs["flat/recommended"],
|
|
995
|
+
{
|
|
996
|
+
files: ["**/*.svelte"],
|
|
997
|
+
languageOptions: {
|
|
998
|
+
parser: svelteParser,
|
|
999
|
+
parserOptions: {
|
|
1000
|
+
parser: tseslint.parser,
|
|
1001
|
+
extraFileExtensions: [".svelte"]
|
|
1002
|
+
}
|
|
1003
|
+
},
|
|
1004
|
+
rules: {
|
|
1005
|
+
// Core Svelte Best Practices (7 rules)
|
|
1006
|
+
"svelte/no-at-html-tags": "error",
|
|
1007
|
+
"svelte/no-target-blank": "error",
|
|
1008
|
+
"svelte/no-reactive-reassign": "error",
|
|
1009
|
+
"svelte/require-store-reactive-access": "error",
|
|
1010
|
+
"svelte/valid-compile": "error",
|
|
1011
|
+
"svelte/no-unused-svelte-ignore": "error",
|
|
1012
|
+
"svelte/no-useless-mustaches": "error",
|
|
1013
|
+
"svelte/require-optimized-style-attribute": "error",
|
|
1014
|
+
// Svelte 5 (runes mode) - 4 rules
|
|
1015
|
+
"svelte/block-lang": [
|
|
1016
|
+
"error",
|
|
1017
|
+
{
|
|
1018
|
+
script: "ts",
|
|
1019
|
+
style: null
|
|
1020
|
+
}
|
|
1021
|
+
],
|
|
1022
|
+
"svelte/no-dom-manipulating": "error",
|
|
1023
|
+
"svelte/no-export-load-in-svelte-module-in-kit-pages": "error",
|
|
1024
|
+
"svelte/no-store-async": "error",
|
|
1025
|
+
// Code Style (3 rules - formatting rules removed, handled by Prettier)
|
|
1026
|
+
"svelte/shorthand-attribute": "error",
|
|
1027
|
+
"svelte/shorthand-directive": "error",
|
|
1028
|
+
"svelte/no-spaces-around-equal-signs-in-attribute": "error"
|
|
1029
|
+
// Note: svelte/html-quotes, svelte/indent, svelte/first-attribute-linebreak
|
|
1030
|
+
// are formatting rules disabled by eslint-config-prettier
|
|
1031
|
+
}
|
|
1032
|
+
},
|
|
1033
|
+
// Disable all formatting rules that conflict with Prettier
|
|
1034
|
+
// This must be last to override any formatting rules from above
|
|
1035
|
+
prettierConfig
|
|
1036
|
+
];
|
|
1037
|
+
}
|
|
1038
|
+
var init_svelte = __esm({
|
|
1039
|
+
"src/tools/eslint/presets/frameworks/svelte.ts"() {
|
|
1040
|
+
}
|
|
1041
|
+
});
|
|
1042
|
+
|
|
1043
|
+
// src/tools/eslint/presets/frameworks/solid.ts
|
|
1044
|
+
var solid_exports = {};
|
|
1045
|
+
__export(solid_exports, {
|
|
1046
|
+
default: () => createSolidPreset
|
|
1047
|
+
});
|
|
1048
|
+
function createSolidPreset() {
|
|
1049
|
+
return [
|
|
1050
|
+
{
|
|
1051
|
+
files: ["**/*.jsx", "**/*.tsx"],
|
|
1052
|
+
...solid,
|
|
1053
|
+
rules: {
|
|
1054
|
+
...solid.rules,
|
|
1055
|
+
// Reactive Primitives (7 rules)
|
|
1056
|
+
"solid/reactivity": "error",
|
|
1057
|
+
// Enforce reactive dependencies
|
|
1058
|
+
"solid/no-destructure": "error",
|
|
1059
|
+
// Don't destructure props (loses reactivity)
|
|
1060
|
+
"solid/prefer-for": "error",
|
|
1061
|
+
// Use <For> over .map()
|
|
1062
|
+
"solid/no-innerhtml": ["error", { allowStatic: true }],
|
|
1063
|
+
// Prevent XSS
|
|
1064
|
+
"solid/event-handlers": [
|
|
1065
|
+
"error",
|
|
1066
|
+
{
|
|
1067
|
+
// Consistent event handler naming
|
|
1068
|
+
ignoreCase: false,
|
|
1069
|
+
warnOnSpread: false
|
|
1070
|
+
}
|
|
1071
|
+
],
|
|
1072
|
+
"solid/jsx-no-undef": "error",
|
|
1073
|
+
// Undefined components
|
|
1074
|
+
"solid/jsx-uses-vars": "error",
|
|
1075
|
+
// Mark JSX vars as used
|
|
1076
|
+
// Component Best Practices (5 rules)
|
|
1077
|
+
"solid/components-return-once": "error",
|
|
1078
|
+
// Single return per component
|
|
1079
|
+
"solid/no-unknown-namespaces": "error",
|
|
1080
|
+
// Validate JSX namespaces
|
|
1081
|
+
"solid/prefer-show": "error",
|
|
1082
|
+
// Use <Show> over ternary
|
|
1083
|
+
"solid/self-closing-comp": "error",
|
|
1084
|
+
// Self-close components without children
|
|
1085
|
+
"solid/style-prop": ["error", { styleProps: ["style", "css"] }]
|
|
1086
|
+
// Validate style prop
|
|
1087
|
+
}
|
|
1088
|
+
},
|
|
1089
|
+
// Disable all formatting rules that conflict with Prettier
|
|
1090
|
+
// This must be last to override any formatting rules from above
|
|
1091
|
+
prettierConfig
|
|
1092
|
+
];
|
|
1093
|
+
}
|
|
1094
|
+
var init_solid = __esm({
|
|
1095
|
+
"src/tools/eslint/presets/frameworks/solid.ts"() {
|
|
1096
|
+
}
|
|
1097
|
+
});
|
|
1098
|
+
|
|
1099
|
+
// src/tools/eslint/presets/frameworks/astro.ts
|
|
1100
|
+
var astro_exports = {};
|
|
1101
|
+
__export(astro_exports, {
|
|
1102
|
+
default: () => createAstroPreset
|
|
1103
|
+
});
|
|
1104
|
+
function createAstroPreset() {
|
|
1105
|
+
return [
|
|
1106
|
+
...configs.recommended,
|
|
1107
|
+
...configs["jsx-a11y-recommended"],
|
|
1108
|
+
{
|
|
1109
|
+
files: ["**/*.astro"],
|
|
1110
|
+
rules: {
|
|
1111
|
+
// Component Best Practices (5 rules)
|
|
1112
|
+
"astro/no-conflict-set-directives": "error",
|
|
1113
|
+
// Avoid conflicting set directives
|
|
1114
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
1115
|
+
// Remove unused CSS variables
|
|
1116
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
1117
|
+
// Use new canonical URL API
|
|
1118
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
1119
|
+
// Use new content collections
|
|
1120
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
1121
|
+
// Use new module resolution
|
|
1122
|
+
// Template Syntax (3 rules - formatting rules removed, handled by Prettier)
|
|
1123
|
+
"astro/valid-compile": "error",
|
|
1124
|
+
// Ensure valid Astro syntax
|
|
1125
|
+
"astro/no-set-html-directive": "warn",
|
|
1126
|
+
// Warn about XSS risk
|
|
1127
|
+
"astro/prefer-class-list-directive": "error"
|
|
1128
|
+
// Use class:list over className
|
|
1129
|
+
// Note: astro/semi is a formatting rule disabled by eslint-config-prettier
|
|
1130
|
+
// Accessibility (included from jsx-a11y-recommended preset)
|
|
1131
|
+
// - alt-text, click-events-have-key-events, etc.
|
|
1132
|
+
}
|
|
1133
|
+
},
|
|
1134
|
+
// Disable all formatting rules that conflict with Prettier
|
|
1135
|
+
// This must be last to override any formatting rules from above
|
|
1136
|
+
prettierConfig
|
|
1137
|
+
];
|
|
1138
|
+
}
|
|
1139
|
+
var init_astro = __esm({
|
|
1140
|
+
"src/tools/eslint/presets/frameworks/astro.ts"() {
|
|
1141
|
+
}
|
|
1142
|
+
});
|
|
1143
|
+
|
|
1144
|
+
// src/tools/eslint/index.ts
|
|
1145
|
+
var eslint_exports = {};
|
|
1146
|
+
__export(eslint_exports, {
|
|
1147
|
+
createEslintConfig: () => createEslintConfig,
|
|
1148
|
+
default: () => eslint_default
|
|
1149
|
+
});
|
|
1150
|
+
async function addFrameworkConfig(config, framework) {
|
|
1151
|
+
switch (framework) {
|
|
1152
|
+
case "react":
|
|
1153
|
+
config.push(...createReactPreset());
|
|
1154
|
+
break;
|
|
1155
|
+
case "vue":
|
|
1156
|
+
config.push(...createVuePreset());
|
|
1157
|
+
break;
|
|
1158
|
+
case "svelte": {
|
|
1159
|
+
const { default: createSveltePreset2 } = await Promise.resolve().then(() => (init_svelte(), svelte_exports));
|
|
1160
|
+
config.push(...createSveltePreset2());
|
|
1161
|
+
break;
|
|
1162
|
+
}
|
|
1163
|
+
case "solid": {
|
|
1164
|
+
const { default: createSolidPreset2 } = await Promise.resolve().then(() => (init_solid(), solid_exports));
|
|
1165
|
+
config.push(...createSolidPreset2());
|
|
1166
|
+
break;
|
|
1167
|
+
}
|
|
1168
|
+
case "astro": {
|
|
1169
|
+
const { default: createAstroPreset2 } = await Promise.resolve().then(() => (init_astro(), astro_exports));
|
|
1170
|
+
config.push(...createAstroPreset2());
|
|
1171
|
+
break;
|
|
1172
|
+
}
|
|
1173
|
+
case "vanilla":
|
|
1174
|
+
config.push(...createVanillaPreset());
|
|
1175
|
+
break;
|
|
1176
|
+
case "node":
|
|
1177
|
+
config.push(...createNodePreset());
|
|
1178
|
+
break;
|
|
1179
|
+
case "angular":
|
|
1180
|
+
config.push(...createAngularPreset());
|
|
1181
|
+
break;
|
|
1182
|
+
default:
|
|
1183
|
+
console.warn(`\u26A0\uFE0F Unknown framework "${framework}", defaulting to vanilla JavaScript`);
|
|
1184
|
+
config.push(...createVanillaPreset());
|
|
1185
|
+
break;
|
|
1186
|
+
}
|
|
1187
|
+
}
|
|
1188
|
+
function getEnvironmentConfig(environment) {
|
|
1189
|
+
switch (environment) {
|
|
1190
|
+
case "node":
|
|
1191
|
+
return node_default;
|
|
1192
|
+
case "universal":
|
|
1193
|
+
return universal_default;
|
|
1194
|
+
case "browser":
|
|
1195
|
+
default:
|
|
1196
|
+
return browser_default;
|
|
1197
|
+
}
|
|
1198
|
+
}
|
|
1199
|
+
function addTypeScriptConfig(config) {
|
|
1200
|
+
config.push(...tseslint.configs.recommended);
|
|
1201
|
+
config.push({
|
|
1202
|
+
files: SOURCE_FILES,
|
|
1203
|
+
...typescript_default
|
|
1204
|
+
});
|
|
1205
|
+
config.push({
|
|
1206
|
+
files: ["**/*.d.ts"],
|
|
1207
|
+
rules: {
|
|
1208
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
1209
|
+
}
|
|
1210
|
+
});
|
|
1211
|
+
config.push({
|
|
1212
|
+
files: ["**/*.js"],
|
|
1213
|
+
rules: {
|
|
1214
|
+
"@typescript-eslint/no-var-requires": "off"
|
|
1215
|
+
}
|
|
1216
|
+
});
|
|
1217
|
+
}
|
|
1218
|
+
function addOverrides(config, options) {
|
|
1219
|
+
config.push({
|
|
1220
|
+
files: ["tests/**/*.{js,ts,jsx,tsx,vue,svelte,astro}"],
|
|
1221
|
+
rules: {
|
|
1222
|
+
"no-console": "off",
|
|
1223
|
+
"max-lines-per-function": "off",
|
|
1224
|
+
complexity: "off",
|
|
1225
|
+
"max-statements": "off",
|
|
1226
|
+
"max-nested-callbacks": "off",
|
|
1227
|
+
"no-magic-numbers": "off",
|
|
1228
|
+
"@typescript-eslint/no-explicit-any": "off"
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1231
|
+
config.push({
|
|
1232
|
+
files: ["**/bin/**/*.js", "**/scripts/**/*.js"],
|
|
1233
|
+
languageOptions: {
|
|
1234
|
+
globals: {
|
|
1235
|
+
...node_default.languageOptions?.globals
|
|
1236
|
+
}
|
|
1237
|
+
},
|
|
1238
|
+
rules: {
|
|
1239
|
+
"no-console": "off",
|
|
1240
|
+
"max-lines-per-function": "off"
|
|
1241
|
+
}
|
|
1242
|
+
});
|
|
1243
|
+
if (options.rules && Object.keys(options.rules).length > 0) {
|
|
1244
|
+
config.push({
|
|
1245
|
+
files: SOURCE_FILES,
|
|
1246
|
+
rules: options.rules
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
async function createEslintConfig(options = {}) {
|
|
1251
|
+
const cwd = options.cwd || process.cwd();
|
|
1252
|
+
const detected = autoDetect(cwd);
|
|
1253
|
+
const framework = options.framework === "auto" || !options.framework ? detected.framework : options.framework;
|
|
1254
|
+
const environment = options.environment === "auto" || !options.environment ? detected.environment : options.environment;
|
|
1255
|
+
const typescript = options.typescript === "auto" || options.typescript === void 0 ? detected.typescript : options.typescript;
|
|
1256
|
+
console.log(
|
|
1257
|
+
`\u{1F4E6} ESLint Config: ${framework} | ${environment} | TypeScript: ${typescript ? "Yes" : "No"}`
|
|
1258
|
+
);
|
|
1259
|
+
if (framework === "angular") {
|
|
1260
|
+
console.warn(
|
|
1261
|
+
"\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"
|
|
1262
|
+
);
|
|
1263
|
+
}
|
|
1264
|
+
const defaultIgnorePaths = getEslintIgnores();
|
|
1265
|
+
const allIgnorePaths = [...defaultIgnorePaths, ...options.ignorePaths || []];
|
|
1266
|
+
const config = [];
|
|
1267
|
+
config.push({ ignores: allIgnorePaths });
|
|
1268
|
+
config.push(js.configs.recommended);
|
|
1269
|
+
if (typescript) {
|
|
1270
|
+
addTypeScriptConfig(config);
|
|
1271
|
+
}
|
|
1272
|
+
const envConfig = getEnvironmentConfig(environment);
|
|
1273
|
+
config.push({
|
|
1274
|
+
files: SOURCE_FILES,
|
|
1275
|
+
...envConfig
|
|
1276
|
+
});
|
|
1277
|
+
config.push({
|
|
1278
|
+
files: SOURCE_FILES,
|
|
1279
|
+
...base_default
|
|
1280
|
+
});
|
|
1281
|
+
config.push({
|
|
1282
|
+
files: SOURCE_FILES,
|
|
1283
|
+
...imports_default
|
|
1284
|
+
});
|
|
1285
|
+
await addFrameworkConfig(config, framework);
|
|
1286
|
+
addOverrides(config, options);
|
|
1287
|
+
return config;
|
|
1288
|
+
}
|
|
1289
|
+
var SOURCE_FILES, eslint_default;
|
|
1290
|
+
var init_eslint = __esm({
|
|
1291
|
+
"src/tools/eslint/index.ts"() {
|
|
1292
|
+
init_base();
|
|
1293
|
+
init_browser();
|
|
1294
|
+
init_node();
|
|
1295
|
+
init_universal();
|
|
1296
|
+
init_angular();
|
|
1297
|
+
init_node2();
|
|
1298
|
+
init_react();
|
|
1299
|
+
init_vanilla();
|
|
1300
|
+
init_vue();
|
|
1301
|
+
init_imports();
|
|
1302
|
+
init_typescript();
|
|
1303
|
+
init_detectors();
|
|
1304
|
+
init_ignore_patterns();
|
|
1305
|
+
SOURCE_FILES = [
|
|
1306
|
+
"**/*.js",
|
|
1307
|
+
"**/*.ts",
|
|
1308
|
+
"**/*.tsx",
|
|
1309
|
+
"**/*.vue",
|
|
1310
|
+
"**/*.jsx",
|
|
1311
|
+
"**/*.svelte",
|
|
1312
|
+
"**/*.astro"
|
|
1313
|
+
];
|
|
1314
|
+
eslint_default = createEslintConfig;
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
|
|
1318
|
+
// src/tools/prettier/presets/base.ts
|
|
1319
|
+
var basePreset2, base_default2;
|
|
1320
|
+
var init_base2 = __esm({
|
|
1321
|
+
"src/tools/prettier/presets/base.ts"() {
|
|
1322
|
+
basePreset2 = {
|
|
1323
|
+
// Code style
|
|
1324
|
+
semi: false,
|
|
1325
|
+
singleQuote: true,
|
|
1326
|
+
trailingComma: "none",
|
|
1327
|
+
// Line formatting
|
|
1328
|
+
printWidth: 100,
|
|
1329
|
+
tabWidth: 2,
|
|
1330
|
+
useTabs: false,
|
|
1331
|
+
proseWrap: "preserve",
|
|
1332
|
+
// Syntax preferences
|
|
1333
|
+
arrowParens: "avoid",
|
|
1334
|
+
bracketSpacing: true,
|
|
1335
|
+
bracketSameLine: false,
|
|
1336
|
+
singleAttributePerLine: true,
|
|
1337
|
+
// Line endings
|
|
1338
|
+
endOfLine: "lf"
|
|
1339
|
+
};
|
|
1340
|
+
base_default2 = basePreset2;
|
|
1341
|
+
}
|
|
1342
|
+
});
|
|
1343
|
+
|
|
1344
|
+
// src/tools/prettier/presets/frameworks/astro.ts
|
|
1345
|
+
var astroPreset, astro_default;
|
|
1346
|
+
var init_astro2 = __esm({
|
|
1347
|
+
"src/tools/prettier/presets/frameworks/astro.ts"() {
|
|
1348
|
+
astroPreset = {
|
|
1349
|
+
// Use Astro plugin for .astro files
|
|
1350
|
+
plugins: ["prettier-plugin-astro"]
|
|
1351
|
+
// Astro plugin handles all formatting automatically
|
|
1352
|
+
// No additional options needed
|
|
1353
|
+
};
|
|
1354
|
+
astro_default = astroPreset;
|
|
1355
|
+
}
|
|
1356
|
+
});
|
|
1357
|
+
|
|
1358
|
+
// src/tools/prettier/presets/frameworks/react.ts
|
|
1359
|
+
var reactPreset, react_default;
|
|
1360
|
+
var init_react2 = __esm({
|
|
1361
|
+
"src/tools/prettier/presets/frameworks/react.ts"() {
|
|
1362
|
+
reactPreset = {
|
|
1363
|
+
// JSX-specific options
|
|
1364
|
+
// Use double quotes in JSX attributes (React convention)
|
|
1365
|
+
jsxSingleQuote: false
|
|
1366
|
+
// Note: bracketSameLine is now in base preset
|
|
1367
|
+
};
|
|
1368
|
+
react_default = reactPreset;
|
|
1369
|
+
}
|
|
1370
|
+
});
|
|
1371
|
+
|
|
1372
|
+
// src/tools/prettier/presets/frameworks/svelte.ts
|
|
1373
|
+
var sveltePreset, svelte_default;
|
|
1374
|
+
var init_svelte2 = __esm({
|
|
1375
|
+
"src/tools/prettier/presets/frameworks/svelte.ts"() {
|
|
1376
|
+
sveltePreset = {
|
|
1377
|
+
// Use Svelte plugin for .svelte files
|
|
1378
|
+
plugins: ["prettier-plugin-svelte"],
|
|
1379
|
+
// Component block ordering: options, scripts, markup, styles
|
|
1380
|
+
// This is the standard Svelte convention
|
|
1381
|
+
svelteSortOrder: "options-scripts-markup-styles",
|
|
1382
|
+
// Don't enforce strict mode (allow flexibility)
|
|
1383
|
+
svelteStrictMode: false,
|
|
1384
|
+
// Indent <script> and <style> tags for consistency
|
|
1385
|
+
svelteIndentScriptAndStyle: true
|
|
1386
|
+
};
|
|
1387
|
+
svelte_default = sveltePreset;
|
|
1388
|
+
}
|
|
1389
|
+
});
|
|
1390
|
+
|
|
1391
|
+
// src/tools/prettier/presets/frameworks/vanilla.ts
|
|
1392
|
+
var vanillaPreset, vanilla_default;
|
|
1393
|
+
var init_vanilla2 = __esm({
|
|
1394
|
+
"src/tools/prettier/presets/frameworks/vanilla.ts"() {
|
|
1395
|
+
vanillaPreset = {
|
|
1396
|
+
// No framework-specific options needed
|
|
1397
|
+
// Base preset provides everything required
|
|
1398
|
+
};
|
|
1399
|
+
vanilla_default = vanillaPreset;
|
|
1400
|
+
}
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
// src/tools/prettier/presets/frameworks/vue.ts
|
|
1404
|
+
var vuePreset, vue_default;
|
|
1405
|
+
var init_vue2 = __esm({
|
|
1406
|
+
"src/tools/prettier/presets/frameworks/vue.ts"() {
|
|
1407
|
+
vuePreset = {
|
|
1408
|
+
// Don't indent <script> and <style> tags
|
|
1409
|
+
// This keeps them aligned with <template> for consistency
|
|
1410
|
+
vueIndentScriptAndStyle: false,
|
|
1411
|
+
// Ignore whitespace sensitivity in HTML
|
|
1412
|
+
// Prevents issues with Vue's template whitespace handling
|
|
1413
|
+
htmlWhitespaceSensitivity: "ignore"
|
|
1414
|
+
};
|
|
1415
|
+
vue_default = vuePreset;
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
|
|
1419
|
+
// src/tools/prettier/index.ts
|
|
1420
|
+
var prettier_exports = {};
|
|
1421
|
+
__export(prettier_exports, {
|
|
1422
|
+
createPrettierConfig: () => createPrettierConfig,
|
|
1423
|
+
default: () => prettier_default
|
|
1424
|
+
});
|
|
1425
|
+
async function createPrettierConfig(options = {}) {
|
|
1426
|
+
const { framework: explicitFramework = "auto", cwd = process.cwd(), ...userOverrides } = options;
|
|
1427
|
+
const framework = explicitFramework === "auto" ? autoDetect(cwd).framework : explicitFramework;
|
|
1428
|
+
const config = { ...base_default2 };
|
|
1429
|
+
switch (framework) {
|
|
1430
|
+
case "vue": {
|
|
1431
|
+
Object.assign(config, vue_default);
|
|
1432
|
+
console.warn("\u{1F4DD} Prettier: Detected Vue.js - using Vue plugin");
|
|
1433
|
+
break;
|
|
1434
|
+
}
|
|
1435
|
+
case "react": {
|
|
1436
|
+
Object.assign(config, react_default);
|
|
1437
|
+
console.warn("\u{1F4DD} Prettier: Detected React - using JSX conventions");
|
|
1438
|
+
break;
|
|
1439
|
+
}
|
|
1440
|
+
case "solid": {
|
|
1441
|
+
Object.assign(config, react_default);
|
|
1442
|
+
console.warn("\u{1F4DD} Prettier: Detected Solid.js - using JSX conventions");
|
|
1443
|
+
break;
|
|
1444
|
+
}
|
|
1445
|
+
case "svelte": {
|
|
1446
|
+
Object.assign(config, svelte_default);
|
|
1447
|
+
console.warn("\u{1F4DD} Prettier: Detected Svelte - using Svelte plugin");
|
|
1448
|
+
break;
|
|
1449
|
+
}
|
|
1450
|
+
case "astro": {
|
|
1451
|
+
Object.assign(config, astro_default);
|
|
1452
|
+
console.warn("\u{1F4DD} Prettier: Detected Astro - using Astro plugin");
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
case "angular":
|
|
1456
|
+
case "node":
|
|
1457
|
+
case "vanilla": {
|
|
1458
|
+
Object.assign(config, vanilla_default);
|
|
1459
|
+
console.warn(`\u{1F4DD} Prettier: Detected ${framework} - using base configuration`);
|
|
1460
|
+
break;
|
|
1461
|
+
}
|
|
1462
|
+
default: {
|
|
1463
|
+
console.warn(`\u26A0\uFE0F Unknown framework "${framework}", using base configuration`);
|
|
1464
|
+
Object.assign(config, vanilla_default);
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
const { framework: _f, cwd: _c, customIgnores: _ci, ...prettierOverrides } = userOverrides;
|
|
1468
|
+
Object.assign(config, prettierOverrides);
|
|
1469
|
+
return config;
|
|
1470
|
+
}
|
|
1471
|
+
var prettier_default;
|
|
1472
|
+
var init_prettier = __esm({
|
|
1473
|
+
"src/tools/prettier/index.ts"() {
|
|
1474
|
+
init_base2();
|
|
1475
|
+
init_astro2();
|
|
1476
|
+
init_react2();
|
|
1477
|
+
init_svelte2();
|
|
1478
|
+
init_vanilla2();
|
|
1479
|
+
init_vue2();
|
|
1480
|
+
init_detectors();
|
|
1481
|
+
prettier_default = createPrettierConfig;
|
|
1482
|
+
}
|
|
1483
|
+
});
|
|
1484
|
+
|
|
1485
|
+
// src/tools/stylelint/presets/base.ts
|
|
1486
|
+
var basePreset3, base_default3;
|
|
1487
|
+
var init_base3 = __esm({
|
|
1488
|
+
"src/tools/stylelint/presets/base.ts"() {
|
|
1489
|
+
basePreset3 = {
|
|
1490
|
+
extends: ["stylelint-config-standard"],
|
|
1491
|
+
rules: {
|
|
1492
|
+
// Color rules
|
|
1493
|
+
"color-hex-length": "short",
|
|
1494
|
+
"color-named": "never",
|
|
1495
|
+
// Property rules
|
|
1496
|
+
"declaration-block-no-redundant-longhand-properties": true,
|
|
1497
|
+
"shorthand-property-no-redundant-values": true,
|
|
1498
|
+
// Selector rules
|
|
1499
|
+
"selector-max-id": 0,
|
|
1500
|
+
"selector-no-qualifying-type": true,
|
|
1501
|
+
"selector-class-pattern": [
|
|
1502
|
+
"^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$",
|
|
1503
|
+
{
|
|
1504
|
+
message: "Expected class selector to be kebab-case or BEM format"
|
|
1505
|
+
}
|
|
1506
|
+
],
|
|
1507
|
+
// Nesting
|
|
1508
|
+
"max-nesting-depth": 3,
|
|
1509
|
+
// Specificity
|
|
1510
|
+
"no-descending-specificity": null,
|
|
1511
|
+
// At-rules
|
|
1512
|
+
"at-rule-no-unknown": [
|
|
1513
|
+
true,
|
|
1514
|
+
{
|
|
1515
|
+
ignoreAtRules: ["tailwind", "apply", "variants", "responsive", "screen"]
|
|
1516
|
+
}
|
|
1517
|
+
]
|
|
1518
|
+
}
|
|
1519
|
+
};
|
|
1520
|
+
base_default3 = basePreset3;
|
|
1521
|
+
}
|
|
1522
|
+
});
|
|
1523
|
+
|
|
1524
|
+
// src/tools/stylelint/presets/css-modules.ts
|
|
1525
|
+
var cssModulesPreset, css_modules_default;
|
|
1526
|
+
var init_css_modules = __esm({
|
|
1527
|
+
"src/tools/stylelint/presets/css-modules.ts"() {
|
|
1528
|
+
cssModulesPreset = {
|
|
1529
|
+
rules: {
|
|
1530
|
+
// Allow CSS Modules pseudo-classes
|
|
1531
|
+
"selector-pseudo-class-no-unknown": [
|
|
1532
|
+
true,
|
|
1533
|
+
{
|
|
1534
|
+
ignorePseudoClasses: ["global", "local", "export", "import"]
|
|
1535
|
+
}
|
|
1536
|
+
],
|
|
1537
|
+
// Allow @value (CSS Modules constants)
|
|
1538
|
+
"at-rule-no-unknown": [
|
|
1539
|
+
true,
|
|
1540
|
+
{
|
|
1541
|
+
ignoreAtRules: ["value"]
|
|
1542
|
+
}
|
|
1543
|
+
],
|
|
1544
|
+
// Allow 'composes' property (CSS Modules composition)
|
|
1545
|
+
"property-no-unknown": [
|
|
1546
|
+
true,
|
|
1547
|
+
{
|
|
1548
|
+
ignoreProperties: ["composes", "compose-with"]
|
|
1549
|
+
}
|
|
1550
|
+
],
|
|
1551
|
+
// CSS Modules often use camelCase
|
|
1552
|
+
"selector-class-pattern": null
|
|
1553
|
+
// Disable pattern check for modules
|
|
1554
|
+
}
|
|
1555
|
+
};
|
|
1556
|
+
css_modules_default = cssModulesPreset;
|
|
1557
|
+
}
|
|
1558
|
+
});
|
|
1559
|
+
|
|
1560
|
+
// src/tools/stylelint/presets/frameworks/react.ts
|
|
1561
|
+
var reactPreset2, react_default2;
|
|
1562
|
+
var init_react3 = __esm({
|
|
1563
|
+
"src/tools/stylelint/presets/frameworks/react.ts"() {
|
|
1564
|
+
reactPreset2 = {
|
|
1565
|
+
// No special rules needed for React/Solid CSS files
|
|
1566
|
+
// They use standard CSS, so base preset is sufficient
|
|
1567
|
+
rules: {}
|
|
1568
|
+
};
|
|
1569
|
+
react_default2 = reactPreset2;
|
|
1570
|
+
}
|
|
1571
|
+
});
|
|
1572
|
+
|
|
1573
|
+
// src/tools/stylelint/presets/frameworks/svelte.ts
|
|
1574
|
+
var sveltePreset2, svelte_default2;
|
|
1575
|
+
var init_svelte3 = __esm({
|
|
1576
|
+
"src/tools/stylelint/presets/frameworks/svelte.ts"() {
|
|
1577
|
+
sveltePreset2 = {
|
|
1578
|
+
extends: ["stylelint-config-standard"],
|
|
1579
|
+
overrides: [
|
|
1580
|
+
{
|
|
1581
|
+
files: ["**/*.svelte"],
|
|
1582
|
+
customSyntax: "postcss-html"
|
|
1583
|
+
}
|
|
1584
|
+
],
|
|
1585
|
+
rules: {
|
|
1586
|
+
// Allow Svelte :global() pseudo-class
|
|
1587
|
+
"selector-pseudo-class-no-unknown": [
|
|
1588
|
+
true,
|
|
1589
|
+
{
|
|
1590
|
+
ignorePseudoClasses: ["global"]
|
|
1591
|
+
}
|
|
1592
|
+
]
|
|
1593
|
+
}
|
|
1594
|
+
};
|
|
1595
|
+
svelte_default2 = sveltePreset2;
|
|
1596
|
+
}
|
|
1597
|
+
});
|
|
1598
|
+
|
|
1599
|
+
// src/tools/stylelint/presets/frameworks/vue.ts
|
|
1600
|
+
var vuePreset2, vue_default2;
|
|
1601
|
+
var init_vue3 = __esm({
|
|
1602
|
+
"src/tools/stylelint/presets/frameworks/vue.ts"() {
|
|
1603
|
+
vuePreset2 = {
|
|
1604
|
+
extends: ["stylelint-config-standard-vue"],
|
|
1605
|
+
overrides: [
|
|
1606
|
+
{
|
|
1607
|
+
files: ["**/*.vue"],
|
|
1608
|
+
customSyntax: "postcss-html"
|
|
1609
|
+
}
|
|
1610
|
+
],
|
|
1611
|
+
rules: {
|
|
1612
|
+
// Allow Vue-specific pseudo-classes
|
|
1613
|
+
"selector-pseudo-class-no-unknown": [
|
|
1614
|
+
true,
|
|
1615
|
+
{
|
|
1616
|
+
ignorePseudoClasses: ["deep", "global", "slotted"]
|
|
1617
|
+
}
|
|
1618
|
+
],
|
|
1619
|
+
// Allow Vue-specific pseudo-elements
|
|
1620
|
+
"selector-pseudo-element-no-unknown": [
|
|
1621
|
+
true,
|
|
1622
|
+
{
|
|
1623
|
+
ignorePseudoElements: ["v-deep", "v-global", "v-slotted"]
|
|
1624
|
+
}
|
|
1625
|
+
]
|
|
1626
|
+
}
|
|
1627
|
+
};
|
|
1628
|
+
vue_default2 = vuePreset2;
|
|
1629
|
+
}
|
|
1630
|
+
});
|
|
1631
|
+
|
|
1632
|
+
// src/tools/stylelint/presets/scss.ts
|
|
1633
|
+
var scssPreset, scss_default;
|
|
1634
|
+
var init_scss = __esm({
|
|
1635
|
+
"src/tools/stylelint/presets/scss.ts"() {
|
|
1636
|
+
scssPreset = {
|
|
1637
|
+
extends: ["stylelint-config-standard-scss"],
|
|
1638
|
+
rules: {
|
|
1639
|
+
// Color rules
|
|
1640
|
+
"color-hex-length": "short",
|
|
1641
|
+
// Variables
|
|
1642
|
+
"scss/dollar-variable-colon-space-after": "always",
|
|
1643
|
+
"scss/dollar-variable-colon-space-before": "never",
|
|
1644
|
+
"scss/dollar-variable-pattern": [
|
|
1645
|
+
"^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$",
|
|
1646
|
+
{
|
|
1647
|
+
message: "Expected variable to be kebab-case"
|
|
1648
|
+
}
|
|
1649
|
+
],
|
|
1650
|
+
// Operators
|
|
1651
|
+
"scss/operator-no-newline-after": true,
|
|
1652
|
+
"scss/operator-no-unspaced": true,
|
|
1653
|
+
// Nesting
|
|
1654
|
+
"max-nesting-depth": 4,
|
|
1655
|
+
// Allow one more level for SCSS
|
|
1656
|
+
// At-rules (allow Tailwind if present)
|
|
1657
|
+
"scss/at-rule-no-unknown": [
|
|
1658
|
+
true,
|
|
1659
|
+
{
|
|
1660
|
+
ignoreAtRules: ["tailwind", "apply", "variants", "responsive", "screen", "layer"]
|
|
1661
|
+
}
|
|
1662
|
+
],
|
|
1663
|
+
// Mixins
|
|
1664
|
+
"scss/at-mixin-pattern": [
|
|
1665
|
+
"^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$",
|
|
1666
|
+
{
|
|
1667
|
+
message: "Expected mixin name to be kebab-case"
|
|
1668
|
+
}
|
|
1669
|
+
],
|
|
1670
|
+
// Functions
|
|
1671
|
+
"scss/at-function-pattern": [
|
|
1672
|
+
"^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$",
|
|
1673
|
+
{
|
|
1674
|
+
message: "Expected function name to be kebab-case"
|
|
1675
|
+
}
|
|
1676
|
+
],
|
|
1677
|
+
// Placeholder selectors
|
|
1678
|
+
"scss/percent-placeholder-pattern": [
|
|
1679
|
+
"^[a-z][a-zA-Z0-9]*(-[a-z][a-zA-Z0-9]*)*$",
|
|
1680
|
+
{
|
|
1681
|
+
message: "Expected placeholder to be kebab-case"
|
|
1682
|
+
}
|
|
1683
|
+
],
|
|
1684
|
+
// Selector rules (inherit from base)
|
|
1685
|
+
"selector-max-id": 0,
|
|
1686
|
+
"selector-no-qualifying-type": true,
|
|
1687
|
+
"selector-class-pattern": [
|
|
1688
|
+
"^[a-z]([a-z0-9-]+)?(__([a-z0-9]+-?)+)?(--([a-z0-9]+-?)+){0,2}$",
|
|
1689
|
+
{
|
|
1690
|
+
message: "Expected class selector to be kebab-case or BEM format"
|
|
1691
|
+
}
|
|
1692
|
+
],
|
|
1693
|
+
// Disable some rules that conflict with SCSS
|
|
1694
|
+
"no-descending-specificity": null
|
|
1695
|
+
}
|
|
1696
|
+
};
|
|
1697
|
+
scss_default = scssPreset;
|
|
1698
|
+
}
|
|
1699
|
+
});
|
|
1700
|
+
|
|
1701
|
+
// src/tools/stylelint/presets/tailwind.ts
|
|
1702
|
+
var tailwindPreset, tailwind_default;
|
|
1703
|
+
var init_tailwind = __esm({
|
|
1704
|
+
"src/tools/stylelint/presets/tailwind.ts"() {
|
|
1705
|
+
tailwindPreset = {
|
|
1706
|
+
// Note: We don't extend stylelint-config-tailwindcss because it's too opinionated
|
|
1707
|
+
// Instead, we selectively disable conflicting rules
|
|
1708
|
+
rules: {
|
|
1709
|
+
// Allow Tailwind at-rules
|
|
1710
|
+
"at-rule-no-unknown": [
|
|
1711
|
+
true,
|
|
1712
|
+
{
|
|
1713
|
+
ignoreAtRules: ["tailwind", "apply", "layer", "variants", "responsive", "screen", "config"]
|
|
1714
|
+
}
|
|
1715
|
+
],
|
|
1716
|
+
// Allow Tailwind functions
|
|
1717
|
+
"function-no-unknown": [
|
|
1718
|
+
true,
|
|
1719
|
+
{
|
|
1720
|
+
ignoreFunctions: ["theme", "screen"]
|
|
1721
|
+
}
|
|
1722
|
+
],
|
|
1723
|
+
// Disable rules that conflict with Tailwind's utility classes
|
|
1724
|
+
"selector-class-pattern": null,
|
|
1725
|
+
// Tailwind uses various patterns
|
|
1726
|
+
"selector-max-id": null,
|
|
1727
|
+
// Allow IDs (though not recommended)
|
|
1728
|
+
"no-descending-specificity": null,
|
|
1729
|
+
// Utility classes have complex specificity
|
|
1730
|
+
"declaration-block-no-redundant-longhand-properties": null,
|
|
1731
|
+
// Utilities may look redundant
|
|
1732
|
+
// Allow unknown properties (Tailwind CSS variables)
|
|
1733
|
+
"property-no-unknown": [
|
|
1734
|
+
true,
|
|
1735
|
+
{
|
|
1736
|
+
ignoreProperties: ["/^--/"]
|
|
1737
|
+
// Allow CSS custom properties
|
|
1738
|
+
}
|
|
1739
|
+
]
|
|
1740
|
+
}
|
|
1741
|
+
};
|
|
1742
|
+
tailwind_default = tailwindPreset;
|
|
1743
|
+
}
|
|
1744
|
+
});
|
|
1745
|
+
|
|
1746
|
+
// src/tools/stylelint/index.ts
|
|
1747
|
+
var stylelint_exports = {};
|
|
1748
|
+
__export(stylelint_exports, {
|
|
1749
|
+
createStylelintConfig: () => createStylelintConfig,
|
|
1750
|
+
default: () => stylelint_default
|
|
1751
|
+
});
|
|
1752
|
+
function normalizeExtends(value) {
|
|
1753
|
+
if (!value) return [];
|
|
1754
|
+
return Array.isArray(value) ? value : [value];
|
|
1755
|
+
}
|
|
1756
|
+
function mergeArrays(target, source) {
|
|
1757
|
+
let targetArray;
|
|
1758
|
+
if (Array.isArray(target)) {
|
|
1759
|
+
targetArray = target;
|
|
1760
|
+
} else if (target) {
|
|
1761
|
+
targetArray = [target];
|
|
1762
|
+
} else {
|
|
1763
|
+
targetArray = [];
|
|
1764
|
+
}
|
|
1765
|
+
let sourceArray;
|
|
1766
|
+
if (Array.isArray(source)) {
|
|
1767
|
+
sourceArray = source;
|
|
1768
|
+
} else if (source) {
|
|
1769
|
+
sourceArray = [source];
|
|
1770
|
+
} else {
|
|
1771
|
+
sourceArray = [];
|
|
1772
|
+
}
|
|
1773
|
+
return [...targetArray, ...sourceArray];
|
|
1774
|
+
}
|
|
1775
|
+
function mergePreset(config, preset) {
|
|
1776
|
+
if (preset.extends) {
|
|
1777
|
+
const presetExtends = normalizeExtends(preset.extends);
|
|
1778
|
+
const configExtends = normalizeExtends(config.extends);
|
|
1779
|
+
config.extends = [...configExtends, ...presetExtends];
|
|
1780
|
+
}
|
|
1781
|
+
if (preset.overrides) {
|
|
1782
|
+
config.overrides = [...config.overrides || [], ...preset.overrides];
|
|
1783
|
+
}
|
|
1784
|
+
if (preset.rules) {
|
|
1785
|
+
config.rules = { ...config.rules, ...preset.rules };
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
function applyUserOverrides(config, userOverrides) {
|
|
1789
|
+
if (userOverrides.extends) {
|
|
1790
|
+
config.extends = mergeArrays(config.extends, userOverrides.extends);
|
|
1791
|
+
delete userOverrides.extends;
|
|
1792
|
+
}
|
|
1793
|
+
if (userOverrides.plugins) {
|
|
1794
|
+
config.plugins = mergeArrays(config.plugins, userOverrides.plugins);
|
|
1795
|
+
delete userOverrides.plugins;
|
|
1796
|
+
}
|
|
1797
|
+
if (userOverrides.overrides) {
|
|
1798
|
+
config.overrides = mergeArrays(
|
|
1799
|
+
config.overrides,
|
|
1800
|
+
userOverrides.overrides
|
|
1801
|
+
);
|
|
1802
|
+
delete userOverrides.overrides;
|
|
1803
|
+
}
|
|
1804
|
+
if (userOverrides.rules) {
|
|
1805
|
+
config.rules = { ...config.rules, ...userOverrides.rules };
|
|
1806
|
+
delete userOverrides.rules;
|
|
1807
|
+
}
|
|
1808
|
+
Object.assign(config, userOverrides);
|
|
1809
|
+
}
|
|
1810
|
+
async function createStylelintConfig(options = {}) {
|
|
1811
|
+
const {
|
|
1812
|
+
framework: explicitFramework = "auto",
|
|
1813
|
+
cssType: explicitCssType = "auto",
|
|
1814
|
+
cwd = process.cwd(),
|
|
1815
|
+
...userOverrides
|
|
1816
|
+
} = options;
|
|
1817
|
+
const framework = explicitFramework === "auto" ? autoDetect(cwd).framework : explicitFramework;
|
|
1818
|
+
const cssType = explicitCssType === "auto" ? detectCssType(cwd) : explicitCssType;
|
|
1819
|
+
let cssTypeResult;
|
|
1820
|
+
if (typeof cssType === "string") {
|
|
1821
|
+
cssTypeResult = cssType === "scss" ? { preprocessor: "scss", tailwind: false, modules: false, postcss: false } : null;
|
|
1822
|
+
} else {
|
|
1823
|
+
cssTypeResult = cssType;
|
|
1824
|
+
}
|
|
1825
|
+
const config = cssTypeResult?.preprocessor === "scss" ? { ...scss_default, customSyntax: "postcss-scss" } : { ...base_default3 };
|
|
1826
|
+
config.ignoreFiles = getStylelintIgnores();
|
|
1827
|
+
if (cssTypeResult?.tailwind) {
|
|
1828
|
+
mergePreset(config, tailwind_default);
|
|
1829
|
+
}
|
|
1830
|
+
if ((framework === "react" || framework === "solid") && !cssTypeResult?.tailwind) {
|
|
1831
|
+
mergePreset(config, css_modules_default);
|
|
1832
|
+
}
|
|
1833
|
+
let cssTypeDesc = cssTypeResult?.preprocessor === "scss" ? "SCSS" : "CSS";
|
|
1834
|
+
if (cssTypeResult?.tailwind) cssTypeDesc += " + Tailwind";
|
|
1835
|
+
if ((framework === "react" || framework === "solid") && !cssTypeResult?.tailwind) {
|
|
1836
|
+
cssTypeDesc += " Modules";
|
|
1837
|
+
}
|
|
1838
|
+
switch (framework) {
|
|
1839
|
+
case "vue": {
|
|
1840
|
+
mergePreset(config, vue_default2);
|
|
1841
|
+
console.warn(`\u{1F3A8} Stylelint: Detected Vue.js - linting .vue component styles (${cssTypeDesc})`);
|
|
1842
|
+
break;
|
|
1843
|
+
}
|
|
1844
|
+
case "svelte": {
|
|
1845
|
+
mergePreset(config, svelte_default2);
|
|
1846
|
+
console.warn(
|
|
1847
|
+
`\u{1F3A8} Stylelint: Detected Svelte - linting .svelte component styles (${cssTypeDesc})`
|
|
1848
|
+
);
|
|
1849
|
+
break;
|
|
1850
|
+
}
|
|
1851
|
+
case "react":
|
|
1852
|
+
case "solid": {
|
|
1853
|
+
mergePreset(config, react_default2);
|
|
1854
|
+
console.warn(
|
|
1855
|
+
`\u{1F3A8} Stylelint: Detected ${framework} - linting ${cssTypeDesc} (CSS-in-JS uses ESLint)`
|
|
1856
|
+
);
|
|
1857
|
+
break;
|
|
1858
|
+
}
|
|
1859
|
+
case "angular":
|
|
1860
|
+
case "node":
|
|
1861
|
+
case "vanilla":
|
|
1862
|
+
case "astro": {
|
|
1863
|
+
console.warn(`\u{1F3A8} Stylelint: Detected ${framework} - linting ${cssTypeDesc} files`);
|
|
1864
|
+
break;
|
|
1865
|
+
}
|
|
1866
|
+
default: {
|
|
1867
|
+
console.warn(`\u26A0\uFE0F Unknown framework "${framework}", using base ${cssTypeDesc} linting`);
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
const {
|
|
1871
|
+
framework: _f,
|
|
1872
|
+
cssType: _ct,
|
|
1873
|
+
cwd: _c,
|
|
1874
|
+
customIgnores: _ci,
|
|
1875
|
+
...restOverrides
|
|
1876
|
+
} = userOverrides;
|
|
1877
|
+
applyUserOverrides(config, restOverrides);
|
|
1878
|
+
return config;
|
|
1879
|
+
}
|
|
1880
|
+
var stylelint_default;
|
|
1881
|
+
var init_stylelint = __esm({
|
|
1882
|
+
"src/tools/stylelint/index.ts"() {
|
|
1883
|
+
init_base3();
|
|
1884
|
+
init_css_modules();
|
|
1885
|
+
init_react3();
|
|
1886
|
+
init_svelte3();
|
|
1887
|
+
init_vue3();
|
|
1888
|
+
init_scss();
|
|
1889
|
+
init_tailwind();
|
|
1890
|
+
init_detectors();
|
|
1891
|
+
init_ignore_patterns();
|
|
1892
|
+
stylelint_default = createStylelintConfig;
|
|
1893
|
+
}
|
|
1894
|
+
});
|
|
1895
|
+
|
|
1896
|
+
// src/tools/semantic-release/presets/default.ts
|
|
1897
|
+
function createDefaultPreset(gitProvider = null) {
|
|
1898
|
+
const plugins = [
|
|
1899
|
+
"@semantic-release/commit-analyzer",
|
|
1900
|
+
"@semantic-release/release-notes-generator",
|
|
1901
|
+
"@semantic-release/changelog",
|
|
1902
|
+
"@semantic-release/npm"
|
|
1903
|
+
];
|
|
1904
|
+
if (gitProvider === "gitlab") {
|
|
1905
|
+
plugins.push("@semantic-release/gitlab");
|
|
1906
|
+
} else if (gitProvider === "github") {
|
|
1907
|
+
plugins.push("@semantic-release/github");
|
|
1908
|
+
}
|
|
1909
|
+
plugins.push("@semantic-release/git");
|
|
1910
|
+
return {
|
|
1911
|
+
branches: ["main"],
|
|
1912
|
+
plugins
|
|
1913
|
+
};
|
|
1914
|
+
}
|
|
1915
|
+
var init_default = __esm({
|
|
1916
|
+
"src/tools/semantic-release/presets/default.ts"() {
|
|
1917
|
+
}
|
|
1918
|
+
});
|
|
1919
|
+
|
|
1920
|
+
// src/tools/semantic-release/presets/library.ts
|
|
1921
|
+
function createLibraryPreset(gitProvider = null) {
|
|
1922
|
+
const plugins = [
|
|
1923
|
+
"@semantic-release/commit-analyzer",
|
|
1924
|
+
"@semantic-release/release-notes-generator",
|
|
1925
|
+
"@semantic-release/changelog",
|
|
1926
|
+
[
|
|
1927
|
+
"@semantic-release/npm",
|
|
1928
|
+
{
|
|
1929
|
+
pkgRoot: "."
|
|
1930
|
+
}
|
|
1931
|
+
]
|
|
1932
|
+
];
|
|
1933
|
+
if (gitProvider === "gitlab") {
|
|
1934
|
+
plugins.push([
|
|
1935
|
+
"@semantic-release/gitlab",
|
|
1936
|
+
{
|
|
1937
|
+
successComment: false,
|
|
1938
|
+
releasedLabels: false
|
|
1939
|
+
}
|
|
1940
|
+
]);
|
|
1941
|
+
} else if (gitProvider === "github") {
|
|
1942
|
+
plugins.push([
|
|
1943
|
+
"@semantic-release/github",
|
|
1944
|
+
{
|
|
1945
|
+
successComment: false,
|
|
1946
|
+
releasedLabels: false
|
|
1947
|
+
}
|
|
1948
|
+
]);
|
|
1949
|
+
}
|
|
1950
|
+
plugins.push("@semantic-release/git");
|
|
1951
|
+
return {
|
|
1952
|
+
branches: ["main"],
|
|
1953
|
+
plugins
|
|
1954
|
+
};
|
|
1955
|
+
}
|
|
1956
|
+
var init_library = __esm({
|
|
1957
|
+
"src/tools/semantic-release/presets/library.ts"() {
|
|
1958
|
+
}
|
|
1959
|
+
});
|
|
1960
|
+
|
|
1961
|
+
// src/tools/semantic-release/presets/monorepo.ts
|
|
1962
|
+
function createMonorepoPreset(gitProvider = null) {
|
|
1963
|
+
const plugins = [
|
|
1964
|
+
"@semantic-release/commit-analyzer",
|
|
1965
|
+
"@semantic-release/release-notes-generator",
|
|
1966
|
+
"@semantic-release/changelog",
|
|
1967
|
+
[
|
|
1968
|
+
"@semantic-release/npm",
|
|
1969
|
+
{
|
|
1970
|
+
pkgRoot: "packages/*"
|
|
1971
|
+
}
|
|
1972
|
+
]
|
|
1973
|
+
];
|
|
1974
|
+
if (gitProvider === "gitlab") {
|
|
1975
|
+
plugins.push("@semantic-release/gitlab");
|
|
1976
|
+
} else if (gitProvider === "github") {
|
|
1977
|
+
plugins.push("@semantic-release/github");
|
|
1978
|
+
}
|
|
1979
|
+
plugins.push("@semantic-release/git");
|
|
1980
|
+
return {
|
|
1981
|
+
branches: ["main"],
|
|
1982
|
+
plugins
|
|
1983
|
+
};
|
|
1984
|
+
}
|
|
1985
|
+
var init_monorepo = __esm({
|
|
1986
|
+
"src/tools/semantic-release/presets/monorepo.ts"() {
|
|
1987
|
+
}
|
|
1988
|
+
});
|
|
1989
|
+
|
|
1990
|
+
// src/tools/semantic-release/index.ts
|
|
1991
|
+
var semantic_release_exports = {};
|
|
1992
|
+
__export(semantic_release_exports, {
|
|
1993
|
+
createReleaseConfig: () => createReleaseConfig,
|
|
1994
|
+
default: () => semantic_release_default
|
|
1995
|
+
});
|
|
1996
|
+
async function createReleaseConfig(options = {}) {
|
|
1997
|
+
const {
|
|
1998
|
+
preset = "default",
|
|
1999
|
+
gitProvider: explicitGitProvider = "auto",
|
|
2000
|
+
cwd = process.cwd(),
|
|
2001
|
+
...userOverrides
|
|
2002
|
+
} = options;
|
|
2003
|
+
const gitProvider = explicitGitProvider === "auto" ? detectGitProvider(cwd) : explicitGitProvider;
|
|
2004
|
+
if (gitProvider) {
|
|
2005
|
+
console.warn(`\u{1F4E6} semantic-release: Detected ${gitProvider} - using ${gitProvider} plugin`);
|
|
2006
|
+
} else {
|
|
2007
|
+
console.warn("\u{1F4E6} semantic-release: No Git provider detected - skipping provider plugin");
|
|
2008
|
+
}
|
|
2009
|
+
let config;
|
|
2010
|
+
switch (preset) {
|
|
2011
|
+
case "library": {
|
|
2012
|
+
config = createLibraryPreset(gitProvider);
|
|
2013
|
+
console.warn("\u{1F4E6} semantic-release: Using library preset");
|
|
2014
|
+
break;
|
|
2015
|
+
}
|
|
2016
|
+
case "monorepo": {
|
|
2017
|
+
config = createMonorepoPreset(gitProvider);
|
|
2018
|
+
console.warn("\u{1F4E6} semantic-release: Using monorepo preset");
|
|
2019
|
+
break;
|
|
2020
|
+
}
|
|
2021
|
+
case "default": {
|
|
2022
|
+
config = createDefaultPreset(gitProvider);
|
|
2023
|
+
console.warn("\u{1F4E6} semantic-release: Using default preset");
|
|
2024
|
+
break;
|
|
2025
|
+
}
|
|
2026
|
+
default: {
|
|
2027
|
+
console.warn(`\u26A0\uFE0F Unknown preset "${preset}", using default preset`);
|
|
2028
|
+
config = createDefaultPreset(gitProvider);
|
|
2029
|
+
}
|
|
2030
|
+
}
|
|
2031
|
+
const overrides = userOverrides;
|
|
2032
|
+
if (overrides.branches) {
|
|
2033
|
+
config.branches = overrides.branches;
|
|
2034
|
+
delete overrides.branches;
|
|
2035
|
+
}
|
|
2036
|
+
if (overrides.plugins) {
|
|
2037
|
+
config.plugins = overrides.plugins;
|
|
2038
|
+
delete overrides.plugins;
|
|
2039
|
+
}
|
|
2040
|
+
Object.assign(config, overrides);
|
|
2041
|
+
config._meta = {
|
|
2042
|
+
preset,
|
|
2043
|
+
gitProvider
|
|
2044
|
+
};
|
|
2045
|
+
return config;
|
|
2046
|
+
}
|
|
2047
|
+
var semantic_release_default;
|
|
2048
|
+
var init_semantic_release = __esm({
|
|
2049
|
+
"src/tools/semantic-release/index.ts"() {
|
|
2050
|
+
init_default();
|
|
2051
|
+
init_library();
|
|
2052
|
+
init_monorepo();
|
|
2053
|
+
init_detectors();
|
|
2054
|
+
semantic_release_default = createReleaseConfig;
|
|
2055
|
+
}
|
|
2056
|
+
});
|
|
2057
|
+
function detectTypeChecker(framework, preference = "auto", cwd = process.cwd()) {
|
|
2058
|
+
if (preference === "legacy") {
|
|
2059
|
+
return framework === "vue" ? "vue-tsc" : "tsc";
|
|
2060
|
+
}
|
|
2061
|
+
if (preference === "modern") {
|
|
2062
|
+
return "tsgo";
|
|
2063
|
+
}
|
|
2064
|
+
if (preference === "auto") {
|
|
2065
|
+
if (framework === "vue") {
|
|
2066
|
+
const hasVueTsc = hasPackageInstalled("vue-tsc", cwd);
|
|
2067
|
+
if (hasVueTsc) return "vue-tsc";
|
|
2068
|
+
console.warn(
|
|
2069
|
+
"\u26A0\uFE0F Vue project detected but vue-tsc not found.\n Install with: npm install -D vue-tsc\n Falling back to tsgo/tsc (won't check .vue files)"
|
|
2070
|
+
);
|
|
2071
|
+
}
|
|
2072
|
+
const hasTsgo = hasPackageInstalled("@typescript/native-preview", cwd);
|
|
2073
|
+
if (hasTsgo) {
|
|
2074
|
+
return "tsgo";
|
|
2075
|
+
}
|
|
2076
|
+
return "tsc";
|
|
2077
|
+
}
|
|
2078
|
+
throw new ConfigError(`Unknown checker preference: "${preference}"`, {
|
|
2079
|
+
received: preference,
|
|
2080
|
+
validOptions: ["auto", "modern", "legacy"]
|
|
2081
|
+
});
|
|
2082
|
+
}
|
|
2083
|
+
function hasPackageInstalled(packageName, cwd) {
|
|
2084
|
+
try {
|
|
2085
|
+
const packagePath = join(cwd, "node_modules", packageName, "package.json");
|
|
2086
|
+
return existsSync(packagePath);
|
|
2087
|
+
} catch (error) {
|
|
2088
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
2089
|
+
console.warn(`Warning: Error checking for ${packageName}: ${message}`);
|
|
2090
|
+
return false;
|
|
2091
|
+
}
|
|
2092
|
+
}
|
|
2093
|
+
var init_checker_detection = __esm({
|
|
2094
|
+
"src/tools/typescript/checker-detection.ts"() {
|
|
2095
|
+
init_types();
|
|
2096
|
+
}
|
|
2097
|
+
});
|
|
2098
|
+
|
|
2099
|
+
// src/tools/typescript/presets/base.ts
|
|
2100
|
+
var basePreset4, base_default4;
|
|
2101
|
+
var init_base4 = __esm({
|
|
2102
|
+
"src/tools/typescript/presets/base.ts"() {
|
|
2103
|
+
basePreset4 = {
|
|
2104
|
+
compilerOptions: {
|
|
2105
|
+
// Language and Environment
|
|
2106
|
+
target: "ES2022",
|
|
2107
|
+
lib: ["ES2022"],
|
|
2108
|
+
// Modules
|
|
2109
|
+
module: "ESNext",
|
|
2110
|
+
moduleResolution: "Bundler",
|
|
2111
|
+
resolveJsonModule: true,
|
|
2112
|
+
// Emit
|
|
2113
|
+
declaration: true,
|
|
2114
|
+
declarationMap: true,
|
|
2115
|
+
sourceMap: true,
|
|
2116
|
+
removeComments: false,
|
|
2117
|
+
// Interop Constraints
|
|
2118
|
+
esModuleInterop: true,
|
|
2119
|
+
allowSyntheticDefaultImports: true,
|
|
2120
|
+
forceConsistentCasingInFileNames: true,
|
|
2121
|
+
isolatedModules: true,
|
|
2122
|
+
// Type Checking (Strict Mode)
|
|
2123
|
+
strict: true,
|
|
2124
|
+
noImplicitAny: true,
|
|
2125
|
+
strictNullChecks: true,
|
|
2126
|
+
strictFunctionTypes: true,
|
|
2127
|
+
strictBindCallApply: true,
|
|
2128
|
+
strictPropertyInitialization: true,
|
|
2129
|
+
noImplicitThis: true,
|
|
2130
|
+
alwaysStrict: true,
|
|
2131
|
+
// Additional Checks
|
|
2132
|
+
noUnusedLocals: true,
|
|
2133
|
+
noUnusedParameters: true,
|
|
2134
|
+
noImplicitReturns: true,
|
|
2135
|
+
noFallthroughCasesInSwitch: true,
|
|
2136
|
+
noUncheckedIndexedAccess: true,
|
|
2137
|
+
noImplicitOverride: true,
|
|
2138
|
+
noPropertyAccessFromIndexSignature: false,
|
|
2139
|
+
// Completeness
|
|
2140
|
+
skipLibCheck: true,
|
|
2141
|
+
// Faster, skip checking .d.ts files
|
|
2142
|
+
// Advanced
|
|
2143
|
+
allowUnusedLabels: false,
|
|
2144
|
+
allowUnreachableCode: false
|
|
2145
|
+
},
|
|
2146
|
+
include: ["src/**/*"],
|
|
2147
|
+
exclude: ["node_modules", "dist", "build", "out", "coverage", ".nyc_output"]
|
|
2148
|
+
};
|
|
2149
|
+
base_default4 = basePreset4;
|
|
2150
|
+
}
|
|
2151
|
+
});
|
|
2152
|
+
|
|
2153
|
+
// src/tools/typescript/presets/environments/browser.ts
|
|
2154
|
+
var browserPreset, browser_default2;
|
|
2155
|
+
var init_browser2 = __esm({
|
|
2156
|
+
"src/tools/typescript/presets/environments/browser.ts"() {
|
|
2157
|
+
browserPreset = {
|
|
2158
|
+
compilerOptions: {
|
|
2159
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
2160
|
+
target: "ES2020"
|
|
2161
|
+
// Good browser support
|
|
2162
|
+
}
|
|
2163
|
+
};
|
|
2164
|
+
browser_default2 = browserPreset;
|
|
2165
|
+
}
|
|
2166
|
+
});
|
|
2167
|
+
|
|
2168
|
+
// src/tools/typescript/presets/environments/node.ts
|
|
2169
|
+
var nodePreset, node_default2;
|
|
2170
|
+
var init_node3 = __esm({
|
|
2171
|
+
"src/tools/typescript/presets/environments/node.ts"() {
|
|
2172
|
+
nodePreset = {
|
|
2173
|
+
compilerOptions: {
|
|
2174
|
+
lib: ["ES2024"],
|
|
2175
|
+
target: "ES2024",
|
|
2176
|
+
module: "NodeNext",
|
|
2177
|
+
moduleResolution: "NodeNext",
|
|
2178
|
+
types: ["node"]
|
|
2179
|
+
}
|
|
2180
|
+
};
|
|
2181
|
+
node_default2 = nodePreset;
|
|
2182
|
+
}
|
|
2183
|
+
});
|
|
2184
|
+
|
|
2185
|
+
// src/tools/typescript/presets/environments/universal.ts
|
|
2186
|
+
var universalPreset, universal_default2;
|
|
2187
|
+
var init_universal2 = __esm({
|
|
2188
|
+
"src/tools/typescript/presets/environments/universal.ts"() {
|
|
2189
|
+
universalPreset = {
|
|
2190
|
+
compilerOptions: {
|
|
2191
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
2192
|
+
target: "ES2022",
|
|
2193
|
+
types: ["node"]
|
|
2194
|
+
}
|
|
2195
|
+
};
|
|
2196
|
+
universal_default2 = universalPreset;
|
|
2197
|
+
}
|
|
2198
|
+
});
|
|
2199
|
+
|
|
2200
|
+
// src/tools/typescript/presets/frameworks/angular.ts
|
|
2201
|
+
var angularPreset, angular_default;
|
|
2202
|
+
var init_angular2 = __esm({
|
|
2203
|
+
"src/tools/typescript/presets/frameworks/angular.ts"() {
|
|
2204
|
+
angularPreset = {
|
|
2205
|
+
compilerOptions: {
|
|
2206
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
2207
|
+
experimentalDecorators: true,
|
|
2208
|
+
emitDecoratorMetadata: true
|
|
2209
|
+
}
|
|
2210
|
+
};
|
|
2211
|
+
angular_default = angularPreset;
|
|
2212
|
+
}
|
|
2213
|
+
});
|
|
2214
|
+
|
|
2215
|
+
// src/tools/typescript/presets/frameworks/astro.ts
|
|
2216
|
+
var astroPreset2, astro_default2;
|
|
2217
|
+
var init_astro3 = __esm({
|
|
2218
|
+
"src/tools/typescript/presets/frameworks/astro.ts"() {
|
|
2219
|
+
astroPreset2 = {
|
|
2220
|
+
compilerOptions: {
|
|
2221
|
+
jsx: "react-jsx",
|
|
2222
|
+
// Astro uses React-style JSX
|
|
2223
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
2224
|
+
types: ["astro/client"]
|
|
2225
|
+
}
|
|
2226
|
+
};
|
|
2227
|
+
astro_default2 = astroPreset2;
|
|
2228
|
+
}
|
|
2229
|
+
});
|
|
2230
|
+
|
|
2231
|
+
// src/tools/typescript/presets/frameworks/electron.ts
|
|
2232
|
+
function createElectronPreset(renderer = "vue") {
|
|
2233
|
+
const rendererExtensions = renderer === "vue" ? ["src/renderer/**/*.vue"] : [];
|
|
2234
|
+
const root = {
|
|
2235
|
+
files: [],
|
|
2236
|
+
references: [{ path: "./tsconfig.node.json" }, { path: "./tsconfig.web.json" }]
|
|
2237
|
+
};
|
|
2238
|
+
const node = {
|
|
2239
|
+
$schema: "https://json.schemastore.org/tsconfig",
|
|
2240
|
+
include: ["electron.vite.config.*", "package.json", "src/main/*", "src/preload/*"],
|
|
2241
|
+
compilerOptions: {
|
|
2242
|
+
composite: true,
|
|
2243
|
+
target: "ES2024",
|
|
2244
|
+
lib: ["ES2024", "ESNext"],
|
|
2245
|
+
module: "NodeNext",
|
|
2246
|
+
moduleResolution: "NodeNext",
|
|
2247
|
+
types: ["electron-vite/node"],
|
|
2248
|
+
baseUrl: ".",
|
|
2249
|
+
paths: {
|
|
2250
|
+
"@/*": ["src/*"],
|
|
2251
|
+
"@main/*": ["src/main/*"],
|
|
2252
|
+
"@preload/*": ["src/preload/*"]
|
|
2253
|
+
},
|
|
2254
|
+
resolveJsonModule: true
|
|
2255
|
+
}
|
|
2256
|
+
};
|
|
2257
|
+
const web = {
|
|
2258
|
+
$schema: "https://json.schemastore.org/tsconfig",
|
|
2259
|
+
include: [
|
|
2260
|
+
"src/renderer/env.d.ts",
|
|
2261
|
+
"src/renderer/**/*",
|
|
2262
|
+
...rendererExtensions,
|
|
2263
|
+
"src/preload/*.d.ts",
|
|
2264
|
+
"package.json"
|
|
2265
|
+
],
|
|
2266
|
+
compilerOptions: {
|
|
2267
|
+
composite: true,
|
|
2268
|
+
target: "ES2024",
|
|
2269
|
+
lib: ["ES2024", "ESNext", "DOM", "DOM.Iterable"],
|
|
2270
|
+
baseUrl: ".",
|
|
2271
|
+
paths: {
|
|
2272
|
+
"@/*": ["src/*"],
|
|
2273
|
+
"@renderer/*": ["src/renderer/*"],
|
|
2274
|
+
"@main/*": ["src/main/*"],
|
|
2275
|
+
"@preload/*": ["src/preload/*"]
|
|
2276
|
+
},
|
|
2277
|
+
strict: true,
|
|
2278
|
+
noUnusedParameters: true,
|
|
2279
|
+
noFallthroughCasesInSwitch: true,
|
|
2280
|
+
noUncheckedIndexedAccess: true
|
|
2281
|
+
}
|
|
2282
|
+
};
|
|
2283
|
+
const tests = {
|
|
2284
|
+
$schema: "https://json.schemastore.org/tsconfig",
|
|
2285
|
+
include: ["tests/**/*", "src/renderer/**/*.vue", "src/renderer/env.d.ts"],
|
|
2286
|
+
compilerOptions: {
|
|
2287
|
+
composite: true,
|
|
2288
|
+
baseUrl: ".",
|
|
2289
|
+
paths: {
|
|
2290
|
+
"@/*": ["src/*"],
|
|
2291
|
+
"@renderer/*": ["src/renderer/*"],
|
|
2292
|
+
"@main/*": ["src/main/*"],
|
|
2293
|
+
"@preload/*": ["src/preload/*"],
|
|
2294
|
+
"@tests/*": ["tests/*"],
|
|
2295
|
+
"@unit/*": ["tests/unit/*"],
|
|
2296
|
+
"@integration/*": ["tests/integration/*"],
|
|
2297
|
+
"@fixtures/*": ["tests/fixtures/*"],
|
|
2298
|
+
"@setup/*": ["tests/setup/*"]
|
|
2299
|
+
},
|
|
2300
|
+
types: ["vitest/globals", "@playwright/test"],
|
|
2301
|
+
strict: false
|
|
2302
|
+
}
|
|
2303
|
+
};
|
|
2304
|
+
return { root, node, web, tests };
|
|
2305
|
+
}
|
|
2306
|
+
var init_electron = __esm({
|
|
2307
|
+
"src/tools/typescript/presets/frameworks/electron.ts"() {
|
|
2308
|
+
}
|
|
2309
|
+
});
|
|
2310
|
+
|
|
2311
|
+
// src/tools/typescript/presets/frameworks/node.ts
|
|
2312
|
+
var nodePreset2, node_default3;
|
|
2313
|
+
var init_node4 = __esm({
|
|
2314
|
+
"src/tools/typescript/presets/frameworks/node.ts"() {
|
|
2315
|
+
nodePreset2 = {
|
|
2316
|
+
compilerOptions: {
|
|
2317
|
+
lib: ["ES2022"],
|
|
2318
|
+
module: "NodeNext",
|
|
2319
|
+
moduleResolution: "NodeNext",
|
|
2320
|
+
types: ["node"]
|
|
2321
|
+
}
|
|
2322
|
+
};
|
|
2323
|
+
node_default3 = nodePreset2;
|
|
2324
|
+
}
|
|
2325
|
+
});
|
|
2326
|
+
|
|
2327
|
+
// src/tools/typescript/presets/frameworks/react.ts
|
|
2328
|
+
var reactPreset3, react_default3;
|
|
2329
|
+
var init_react4 = __esm({
|
|
2330
|
+
"src/tools/typescript/presets/frameworks/react.ts"() {
|
|
2331
|
+
reactPreset3 = {
|
|
2332
|
+
compilerOptions: {
|
|
2333
|
+
jsx: "react-jsx",
|
|
2334
|
+
// Modern React 17+ automatic runtime
|
|
2335
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"]
|
|
2336
|
+
}
|
|
2337
|
+
};
|
|
2338
|
+
react_default3 = reactPreset3;
|
|
2339
|
+
}
|
|
2340
|
+
});
|
|
2341
|
+
|
|
2342
|
+
// src/tools/typescript/presets/frameworks/solid.ts
|
|
2343
|
+
var solidPreset, solid_default;
|
|
2344
|
+
var init_solid2 = __esm({
|
|
2345
|
+
"src/tools/typescript/presets/frameworks/solid.ts"() {
|
|
2346
|
+
solidPreset = {
|
|
2347
|
+
compilerOptions: {
|
|
2348
|
+
jsx: "preserve",
|
|
2349
|
+
// Solid uses its own JSX transform
|
|
2350
|
+
jsxImportSource: "solid-js",
|
|
2351
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"]
|
|
2352
|
+
}
|
|
2353
|
+
};
|
|
2354
|
+
solid_default = solidPreset;
|
|
2355
|
+
}
|
|
2356
|
+
});
|
|
2357
|
+
|
|
2358
|
+
// src/tools/typescript/presets/frameworks/svelte.ts
|
|
2359
|
+
var sveltePreset3, svelte_default3;
|
|
2360
|
+
var init_svelte4 = __esm({
|
|
2361
|
+
"src/tools/typescript/presets/frameworks/svelte.ts"() {
|
|
2362
|
+
sveltePreset3 = {
|
|
2363
|
+
compilerOptions: {
|
|
2364
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
2365
|
+
types: ["svelte"]
|
|
2366
|
+
}
|
|
2367
|
+
};
|
|
2368
|
+
svelte_default3 = sveltePreset3;
|
|
2369
|
+
}
|
|
2370
|
+
});
|
|
2371
|
+
|
|
2372
|
+
// src/tools/typescript/presets/frameworks/vanilla.ts
|
|
2373
|
+
var vanillaPreset2, vanilla_default2;
|
|
2374
|
+
var init_vanilla3 = __esm({
|
|
2375
|
+
"src/tools/typescript/presets/frameworks/vanilla.ts"() {
|
|
2376
|
+
vanillaPreset2 = {
|
|
2377
|
+
compilerOptions: {
|
|
2378
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"]
|
|
2379
|
+
}
|
|
2380
|
+
};
|
|
2381
|
+
vanilla_default2 = vanillaPreset2;
|
|
2382
|
+
}
|
|
2383
|
+
});
|
|
2384
|
+
|
|
2385
|
+
// src/tools/typescript/presets/frameworks/vue.ts
|
|
2386
|
+
var vuePreset3, vue_default3;
|
|
2387
|
+
var init_vue4 = __esm({
|
|
2388
|
+
"src/tools/typescript/presets/frameworks/vue.ts"() {
|
|
2389
|
+
vuePreset3 = {
|
|
2390
|
+
compilerOptions: {
|
|
2391
|
+
jsx: "preserve",
|
|
2392
|
+
// Vue compiler handles JSX transformation
|
|
2393
|
+
jsxImportSource: "vue",
|
|
2394
|
+
lib: ["ES2022", "DOM", "DOM.Iterable"],
|
|
2395
|
+
types: ["vite/client"]
|
|
2396
|
+
// Common for Vue + Vite projects
|
|
2397
|
+
},
|
|
2398
|
+
// Vue-specific options (for vue-tsc)
|
|
2399
|
+
vueCompilerOptions: {
|
|
2400
|
+
extensions: [".vue"],
|
|
2401
|
+
vitePressExtensions: [".md"]
|
|
2402
|
+
}
|
|
2403
|
+
};
|
|
2404
|
+
vue_default3 = vuePreset3;
|
|
2405
|
+
}
|
|
2406
|
+
});
|
|
2407
|
+
|
|
2408
|
+
// src/tools/typescript/index.ts
|
|
2409
|
+
var typescript_exports = {};
|
|
2410
|
+
__export(typescript_exports, {
|
|
2411
|
+
createTypescriptConfig: () => createTypescriptConfig,
|
|
2412
|
+
default: () => typescript_default2
|
|
2413
|
+
});
|
|
2414
|
+
async function createTypescriptConfig(options = {}) {
|
|
2415
|
+
const {
|
|
2416
|
+
framework: frameworkOption = "auto",
|
|
2417
|
+
environment: environmentOption = "auto",
|
|
2418
|
+
checker: checkerPreference = "auto",
|
|
2419
|
+
strict = true,
|
|
2420
|
+
electron: electronOption,
|
|
2421
|
+
renderer: rendererOption,
|
|
2422
|
+
compilerOptions: userCompilerOptions = {},
|
|
2423
|
+
cwd = process.cwd()
|
|
2424
|
+
} = options;
|
|
2425
|
+
const detected = frameworkOption === "auto" || environmentOption === "auto" || electronOption === void 0 ? autoDetect(cwd) : { framework: frameworkOption, environment: environmentOption, electron: electronOption };
|
|
2426
|
+
const framework = frameworkOption === "auto" ? detected.framework : frameworkOption;
|
|
2427
|
+
const environment = environmentOption === "auto" ? detected.environment : environmentOption;
|
|
2428
|
+
const isElectron = electronOption !== void 0 ? electronOption : detected.electron;
|
|
2429
|
+
if (isElectron) {
|
|
2430
|
+
const renderer = rendererOption || framework;
|
|
2431
|
+
if (!VALID_RENDERERS.includes(renderer)) {
|
|
2432
|
+
throw new ConfigError(
|
|
2433
|
+
`Invalid renderer option for Electron: "${renderer}". Must be one of: ${VALID_RENDERERS.join(", ")}`,
|
|
2434
|
+
{
|
|
2435
|
+
received: renderer,
|
|
2436
|
+
validRenderers: VALID_RENDERERS
|
|
2437
|
+
}
|
|
2438
|
+
);
|
|
2439
|
+
}
|
|
2440
|
+
const checker2 = detectTypeChecker(
|
|
2441
|
+
framework,
|
|
2442
|
+
checkerPreference,
|
|
2443
|
+
cwd
|
|
2444
|
+
);
|
|
2445
|
+
console.log(
|
|
2446
|
+
`\u26A1 Electron TypeScript Config: ${renderer} renderer | Checker: ${checker2}${checker2 === "tsgo" ? " (10x faster!)" : ""}`
|
|
2447
|
+
);
|
|
2448
|
+
const configs2 = createElectronPreset(renderer);
|
|
2449
|
+
return {
|
|
2450
|
+
...configs2,
|
|
2451
|
+
_meta: {
|
|
2452
|
+
framework: "electron",
|
|
2453
|
+
renderer,
|
|
2454
|
+
checker: checker2,
|
|
2455
|
+
multiConfig: true,
|
|
2456
|
+
experimental: checker2 === "tsgo",
|
|
2457
|
+
generatedBy: "@dimensional-innovations/tool-config"
|
|
2458
|
+
}
|
|
2459
|
+
};
|
|
2460
|
+
}
|
|
2461
|
+
const checker = detectTypeChecker(
|
|
2462
|
+
framework,
|
|
2463
|
+
checkerPreference,
|
|
2464
|
+
cwd
|
|
2465
|
+
);
|
|
2466
|
+
console.log(
|
|
2467
|
+
`\u{1F50D} TypeScript Config: ${framework} | ${environment} | Checker: ${checker}${checker === "tsgo" ? " (10x faster!)" : ""}`
|
|
2468
|
+
);
|
|
2469
|
+
const config = loadPresets(framework, environment, strict);
|
|
2470
|
+
if (userCompilerOptions && Object.keys(userCompilerOptions).length > 0) {
|
|
2471
|
+
config.compilerOptions = {
|
|
2472
|
+
...config.compilerOptions,
|
|
2473
|
+
...userCompilerOptions
|
|
2474
|
+
};
|
|
2475
|
+
}
|
|
2476
|
+
config._meta = {
|
|
2477
|
+
framework,
|
|
2478
|
+
environment,
|
|
2479
|
+
checker,
|
|
2480
|
+
experimental: checker === "tsgo",
|
|
2481
|
+
generatedBy: "@dimensional-innovations/tool-config"
|
|
2482
|
+
};
|
|
2483
|
+
return config;
|
|
2484
|
+
}
|
|
2485
|
+
function loadPresets(framework, environment, strict) {
|
|
2486
|
+
const config = structuredClone(base_default4);
|
|
2487
|
+
const envPreset = loadEnvironmentPreset(environment);
|
|
2488
|
+
mergeConfig(config, envPreset);
|
|
2489
|
+
const frameworkPreset = loadFrameworkPreset(framework);
|
|
2490
|
+
mergeConfig(config, frameworkPreset);
|
|
2491
|
+
if (!strict) {
|
|
2492
|
+
config.compilerOptions = config.compilerOptions || {};
|
|
2493
|
+
config.compilerOptions.strict = false;
|
|
2494
|
+
config.compilerOptions.noImplicitAny = false;
|
|
2495
|
+
}
|
|
2496
|
+
return config;
|
|
2497
|
+
}
|
|
2498
|
+
function loadEnvironmentPreset(environment) {
|
|
2499
|
+
switch (environment) {
|
|
2500
|
+
case "browser":
|
|
2501
|
+
return browser_default2;
|
|
2502
|
+
case "node":
|
|
2503
|
+
return node_default2;
|
|
2504
|
+
case "universal":
|
|
2505
|
+
return universal_default2;
|
|
2506
|
+
default:
|
|
2507
|
+
return {};
|
|
2508
|
+
}
|
|
2509
|
+
}
|
|
2510
|
+
function loadFrameworkPreset(framework) {
|
|
2511
|
+
switch (framework) {
|
|
2512
|
+
case "react":
|
|
2513
|
+
return react_default3;
|
|
2514
|
+
case "vue":
|
|
2515
|
+
return vue_default3;
|
|
2516
|
+
case "svelte":
|
|
2517
|
+
return svelte_default3;
|
|
2518
|
+
case "solid":
|
|
2519
|
+
return solid_default;
|
|
2520
|
+
case "astro":
|
|
2521
|
+
return astro_default2;
|
|
2522
|
+
case "angular":
|
|
2523
|
+
return angular_default;
|
|
2524
|
+
case "node":
|
|
2525
|
+
return node_default3;
|
|
2526
|
+
case "vanilla":
|
|
2527
|
+
default:
|
|
2528
|
+
return vanilla_default2;
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
function mergeConfig(target, source) {
|
|
2532
|
+
for (const key in source) {
|
|
2533
|
+
const sourceKey = key;
|
|
2534
|
+
if (key === "compilerOptions" && target.compilerOptions) {
|
|
2535
|
+
Object.assign(target.compilerOptions, source.compilerOptions);
|
|
2536
|
+
} else if (key === "include" && Array.isArray(source.include)) {
|
|
2537
|
+
target.include = [.../* @__PURE__ */ new Set([...target.include || [], ...source.include])];
|
|
2538
|
+
} else if (key === "exclude" && Array.isArray(source.exclude)) {
|
|
2539
|
+
target.exclude = [.../* @__PURE__ */ new Set([...target.exclude || [], ...source.exclude])];
|
|
2540
|
+
} else {
|
|
2541
|
+
target[sourceKey] = source[sourceKey];
|
|
2542
|
+
}
|
|
2543
|
+
}
|
|
2544
|
+
}
|
|
2545
|
+
var VALID_RENDERERS, typescript_default2;
|
|
2546
|
+
var init_typescript2 = __esm({
|
|
2547
|
+
"src/tools/typescript/index.ts"() {
|
|
2548
|
+
init_checker_detection();
|
|
2549
|
+
init_base4();
|
|
2550
|
+
init_browser2();
|
|
2551
|
+
init_node3();
|
|
2552
|
+
init_universal2();
|
|
2553
|
+
init_angular2();
|
|
2554
|
+
init_astro3();
|
|
2555
|
+
init_electron();
|
|
2556
|
+
init_node4();
|
|
2557
|
+
init_react4();
|
|
2558
|
+
init_solid2();
|
|
2559
|
+
init_svelte4();
|
|
2560
|
+
init_vanilla3();
|
|
2561
|
+
init_vue4();
|
|
2562
|
+
init_detectors();
|
|
2563
|
+
init_types();
|
|
2564
|
+
VALID_RENDERERS = [
|
|
2565
|
+
"react",
|
|
2566
|
+
"vue",
|
|
2567
|
+
"svelte",
|
|
2568
|
+
"solid",
|
|
2569
|
+
"astro",
|
|
2570
|
+
"angular",
|
|
2571
|
+
"vanilla"
|
|
2572
|
+
];
|
|
2573
|
+
typescript_default2 = createTypescriptConfig;
|
|
2574
|
+
}
|
|
2575
|
+
});
|
|
2576
|
+
|
|
2577
|
+
// src/index.ts
|
|
2578
|
+
init_types();
|
|
2579
|
+
init_eslint();
|
|
2580
|
+
init_prettier();
|
|
2581
|
+
init_stylelint();
|
|
2582
|
+
init_semantic_release();
|
|
2583
|
+
init_typescript2();
|
|
2584
|
+
init_detectors();
|
|
2585
|
+
init_types();
|
|
2586
|
+
var VALID_TOOLS = [
|
|
2587
|
+
"eslint",
|
|
2588
|
+
"prettier",
|
|
2589
|
+
"stylelint",
|
|
2590
|
+
"typescript",
|
|
2591
|
+
"semantic-release"
|
|
2592
|
+
];
|
|
2593
|
+
function validateToolName(tool) {
|
|
2594
|
+
if (typeof tool !== "string") {
|
|
2595
|
+
throw new ConfigError("Tool name must be a string", {
|
|
2596
|
+
received: typeof tool,
|
|
2597
|
+
validTools: VALID_TOOLS
|
|
2598
|
+
});
|
|
2599
|
+
}
|
|
2600
|
+
if (!VALID_TOOLS.includes(tool)) {
|
|
2601
|
+
throw new ConfigError(`Unknown tool: "${tool}". Supported tools: ${VALID_TOOLS.join(", ")}`, {
|
|
2602
|
+
received: tool,
|
|
2603
|
+
validTools: VALID_TOOLS
|
|
2604
|
+
});
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
function validateOptions(options) {
|
|
2608
|
+
if (options !== void 0 && options !== null && typeof options !== "object") {
|
|
2609
|
+
throw new ConfigError("Options must be an object", {
|
|
2610
|
+
received: typeof options
|
|
2611
|
+
});
|
|
2612
|
+
}
|
|
2613
|
+
}
|
|
2614
|
+
async function createConfig(tool, options) {
|
|
2615
|
+
validateToolName(tool);
|
|
2616
|
+
validateOptions(options);
|
|
2617
|
+
const opts = options ?? {};
|
|
2618
|
+
switch (tool) {
|
|
2619
|
+
case "eslint": {
|
|
2620
|
+
const { createEslintConfig: createEslintConfig2 } = await Promise.resolve().then(() => (init_eslint(), eslint_exports));
|
|
2621
|
+
return createEslintConfig2(opts);
|
|
2622
|
+
}
|
|
2623
|
+
case "prettier": {
|
|
2624
|
+
const { createPrettierConfig: createPrettierConfig2 } = await Promise.resolve().then(() => (init_prettier(), prettier_exports));
|
|
2625
|
+
return createPrettierConfig2(opts);
|
|
2626
|
+
}
|
|
2627
|
+
case "stylelint": {
|
|
2628
|
+
const { createStylelintConfig: createStylelintConfig2 } = await Promise.resolve().then(() => (init_stylelint(), stylelint_exports));
|
|
2629
|
+
return createStylelintConfig2(opts);
|
|
2630
|
+
}
|
|
2631
|
+
case "semantic-release": {
|
|
2632
|
+
const { createReleaseConfig: createReleaseConfig2 } = await Promise.resolve().then(() => (init_semantic_release(), semantic_release_exports));
|
|
2633
|
+
return createReleaseConfig2(opts);
|
|
2634
|
+
}
|
|
2635
|
+
case "typescript": {
|
|
2636
|
+
const { createTypescriptConfig: createTypescriptConfig2 } = await Promise.resolve().then(() => (init_typescript2(), typescript_exports));
|
|
2637
|
+
return createTypescriptConfig2(opts);
|
|
2638
|
+
}
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
|
|
2642
|
+
export { ConfigError, autoDetect, createConfig, createEslintConfig, createPrettierConfig, createReleaseConfig, createStylelintConfig, createTypescriptConfig, detectCssType, detectElectron, detectEnvironment, detectFramework, detectGitProvider, detectTypeScript };
|
|
2643
|
+
//# sourceMappingURL=index.js.map
|
|
2644
|
+
//# sourceMappingURL=index.js.map
|