@vinicunca/eslint-config 4.8.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +1173 -1993
- package/dist/index.mjs +246 -261
- package/dist/{lib-ok3LDcYL.mjs → lib-D3Kr7UIJ.mjs} +560 -851
- package/package.json +42 -28
package/dist/index.mjs
CHANGED
|
@@ -6,6 +6,7 @@ import fs$1 from "node:fs";
|
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { isPackageExists } from "local-pkg";
|
|
8
8
|
import createCommand from "eslint-plugin-command/config";
|
|
9
|
+
import pluginE18e from "@e18e/eslint-plugin";
|
|
9
10
|
import pluginComments from "@eslint-community/eslint-plugin-eslint-comments";
|
|
10
11
|
import pluginAntfu from "eslint-plugin-antfu";
|
|
11
12
|
import pluginImportLite from "eslint-plugin-import-lite";
|
|
@@ -17,24 +18,20 @@ import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
|
17
18
|
import globals from "globals";
|
|
18
19
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
19
20
|
import { configs } from "eslint-plugin-regexp";
|
|
20
|
-
|
|
21
21
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-boolean.js
|
|
22
|
-
function e$2(e
|
|
23
|
-
return typeof e
|
|
22
|
+
function e$2(e) {
|
|
23
|
+
return typeof e == `boolean`;
|
|
24
24
|
}
|
|
25
|
-
|
|
26
25
|
//#endregion
|
|
27
26
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-function.js
|
|
28
|
-
function e$1(e
|
|
29
|
-
return typeof e
|
|
27
|
+
function e$1(e) {
|
|
28
|
+
return typeof e == `function`;
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
//#endregion
|
|
33
31
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-number.js
|
|
34
|
-
function e(e
|
|
35
|
-
return typeof e
|
|
32
|
+
function e(e) {
|
|
33
|
+
return typeof e == `number` && !Number.isNaN(e);
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
//#endregion
|
|
39
36
|
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
40
37
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
@@ -68,16 +65,13 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
68
65
|
directory = path.dirname(directory);
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
|
|
72
68
|
//#endregion
|
|
73
69
|
//#region src/flags.ts
|
|
74
70
|
const ERROR = "error";
|
|
75
|
-
const OFF = "off";
|
|
76
71
|
const WARN = "warn";
|
|
77
72
|
const CONSISTENT = "consistent";
|
|
78
73
|
const NEVER = "never";
|
|
79
74
|
const ALWAYS = "always";
|
|
80
|
-
|
|
81
75
|
//#endregion
|
|
82
76
|
//#region src/globs.ts
|
|
83
77
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -159,7 +153,6 @@ const GLOB_EXCLUDE = [
|
|
|
159
153
|
"**/auto-import?(s).d.ts",
|
|
160
154
|
"**/components.d.ts"
|
|
161
155
|
];
|
|
162
|
-
|
|
163
156
|
//#endregion
|
|
164
157
|
//#region src/utils.ts
|
|
165
158
|
const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
@@ -186,8 +179,8 @@ const parserPlain = {
|
|
|
186
179
|
/**
|
|
187
180
|
* Combine array and non-array configs into a single array.
|
|
188
181
|
*/
|
|
189
|
-
async function combineConfigs(...configs
|
|
190
|
-
return (await Promise.all(configs
|
|
182
|
+
async function combineConfigs(...configs) {
|
|
183
|
+
return (await Promise.all(configs)).flat();
|
|
191
184
|
}
|
|
192
185
|
/**
|
|
193
186
|
* Rename plugin prefixes in a rule object.
|
|
@@ -227,8 +220,8 @@ function renameRules(rules, map) {
|
|
|
227
220
|
* })
|
|
228
221
|
* ```
|
|
229
222
|
*/
|
|
230
|
-
function renamePluginInConfigs(configs
|
|
231
|
-
return configs
|
|
223
|
+
function renamePluginInConfigs(configs, map) {
|
|
224
|
+
return configs.map((i) => {
|
|
232
225
|
const clone = { ...i };
|
|
233
226
|
if (clone.rules) clone.rules = renameRules(clone.rules, map);
|
|
234
227
|
if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
|
|
@@ -262,11 +255,10 @@ function isInEditorEnv() {
|
|
|
262
255
|
function isInGitHooksOrLintStaged() {
|
|
263
256
|
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
264
257
|
}
|
|
265
|
-
|
|
266
258
|
//#endregion
|
|
267
259
|
//#region src/configs/astro.ts
|
|
268
260
|
async function astro(options = {}) {
|
|
269
|
-
const { files = [GLOB_ASTRO], overrides = {}, stylistic
|
|
261
|
+
const { files = [GLOB_ASTRO], overrides = {}, stylistic = true } = options;
|
|
270
262
|
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
|
|
271
263
|
interopDefault(import("eslint-plugin-astro")),
|
|
272
264
|
interopDefault(import("astro-eslint-parser")),
|
|
@@ -289,28 +281,27 @@ async function astro(options = {}) {
|
|
|
289
281
|
name: "vinicunca/astro/rules",
|
|
290
282
|
processor: "astro/client-side-ts",
|
|
291
283
|
rules: {
|
|
292
|
-
"antfu/no-top-level-await":
|
|
284
|
+
"antfu/no-top-level-await": "off",
|
|
293
285
|
"astro/missing-client-only-directive-value": ERROR,
|
|
294
286
|
"astro/no-conflict-set-directives": ERROR,
|
|
295
287
|
"astro/no-deprecated-astro-canonicalurl": ERROR,
|
|
296
288
|
"astro/no-deprecated-astro-fetchcontent": ERROR,
|
|
297
289
|
"astro/no-deprecated-astro-resolve": ERROR,
|
|
298
290
|
"astro/no-deprecated-getentrybyslug": ERROR,
|
|
299
|
-
"astro/no-set-html-directive":
|
|
291
|
+
"astro/no-set-html-directive": "off",
|
|
300
292
|
"astro/no-unused-define-vars-in-style": ERROR,
|
|
301
|
-
"astro/semi":
|
|
293
|
+
"astro/semi": "off",
|
|
302
294
|
"astro/valid-compile": ERROR,
|
|
303
|
-
...stylistic
|
|
304
|
-
"style/indent":
|
|
305
|
-
"style/jsx-closing-tag-location":
|
|
306
|
-
"style/jsx-one-expression-per-line":
|
|
307
|
-
"style/no-multiple-empty-lines":
|
|
295
|
+
...stylistic ? {
|
|
296
|
+
"style/indent": "off",
|
|
297
|
+
"style/jsx-closing-tag-location": "off",
|
|
298
|
+
"style/jsx-one-expression-per-line": "off",
|
|
299
|
+
"style/no-multiple-empty-lines": "off"
|
|
308
300
|
} : {},
|
|
309
301
|
...overrides
|
|
310
302
|
}
|
|
311
303
|
}];
|
|
312
304
|
}
|
|
313
|
-
|
|
314
305
|
//#endregion
|
|
315
306
|
//#region src/configs/command.ts
|
|
316
307
|
async function command() {
|
|
@@ -319,7 +310,6 @@ async function command() {
|
|
|
319
310
|
name: "vinicunca/command/rules"
|
|
320
311
|
}];
|
|
321
312
|
}
|
|
322
|
-
|
|
323
313
|
//#endregion
|
|
324
314
|
//#region src/configs/comments.ts
|
|
325
315
|
async function comments() {
|
|
@@ -334,7 +324,6 @@ async function comments() {
|
|
|
334
324
|
}
|
|
335
325
|
}];
|
|
336
326
|
}
|
|
337
|
-
|
|
338
327
|
//#endregion
|
|
339
328
|
//#region src/configs/disables.ts
|
|
340
329
|
async function disables() {
|
|
@@ -343,53 +332,72 @@ async function disables() {
|
|
|
343
332
|
files: [`**/scripts/${GLOB_SRC}`],
|
|
344
333
|
name: "vinicunca/disables/scripts",
|
|
345
334
|
rules: {
|
|
346
|
-
"antfu/no-top-level-await":
|
|
347
|
-
"no-console":
|
|
348
|
-
"ts/explicit-function-return-type":
|
|
335
|
+
"antfu/no-top-level-await": "off",
|
|
336
|
+
"no-console": "off",
|
|
337
|
+
"ts/explicit-function-return-type": "off"
|
|
349
338
|
}
|
|
350
339
|
},
|
|
351
340
|
{
|
|
352
341
|
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
353
342
|
name: "vinicunca/disables/cli",
|
|
354
343
|
rules: {
|
|
355
|
-
"antfu/no-top-level-await":
|
|
356
|
-
"no-console":
|
|
344
|
+
"antfu/no-top-level-await": "off",
|
|
345
|
+
"no-console": "off"
|
|
357
346
|
}
|
|
358
347
|
},
|
|
359
348
|
{
|
|
360
349
|
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
361
350
|
name: "vinicunca/disables/bin",
|
|
362
351
|
rules: {
|
|
363
|
-
"antfu/no-import-dist":
|
|
364
|
-
"antfu/no-import-node-modules-by-path":
|
|
352
|
+
"antfu/no-import-dist": "off",
|
|
353
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
365
354
|
}
|
|
366
355
|
},
|
|
367
356
|
{
|
|
368
357
|
files: ["**/*.d.?([cm])ts"],
|
|
369
358
|
name: "vinicunca/disables/dts",
|
|
370
359
|
rules: {
|
|
371
|
-
"eslint-comments/no-unlimited-disable":
|
|
372
|
-
"no-restricted-syntax":
|
|
373
|
-
"unused-imports/no-unused-vars":
|
|
360
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
361
|
+
"no-restricted-syntax": "off",
|
|
362
|
+
"unused-imports/no-unused-vars": "off"
|
|
374
363
|
}
|
|
375
364
|
},
|
|
376
365
|
{
|
|
377
366
|
files: ["**/*.js", "**/*.cjs"],
|
|
378
367
|
name: "vinicunca/disables/cjs",
|
|
379
|
-
rules: { "ts/no-require-imports":
|
|
368
|
+
rules: { "ts/no-require-imports": "off" }
|
|
380
369
|
},
|
|
381
370
|
{
|
|
382
371
|
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
383
372
|
name: "vinicunca/disables/config-files",
|
|
384
373
|
rules: {
|
|
385
|
-
"antfu/no-top-level-await":
|
|
386
|
-
"no-console":
|
|
387
|
-
"ts/explicit-function-return-type":
|
|
374
|
+
"antfu/no-top-level-await": "off",
|
|
375
|
+
"no-console": "off",
|
|
376
|
+
"ts/explicit-function-return-type": "off"
|
|
388
377
|
}
|
|
389
378
|
}
|
|
390
379
|
];
|
|
391
380
|
}
|
|
392
|
-
|
|
381
|
+
//#endregion
|
|
382
|
+
//#region src/configs/e18e.ts
|
|
383
|
+
async function e18e(options = {}) {
|
|
384
|
+
const { isInEditor = false, modernization = true, type = "app", moduleReplacements = type === "lib" && isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
385
|
+
const configs = pluginE18e.configs;
|
|
386
|
+
return [{
|
|
387
|
+
name: "vinicunca/e18e/rules",
|
|
388
|
+
plugins: { e18e: pluginE18e },
|
|
389
|
+
rules: {
|
|
390
|
+
...modernization ? { ...configs.modernization.rules } : {},
|
|
391
|
+
...moduleReplacements ? { ...configs.moduleReplacements.rules } : {},
|
|
392
|
+
...performanceImprovements ? { ...configs.performanceImprovements.rules } : {},
|
|
393
|
+
"e18e/prefer-array-to-reversed": "off",
|
|
394
|
+
"e18e/prefer-array-to-sorted": "off",
|
|
395
|
+
"e18e/prefer-array-to-spliced": "off",
|
|
396
|
+
"e18e/prefer-spread-syntax": "off",
|
|
397
|
+
...overrides
|
|
398
|
+
}
|
|
399
|
+
}];
|
|
400
|
+
}
|
|
393
401
|
//#endregion
|
|
394
402
|
//#region src/configs/stylistic.ts
|
|
395
403
|
const STYLISTIC_CONFIG_DEFAULTS = {
|
|
@@ -399,7 +407,7 @@ const STYLISTIC_CONFIG_DEFAULTS = {
|
|
|
399
407
|
semi: true
|
|
400
408
|
};
|
|
401
409
|
async function stylistic(options = {}) {
|
|
402
|
-
const { experimental, indent, jsx
|
|
410
|
+
const { experimental, indent, jsx, overrides = {}, quotes, semi } = {
|
|
403
411
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
404
412
|
...options
|
|
405
413
|
};
|
|
@@ -407,7 +415,7 @@ async function stylistic(options = {}) {
|
|
|
407
415
|
const config = pluginStylistic.configs.customize({
|
|
408
416
|
experimental,
|
|
409
417
|
indent,
|
|
410
|
-
jsx
|
|
418
|
+
jsx,
|
|
411
419
|
pluginName: "style",
|
|
412
420
|
quotes,
|
|
413
421
|
semi
|
|
@@ -463,7 +471,6 @@ async function stylistic(options = {}) {
|
|
|
463
471
|
}
|
|
464
472
|
}];
|
|
465
473
|
}
|
|
466
|
-
|
|
467
474
|
//#endregion
|
|
468
475
|
//#region src/configs/formatters.ts
|
|
469
476
|
function mergePrettierOptions(options, overrides) {
|
|
@@ -473,7 +480,7 @@ function mergePrettierOptions(options, overrides) {
|
|
|
473
480
|
plugins: [...overrides.plugins || [], ...options.plugins || []]
|
|
474
481
|
};
|
|
475
482
|
}
|
|
476
|
-
async function formatters(options = {}, stylistic
|
|
483
|
+
async function formatters(options = {}, stylistic = {}) {
|
|
477
484
|
if (options === true) {
|
|
478
485
|
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
479
486
|
options = {
|
|
@@ -495,7 +502,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
495
502
|
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
496
503
|
const { indent, quotes, semi } = {
|
|
497
504
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
498
|
-
...stylistic
|
|
505
|
+
...stylistic
|
|
499
506
|
};
|
|
500
507
|
const prettierOptions = Object.assign({
|
|
501
508
|
endOfLine: "auto",
|
|
@@ -511,16 +518,17 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
511
518
|
xmlSortAttributesByKey: false,
|
|
512
519
|
xmlWhitespaceSensitivity: "ignore"
|
|
513
520
|
};
|
|
514
|
-
const dprintOptions =
|
|
521
|
+
const dprintOptions = {
|
|
515
522
|
indentWidth: e(indent) ? indent : 2,
|
|
516
523
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
517
|
-
useTabs: indent === "tab"
|
|
518
|
-
|
|
519
|
-
|
|
524
|
+
useTabs: indent === "tab",
|
|
525
|
+
...options.dprintOptions || {}
|
|
526
|
+
};
|
|
527
|
+
const configs = [{
|
|
520
528
|
name: "vinicunca/formatter/setup",
|
|
521
529
|
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
522
530
|
}];
|
|
523
|
-
if (options.css) configs
|
|
531
|
+
if (options.css) configs.push({
|
|
524
532
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
525
533
|
languageOptions: { parser: parserPlain },
|
|
526
534
|
name: "vinicunca/formatter/css",
|
|
@@ -536,13 +544,13 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
536
544
|
name: "vinicunca/formatter/less",
|
|
537
545
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
538
546
|
});
|
|
539
|
-
if (options.html) configs
|
|
547
|
+
if (options.html) configs.push({
|
|
540
548
|
files: ["**/*.html"],
|
|
541
549
|
languageOptions: { parser: parserPlain },
|
|
542
550
|
name: "vinicunca/formatter/html",
|
|
543
551
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
544
552
|
});
|
|
545
|
-
if (options.xml) configs
|
|
553
|
+
if (options.xml) configs.push({
|
|
546
554
|
files: [GLOB_XML],
|
|
547
555
|
languageOptions: { parser: parserPlain },
|
|
548
556
|
name: "vinicunca/formatter/xml",
|
|
@@ -554,7 +562,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
554
562
|
plugins: ["@prettier/plugin-xml"]
|
|
555
563
|
})] }
|
|
556
564
|
});
|
|
557
|
-
if (options.svg) configs
|
|
565
|
+
if (options.svg) configs.push({
|
|
558
566
|
files: [GLOB_SVG],
|
|
559
567
|
languageOptions: { parser: parserPlain },
|
|
560
568
|
name: "vinicunca/formatter/svg",
|
|
@@ -571,7 +579,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
571
579
|
let GLOB_SLIDEV;
|
|
572
580
|
if (options.slidev) GLOB_SLIDEV = options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
573
581
|
else GLOB_SLIDEV = [];
|
|
574
|
-
configs
|
|
582
|
+
configs.push({
|
|
575
583
|
files: [GLOB_MARKDOWN],
|
|
576
584
|
ignores: GLOB_SLIDEV,
|
|
577
585
|
languageOptions: { parser: parserPlain },
|
|
@@ -584,7 +592,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
584
592
|
language: "markdown"
|
|
585
593
|
}] }
|
|
586
594
|
});
|
|
587
|
-
if (options.slidev) configs
|
|
595
|
+
if (options.slidev) configs.push({
|
|
588
596
|
files: GLOB_SLIDEV,
|
|
589
597
|
languageOptions: { parser: parserPlain },
|
|
590
598
|
name: "vinicunca/formatter/slidev",
|
|
@@ -596,7 +604,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
596
604
|
});
|
|
597
605
|
}
|
|
598
606
|
if (options.astro) {
|
|
599
|
-
configs
|
|
607
|
+
configs.push({
|
|
600
608
|
files: [GLOB_ASTRO],
|
|
601
609
|
languageOptions: { parser: parserPlain },
|
|
602
610
|
name: "vinicunca/formatter/astro",
|
|
@@ -605,45 +613,43 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
605
613
|
plugins: ["prettier-plugin-astro"]
|
|
606
614
|
})] }
|
|
607
615
|
});
|
|
608
|
-
configs
|
|
616
|
+
configs.push({
|
|
609
617
|
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
610
618
|
name: "vinicunca/formatter/astro/disables",
|
|
611
619
|
rules: {
|
|
612
|
-
"style/arrow-parens":
|
|
613
|
-
"style/block-spacing":
|
|
614
|
-
"style/comma-dangle":
|
|
615
|
-
"style/indent":
|
|
616
|
-
"style/no-multi-spaces":
|
|
617
|
-
"style/quotes":
|
|
618
|
-
"style/semi":
|
|
620
|
+
"style/arrow-parens": "off",
|
|
621
|
+
"style/block-spacing": "off",
|
|
622
|
+
"style/comma-dangle": "off",
|
|
623
|
+
"style/indent": "off",
|
|
624
|
+
"style/no-multi-spaces": "off",
|
|
625
|
+
"style/quotes": "off",
|
|
626
|
+
"style/semi": "off"
|
|
619
627
|
}
|
|
620
628
|
});
|
|
621
629
|
}
|
|
622
|
-
if (options.graphql) configs
|
|
630
|
+
if (options.graphql) configs.push({
|
|
623
631
|
files: [GLOB_GRAPHQL],
|
|
624
632
|
languageOptions: { parser: parserPlain },
|
|
625
633
|
name: "vinicunca/formatter/graphql",
|
|
626
634
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
627
635
|
});
|
|
628
|
-
return configs
|
|
636
|
+
return configs;
|
|
629
637
|
}
|
|
630
|
-
|
|
631
638
|
//#endregion
|
|
632
639
|
//#region src/configs/ignores.ts
|
|
633
640
|
async function ignores(userIgnores = []) {
|
|
634
|
-
let ignores
|
|
635
|
-
if (e$1(userIgnores)) ignores
|
|
636
|
-
else ignores
|
|
641
|
+
let ignores = [...GLOB_EXCLUDE];
|
|
642
|
+
if (e$1(userIgnores)) ignores = userIgnores(ignores);
|
|
643
|
+
else ignores = [...ignores, ...userIgnores];
|
|
637
644
|
return [{
|
|
638
|
-
ignores
|
|
645
|
+
ignores,
|
|
639
646
|
name: "vinicunca/ignores"
|
|
640
647
|
}];
|
|
641
648
|
}
|
|
642
|
-
|
|
643
649
|
//#endregion
|
|
644
650
|
//#region src/configs/imports.ts
|
|
645
651
|
async function imports(options = {}) {
|
|
646
|
-
const { overrides = {}, stylistic
|
|
652
|
+
const { overrides = {}, stylistic = true } = options;
|
|
647
653
|
return [{
|
|
648
654
|
name: "vinicunca/imports/rules",
|
|
649
655
|
plugins: {
|
|
@@ -659,12 +665,11 @@ async function imports(options = {}) {
|
|
|
659
665
|
"import/no-duplicates": "error",
|
|
660
666
|
"import/no-mutable-exports": "error",
|
|
661
667
|
"import/no-named-default": "error",
|
|
662
|
-
...stylistic
|
|
668
|
+
...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
|
|
663
669
|
...overrides
|
|
664
670
|
}
|
|
665
671
|
}];
|
|
666
672
|
}
|
|
667
|
-
|
|
668
673
|
//#endregion
|
|
669
674
|
//#region src/configs/javascript.ts
|
|
670
675
|
async function javascript(options = {}) {
|
|
@@ -905,11 +910,10 @@ async function javascript(options = {}) {
|
|
|
905
910
|
}
|
|
906
911
|
}];
|
|
907
912
|
}
|
|
908
|
-
|
|
909
913
|
//#endregion
|
|
910
914
|
//#region src/configs/jsdoc.ts
|
|
911
915
|
async function jsdoc(options = {}) {
|
|
912
|
-
const { stylistic
|
|
916
|
+
const { stylistic = true } = options;
|
|
913
917
|
return [{
|
|
914
918
|
name: "vinicunca/jsdoc/setup",
|
|
915
919
|
plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
|
|
@@ -936,14 +940,13 @@ async function jsdoc(options = {}) {
|
|
|
936
940
|
"jsdoc/require-returns-description": WARN,
|
|
937
941
|
"jsdoc/require-yields-check": WARN,
|
|
938
942
|
"jsdoc/valid-types": WARN,
|
|
939
|
-
...stylistic
|
|
943
|
+
...stylistic ? {
|
|
940
944
|
"jsdoc/check-alignment": WARN,
|
|
941
945
|
"jsdoc/multiline-blocks": WARN
|
|
942
946
|
} : {}
|
|
943
947
|
}
|
|
944
948
|
}];
|
|
945
949
|
}
|
|
946
|
-
|
|
947
950
|
//#endregion
|
|
948
951
|
//#region src/configs/jsonc.ts
|
|
949
952
|
async function jsonc(options = {}) {
|
|
@@ -951,8 +954,8 @@ async function jsonc(options = {}) {
|
|
|
951
954
|
GLOB_JSON,
|
|
952
955
|
GLOB_JSON5,
|
|
953
956
|
GLOB_JSONC
|
|
954
|
-
], overrides = {}, stylistic
|
|
955
|
-
const { indent = 2 } = e$2(stylistic
|
|
957
|
+
], overrides = {}, stylistic = true } = options;
|
|
958
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
956
959
|
return [{
|
|
957
960
|
name: "vinicunca/jsonc/setup",
|
|
958
961
|
plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
|
|
@@ -987,7 +990,7 @@ async function jsonc(options = {}) {
|
|
|
987
990
|
"jsonc/space-unary-ops": ERROR,
|
|
988
991
|
"jsonc/valid-json-number": ERROR,
|
|
989
992
|
"jsonc/vue-custom-block/no-parsing-error": ERROR,
|
|
990
|
-
...stylistic
|
|
993
|
+
...stylistic ? {
|
|
991
994
|
"jsonc/array-bracket-spacing": [ERROR, NEVER],
|
|
992
995
|
"jsonc/comma-dangle": [ERROR, NEVER],
|
|
993
996
|
"jsonc/comma-style": [ERROR, "last"],
|
|
@@ -1009,7 +1012,6 @@ async function jsonc(options = {}) {
|
|
|
1009
1012
|
}
|
|
1010
1013
|
}];
|
|
1011
1014
|
}
|
|
1012
|
-
|
|
1013
1015
|
//#endregion
|
|
1014
1016
|
//#region src/configs/jsx.ts
|
|
1015
1017
|
async function jsx(options = {}) {
|
|
@@ -1048,22 +1050,21 @@ async function jsx(options = {}) {
|
|
|
1048
1050
|
}
|
|
1049
1051
|
}];
|
|
1050
1052
|
}
|
|
1051
|
-
|
|
1052
1053
|
//#endregion
|
|
1053
1054
|
//#region src/configs/markdown.ts
|
|
1054
1055
|
async function markdown(options = {}) {
|
|
1055
1056
|
const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
|
|
1056
|
-
const markdown
|
|
1057
|
+
const markdown = await interopDefault(import("@eslint/markdown"));
|
|
1057
1058
|
return [
|
|
1058
1059
|
{
|
|
1059
1060
|
name: "vinicunca/markdown/setup",
|
|
1060
|
-
plugins: { markdown
|
|
1061
|
+
plugins: { markdown }
|
|
1061
1062
|
},
|
|
1062
1063
|
{
|
|
1063
1064
|
files,
|
|
1064
1065
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
1065
1066
|
name: "vinicunca/markdown/processor",
|
|
1066
|
-
processor: mergeProcessors([markdown
|
|
1067
|
+
processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
|
|
1067
1068
|
},
|
|
1068
1069
|
{
|
|
1069
1070
|
files,
|
|
@@ -1074,8 +1075,8 @@ async function markdown(options = {}) {
|
|
|
1074
1075
|
files,
|
|
1075
1076
|
name: "vinicunca/markdown/rules",
|
|
1076
1077
|
rules: {
|
|
1077
|
-
...markdown
|
|
1078
|
-
"markdown/no-missing-label-refs":
|
|
1078
|
+
...markdown.configs.recommended.at(0)?.rules,
|
|
1079
|
+
"markdown/no-missing-label-refs": "off",
|
|
1079
1080
|
...overridesMarkdown
|
|
1080
1081
|
}
|
|
1081
1082
|
},
|
|
@@ -1083,15 +1084,15 @@ async function markdown(options = {}) {
|
|
|
1083
1084
|
files,
|
|
1084
1085
|
name: "vinicunca/markdown/disables/markdown",
|
|
1085
1086
|
rules: {
|
|
1086
|
-
"command/command":
|
|
1087
|
-
"no-irregular-whitespace":
|
|
1088
|
-
"perfectionist/sort-exports":
|
|
1089
|
-
"perfectionist/sort-imports":
|
|
1090
|
-
"regexp/no-legacy-features":
|
|
1091
|
-
"regexp/no-missing-g-flag":
|
|
1092
|
-
"regexp/no-useless-dollar-replacements":
|
|
1093
|
-
"regexp/no-useless-flag":
|
|
1094
|
-
"style/indent":
|
|
1087
|
+
"command/command": "off",
|
|
1088
|
+
"no-irregular-whitespace": "off",
|
|
1089
|
+
"perfectionist/sort-exports": "off",
|
|
1090
|
+
"perfectionist/sort-imports": "off",
|
|
1091
|
+
"regexp/no-legacy-features": "off",
|
|
1092
|
+
"regexp/no-missing-g-flag": "off",
|
|
1093
|
+
"regexp/no-useless-dollar-replacements": "off",
|
|
1094
|
+
"regexp/no-useless-flag": "off",
|
|
1095
|
+
"style/indent": "off"
|
|
1095
1096
|
}
|
|
1096
1097
|
},
|
|
1097
1098
|
{
|
|
@@ -1099,30 +1100,30 @@ async function markdown(options = {}) {
|
|
|
1099
1100
|
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
1100
1101
|
name: "vinicunca/markdown/disables",
|
|
1101
1102
|
rules: {
|
|
1102
|
-
"
|
|
1103
|
-
"no-
|
|
1104
|
-
"no-
|
|
1105
|
-
"no-
|
|
1106
|
-
"no-unused-
|
|
1107
|
-
"
|
|
1108
|
-
"
|
|
1109
|
-
"style/
|
|
1110
|
-
"style/
|
|
1111
|
-
"
|
|
1112
|
-
"ts/
|
|
1113
|
-
"ts/no-
|
|
1114
|
-
"ts/no-
|
|
1115
|
-
"ts/no-
|
|
1116
|
-
"ts/no-
|
|
1117
|
-
"
|
|
1118
|
-
"
|
|
1119
|
-
"unused-imports/no-unused-
|
|
1103
|
+
"e18e/prefer-static-regex": "off",
|
|
1104
|
+
"no-alert": "off",
|
|
1105
|
+
"no-console": "off",
|
|
1106
|
+
"no-undef": "off",
|
|
1107
|
+
"no-unused-expressions": "off",
|
|
1108
|
+
"no-unused-vars": "off",
|
|
1109
|
+
"node/prefer-global/process": "off",
|
|
1110
|
+
"style/comma-dangle": "off",
|
|
1111
|
+
"style/eol-last": "off",
|
|
1112
|
+
"style/padding-line-between-statements": "off",
|
|
1113
|
+
"ts/consistent-type-imports": "off",
|
|
1114
|
+
"ts/no-namespace": "off",
|
|
1115
|
+
"ts/no-redeclare": "off",
|
|
1116
|
+
"ts/no-require-imports": "off",
|
|
1117
|
+
"ts/no-unused-vars": "off",
|
|
1118
|
+
"ts/no-use-before-define": "off",
|
|
1119
|
+
"unicode-bom": "off",
|
|
1120
|
+
"unused-imports/no-unused-imports": "off",
|
|
1121
|
+
"unused-imports/no-unused-vars": "off",
|
|
1120
1122
|
...overrides
|
|
1121
1123
|
}
|
|
1122
1124
|
}
|
|
1123
1125
|
];
|
|
1124
1126
|
}
|
|
1125
|
-
|
|
1126
1127
|
//#endregion
|
|
1127
1128
|
//#region src/configs/nextjs.ts
|
|
1128
1129
|
function normalizeRules(rules) {
|
|
@@ -1155,7 +1156,6 @@ async function nextjs(options = {}) {
|
|
|
1155
1156
|
settings: { react: { version: "detect" } }
|
|
1156
1157
|
}];
|
|
1157
1158
|
}
|
|
1158
|
-
|
|
1159
1159
|
//#endregion
|
|
1160
1160
|
//#region src/configs/node.ts
|
|
1161
1161
|
async function node() {
|
|
@@ -1164,7 +1164,7 @@ async function node() {
|
|
|
1164
1164
|
plugins: { node: pluginNode },
|
|
1165
1165
|
rules: {
|
|
1166
1166
|
"node/handle-callback-err": [ERROR, "^(err|error)$"],
|
|
1167
|
-
"node/no-callback-literal":
|
|
1167
|
+
"node/no-callback-literal": "off",
|
|
1168
1168
|
"node/no-deprecated-api": ERROR,
|
|
1169
1169
|
"node/no-exports-assign": ERROR,
|
|
1170
1170
|
"node/no-new-require": ERROR,
|
|
@@ -1175,7 +1175,6 @@ async function node() {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
}];
|
|
1177
1177
|
}
|
|
1178
|
-
|
|
1179
1178
|
//#endregion
|
|
1180
1179
|
//#region src/configs/perfectionist.ts
|
|
1181
1180
|
/**
|
|
@@ -1228,14 +1227,13 @@ async function perfectionist() {
|
|
|
1228
1227
|
}
|
|
1229
1228
|
}];
|
|
1230
1229
|
}
|
|
1231
|
-
|
|
1232
1230
|
//#endregion
|
|
1233
1231
|
//#region src/configs/pnpm.ts
|
|
1234
1232
|
async function detectCatalogUsage() {
|
|
1235
1233
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1236
1234
|
if (!workspaceFile) return false;
|
|
1237
|
-
const yaml
|
|
1238
|
-
return yaml
|
|
1235
|
+
const yaml = await fs.readFile(workspaceFile, "utf-8");
|
|
1236
|
+
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1239
1237
|
}
|
|
1240
1238
|
async function pnpm(options) {
|
|
1241
1239
|
const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
|
|
@@ -1243,9 +1241,9 @@ async function pnpm(options) {
|
|
|
1243
1241
|
interopDefault(import("eslint-plugin-yml")),
|
|
1244
1242
|
interopDefault(import("yaml-eslint-parser"))
|
|
1245
1243
|
]);
|
|
1246
|
-
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml
|
|
1247
|
-
const configs
|
|
1248
|
-
if (json) configs
|
|
1244
|
+
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml = true } = options;
|
|
1245
|
+
const configs = [];
|
|
1246
|
+
if (json) configs.push({
|
|
1249
1247
|
files: ["package.json", "**/package.json"],
|
|
1250
1248
|
language: "jsonc/x",
|
|
1251
1249
|
name: "vinicunca/pnpm/package-json",
|
|
@@ -1259,8 +1257,8 @@ async function pnpm(options) {
|
|
|
1259
1257
|
"pnpm/json-valid-catalog": [ERROR, { autofix: !isInEditor }]
|
|
1260
1258
|
}
|
|
1261
1259
|
});
|
|
1262
|
-
if (yaml
|
|
1263
|
-
configs
|
|
1260
|
+
if (yaml) {
|
|
1261
|
+
configs.push({
|
|
1264
1262
|
files: ["pnpm-workspace.yaml"],
|
|
1265
1263
|
languageOptions: { parser: yamlParser },
|
|
1266
1264
|
name: "vinicunca/pnpm/pnpm-workspace-yaml",
|
|
@@ -1274,7 +1272,7 @@ async function pnpm(options) {
|
|
|
1274
1272
|
"pnpm/yaml-no-unused-catalog-item": ERROR
|
|
1275
1273
|
}
|
|
1276
1274
|
});
|
|
1277
|
-
if (sort) configs
|
|
1275
|
+
if (sort) configs.push({
|
|
1278
1276
|
files: ["pnpm-workspace.yaml"],
|
|
1279
1277
|
languageOptions: { parser: yamlParser },
|
|
1280
1278
|
name: "vinicunca/pnpm/pnpm-workspace-yaml-sort",
|
|
@@ -1353,9 +1351,8 @@ async function pnpm(options) {
|
|
|
1353
1351
|
] }
|
|
1354
1352
|
});
|
|
1355
1353
|
}
|
|
1356
|
-
return configs
|
|
1354
|
+
return configs;
|
|
1357
1355
|
}
|
|
1358
|
-
|
|
1359
1356
|
//#endregion
|
|
1360
1357
|
//#region src/configs/react.ts
|
|
1361
1358
|
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
@@ -1381,10 +1378,7 @@ async function react(options = {}) {
|
|
|
1381
1378
|
"eslint-plugin-react-refresh"
|
|
1382
1379
|
]);
|
|
1383
1380
|
const isTypeAware = !!tsconfigPath;
|
|
1384
|
-
const typeAwareRules = {
|
|
1385
|
-
"react/no-implicit-key": ERROR,
|
|
1386
|
-
"react/no-leaked-conditional-rendering": WARN
|
|
1387
|
-
};
|
|
1381
|
+
const typeAwareRules = { "react/no-leaked-conditional-rendering": WARN };
|
|
1388
1382
|
const [pluginReact, pluginReactHooks, pluginReactRefresh] = await Promise.all([
|
|
1389
1383
|
interopDefault(import("@eslint-react/eslint-plugin")),
|
|
1390
1384
|
interopDefault(import("eslint-plugin-react-hooks")),
|
|
@@ -1534,12 +1528,12 @@ async function react(options = {}) {
|
|
|
1534
1528
|
files: filesTypeAware,
|
|
1535
1529
|
name: "vinicunca/react/typescript",
|
|
1536
1530
|
rules: {
|
|
1537
|
-
"react-dom/no-string-style-prop":
|
|
1538
|
-
"react-dom/no-unknown-property":
|
|
1539
|
-
"react/jsx-no-duplicate-props":
|
|
1540
|
-
"react/jsx-no-undef":
|
|
1541
|
-
"react/jsx-uses-react":
|
|
1542
|
-
"react/jsx-uses-vars":
|
|
1531
|
+
"react-dom/no-string-style-prop": "off",
|
|
1532
|
+
"react-dom/no-unknown-property": "off",
|
|
1533
|
+
"react/jsx-no-duplicate-props": "off",
|
|
1534
|
+
"react/jsx-no-undef": "off",
|
|
1535
|
+
"react/jsx-uses-react": "off",
|
|
1536
|
+
"react/jsx-uses-vars": "off"
|
|
1543
1537
|
}
|
|
1544
1538
|
},
|
|
1545
1539
|
...isTypeAware ? [{
|
|
@@ -1550,14 +1544,13 @@ async function react(options = {}) {
|
|
|
1550
1544
|
}] : []
|
|
1551
1545
|
];
|
|
1552
1546
|
}
|
|
1553
|
-
|
|
1554
1547
|
//#endregion
|
|
1555
1548
|
//#region src/configs/regexp.ts
|
|
1556
1549
|
async function regexp(options = {}) {
|
|
1557
1550
|
const config = configs["flat/recommended"];
|
|
1558
1551
|
const rules = { ...config.rules };
|
|
1559
|
-
if (options.level ===
|
|
1560
|
-
for (const key in rules) if (rules[key] ===
|
|
1552
|
+
if (options.level === "warn") {
|
|
1553
|
+
for (const key in rules) if (rules[key] === "error") rules[key] = WARN;
|
|
1561
1554
|
}
|
|
1562
1555
|
return [{
|
|
1563
1556
|
...config,
|
|
@@ -1568,11 +1561,10 @@ async function regexp(options = {}) {
|
|
|
1568
1561
|
}
|
|
1569
1562
|
}];
|
|
1570
1563
|
}
|
|
1571
|
-
|
|
1572
1564
|
//#endregion
|
|
1573
1565
|
//#region src/configs/solid.ts
|
|
1574
1566
|
async function solid(options = {}) {
|
|
1575
|
-
const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript
|
|
1567
|
+
const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript = true } = options;
|
|
1576
1568
|
await ensurePackages(["eslint-plugin-solid"]);
|
|
1577
1569
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1578
1570
|
const isTypeAware = !!tsconfigPath;
|
|
@@ -1611,15 +1603,14 @@ async function solid(options = {}) {
|
|
|
1611
1603
|
"solid/reactivity": WARN,
|
|
1612
1604
|
"solid/self-closing-comp": ERROR,
|
|
1613
1605
|
"solid/style-prop": [ERROR, { styleProps: ["style", "css"] }],
|
|
1614
|
-
...typescript
|
|
1606
|
+
...typescript ? {
|
|
1615
1607
|
"solid/jsx-no-undef": [ERROR, { typescriptEnabled: true }],
|
|
1616
|
-
"solid/no-unknown-namespaces":
|
|
1608
|
+
"solid/no-unknown-namespaces": "off"
|
|
1617
1609
|
} : {},
|
|
1618
1610
|
...overrides
|
|
1619
1611
|
}
|
|
1620
1612
|
}];
|
|
1621
1613
|
}
|
|
1622
|
-
|
|
1623
1614
|
//#endregion
|
|
1624
1615
|
//#region src/configs/sonar.ts
|
|
1625
1616
|
async function sonar() {
|
|
@@ -1628,15 +1619,14 @@ async function sonar() {
|
|
|
1628
1619
|
plugins: { sonar: pluginSonar },
|
|
1629
1620
|
rules: {
|
|
1630
1621
|
...pluginSonar.configs.recommended.rules,
|
|
1631
|
-
"sonar/cognitive-complexity":
|
|
1632
|
-
"sonar/no-unused-vars":
|
|
1633
|
-
"sonar/pseudo-random":
|
|
1634
|
-
"sonar/slow-regex":
|
|
1635
|
-
"sonar/todo-tag":
|
|
1622
|
+
"sonar/cognitive-complexity": "off",
|
|
1623
|
+
"sonar/no-unused-vars": "off",
|
|
1624
|
+
"sonar/pseudo-random": "off",
|
|
1625
|
+
"sonar/slow-regex": "off",
|
|
1626
|
+
"sonar/todo-tag": "off"
|
|
1636
1627
|
}
|
|
1637
1628
|
}];
|
|
1638
1629
|
}
|
|
1639
|
-
|
|
1640
1630
|
//#endregion
|
|
1641
1631
|
//#region src/configs/sort-package-json.ts
|
|
1642
1632
|
/**
|
|
@@ -1870,12 +1860,11 @@ function sortTsconfig() {
|
|
|
1870
1860
|
] }
|
|
1871
1861
|
}];
|
|
1872
1862
|
}
|
|
1873
|
-
|
|
1874
1863
|
//#endregion
|
|
1875
1864
|
//#region src/configs/svelte.ts
|
|
1876
1865
|
async function svelte(options = {}) {
|
|
1877
|
-
const { files = [GLOB_SVELTE], overrides = {}, stylistic
|
|
1878
|
-
const { indent = 2, quotes = "single" } = e$2(stylistic
|
|
1866
|
+
const { files = [GLOB_SVELTE], overrides = {}, stylistic = true } = options;
|
|
1867
|
+
const { indent = 2, quotes = "single" } = e$2(stylistic) ? {} : stylistic;
|
|
1879
1868
|
await ensurePackages(["eslint-plugin-svelte"]);
|
|
1880
1869
|
const [pluginSvelte, parserSvelte] = await Promise.all([interopDefault(import("eslint-plugin-svelte")), interopDefault(import("svelte-eslint-parser"))]);
|
|
1881
1870
|
return [{
|
|
@@ -1893,7 +1882,7 @@ async function svelte(options = {}) {
|
|
|
1893
1882
|
name: "vinicunca/svelte/rules",
|
|
1894
1883
|
processor: pluginSvelte.processors[".svelte"],
|
|
1895
1884
|
rules: {
|
|
1896
|
-
"no-undef":
|
|
1885
|
+
"no-undef": "off",
|
|
1897
1886
|
"no-unused-vars": [ERROR, {
|
|
1898
1887
|
args: "none",
|
|
1899
1888
|
caughtErrors: "none",
|
|
@@ -1927,9 +1916,9 @@ async function svelte(options = {}) {
|
|
|
1927
1916
|
vars: "all",
|
|
1928
1917
|
varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
|
|
1929
1918
|
}],
|
|
1930
|
-
...stylistic
|
|
1931
|
-
"style/indent":
|
|
1932
|
-
"style/no-trailing-spaces":
|
|
1919
|
+
...stylistic ? {
|
|
1920
|
+
"style/indent": "off",
|
|
1921
|
+
"style/no-trailing-spaces": "off",
|
|
1933
1922
|
"svelte/derived-has-same-inputs-outputs": ERROR,
|
|
1934
1923
|
"svelte/html-closing-bracket-spacing": ERROR,
|
|
1935
1924
|
"svelte/html-quotes": [ERROR, { prefer: quotes }],
|
|
@@ -1946,7 +1935,6 @@ async function svelte(options = {}) {
|
|
|
1946
1935
|
}
|
|
1947
1936
|
}];
|
|
1948
1937
|
}
|
|
1949
|
-
|
|
1950
1938
|
//#endregion
|
|
1951
1939
|
//#region src/configs/test.ts
|
|
1952
1940
|
let _pluginTest;
|
|
@@ -1967,7 +1955,8 @@ async function test(options = {}) {
|
|
|
1967
1955
|
files,
|
|
1968
1956
|
name: "vinicunca/test/rules",
|
|
1969
1957
|
rules: {
|
|
1970
|
-
"
|
|
1958
|
+
"e18e/prefer-static-regex": "off",
|
|
1959
|
+
"sonar/no-duplicate-string": "off",
|
|
1971
1960
|
"test/consistent-test-it": [ERROR, {
|
|
1972
1961
|
fn: "it",
|
|
1973
1962
|
withinDescribe: "it"
|
|
@@ -1977,20 +1966,19 @@ async function test(options = {}) {
|
|
|
1977
1966
|
"test/no-only-tests": isInEditor ? WARN : ERROR,
|
|
1978
1967
|
"test/prefer-hooks-in-order": ERROR,
|
|
1979
1968
|
"test/prefer-lowercase-title": ERROR,
|
|
1980
|
-
"antfu/no-top-level-await":
|
|
1981
|
-
"no-unused-expressions":
|
|
1982
|
-
"node/prefer-global/process":
|
|
1983
|
-
"ts/explicit-function-return-type":
|
|
1969
|
+
"antfu/no-top-level-await": "off",
|
|
1970
|
+
"no-unused-expressions": "off",
|
|
1971
|
+
"node/prefer-global/process": "off",
|
|
1972
|
+
"ts/explicit-function-return-type": "off",
|
|
1984
1973
|
...overrides
|
|
1985
1974
|
}
|
|
1986
1975
|
}];
|
|
1987
1976
|
}
|
|
1988
|
-
|
|
1989
1977
|
//#endregion
|
|
1990
1978
|
//#region src/configs/toml.ts
|
|
1991
1979
|
async function toml(options = {}) {
|
|
1992
|
-
const { files = [GLOB_TOML], overrides = {}, stylistic
|
|
1993
|
-
const { indent = 2 } = e$2(stylistic
|
|
1980
|
+
const { files = [GLOB_TOML], overrides = {}, stylistic = true } = options;
|
|
1981
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
1994
1982
|
const [pluginToml, parserToml] = await Promise.all([interopDefault(import("eslint-plugin-toml")), interopDefault(import("toml-eslint-parser"))]);
|
|
1995
1983
|
return [{
|
|
1996
1984
|
name: "vinicunca/toml/setup",
|
|
@@ -2000,7 +1988,7 @@ async function toml(options = {}) {
|
|
|
2000
1988
|
languageOptions: { parser: parserToml },
|
|
2001
1989
|
name: "vinicunca/toml/rules",
|
|
2002
1990
|
rules: {
|
|
2003
|
-
"style/spaced-comment":
|
|
1991
|
+
"style/spaced-comment": "off",
|
|
2004
1992
|
"toml/comma-style": ERROR,
|
|
2005
1993
|
"toml/keys-order": ERROR,
|
|
2006
1994
|
"toml/no-space-dots": ERROR,
|
|
@@ -2009,7 +1997,7 @@ async function toml(options = {}) {
|
|
|
2009
1997
|
"toml/precision-of-integer": ERROR,
|
|
2010
1998
|
"toml/tables-order": ERROR,
|
|
2011
1999
|
"toml/vue-custom-block/no-parsing-error": ERROR,
|
|
2012
|
-
...stylistic
|
|
2000
|
+
...stylistic ? {
|
|
2013
2001
|
"toml/array-bracket-newline": ERROR,
|
|
2014
2002
|
"toml/array-bracket-spacing": ERROR,
|
|
2015
2003
|
"toml/array-element-newline": ERROR,
|
|
@@ -2026,23 +2014,22 @@ async function toml(options = {}) {
|
|
|
2026
2014
|
}
|
|
2027
2015
|
}];
|
|
2028
2016
|
}
|
|
2029
|
-
|
|
2030
2017
|
//#endregion
|
|
2031
2018
|
//#region src/configs/typescript.ts
|
|
2032
2019
|
async function typescript(options = {}) {
|
|
2033
2020
|
const { componentExts = [], erasableOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
2034
2021
|
const files = options.files ?? [
|
|
2035
|
-
|
|
2036
|
-
|
|
2022
|
+
"**/*.?([cm])ts",
|
|
2023
|
+
"**/*.?([cm])tsx",
|
|
2037
2024
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2038
2025
|
];
|
|
2039
|
-
const filesTypeAware = options.filesTypeAware ?? [
|
|
2040
|
-
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
2026
|
+
const filesTypeAware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
|
|
2027
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`, "**/*.astro/*.ts"];
|
|
2041
2028
|
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
2042
2029
|
const isTypeAware = !!tsconfigPath;
|
|
2043
2030
|
const typeAwareRules = {
|
|
2044
|
-
"dot-notation":
|
|
2045
|
-
"no-implied-eval":
|
|
2031
|
+
"dot-notation": "off",
|
|
2032
|
+
"no-implied-eval": "off",
|
|
2046
2033
|
"ts/await-thenable": ERROR,
|
|
2047
2034
|
"ts/dot-notation": [ERROR, { allowKeywords: true }],
|
|
2048
2035
|
"ts/no-floating-promises": ERROR,
|
|
@@ -2067,10 +2054,10 @@ async function typescript(options = {}) {
|
|
|
2067
2054
|
"ts/unbound-method": ERROR
|
|
2068
2055
|
};
|
|
2069
2056
|
const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
2070
|
-
function makeParser({ files
|
|
2057
|
+
function makeParser({ files, ignores, typeAware }) {
|
|
2071
2058
|
return {
|
|
2072
|
-
files
|
|
2073
|
-
...ignores
|
|
2059
|
+
files,
|
|
2060
|
+
...ignores ? { ignores } : {},
|
|
2074
2061
|
languageOptions: {
|
|
2075
2062
|
parser: parserTs,
|
|
2076
2063
|
parserOptions: {
|
|
@@ -2114,10 +2101,10 @@ async function typescript(options = {}) {
|
|
|
2114
2101
|
rules: {
|
|
2115
2102
|
...renameRules(pluginTs.configs["eslint-recommended"].overrides[0].rules, { "@typescript-eslint": "ts" }),
|
|
2116
2103
|
...renameRules(pluginTs.configs.strict.rules, { "@typescript-eslint": "ts" }),
|
|
2117
|
-
"no-dupe-class-members":
|
|
2118
|
-
"no-redeclare":
|
|
2119
|
-
"no-use-before-define":
|
|
2120
|
-
"no-useless-constructor":
|
|
2104
|
+
"no-dupe-class-members": "off",
|
|
2105
|
+
"no-redeclare": "off",
|
|
2106
|
+
"no-use-before-define": "off",
|
|
2107
|
+
"no-useless-constructor": "off",
|
|
2121
2108
|
"ts/array-type": [ERROR, { default: "generic" }],
|
|
2122
2109
|
"ts/ban-ts-comment": [ERROR, { "ts-expect-error": "allow-with-description" }],
|
|
2123
2110
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
@@ -2126,19 +2113,19 @@ async function typescript(options = {}) {
|
|
|
2126
2113
|
fixStyle: "separate-type-imports",
|
|
2127
2114
|
prefer: "type-imports"
|
|
2128
2115
|
}],
|
|
2129
|
-
"ts/explicit-member-accessibility":
|
|
2130
|
-
"ts/explicit-module-boundary-types":
|
|
2116
|
+
"ts/explicit-member-accessibility": "off",
|
|
2117
|
+
"ts/explicit-module-boundary-types": "off",
|
|
2131
2118
|
"ts/method-signature-style": [ERROR, "property"],
|
|
2132
|
-
"ts/naming-convention":
|
|
2119
|
+
"ts/naming-convention": "off",
|
|
2133
2120
|
"ts/no-dupe-class-members": ERROR,
|
|
2134
|
-
"ts/no-empty-function":
|
|
2121
|
+
"ts/no-empty-function": "off",
|
|
2135
2122
|
"ts/no-empty-object-type": [ERROR, { allowInterfaces: "always" }],
|
|
2136
|
-
"ts/no-explicit-any":
|
|
2137
|
-
"ts/no-extraneous-class":
|
|
2123
|
+
"ts/no-explicit-any": "off",
|
|
2124
|
+
"ts/no-extraneous-class": "off",
|
|
2138
2125
|
"ts/no-import-type-side-effects": ERROR,
|
|
2139
2126
|
"ts/no-invalid-this": ERROR,
|
|
2140
|
-
"ts/no-invalid-void-type":
|
|
2141
|
-
"ts/no-non-null-assertion":
|
|
2127
|
+
"ts/no-invalid-void-type": "off",
|
|
2128
|
+
"ts/no-non-null-assertion": "off",
|
|
2142
2129
|
"ts/no-redeclare": [ERROR, { builtinGlobals: false }],
|
|
2143
2130
|
"ts/no-require-imports": ERROR,
|
|
2144
2131
|
"ts/no-unused-expressions": [ERROR, {
|
|
@@ -2157,8 +2144,8 @@ async function typescript(options = {}) {
|
|
|
2157
2144
|
functions: false,
|
|
2158
2145
|
variables: true
|
|
2159
2146
|
}],
|
|
2160
|
-
"ts/parameter-properties":
|
|
2161
|
-
"ts/triple-slash-reference":
|
|
2147
|
+
"ts/parameter-properties": "off",
|
|
2148
|
+
"ts/triple-slash-reference": "off",
|
|
2162
2149
|
...type === "lib" ? { "ts/explicit-function-return-type": [ERROR, {
|
|
2163
2150
|
allowExpressions: true,
|
|
2164
2151
|
allowHigherOrderFunctions: true,
|
|
@@ -2178,7 +2165,7 @@ async function typescript(options = {}) {
|
|
|
2178
2165
|
}] : [],
|
|
2179
2166
|
...erasableOnly ? [{
|
|
2180
2167
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2181
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2168
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-D3Kr7UIJ.mjs")) },
|
|
2182
2169
|
rules: {
|
|
2183
2170
|
"erasable-syntax-only/enums": ERROR,
|
|
2184
2171
|
"erasable-syntax-only/import-aliases": ERROR,
|
|
@@ -2188,7 +2175,6 @@ async function typescript(options = {}) {
|
|
|
2188
2175
|
}] : []
|
|
2189
2176
|
];
|
|
2190
2177
|
}
|
|
2191
|
-
|
|
2192
2178
|
//#endregion
|
|
2193
2179
|
//#region src/configs/unicorn.ts
|
|
2194
2180
|
async function unicorn(options = {}) {
|
|
@@ -2213,7 +2199,6 @@ async function unicorn(options = {}) {
|
|
|
2213
2199
|
} }
|
|
2214
2200
|
}];
|
|
2215
2201
|
}
|
|
2216
|
-
|
|
2217
2202
|
//#endregion
|
|
2218
2203
|
//#region src/configs/unocss.ts
|
|
2219
2204
|
async function unocss(options = {}) {
|
|
@@ -2231,13 +2216,12 @@ async function unocss(options = {}) {
|
|
|
2231
2216
|
settings: { unocss: { configPath } }
|
|
2232
2217
|
}];
|
|
2233
2218
|
}
|
|
2234
|
-
|
|
2235
2219
|
//#endregion
|
|
2236
2220
|
//#region src/configs/vue.ts
|
|
2237
2221
|
async function vue(options = {}) {
|
|
2238
|
-
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic
|
|
2222
|
+
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic = true } = options;
|
|
2239
2223
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
2240
|
-
const { indent = 2 } = e$2(stylistic
|
|
2224
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
2241
2225
|
if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
|
|
2242
2226
|
const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
|
|
2243
2227
|
interopDefault(import("eslint-plugin-vue")),
|
|
@@ -2300,9 +2284,9 @@ async function vue(options = {}) {
|
|
|
2300
2284
|
...acc,
|
|
2301
2285
|
...c
|
|
2302
2286
|
}), {}),
|
|
2303
|
-
"antfu/no-top-level-await":
|
|
2304
|
-
"node/prefer-global/process":
|
|
2305
|
-
"ts/explicit-function-return-type":
|
|
2287
|
+
"antfu/no-top-level-await": "off",
|
|
2288
|
+
"node/prefer-global/process": "off",
|
|
2289
|
+
"ts/explicit-function-return-type": "off",
|
|
2306
2290
|
"vue/block-order": [ERROR, { order: [
|
|
2307
2291
|
"script",
|
|
2308
2292
|
"template",
|
|
@@ -2310,7 +2294,7 @@ async function vue(options = {}) {
|
|
|
2310
2294
|
] }],
|
|
2311
2295
|
"vue/component-name-in-template-casing": [ERROR, "PascalCase"],
|
|
2312
2296
|
"vue/component-options-name-casing": [ERROR, "PascalCase"],
|
|
2313
|
-
"vue/component-tags-order":
|
|
2297
|
+
"vue/component-tags-order": "off",
|
|
2314
2298
|
"vue/custom-event-name-casing": [
|
|
2315
2299
|
ERROR,
|
|
2316
2300
|
"camelCase",
|
|
@@ -2328,9 +2312,9 @@ async function vue(options = {}) {
|
|
|
2328
2312
|
"vue/html-indent": [ERROR, indent],
|
|
2329
2313
|
"vue/html-quotes": [ERROR, "double"],
|
|
2330
2314
|
"vue/max-attributes-per-line": [ERROR],
|
|
2331
|
-
"vue/multi-word-component-names":
|
|
2315
|
+
"vue/multi-word-component-names": "off",
|
|
2332
2316
|
"vue/no-constant-condition": WARN,
|
|
2333
|
-
"vue/no-dupe-keys":
|
|
2317
|
+
"vue/no-dupe-keys": "off",
|
|
2334
2318
|
"vue/no-empty-pattern": ERROR,
|
|
2335
2319
|
"vue/no-irregular-whitespace": ERROR,
|
|
2336
2320
|
"vue/no-loss-of-precision": ERROR,
|
|
@@ -2341,12 +2325,12 @@ async function vue(options = {}) {
|
|
|
2341
2325
|
"WithStatement"
|
|
2342
2326
|
],
|
|
2343
2327
|
"vue/no-restricted-v-bind": [ERROR, "/^v-/"],
|
|
2344
|
-
"vue/no-setup-props-reactivity-loss":
|
|
2328
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
2345
2329
|
"vue/no-sparse-arrays": ERROR,
|
|
2346
2330
|
"vue/no-unused-refs": ERROR,
|
|
2347
2331
|
"vue/no-useless-v-bind": ERROR,
|
|
2348
|
-
"vue/no-v-html":
|
|
2349
|
-
"vue/no-v-text-v-html-on-component":
|
|
2332
|
+
"vue/no-v-html": "off",
|
|
2333
|
+
"vue/no-v-text-v-html-on-component": "off",
|
|
2350
2334
|
"vue/object-shorthand": [
|
|
2351
2335
|
ERROR,
|
|
2352
2336
|
ALWAYS,
|
|
@@ -2355,18 +2339,18 @@ async function vue(options = {}) {
|
|
|
2355
2339
|
ignoreConstructors: false
|
|
2356
2340
|
}
|
|
2357
2341
|
],
|
|
2358
|
-
"vue/prefer-import-from-vue":
|
|
2342
|
+
"vue/prefer-import-from-vue": "off",
|
|
2359
2343
|
"vue/prefer-separate-static-class": ERROR,
|
|
2360
2344
|
"vue/prefer-template": ERROR,
|
|
2361
2345
|
"vue/prop-name-casing": [ERROR, "camelCase"],
|
|
2362
|
-
"vue/require-default-prop":
|
|
2363
|
-
"vue/require-prop-types":
|
|
2346
|
+
"vue/require-default-prop": "off",
|
|
2347
|
+
"vue/require-prop-types": "off",
|
|
2364
2348
|
"vue/space-infix-ops": ERROR,
|
|
2365
2349
|
"vue/space-unary-ops": [ERROR, {
|
|
2366
2350
|
nonwords: false,
|
|
2367
2351
|
words: true
|
|
2368
2352
|
}],
|
|
2369
|
-
...stylistic
|
|
2353
|
+
...stylistic ? {
|
|
2370
2354
|
"vue/array-bracket-spacing": [ERROR, NEVER],
|
|
2371
2355
|
"vue/arrow-spacing": [ERROR, {
|
|
2372
2356
|
after: true,
|
|
@@ -2441,12 +2425,11 @@ async function vue(options = {}) {
|
|
|
2441
2425
|
}
|
|
2442
2426
|
}];
|
|
2443
2427
|
}
|
|
2444
|
-
|
|
2445
2428
|
//#endregion
|
|
2446
2429
|
//#region src/configs/yaml.ts
|
|
2447
2430
|
async function yaml(options = {}) {
|
|
2448
|
-
const { files = [GLOB_YAML], overrides = {}, stylistic
|
|
2449
|
-
const { indent = 2, quotes = "single" } = e$2(stylistic
|
|
2431
|
+
const { files = [GLOB_YAML], overrides = {}, stylistic = true } = options;
|
|
2432
|
+
const { indent = 2, quotes = "single" } = e$2(stylistic) ? {} : stylistic;
|
|
2450
2433
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
2451
2434
|
return [{
|
|
2452
2435
|
name: "vinicunca/yaml/setup",
|
|
@@ -2456,7 +2439,7 @@ async function yaml(options = {}) {
|
|
|
2456
2439
|
languageOptions: { parser: parserYaml },
|
|
2457
2440
|
name: "vinicunca/yaml/rules",
|
|
2458
2441
|
rules: {
|
|
2459
|
-
"style/spaced-comment":
|
|
2442
|
+
"style/spaced-comment": "off",
|
|
2460
2443
|
"yaml/block-mapping": ERROR,
|
|
2461
2444
|
"yaml/block-sequence": ERROR,
|
|
2462
2445
|
"yaml/no-empty-key": ERROR,
|
|
@@ -2464,7 +2447,7 @@ async function yaml(options = {}) {
|
|
|
2464
2447
|
"yaml/no-irregular-whitespace": ERROR,
|
|
2465
2448
|
"yaml/plain-scalar": ERROR,
|
|
2466
2449
|
"yaml/vue-custom-block/no-parsing-error": ERROR,
|
|
2467
|
-
...stylistic
|
|
2450
|
+
...stylistic ? {
|
|
2468
2451
|
"yaml/block-mapping-question-indicator-newline": ERROR,
|
|
2469
2452
|
"yaml/block-sequence-hyphen-indicator-newline": ERROR,
|
|
2470
2453
|
"yaml/flow-mapping-curly-newline": ERROR,
|
|
@@ -2484,7 +2467,6 @@ async function yaml(options = {}) {
|
|
|
2484
2467
|
}
|
|
2485
2468
|
}];
|
|
2486
2469
|
}
|
|
2487
|
-
|
|
2488
2470
|
//#endregion
|
|
2489
2471
|
//#region src/base.ts
|
|
2490
2472
|
const flatConfigProps = [
|
|
@@ -2527,7 +2509,7 @@ const defaultPluginRenaming = {
|
|
|
2527
2509
|
* The merged ESLint configurations.
|
|
2528
2510
|
*/
|
|
2529
2511
|
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
2530
|
-
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2512
|
+
const { astro: enableAstro = false, autoRenamePlugins = true, componentExts = [], e18e: enableE18e = true, gitignore: enableGitignore = true, ignores: userIgnores = [], imports: enableImports = true, jsdoc: enableJsdoc = true, jsx: enableJsx = true, nextjs: enableNextjs = false, node: enableNode = true, pnpm: enableCatalogs = !!findUpSync("pnpm-workspace.yaml"), react: enableReact = false, regexp: enableRegexp = true, solid: enableSolid = false, svelte: enableSvelte = false, type: appType = "app", typescript: enableTypeScript = isPackageExists("typescript"), unicorn: enableUnicorn = true, unocss: enableUnoCSS = false, vue: enableVue = VuePackages.some((i) => isPackageExists(i)) } = options;
|
|
2531
2513
|
let isInEditor = options.isInEditor;
|
|
2532
2514
|
if (isInEditor == null) {
|
|
2533
2515
|
isInEditor = isInEditorEnv();
|
|
@@ -2535,104 +2517,108 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2535
2517
|
}
|
|
2536
2518
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2537
2519
|
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = typeof enableJsx === "object" ? true : enableJsx;
|
|
2538
|
-
const configs
|
|
2539
|
-
if (enableGitignore) if (!e$2(enableGitignore)) configs
|
|
2520
|
+
const configs = [];
|
|
2521
|
+
if (enableGitignore) if (!e$2(enableGitignore)) configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2540
2522
|
name: "vinicunca/gitignore",
|
|
2541
2523
|
...enableGitignore
|
|
2542
2524
|
})]));
|
|
2543
|
-
else configs
|
|
2525
|
+
else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2544
2526
|
name: "vinicunca/gitignore",
|
|
2545
2527
|
strict: false
|
|
2546
2528
|
})]));
|
|
2547
2529
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2548
2530
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2549
|
-
configs
|
|
2531
|
+
configs.push(ignores(userIgnores), javascript({
|
|
2550
2532
|
isInEditor,
|
|
2551
2533
|
overrides: getOverrides(options, "javascript")
|
|
2552
2534
|
}), comments(), imports({ stylistic: stylisticOptions }), command(), perfectionist(), sonar());
|
|
2553
|
-
if (enableNode) configs
|
|
2554
|
-
if (enableJsdoc) configs
|
|
2555
|
-
if (enableImports) configs
|
|
2535
|
+
if (enableNode) configs.push(node());
|
|
2536
|
+
if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
|
|
2537
|
+
if (enableImports) configs.push(imports({
|
|
2556
2538
|
stylistic: stylisticOptions,
|
|
2557
2539
|
...resolveSubOptions(options, "imports")
|
|
2558
2540
|
}));
|
|
2559
|
-
if (
|
|
2541
|
+
if (enableE18e) configs.push(e18e({
|
|
2542
|
+
isInEditor,
|
|
2543
|
+
...enableE18e === true ? {} : enableE18e
|
|
2544
|
+
}));
|
|
2545
|
+
if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2560
2546
|
if (enableVue) componentExts.push("vue");
|
|
2561
|
-
if (enableJsx) configs
|
|
2562
|
-
if (enableTypeScript) configs
|
|
2547
|
+
if (enableJsx) configs.push(jsx(enableJsx === true ? {} : enableJsx));
|
|
2548
|
+
if (enableTypeScript) configs.push(typescript({
|
|
2563
2549
|
...typescriptOptions,
|
|
2564
2550
|
componentExts,
|
|
2565
2551
|
overrides: getOverrides(options, "typescript"),
|
|
2566
|
-
type:
|
|
2552
|
+
type: appType
|
|
2567
2553
|
}));
|
|
2568
|
-
if (stylisticOptions) configs
|
|
2554
|
+
if (stylisticOptions) configs.push(stylistic({
|
|
2569
2555
|
...stylisticOptions,
|
|
2570
2556
|
lessOpinionated: options.lessOpinionated,
|
|
2571
2557
|
overrides: getOverrides(options, "stylistic")
|
|
2572
2558
|
}));
|
|
2573
|
-
if (enableRegexp) configs
|
|
2574
|
-
if (options.test ?? true) configs
|
|
2559
|
+
if (enableRegexp) configs.push(regexp(e$2(enableRegexp) ? {} : enableRegexp));
|
|
2560
|
+
if (options.test ?? true) configs.push(test({
|
|
2575
2561
|
isInEditor,
|
|
2576
2562
|
overrides: getOverrides(options, "test")
|
|
2577
2563
|
}));
|
|
2578
|
-
if (enableVue) configs
|
|
2564
|
+
if (enableVue) configs.push(vue({
|
|
2579
2565
|
...resolveSubOptions(options, "vue"),
|
|
2580
2566
|
overrides: getOverrides(options, "vue"),
|
|
2581
2567
|
stylistic: stylisticOptions,
|
|
2582
2568
|
typescript: !!enableTypeScript
|
|
2583
2569
|
}));
|
|
2584
|
-
if (enableReact) configs
|
|
2570
|
+
if (enableReact) configs.push(react({
|
|
2585
2571
|
...typescriptOptions,
|
|
2586
2572
|
...resolveSubOptions(options, "react"),
|
|
2587
2573
|
overrides: getOverrides(options, "react"),
|
|
2588
2574
|
tsconfigPath
|
|
2589
2575
|
}));
|
|
2590
|
-
if (enableNextjs) configs
|
|
2591
|
-
if (enableSolid) configs
|
|
2576
|
+
if (enableNextjs) configs.push(nextjs({ overrides: getOverrides(options, "nextjs") }));
|
|
2577
|
+
if (enableSolid) configs.push(solid({
|
|
2592
2578
|
overrides: getOverrides(options, "solid"),
|
|
2593
2579
|
tsconfigPath,
|
|
2594
2580
|
typescript: !!enableTypeScript
|
|
2595
2581
|
}));
|
|
2596
|
-
if (enableSvelte) configs
|
|
2582
|
+
if (enableSvelte) configs.push(svelte({
|
|
2597
2583
|
overrides: getOverrides(options, "svelte"),
|
|
2598
2584
|
stylistic: stylisticOptions,
|
|
2599
2585
|
typescript: !!enableTypeScript
|
|
2600
2586
|
}));
|
|
2601
|
-
if (enableUnoCSS) configs
|
|
2587
|
+
if (enableUnoCSS) configs.push(unocss({
|
|
2602
2588
|
...resolveSubOptions(options, "unocss"),
|
|
2603
2589
|
overrides: getOverrides(options, "unocss")
|
|
2604
2590
|
}));
|
|
2605
|
-
if (enableAstro) configs
|
|
2591
|
+
if (enableAstro) configs.push(astro({
|
|
2606
2592
|
overrides: getOverrides(options, "astro"),
|
|
2607
2593
|
stylistic: stylisticOptions
|
|
2608
2594
|
}));
|
|
2609
|
-
if (options.jsonc ?? true) configs
|
|
2595
|
+
if (options.jsonc ?? true) configs.push(jsonc({
|
|
2610
2596
|
overrides: getOverrides(options, "jsonc"),
|
|
2611
2597
|
stylistic: stylisticOptions
|
|
2612
2598
|
}), sortPackageJson(), sortTsconfig());
|
|
2613
2599
|
if (enableCatalogs) {
|
|
2614
2600
|
const optionsPnpm = resolveSubOptions(options, "pnpm");
|
|
2615
|
-
configs
|
|
2601
|
+
configs.push(pnpm({
|
|
2616
2602
|
isInEditor,
|
|
2617
2603
|
json: options.jsonc !== false,
|
|
2618
2604
|
yaml: options.yaml !== false,
|
|
2619
2605
|
...optionsPnpm
|
|
2620
2606
|
}));
|
|
2621
2607
|
}
|
|
2622
|
-
if (options.yaml ?? true) configs
|
|
2608
|
+
if (options.yaml ?? true) configs.push(yaml({
|
|
2623
2609
|
overrides: getOverrides(options, "yaml"),
|
|
2624
2610
|
stylistic: stylisticOptions
|
|
2625
2611
|
}));
|
|
2626
|
-
if (options.toml ?? true) configs
|
|
2612
|
+
if (options.toml ?? true) configs.push(toml({
|
|
2627
2613
|
overrides: getOverrides(options, "toml"),
|
|
2628
2614
|
stylistic: stylisticOptions
|
|
2629
2615
|
}));
|
|
2630
|
-
if (options.markdown ?? true) configs
|
|
2616
|
+
if (options.markdown ?? true) configs.push(markdown({
|
|
2631
2617
|
componentExts,
|
|
2632
2618
|
overrides: getOverrides(options, "markdown")
|
|
2633
2619
|
}));
|
|
2634
|
-
if (options.formatters) configs
|
|
2635
|
-
configs
|
|
2620
|
+
if (options.formatters) configs.push(formatters(options.formatters, e$2(stylisticOptions) ? {} : stylisticOptions));
|
|
2621
|
+
configs.push(disables());
|
|
2636
2622
|
if ("files" in options) throw new Error("[@vinicunca/eslint-config] The first argument should not contain the \"files\" property as the options are supposed to be global. Place it in the second or later config instead.");
|
|
2637
2623
|
/**
|
|
2638
2624
|
* User can optionally pass a flat config item to the first argument.
|
|
@@ -2642,9 +2628,9 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2642
2628
|
if (key in options) acc[key] = options[key];
|
|
2643
2629
|
return acc;
|
|
2644
2630
|
}, {});
|
|
2645
|
-
if (Object.keys(fusedConfig).length) configs
|
|
2631
|
+
if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
|
|
2646
2632
|
let composer = new FlatConfigComposer();
|
|
2647
|
-
composer = composer.append(...configs
|
|
2633
|
+
composer = composer.append(...configs, ...userConfigs);
|
|
2648
2634
|
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2649
2635
|
if (isInEditor) composer = composer.disableRulesFix([
|
|
2650
2636
|
"unused-imports/no-unused-imports",
|
|
@@ -2660,6 +2646,5 @@ function getOverrides(options, key) {
|
|
|
2660
2646
|
function resolveSubOptions(options, key) {
|
|
2661
2647
|
return e$2(options[key]) ? {} : options[key] || {};
|
|
2662
2648
|
}
|
|
2663
|
-
|
|
2664
2649
|
//#endregion
|
|
2665
|
-
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, disables, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
|
|
2650
|
+
export { GLOB_ALL_SRC, GLOB_ASTRO, GLOB_ASTRO_TS, GLOB_CSS, GLOB_EXCLUDE, GLOB_GRAPHQL, GLOB_HTML, GLOB_JS, GLOB_JSON, GLOB_JSON5, GLOB_JSONC, GLOB_JSX, GLOB_LESS, GLOB_MARKDOWN, GLOB_MARKDOWN_CODE, GLOB_MARKDOWN_IN_MARKDOWN, GLOB_POSTCSS, GLOB_SCSS, GLOB_SRC, GLOB_SRC_EXT, GLOB_STYLE, GLOB_SVELTE, GLOB_SVG, GLOB_TESTS, GLOB_TOML, GLOB_TS, GLOB_TSX, GLOB_VUE, GLOB_XML, GLOB_YAML, STYLISTIC_CONFIG_DEFAULTS, astro, combineConfigs, command, comments, defaultPluginRenaming, disables, e18e, ensurePackages, formatters, ignores, imports, interopDefault, isInEditorEnv, isInGitHooksOrLintStaged, isPackageInScope, javascript, jsdoc, jsonc, jsx, markdown, nextjs, node, parserPlain, perfectionist, pluginAntfu, pluginComments, pluginE18e, pluginImportLite, pluginNode, pluginPerfectionist, pluginSonar, pluginUnicorn, pluginUnusedImports, pnpm, react, regexp, renamePluginInConfigs, renameRules, solid, sonar, sortPackageJson, sortTsconfig, stylistic, svelte, test, toArray, toml, typescript, unicorn, unocss, vinicuncaESLint, vue, yaml };
|