@vinicunca/eslint-config 4.9.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 +996 -1965
- package/dist/index.mjs +230 -265
- package/dist/{lib-BY1orQVd.mjs → lib-D3Kr7UIJ.mjs} +340 -631
- package/package.json +22 -9
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { FlatConfigComposer } from "eslint-flat-config-utils";
|
|
2
2
|
import process from "node:process";
|
|
3
|
-
import
|
|
3
|
+
import fs from "node:fs/promises";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
|
-
import fs from "node:fs";
|
|
5
|
+
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";
|
|
@@ -18,24 +18,20 @@ import pluginUnusedImports from "eslint-plugin-unused-imports";
|
|
|
18
18
|
import globals from "globals";
|
|
19
19
|
import { mergeProcessors, processorPassThrough } from "eslint-merge-processors";
|
|
20
20
|
import { configs } from "eslint-plugin-regexp";
|
|
21
|
-
|
|
22
21
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-boolean.js
|
|
23
|
-
function e$2(e
|
|
24
|
-
return typeof e
|
|
22
|
+
function e$2(e) {
|
|
23
|
+
return typeof e == `boolean`;
|
|
25
24
|
}
|
|
26
|
-
|
|
27
25
|
//#endregion
|
|
28
26
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-function.js
|
|
29
|
-
function e$1(e
|
|
30
|
-
return typeof e
|
|
27
|
+
function e$1(e) {
|
|
28
|
+
return typeof e == `function`;
|
|
31
29
|
}
|
|
32
|
-
|
|
33
30
|
//#endregion
|
|
34
31
|
//#region node_modules/.pnpm/@vinicunca+perkakas@1.13.2/node_modules/@vinicunca/perkakas/dist/is-number.js
|
|
35
|
-
function e(e
|
|
36
|
-
return typeof e
|
|
32
|
+
function e(e) {
|
|
33
|
+
return typeof e == `number` && !Number.isNaN(e);
|
|
37
34
|
}
|
|
38
|
-
|
|
39
35
|
//#endregion
|
|
40
36
|
//#region node_modules/.pnpm/find-up-simple@1.0.1/node_modules/find-up-simple/index.js
|
|
41
37
|
const toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
|
|
@@ -47,7 +43,7 @@ async function findUp(name, { cwd = process.cwd(), type = "file", stopAt } = {})
|
|
|
47
43
|
while (directory) {
|
|
48
44
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
49
45
|
try {
|
|
50
|
-
const stats = await
|
|
46
|
+
const stats = await fs.stat(filePath);
|
|
51
47
|
if (type === "file" && stats.isFile() || type === "directory" && stats.isDirectory()) return filePath;
|
|
52
48
|
} catch {}
|
|
53
49
|
if (directory === stopAt || directory === root) break;
|
|
@@ -62,23 +58,20 @@ function findUpSync(name, { cwd = process.cwd(), type = "file", stopAt } = {}) {
|
|
|
62
58
|
while (directory) {
|
|
63
59
|
const filePath = isAbsoluteName ? name : path.join(directory, name);
|
|
64
60
|
try {
|
|
65
|
-
const stats = fs.statSync(filePath, { throwIfNoEntry: false });
|
|
61
|
+
const stats = fs$1.statSync(filePath, { throwIfNoEntry: false });
|
|
66
62
|
if (type === "file" && stats?.isFile() || type === "directory" && stats?.isDirectory()) return filePath;
|
|
67
63
|
} catch {}
|
|
68
64
|
if (directory === stopAt || directory === root) break;
|
|
69
65
|
directory = path.dirname(directory);
|
|
70
66
|
}
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
//#endregion
|
|
74
69
|
//#region src/flags.ts
|
|
75
70
|
const ERROR = "error";
|
|
76
|
-
const OFF = "off";
|
|
77
71
|
const WARN = "warn";
|
|
78
72
|
const CONSISTENT = "consistent";
|
|
79
73
|
const NEVER = "never";
|
|
80
74
|
const ALWAYS = "always";
|
|
81
|
-
|
|
82
75
|
//#endregion
|
|
83
76
|
//#region src/globs.ts
|
|
84
77
|
const GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -160,7 +153,6 @@ const GLOB_EXCLUDE = [
|
|
|
160
153
|
"**/auto-import?(s).d.ts",
|
|
161
154
|
"**/components.d.ts"
|
|
162
155
|
];
|
|
163
|
-
|
|
164
156
|
//#endregion
|
|
165
157
|
//#region src/utils.ts
|
|
166
158
|
const scopeUrl = fileURLToPath(new URL(".", import.meta.url));
|
|
@@ -187,8 +179,8 @@ const parserPlain = {
|
|
|
187
179
|
/**
|
|
188
180
|
* Combine array and non-array configs into a single array.
|
|
189
181
|
*/
|
|
190
|
-
async function combineConfigs(...configs
|
|
191
|
-
return (await Promise.all(configs
|
|
182
|
+
async function combineConfigs(...configs) {
|
|
183
|
+
return (await Promise.all(configs)).flat();
|
|
192
184
|
}
|
|
193
185
|
/**
|
|
194
186
|
* Rename plugin prefixes in a rule object.
|
|
@@ -228,8 +220,8 @@ function renameRules(rules, map) {
|
|
|
228
220
|
* })
|
|
229
221
|
* ```
|
|
230
222
|
*/
|
|
231
|
-
function renamePluginInConfigs(configs
|
|
232
|
-
return configs
|
|
223
|
+
function renamePluginInConfigs(configs, map) {
|
|
224
|
+
return configs.map((i) => {
|
|
233
225
|
const clone = { ...i };
|
|
234
226
|
if (clone.rules) clone.rules = renameRules(clone.rules, map);
|
|
235
227
|
if (clone.plugins) clone.plugins = Object.fromEntries(Object.entries(clone.plugins).map(([key, value]) => {
|
|
@@ -263,11 +255,10 @@ function isInEditorEnv() {
|
|
|
263
255
|
function isInGitHooksOrLintStaged() {
|
|
264
256
|
return !!(process.env.GIT_PARAMS || process.env.VSCODE_GIT_COMMAND || process.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
265
257
|
}
|
|
266
|
-
|
|
267
258
|
//#endregion
|
|
268
259
|
//#region src/configs/astro.ts
|
|
269
260
|
async function astro(options = {}) {
|
|
270
|
-
const { files = [GLOB_ASTRO], overrides = {}, stylistic
|
|
261
|
+
const { files = [GLOB_ASTRO], overrides = {}, stylistic = true } = options;
|
|
271
262
|
const [pluginAstro, parserAstro, parserTs] = await Promise.all([
|
|
272
263
|
interopDefault(import("eslint-plugin-astro")),
|
|
273
264
|
interopDefault(import("astro-eslint-parser")),
|
|
@@ -290,28 +281,27 @@ async function astro(options = {}) {
|
|
|
290
281
|
name: "vinicunca/astro/rules",
|
|
291
282
|
processor: "astro/client-side-ts",
|
|
292
283
|
rules: {
|
|
293
|
-
"antfu/no-top-level-await":
|
|
284
|
+
"antfu/no-top-level-await": "off",
|
|
294
285
|
"astro/missing-client-only-directive-value": ERROR,
|
|
295
286
|
"astro/no-conflict-set-directives": ERROR,
|
|
296
287
|
"astro/no-deprecated-astro-canonicalurl": ERROR,
|
|
297
288
|
"astro/no-deprecated-astro-fetchcontent": ERROR,
|
|
298
289
|
"astro/no-deprecated-astro-resolve": ERROR,
|
|
299
290
|
"astro/no-deprecated-getentrybyslug": ERROR,
|
|
300
|
-
"astro/no-set-html-directive":
|
|
291
|
+
"astro/no-set-html-directive": "off",
|
|
301
292
|
"astro/no-unused-define-vars-in-style": ERROR,
|
|
302
|
-
"astro/semi":
|
|
293
|
+
"astro/semi": "off",
|
|
303
294
|
"astro/valid-compile": ERROR,
|
|
304
|
-
...stylistic
|
|
305
|
-
"style/indent":
|
|
306
|
-
"style/jsx-closing-tag-location":
|
|
307
|
-
"style/jsx-one-expression-per-line":
|
|
308
|
-
"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"
|
|
309
300
|
} : {},
|
|
310
301
|
...overrides
|
|
311
302
|
}
|
|
312
303
|
}];
|
|
313
304
|
}
|
|
314
|
-
|
|
315
305
|
//#endregion
|
|
316
306
|
//#region src/configs/command.ts
|
|
317
307
|
async function command() {
|
|
@@ -320,7 +310,6 @@ async function command() {
|
|
|
320
310
|
name: "vinicunca/command/rules"
|
|
321
311
|
}];
|
|
322
312
|
}
|
|
323
|
-
|
|
324
313
|
//#endregion
|
|
325
314
|
//#region src/configs/comments.ts
|
|
326
315
|
async function comments() {
|
|
@@ -335,7 +324,6 @@ async function comments() {
|
|
|
335
324
|
}
|
|
336
325
|
}];
|
|
337
326
|
}
|
|
338
|
-
|
|
339
327
|
//#endregion
|
|
340
328
|
//#region src/configs/disables.ts
|
|
341
329
|
async function disables() {
|
|
@@ -344,70 +332,72 @@ async function disables() {
|
|
|
344
332
|
files: [`**/scripts/${GLOB_SRC}`],
|
|
345
333
|
name: "vinicunca/disables/scripts",
|
|
346
334
|
rules: {
|
|
347
|
-
"antfu/no-top-level-await":
|
|
348
|
-
"no-console":
|
|
349
|
-
"ts/explicit-function-return-type":
|
|
335
|
+
"antfu/no-top-level-await": "off",
|
|
336
|
+
"no-console": "off",
|
|
337
|
+
"ts/explicit-function-return-type": "off"
|
|
350
338
|
}
|
|
351
339
|
},
|
|
352
340
|
{
|
|
353
341
|
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
354
342
|
name: "vinicunca/disables/cli",
|
|
355
343
|
rules: {
|
|
356
|
-
"antfu/no-top-level-await":
|
|
357
|
-
"no-console":
|
|
344
|
+
"antfu/no-top-level-await": "off",
|
|
345
|
+
"no-console": "off"
|
|
358
346
|
}
|
|
359
347
|
},
|
|
360
348
|
{
|
|
361
349
|
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
362
350
|
name: "vinicunca/disables/bin",
|
|
363
351
|
rules: {
|
|
364
|
-
"antfu/no-import-dist":
|
|
365
|
-
"antfu/no-import-node-modules-by-path":
|
|
352
|
+
"antfu/no-import-dist": "off",
|
|
353
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
366
354
|
}
|
|
367
355
|
},
|
|
368
356
|
{
|
|
369
357
|
files: ["**/*.d.?([cm])ts"],
|
|
370
358
|
name: "vinicunca/disables/dts",
|
|
371
359
|
rules: {
|
|
372
|
-
"eslint-comments/no-unlimited-disable":
|
|
373
|
-
"no-restricted-syntax":
|
|
374
|
-
"unused-imports/no-unused-vars":
|
|
360
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
361
|
+
"no-restricted-syntax": "off",
|
|
362
|
+
"unused-imports/no-unused-vars": "off"
|
|
375
363
|
}
|
|
376
364
|
},
|
|
377
365
|
{
|
|
378
366
|
files: ["**/*.js", "**/*.cjs"],
|
|
379
367
|
name: "vinicunca/disables/cjs",
|
|
380
|
-
rules: { "ts/no-require-imports":
|
|
368
|
+
rules: { "ts/no-require-imports": "off" }
|
|
381
369
|
},
|
|
382
370
|
{
|
|
383
371
|
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
384
372
|
name: "vinicunca/disables/config-files",
|
|
385
373
|
rules: {
|
|
386
|
-
"antfu/no-top-level-await":
|
|
387
|
-
"no-console":
|
|
388
|
-
"ts/explicit-function-return-type":
|
|
374
|
+
"antfu/no-top-level-await": "off",
|
|
375
|
+
"no-console": "off",
|
|
376
|
+
"ts/explicit-function-return-type": "off"
|
|
389
377
|
}
|
|
390
378
|
}
|
|
391
379
|
];
|
|
392
380
|
}
|
|
393
|
-
|
|
394
381
|
//#endregion
|
|
395
382
|
//#region src/configs/e18e.ts
|
|
396
383
|
async function e18e(options = {}) {
|
|
397
|
-
const { isInEditor = false, modernization = true, moduleReplacements = isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
398
|
-
const configs
|
|
384
|
+
const { isInEditor = false, modernization = true, type = "app", moduleReplacements = type === "lib" && isInEditor, overrides = {}, performanceImprovements = true } = options;
|
|
385
|
+
const configs = pluginE18e.configs;
|
|
399
386
|
return [{
|
|
400
387
|
name: "vinicunca/e18e/rules",
|
|
401
388
|
plugins: { e18e: pluginE18e },
|
|
402
389
|
rules: {
|
|
403
|
-
...modernization ? { ...configs
|
|
404
|
-
...moduleReplacements ? { ...configs
|
|
405
|
-
...performanceImprovements ? { ...configs
|
|
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",
|
|
406
397
|
...overrides
|
|
407
398
|
}
|
|
408
399
|
}];
|
|
409
400
|
}
|
|
410
|
-
|
|
411
401
|
//#endregion
|
|
412
402
|
//#region src/configs/stylistic.ts
|
|
413
403
|
const STYLISTIC_CONFIG_DEFAULTS = {
|
|
@@ -417,7 +407,7 @@ const STYLISTIC_CONFIG_DEFAULTS = {
|
|
|
417
407
|
semi: true
|
|
418
408
|
};
|
|
419
409
|
async function stylistic(options = {}) {
|
|
420
|
-
const { experimental, indent, jsx
|
|
410
|
+
const { experimental, indent, jsx, overrides = {}, quotes, semi } = {
|
|
421
411
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
422
412
|
...options
|
|
423
413
|
};
|
|
@@ -425,7 +415,7 @@ async function stylistic(options = {}) {
|
|
|
425
415
|
const config = pluginStylistic.configs.customize({
|
|
426
416
|
experimental,
|
|
427
417
|
indent,
|
|
428
|
-
jsx
|
|
418
|
+
jsx,
|
|
429
419
|
pluginName: "style",
|
|
430
420
|
quotes,
|
|
431
421
|
semi
|
|
@@ -481,7 +471,6 @@ async function stylistic(options = {}) {
|
|
|
481
471
|
}
|
|
482
472
|
}];
|
|
483
473
|
}
|
|
484
|
-
|
|
485
474
|
//#endregion
|
|
486
475
|
//#region src/configs/formatters.ts
|
|
487
476
|
function mergePrettierOptions(options, overrides) {
|
|
@@ -491,7 +480,7 @@ function mergePrettierOptions(options, overrides) {
|
|
|
491
480
|
plugins: [...overrides.plugins || [], ...options.plugins || []]
|
|
492
481
|
};
|
|
493
482
|
}
|
|
494
|
-
async function formatters(options = {}, stylistic
|
|
483
|
+
async function formatters(options = {}, stylistic = {}) {
|
|
495
484
|
if (options === true) {
|
|
496
485
|
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
497
486
|
options = {
|
|
@@ -513,7 +502,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
513
502
|
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
514
503
|
const { indent, quotes, semi } = {
|
|
515
504
|
...STYLISTIC_CONFIG_DEFAULTS,
|
|
516
|
-
...stylistic
|
|
505
|
+
...stylistic
|
|
517
506
|
};
|
|
518
507
|
const prettierOptions = Object.assign({
|
|
519
508
|
endOfLine: "auto",
|
|
@@ -535,11 +524,11 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
535
524
|
useTabs: indent === "tab",
|
|
536
525
|
...options.dprintOptions || {}
|
|
537
526
|
};
|
|
538
|
-
const configs
|
|
527
|
+
const configs = [{
|
|
539
528
|
name: "vinicunca/formatter/setup",
|
|
540
529
|
plugins: { format: await interopDefault(import("eslint-plugin-format")) }
|
|
541
530
|
}];
|
|
542
|
-
if (options.css) configs
|
|
531
|
+
if (options.css) configs.push({
|
|
543
532
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
544
533
|
languageOptions: { parser: parserPlain },
|
|
545
534
|
name: "vinicunca/formatter/css",
|
|
@@ -555,13 +544,13 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
555
544
|
name: "vinicunca/formatter/less",
|
|
556
545
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "less" })] }
|
|
557
546
|
});
|
|
558
|
-
if (options.html) configs
|
|
547
|
+
if (options.html) configs.push({
|
|
559
548
|
files: ["**/*.html"],
|
|
560
549
|
languageOptions: { parser: parserPlain },
|
|
561
550
|
name: "vinicunca/formatter/html",
|
|
562
551
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "html" })] }
|
|
563
552
|
});
|
|
564
|
-
if (options.xml) configs
|
|
553
|
+
if (options.xml) configs.push({
|
|
565
554
|
files: [GLOB_XML],
|
|
566
555
|
languageOptions: { parser: parserPlain },
|
|
567
556
|
name: "vinicunca/formatter/xml",
|
|
@@ -573,7 +562,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
573
562
|
plugins: ["@prettier/plugin-xml"]
|
|
574
563
|
})] }
|
|
575
564
|
});
|
|
576
|
-
if (options.svg) configs
|
|
565
|
+
if (options.svg) configs.push({
|
|
577
566
|
files: [GLOB_SVG],
|
|
578
567
|
languageOptions: { parser: parserPlain },
|
|
579
568
|
name: "vinicunca/formatter/svg",
|
|
@@ -590,7 +579,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
590
579
|
let GLOB_SLIDEV;
|
|
591
580
|
if (options.slidev) GLOB_SLIDEV = options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
592
581
|
else GLOB_SLIDEV = [];
|
|
593
|
-
configs
|
|
582
|
+
configs.push({
|
|
594
583
|
files: [GLOB_MARKDOWN],
|
|
595
584
|
ignores: GLOB_SLIDEV,
|
|
596
585
|
languageOptions: { parser: parserPlain },
|
|
@@ -603,7 +592,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
603
592
|
language: "markdown"
|
|
604
593
|
}] }
|
|
605
594
|
});
|
|
606
|
-
if (options.slidev) configs
|
|
595
|
+
if (options.slidev) configs.push({
|
|
607
596
|
files: GLOB_SLIDEV,
|
|
608
597
|
languageOptions: { parser: parserPlain },
|
|
609
598
|
name: "vinicunca/formatter/slidev",
|
|
@@ -615,7 +604,7 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
615
604
|
});
|
|
616
605
|
}
|
|
617
606
|
if (options.astro) {
|
|
618
|
-
configs
|
|
607
|
+
configs.push({
|
|
619
608
|
files: [GLOB_ASTRO],
|
|
620
609
|
languageOptions: { parser: parserPlain },
|
|
621
610
|
name: "vinicunca/formatter/astro",
|
|
@@ -624,45 +613,43 @@ async function formatters(options = {}, stylistic$1 = {}) {
|
|
|
624
613
|
plugins: ["prettier-plugin-astro"]
|
|
625
614
|
})] }
|
|
626
615
|
});
|
|
627
|
-
configs
|
|
616
|
+
configs.push({
|
|
628
617
|
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
629
618
|
name: "vinicunca/formatter/astro/disables",
|
|
630
619
|
rules: {
|
|
631
|
-
"style/arrow-parens":
|
|
632
|
-
"style/block-spacing":
|
|
633
|
-
"style/comma-dangle":
|
|
634
|
-
"style/indent":
|
|
635
|
-
"style/no-multi-spaces":
|
|
636
|
-
"style/quotes":
|
|
637
|
-
"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"
|
|
638
627
|
}
|
|
639
628
|
});
|
|
640
629
|
}
|
|
641
|
-
if (options.graphql) configs
|
|
630
|
+
if (options.graphql) configs.push({
|
|
642
631
|
files: [GLOB_GRAPHQL],
|
|
643
632
|
languageOptions: { parser: parserPlain },
|
|
644
633
|
name: "vinicunca/formatter/graphql",
|
|
645
634
|
rules: { "format/prettier": [ERROR, mergePrettierOptions(prettierOptions, { parser: "graphql" })] }
|
|
646
635
|
});
|
|
647
|
-
return configs
|
|
636
|
+
return configs;
|
|
648
637
|
}
|
|
649
|
-
|
|
650
638
|
//#endregion
|
|
651
639
|
//#region src/configs/ignores.ts
|
|
652
640
|
async function ignores(userIgnores = []) {
|
|
653
|
-
let ignores
|
|
654
|
-
if (e$1(userIgnores)) ignores
|
|
655
|
-
else ignores
|
|
641
|
+
let ignores = [...GLOB_EXCLUDE];
|
|
642
|
+
if (e$1(userIgnores)) ignores = userIgnores(ignores);
|
|
643
|
+
else ignores = [...ignores, ...userIgnores];
|
|
656
644
|
return [{
|
|
657
|
-
ignores
|
|
645
|
+
ignores,
|
|
658
646
|
name: "vinicunca/ignores"
|
|
659
647
|
}];
|
|
660
648
|
}
|
|
661
|
-
|
|
662
649
|
//#endregion
|
|
663
650
|
//#region src/configs/imports.ts
|
|
664
651
|
async function imports(options = {}) {
|
|
665
|
-
const { overrides = {}, stylistic
|
|
652
|
+
const { overrides = {}, stylistic = true } = options;
|
|
666
653
|
return [{
|
|
667
654
|
name: "vinicunca/imports/rules",
|
|
668
655
|
plugins: {
|
|
@@ -678,12 +665,11 @@ async function imports(options = {}) {
|
|
|
678
665
|
"import/no-duplicates": "error",
|
|
679
666
|
"import/no-mutable-exports": "error",
|
|
680
667
|
"import/no-named-default": "error",
|
|
681
|
-
...stylistic
|
|
668
|
+
...stylistic ? { "import/newline-after-import": ["error", { count: 1 }] } : {},
|
|
682
669
|
...overrides
|
|
683
670
|
}
|
|
684
671
|
}];
|
|
685
672
|
}
|
|
686
|
-
|
|
687
673
|
//#endregion
|
|
688
674
|
//#region src/configs/javascript.ts
|
|
689
675
|
async function javascript(options = {}) {
|
|
@@ -924,11 +910,10 @@ async function javascript(options = {}) {
|
|
|
924
910
|
}
|
|
925
911
|
}];
|
|
926
912
|
}
|
|
927
|
-
|
|
928
913
|
//#endregion
|
|
929
914
|
//#region src/configs/jsdoc.ts
|
|
930
915
|
async function jsdoc(options = {}) {
|
|
931
|
-
const { stylistic
|
|
916
|
+
const { stylistic = true } = options;
|
|
932
917
|
return [{
|
|
933
918
|
name: "vinicunca/jsdoc/setup",
|
|
934
919
|
plugins: { jsdoc: await interopDefault(import("eslint-plugin-jsdoc")) }
|
|
@@ -955,14 +940,13 @@ async function jsdoc(options = {}) {
|
|
|
955
940
|
"jsdoc/require-returns-description": WARN,
|
|
956
941
|
"jsdoc/require-yields-check": WARN,
|
|
957
942
|
"jsdoc/valid-types": WARN,
|
|
958
|
-
...stylistic
|
|
943
|
+
...stylistic ? {
|
|
959
944
|
"jsdoc/check-alignment": WARN,
|
|
960
945
|
"jsdoc/multiline-blocks": WARN
|
|
961
946
|
} : {}
|
|
962
947
|
}
|
|
963
948
|
}];
|
|
964
949
|
}
|
|
965
|
-
|
|
966
950
|
//#endregion
|
|
967
951
|
//#region src/configs/jsonc.ts
|
|
968
952
|
async function jsonc(options = {}) {
|
|
@@ -970,8 +954,8 @@ async function jsonc(options = {}) {
|
|
|
970
954
|
GLOB_JSON,
|
|
971
955
|
GLOB_JSON5,
|
|
972
956
|
GLOB_JSONC
|
|
973
|
-
], overrides = {}, stylistic
|
|
974
|
-
const { indent = 2 } = e$2(stylistic
|
|
957
|
+
], overrides = {}, stylistic = true } = options;
|
|
958
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
975
959
|
return [{
|
|
976
960
|
name: "vinicunca/jsonc/setup",
|
|
977
961
|
plugins: { jsonc: await interopDefault(import("eslint-plugin-jsonc")) }
|
|
@@ -1006,7 +990,7 @@ async function jsonc(options = {}) {
|
|
|
1006
990
|
"jsonc/space-unary-ops": ERROR,
|
|
1007
991
|
"jsonc/valid-json-number": ERROR,
|
|
1008
992
|
"jsonc/vue-custom-block/no-parsing-error": ERROR,
|
|
1009
|
-
...stylistic
|
|
993
|
+
...stylistic ? {
|
|
1010
994
|
"jsonc/array-bracket-spacing": [ERROR, NEVER],
|
|
1011
995
|
"jsonc/comma-dangle": [ERROR, NEVER],
|
|
1012
996
|
"jsonc/comma-style": [ERROR, "last"],
|
|
@@ -1028,7 +1012,6 @@ async function jsonc(options = {}) {
|
|
|
1028
1012
|
}
|
|
1029
1013
|
}];
|
|
1030
1014
|
}
|
|
1031
|
-
|
|
1032
1015
|
//#endregion
|
|
1033
1016
|
//#region src/configs/jsx.ts
|
|
1034
1017
|
async function jsx(options = {}) {
|
|
@@ -1067,22 +1050,21 @@ async function jsx(options = {}) {
|
|
|
1067
1050
|
}
|
|
1068
1051
|
}];
|
|
1069
1052
|
}
|
|
1070
|
-
|
|
1071
1053
|
//#endregion
|
|
1072
1054
|
//#region src/configs/markdown.ts
|
|
1073
1055
|
async function markdown(options = {}) {
|
|
1074
1056
|
const { componentExts = [], files = [GLOB_MARKDOWN], gfm = true, overrides = {}, overridesMarkdown = {} } = options;
|
|
1075
|
-
const markdown
|
|
1057
|
+
const markdown = await interopDefault(import("@eslint/markdown"));
|
|
1076
1058
|
return [
|
|
1077
1059
|
{
|
|
1078
1060
|
name: "vinicunca/markdown/setup",
|
|
1079
|
-
plugins: { markdown
|
|
1061
|
+
plugins: { markdown }
|
|
1080
1062
|
},
|
|
1081
1063
|
{
|
|
1082
1064
|
files,
|
|
1083
1065
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
1084
1066
|
name: "vinicunca/markdown/processor",
|
|
1085
|
-
processor: mergeProcessors([markdown
|
|
1067
|
+
processor: mergeProcessors([markdown.processors.markdown, processorPassThrough])
|
|
1086
1068
|
},
|
|
1087
1069
|
{
|
|
1088
1070
|
files,
|
|
@@ -1093,8 +1075,8 @@ async function markdown(options = {}) {
|
|
|
1093
1075
|
files,
|
|
1094
1076
|
name: "vinicunca/markdown/rules",
|
|
1095
1077
|
rules: {
|
|
1096
|
-
...markdown
|
|
1097
|
-
"markdown/no-missing-label-refs":
|
|
1078
|
+
...markdown.configs.recommended.at(0)?.rules,
|
|
1079
|
+
"markdown/no-missing-label-refs": "off",
|
|
1098
1080
|
...overridesMarkdown
|
|
1099
1081
|
}
|
|
1100
1082
|
},
|
|
@@ -1102,15 +1084,15 @@ async function markdown(options = {}) {
|
|
|
1102
1084
|
files,
|
|
1103
1085
|
name: "vinicunca/markdown/disables/markdown",
|
|
1104
1086
|
rules: {
|
|
1105
|
-
"command/command":
|
|
1106
|
-
"no-irregular-whitespace":
|
|
1107
|
-
"perfectionist/sort-exports":
|
|
1108
|
-
"perfectionist/sort-imports":
|
|
1109
|
-
"regexp/no-legacy-features":
|
|
1110
|
-
"regexp/no-missing-g-flag":
|
|
1111
|
-
"regexp/no-useless-dollar-replacements":
|
|
1112
|
-
"regexp/no-useless-flag":
|
|
1113
|
-
"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"
|
|
1114
1096
|
}
|
|
1115
1097
|
},
|
|
1116
1098
|
{
|
|
@@ -1118,30 +1100,30 @@ async function markdown(options = {}) {
|
|
|
1118
1100
|
languageOptions: { parserOptions: { ecmaFeatures: { impliedStrict: true } } },
|
|
1119
1101
|
name: "vinicunca/markdown/disables",
|
|
1120
1102
|
rules: {
|
|
1121
|
-
"
|
|
1122
|
-
"no-
|
|
1123
|
-
"no-
|
|
1124
|
-
"no-
|
|
1125
|
-
"no-unused-
|
|
1126
|
-
"
|
|
1127
|
-
"
|
|
1128
|
-
"style/
|
|
1129
|
-
"style/
|
|
1130
|
-
"
|
|
1131
|
-
"ts/
|
|
1132
|
-
"ts/no-
|
|
1133
|
-
"ts/no-
|
|
1134
|
-
"ts/no-
|
|
1135
|
-
"ts/no-
|
|
1136
|
-
"
|
|
1137
|
-
"
|
|
1138
|
-
"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",
|
|
1139
1122
|
...overrides
|
|
1140
1123
|
}
|
|
1141
1124
|
}
|
|
1142
1125
|
];
|
|
1143
1126
|
}
|
|
1144
|
-
|
|
1145
1127
|
//#endregion
|
|
1146
1128
|
//#region src/configs/nextjs.ts
|
|
1147
1129
|
function normalizeRules(rules) {
|
|
@@ -1174,7 +1156,6 @@ async function nextjs(options = {}) {
|
|
|
1174
1156
|
settings: { react: { version: "detect" } }
|
|
1175
1157
|
}];
|
|
1176
1158
|
}
|
|
1177
|
-
|
|
1178
1159
|
//#endregion
|
|
1179
1160
|
//#region src/configs/node.ts
|
|
1180
1161
|
async function node() {
|
|
@@ -1183,7 +1164,7 @@ async function node() {
|
|
|
1183
1164
|
plugins: { node: pluginNode },
|
|
1184
1165
|
rules: {
|
|
1185
1166
|
"node/handle-callback-err": [ERROR, "^(err|error)$"],
|
|
1186
|
-
"node/no-callback-literal":
|
|
1167
|
+
"node/no-callback-literal": "off",
|
|
1187
1168
|
"node/no-deprecated-api": ERROR,
|
|
1188
1169
|
"node/no-exports-assign": ERROR,
|
|
1189
1170
|
"node/no-new-require": ERROR,
|
|
@@ -1194,7 +1175,6 @@ async function node() {
|
|
|
1194
1175
|
}
|
|
1195
1176
|
}];
|
|
1196
1177
|
}
|
|
1197
|
-
|
|
1198
1178
|
//#endregion
|
|
1199
1179
|
//#region src/configs/perfectionist.ts
|
|
1200
1180
|
/**
|
|
@@ -1247,14 +1227,13 @@ async function perfectionist() {
|
|
|
1247
1227
|
}
|
|
1248
1228
|
}];
|
|
1249
1229
|
}
|
|
1250
|
-
|
|
1251
1230
|
//#endregion
|
|
1252
1231
|
//#region src/configs/pnpm.ts
|
|
1253
1232
|
async function detectCatalogUsage() {
|
|
1254
1233
|
const workspaceFile = await findUp("pnpm-workspace.yaml");
|
|
1255
1234
|
if (!workspaceFile) return false;
|
|
1256
|
-
const yaml
|
|
1257
|
-
return yaml
|
|
1235
|
+
const yaml = await fs.readFile(workspaceFile, "utf-8");
|
|
1236
|
+
return yaml.includes("catalog:") || yaml.includes("catalogs:");
|
|
1258
1237
|
}
|
|
1259
1238
|
async function pnpm(options) {
|
|
1260
1239
|
const [pluginPnpm, pluginYaml, yamlParser] = await Promise.all([
|
|
@@ -1262,9 +1241,9 @@ async function pnpm(options) {
|
|
|
1262
1241
|
interopDefault(import("eslint-plugin-yml")),
|
|
1263
1242
|
interopDefault(import("yaml-eslint-parser"))
|
|
1264
1243
|
]);
|
|
1265
|
-
const { catalogs = await detectCatalogUsage(), isInEditor = false, json = true, sort = true, yaml
|
|
1266
|
-
const configs
|
|
1267
|
-
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({
|
|
1268
1247
|
files: ["package.json", "**/package.json"],
|
|
1269
1248
|
language: "jsonc/x",
|
|
1270
1249
|
name: "vinicunca/pnpm/package-json",
|
|
@@ -1278,8 +1257,8 @@ async function pnpm(options) {
|
|
|
1278
1257
|
"pnpm/json-valid-catalog": [ERROR, { autofix: !isInEditor }]
|
|
1279
1258
|
}
|
|
1280
1259
|
});
|
|
1281
|
-
if (yaml
|
|
1282
|
-
configs
|
|
1260
|
+
if (yaml) {
|
|
1261
|
+
configs.push({
|
|
1283
1262
|
files: ["pnpm-workspace.yaml"],
|
|
1284
1263
|
languageOptions: { parser: yamlParser },
|
|
1285
1264
|
name: "vinicunca/pnpm/pnpm-workspace-yaml",
|
|
@@ -1293,7 +1272,7 @@ async function pnpm(options) {
|
|
|
1293
1272
|
"pnpm/yaml-no-unused-catalog-item": ERROR
|
|
1294
1273
|
}
|
|
1295
1274
|
});
|
|
1296
|
-
if (sort) configs
|
|
1275
|
+
if (sort) configs.push({
|
|
1297
1276
|
files: ["pnpm-workspace.yaml"],
|
|
1298
1277
|
languageOptions: { parser: yamlParser },
|
|
1299
1278
|
name: "vinicunca/pnpm/pnpm-workspace-yaml-sort",
|
|
@@ -1372,9 +1351,8 @@ async function pnpm(options) {
|
|
|
1372
1351
|
] }
|
|
1373
1352
|
});
|
|
1374
1353
|
}
|
|
1375
|
-
return configs
|
|
1354
|
+
return configs;
|
|
1376
1355
|
}
|
|
1377
|
-
|
|
1378
1356
|
//#endregion
|
|
1379
1357
|
//#region src/configs/react.ts
|
|
1380
1358
|
const ReactRefreshAllowConstantExportPackages = ["vite"];
|
|
@@ -1550,12 +1528,12 @@ async function react(options = {}) {
|
|
|
1550
1528
|
files: filesTypeAware,
|
|
1551
1529
|
name: "vinicunca/react/typescript",
|
|
1552
1530
|
rules: {
|
|
1553
|
-
"react-dom/no-string-style-prop":
|
|
1554
|
-
"react-dom/no-unknown-property":
|
|
1555
|
-
"react/jsx-no-duplicate-props":
|
|
1556
|
-
"react/jsx-no-undef":
|
|
1557
|
-
"react/jsx-uses-react":
|
|
1558
|
-
"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"
|
|
1559
1537
|
}
|
|
1560
1538
|
},
|
|
1561
1539
|
...isTypeAware ? [{
|
|
@@ -1566,14 +1544,13 @@ async function react(options = {}) {
|
|
|
1566
1544
|
}] : []
|
|
1567
1545
|
];
|
|
1568
1546
|
}
|
|
1569
|
-
|
|
1570
1547
|
//#endregion
|
|
1571
1548
|
//#region src/configs/regexp.ts
|
|
1572
1549
|
async function regexp(options = {}) {
|
|
1573
1550
|
const config = configs["flat/recommended"];
|
|
1574
1551
|
const rules = { ...config.rules };
|
|
1575
|
-
if (options.level ===
|
|
1576
|
-
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;
|
|
1577
1554
|
}
|
|
1578
1555
|
return [{
|
|
1579
1556
|
...config,
|
|
@@ -1584,11 +1561,10 @@ async function regexp(options = {}) {
|
|
|
1584
1561
|
}
|
|
1585
1562
|
}];
|
|
1586
1563
|
}
|
|
1587
|
-
|
|
1588
1564
|
//#endregion
|
|
1589
1565
|
//#region src/configs/solid.ts
|
|
1590
1566
|
async function solid(options = {}) {
|
|
1591
|
-
const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript
|
|
1567
|
+
const { files = [GLOB_JSX, GLOB_TSX], overrides = {}, typescript = true } = options;
|
|
1592
1568
|
await ensurePackages(["eslint-plugin-solid"]);
|
|
1593
1569
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1594
1570
|
const isTypeAware = !!tsconfigPath;
|
|
@@ -1627,15 +1603,14 @@ async function solid(options = {}) {
|
|
|
1627
1603
|
"solid/reactivity": WARN,
|
|
1628
1604
|
"solid/self-closing-comp": ERROR,
|
|
1629
1605
|
"solid/style-prop": [ERROR, { styleProps: ["style", "css"] }],
|
|
1630
|
-
...typescript
|
|
1606
|
+
...typescript ? {
|
|
1631
1607
|
"solid/jsx-no-undef": [ERROR, { typescriptEnabled: true }],
|
|
1632
|
-
"solid/no-unknown-namespaces":
|
|
1608
|
+
"solid/no-unknown-namespaces": "off"
|
|
1633
1609
|
} : {},
|
|
1634
1610
|
...overrides
|
|
1635
1611
|
}
|
|
1636
1612
|
}];
|
|
1637
1613
|
}
|
|
1638
|
-
|
|
1639
1614
|
//#endregion
|
|
1640
1615
|
//#region src/configs/sonar.ts
|
|
1641
1616
|
async function sonar() {
|
|
@@ -1644,15 +1619,14 @@ async function sonar() {
|
|
|
1644
1619
|
plugins: { sonar: pluginSonar },
|
|
1645
1620
|
rules: {
|
|
1646
1621
|
...pluginSonar.configs.recommended.rules,
|
|
1647
|
-
"sonar/cognitive-complexity":
|
|
1648
|
-
"sonar/no-unused-vars":
|
|
1649
|
-
"sonar/pseudo-random":
|
|
1650
|
-
"sonar/slow-regex":
|
|
1651
|
-
"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"
|
|
1652
1627
|
}
|
|
1653
1628
|
}];
|
|
1654
1629
|
}
|
|
1655
|
-
|
|
1656
1630
|
//#endregion
|
|
1657
1631
|
//#region src/configs/sort-package-json.ts
|
|
1658
1632
|
/**
|
|
@@ -1886,12 +1860,11 @@ function sortTsconfig() {
|
|
|
1886
1860
|
] }
|
|
1887
1861
|
}];
|
|
1888
1862
|
}
|
|
1889
|
-
|
|
1890
1863
|
//#endregion
|
|
1891
1864
|
//#region src/configs/svelte.ts
|
|
1892
1865
|
async function svelte(options = {}) {
|
|
1893
|
-
const { files = [GLOB_SVELTE], overrides = {}, stylistic
|
|
1894
|
-
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;
|
|
1895
1868
|
await ensurePackages(["eslint-plugin-svelte"]);
|
|
1896
1869
|
const [pluginSvelte, parserSvelte] = await Promise.all([interopDefault(import("eslint-plugin-svelte")), interopDefault(import("svelte-eslint-parser"))]);
|
|
1897
1870
|
return [{
|
|
@@ -1909,7 +1882,7 @@ async function svelte(options = {}) {
|
|
|
1909
1882
|
name: "vinicunca/svelte/rules",
|
|
1910
1883
|
processor: pluginSvelte.processors[".svelte"],
|
|
1911
1884
|
rules: {
|
|
1912
|
-
"no-undef":
|
|
1885
|
+
"no-undef": "off",
|
|
1913
1886
|
"no-unused-vars": [ERROR, {
|
|
1914
1887
|
args: "none",
|
|
1915
1888
|
caughtErrors: "none",
|
|
@@ -1943,9 +1916,9 @@ async function svelte(options = {}) {
|
|
|
1943
1916
|
vars: "all",
|
|
1944
1917
|
varsIgnorePattern: "^(_|\\$\\$Props$|\\$\\$Events$|\\$\\$Slots$)"
|
|
1945
1918
|
}],
|
|
1946
|
-
...stylistic
|
|
1947
|
-
"style/indent":
|
|
1948
|
-
"style/no-trailing-spaces":
|
|
1919
|
+
...stylistic ? {
|
|
1920
|
+
"style/indent": "off",
|
|
1921
|
+
"style/no-trailing-spaces": "off",
|
|
1949
1922
|
"svelte/derived-has-same-inputs-outputs": ERROR,
|
|
1950
1923
|
"svelte/html-closing-bracket-spacing": ERROR,
|
|
1951
1924
|
"svelte/html-quotes": [ERROR, { prefer: quotes }],
|
|
@@ -1962,7 +1935,6 @@ async function svelte(options = {}) {
|
|
|
1962
1935
|
}
|
|
1963
1936
|
}];
|
|
1964
1937
|
}
|
|
1965
|
-
|
|
1966
1938
|
//#endregion
|
|
1967
1939
|
//#region src/configs/test.ts
|
|
1968
1940
|
let _pluginTest;
|
|
@@ -1983,7 +1955,8 @@ async function test(options = {}) {
|
|
|
1983
1955
|
files,
|
|
1984
1956
|
name: "vinicunca/test/rules",
|
|
1985
1957
|
rules: {
|
|
1986
|
-
"
|
|
1958
|
+
"e18e/prefer-static-regex": "off",
|
|
1959
|
+
"sonar/no-duplicate-string": "off",
|
|
1987
1960
|
"test/consistent-test-it": [ERROR, {
|
|
1988
1961
|
fn: "it",
|
|
1989
1962
|
withinDescribe: "it"
|
|
@@ -1993,20 +1966,19 @@ async function test(options = {}) {
|
|
|
1993
1966
|
"test/no-only-tests": isInEditor ? WARN : ERROR,
|
|
1994
1967
|
"test/prefer-hooks-in-order": ERROR,
|
|
1995
1968
|
"test/prefer-lowercase-title": ERROR,
|
|
1996
|
-
"antfu/no-top-level-await":
|
|
1997
|
-
"no-unused-expressions":
|
|
1998
|
-
"node/prefer-global/process":
|
|
1999
|
-
"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",
|
|
2000
1973
|
...overrides
|
|
2001
1974
|
}
|
|
2002
1975
|
}];
|
|
2003
1976
|
}
|
|
2004
|
-
|
|
2005
1977
|
//#endregion
|
|
2006
1978
|
//#region src/configs/toml.ts
|
|
2007
1979
|
async function toml(options = {}) {
|
|
2008
|
-
const { files = [GLOB_TOML], overrides = {}, stylistic
|
|
2009
|
-
const { indent = 2 } = e$2(stylistic
|
|
1980
|
+
const { files = [GLOB_TOML], overrides = {}, stylistic = true } = options;
|
|
1981
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
2010
1982
|
const [pluginToml, parserToml] = await Promise.all([interopDefault(import("eslint-plugin-toml")), interopDefault(import("toml-eslint-parser"))]);
|
|
2011
1983
|
return [{
|
|
2012
1984
|
name: "vinicunca/toml/setup",
|
|
@@ -2016,7 +1988,7 @@ async function toml(options = {}) {
|
|
|
2016
1988
|
languageOptions: { parser: parserToml },
|
|
2017
1989
|
name: "vinicunca/toml/rules",
|
|
2018
1990
|
rules: {
|
|
2019
|
-
"style/spaced-comment":
|
|
1991
|
+
"style/spaced-comment": "off",
|
|
2020
1992
|
"toml/comma-style": ERROR,
|
|
2021
1993
|
"toml/keys-order": ERROR,
|
|
2022
1994
|
"toml/no-space-dots": ERROR,
|
|
@@ -2025,7 +1997,7 @@ async function toml(options = {}) {
|
|
|
2025
1997
|
"toml/precision-of-integer": ERROR,
|
|
2026
1998
|
"toml/tables-order": ERROR,
|
|
2027
1999
|
"toml/vue-custom-block/no-parsing-error": ERROR,
|
|
2028
|
-
...stylistic
|
|
2000
|
+
...stylistic ? {
|
|
2029
2001
|
"toml/array-bracket-newline": ERROR,
|
|
2030
2002
|
"toml/array-bracket-spacing": ERROR,
|
|
2031
2003
|
"toml/array-element-newline": ERROR,
|
|
@@ -2042,23 +2014,22 @@ async function toml(options = {}) {
|
|
|
2042
2014
|
}
|
|
2043
2015
|
}];
|
|
2044
2016
|
}
|
|
2045
|
-
|
|
2046
2017
|
//#endregion
|
|
2047
2018
|
//#region src/configs/typescript.ts
|
|
2048
2019
|
async function typescript(options = {}) {
|
|
2049
2020
|
const { componentExts = [], erasableOnly = false, overrides = {}, overridesTypeAware = {}, parserOptions = {}, type = "app" } = options ?? {};
|
|
2050
2021
|
const files = options.files ?? [
|
|
2051
|
-
|
|
2052
|
-
|
|
2022
|
+
"**/*.?([cm])ts",
|
|
2023
|
+
"**/*.?([cm])tsx",
|
|
2053
2024
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
2054
2025
|
];
|
|
2055
|
-
const filesTypeAware = options.filesTypeAware ?? [
|
|
2056
|
-
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
2026
|
+
const filesTypeAware = options.filesTypeAware ?? ["**/*.?([cm])ts", "**/*.?([cm])tsx"];
|
|
2027
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [`**/*.md/**`, "**/*.astro/*.ts"];
|
|
2057
2028
|
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
2058
2029
|
const isTypeAware = !!tsconfigPath;
|
|
2059
2030
|
const typeAwareRules = {
|
|
2060
|
-
"dot-notation":
|
|
2061
|
-
"no-implied-eval":
|
|
2031
|
+
"dot-notation": "off",
|
|
2032
|
+
"no-implied-eval": "off",
|
|
2062
2033
|
"ts/await-thenable": ERROR,
|
|
2063
2034
|
"ts/dot-notation": [ERROR, { allowKeywords: true }],
|
|
2064
2035
|
"ts/no-floating-promises": ERROR,
|
|
@@ -2083,10 +2054,10 @@ async function typescript(options = {}) {
|
|
|
2083
2054
|
"ts/unbound-method": ERROR
|
|
2084
2055
|
};
|
|
2085
2056
|
const [pluginTs, parserTs] = await Promise.all([interopDefault(import("@typescript-eslint/eslint-plugin")), interopDefault(import("@typescript-eslint/parser"))]);
|
|
2086
|
-
function makeParser({ files
|
|
2057
|
+
function makeParser({ files, ignores, typeAware }) {
|
|
2087
2058
|
return {
|
|
2088
|
-
files
|
|
2089
|
-
...ignores
|
|
2059
|
+
files,
|
|
2060
|
+
...ignores ? { ignores } : {},
|
|
2090
2061
|
languageOptions: {
|
|
2091
2062
|
parser: parserTs,
|
|
2092
2063
|
parserOptions: {
|
|
@@ -2130,10 +2101,10 @@ async function typescript(options = {}) {
|
|
|
2130
2101
|
rules: {
|
|
2131
2102
|
...renameRules(pluginTs.configs["eslint-recommended"].overrides[0].rules, { "@typescript-eslint": "ts" }),
|
|
2132
2103
|
...renameRules(pluginTs.configs.strict.rules, { "@typescript-eslint": "ts" }),
|
|
2133
|
-
"no-dupe-class-members":
|
|
2134
|
-
"no-redeclare":
|
|
2135
|
-
"no-use-before-define":
|
|
2136
|
-
"no-useless-constructor":
|
|
2104
|
+
"no-dupe-class-members": "off",
|
|
2105
|
+
"no-redeclare": "off",
|
|
2106
|
+
"no-use-before-define": "off",
|
|
2107
|
+
"no-useless-constructor": "off",
|
|
2137
2108
|
"ts/array-type": [ERROR, { default: "generic" }],
|
|
2138
2109
|
"ts/ban-ts-comment": [ERROR, { "ts-expect-error": "allow-with-description" }],
|
|
2139
2110
|
"ts/consistent-type-definitions": [ERROR, "interface"],
|
|
@@ -2142,19 +2113,19 @@ async function typescript(options = {}) {
|
|
|
2142
2113
|
fixStyle: "separate-type-imports",
|
|
2143
2114
|
prefer: "type-imports"
|
|
2144
2115
|
}],
|
|
2145
|
-
"ts/explicit-member-accessibility":
|
|
2146
|
-
"ts/explicit-module-boundary-types":
|
|
2116
|
+
"ts/explicit-member-accessibility": "off",
|
|
2117
|
+
"ts/explicit-module-boundary-types": "off",
|
|
2147
2118
|
"ts/method-signature-style": [ERROR, "property"],
|
|
2148
|
-
"ts/naming-convention":
|
|
2119
|
+
"ts/naming-convention": "off",
|
|
2149
2120
|
"ts/no-dupe-class-members": ERROR,
|
|
2150
|
-
"ts/no-empty-function":
|
|
2121
|
+
"ts/no-empty-function": "off",
|
|
2151
2122
|
"ts/no-empty-object-type": [ERROR, { allowInterfaces: "always" }],
|
|
2152
|
-
"ts/no-explicit-any":
|
|
2153
|
-
"ts/no-extraneous-class":
|
|
2123
|
+
"ts/no-explicit-any": "off",
|
|
2124
|
+
"ts/no-extraneous-class": "off",
|
|
2154
2125
|
"ts/no-import-type-side-effects": ERROR,
|
|
2155
2126
|
"ts/no-invalid-this": ERROR,
|
|
2156
|
-
"ts/no-invalid-void-type":
|
|
2157
|
-
"ts/no-non-null-assertion":
|
|
2127
|
+
"ts/no-invalid-void-type": "off",
|
|
2128
|
+
"ts/no-non-null-assertion": "off",
|
|
2158
2129
|
"ts/no-redeclare": [ERROR, { builtinGlobals: false }],
|
|
2159
2130
|
"ts/no-require-imports": ERROR,
|
|
2160
2131
|
"ts/no-unused-expressions": [ERROR, {
|
|
@@ -2173,8 +2144,8 @@ async function typescript(options = {}) {
|
|
|
2173
2144
|
functions: false,
|
|
2174
2145
|
variables: true
|
|
2175
2146
|
}],
|
|
2176
|
-
"ts/parameter-properties":
|
|
2177
|
-
"ts/triple-slash-reference":
|
|
2147
|
+
"ts/parameter-properties": "off",
|
|
2148
|
+
"ts/triple-slash-reference": "off",
|
|
2178
2149
|
...type === "lib" ? { "ts/explicit-function-return-type": [ERROR, {
|
|
2179
2150
|
allowExpressions: true,
|
|
2180
2151
|
allowHigherOrderFunctions: true,
|
|
@@ -2194,7 +2165,7 @@ async function typescript(options = {}) {
|
|
|
2194
2165
|
}] : [],
|
|
2195
2166
|
...erasableOnly ? [{
|
|
2196
2167
|
name: "antfu/typescript/erasable-syntax-only",
|
|
2197
|
-
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-
|
|
2168
|
+
plugins: { "erasable-syntax-only": await interopDefault(import("./lib-D3Kr7UIJ.mjs")) },
|
|
2198
2169
|
rules: {
|
|
2199
2170
|
"erasable-syntax-only/enums": ERROR,
|
|
2200
2171
|
"erasable-syntax-only/import-aliases": ERROR,
|
|
@@ -2204,7 +2175,6 @@ async function typescript(options = {}) {
|
|
|
2204
2175
|
}] : []
|
|
2205
2176
|
];
|
|
2206
2177
|
}
|
|
2207
|
-
|
|
2208
2178
|
//#endregion
|
|
2209
2179
|
//#region src/configs/unicorn.ts
|
|
2210
2180
|
async function unicorn(options = {}) {
|
|
@@ -2229,7 +2199,6 @@ async function unicorn(options = {}) {
|
|
|
2229
2199
|
} }
|
|
2230
2200
|
}];
|
|
2231
2201
|
}
|
|
2232
|
-
|
|
2233
2202
|
//#endregion
|
|
2234
2203
|
//#region src/configs/unocss.ts
|
|
2235
2204
|
async function unocss(options = {}) {
|
|
@@ -2247,13 +2216,12 @@ async function unocss(options = {}) {
|
|
|
2247
2216
|
settings: { unocss: { configPath } }
|
|
2248
2217
|
}];
|
|
2249
2218
|
}
|
|
2250
|
-
|
|
2251
2219
|
//#endregion
|
|
2252
2220
|
//#region src/configs/vue.ts
|
|
2253
2221
|
async function vue(options = {}) {
|
|
2254
|
-
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic
|
|
2222
|
+
const { a11y = false, files = [GLOB_VUE], overrides = {}, stylistic = true } = options;
|
|
2255
2223
|
const sfcBlocks = options.sfcBlocks === true ? {} : options.sfcBlocks ?? {};
|
|
2256
|
-
const { indent = 2 } = e$2(stylistic
|
|
2224
|
+
const { indent = 2 } = e$2(stylistic) ? {} : stylistic;
|
|
2257
2225
|
if (a11y) await ensurePackages(["eslint-plugin-vuejs-accessibility"]);
|
|
2258
2226
|
const [pluginVue, parserVue, processorVueBlocks, pluginVueA11y] = await Promise.all([
|
|
2259
2227
|
interopDefault(import("eslint-plugin-vue")),
|
|
@@ -2316,9 +2284,9 @@ async function vue(options = {}) {
|
|
|
2316
2284
|
...acc,
|
|
2317
2285
|
...c
|
|
2318
2286
|
}), {}),
|
|
2319
|
-
"antfu/no-top-level-await":
|
|
2320
|
-
"node/prefer-global/process":
|
|
2321
|
-
"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",
|
|
2322
2290
|
"vue/block-order": [ERROR, { order: [
|
|
2323
2291
|
"script",
|
|
2324
2292
|
"template",
|
|
@@ -2326,7 +2294,7 @@ async function vue(options = {}) {
|
|
|
2326
2294
|
] }],
|
|
2327
2295
|
"vue/component-name-in-template-casing": [ERROR, "PascalCase"],
|
|
2328
2296
|
"vue/component-options-name-casing": [ERROR, "PascalCase"],
|
|
2329
|
-
"vue/component-tags-order":
|
|
2297
|
+
"vue/component-tags-order": "off",
|
|
2330
2298
|
"vue/custom-event-name-casing": [
|
|
2331
2299
|
ERROR,
|
|
2332
2300
|
"camelCase",
|
|
@@ -2344,9 +2312,9 @@ async function vue(options = {}) {
|
|
|
2344
2312
|
"vue/html-indent": [ERROR, indent],
|
|
2345
2313
|
"vue/html-quotes": [ERROR, "double"],
|
|
2346
2314
|
"vue/max-attributes-per-line": [ERROR],
|
|
2347
|
-
"vue/multi-word-component-names":
|
|
2315
|
+
"vue/multi-word-component-names": "off",
|
|
2348
2316
|
"vue/no-constant-condition": WARN,
|
|
2349
|
-
"vue/no-dupe-keys":
|
|
2317
|
+
"vue/no-dupe-keys": "off",
|
|
2350
2318
|
"vue/no-empty-pattern": ERROR,
|
|
2351
2319
|
"vue/no-irregular-whitespace": ERROR,
|
|
2352
2320
|
"vue/no-loss-of-precision": ERROR,
|
|
@@ -2357,12 +2325,12 @@ async function vue(options = {}) {
|
|
|
2357
2325
|
"WithStatement"
|
|
2358
2326
|
],
|
|
2359
2327
|
"vue/no-restricted-v-bind": [ERROR, "/^v-/"],
|
|
2360
|
-
"vue/no-setup-props-reactivity-loss":
|
|
2328
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
2361
2329
|
"vue/no-sparse-arrays": ERROR,
|
|
2362
2330
|
"vue/no-unused-refs": ERROR,
|
|
2363
2331
|
"vue/no-useless-v-bind": ERROR,
|
|
2364
|
-
"vue/no-v-html":
|
|
2365
|
-
"vue/no-v-text-v-html-on-component":
|
|
2332
|
+
"vue/no-v-html": "off",
|
|
2333
|
+
"vue/no-v-text-v-html-on-component": "off",
|
|
2366
2334
|
"vue/object-shorthand": [
|
|
2367
2335
|
ERROR,
|
|
2368
2336
|
ALWAYS,
|
|
@@ -2371,18 +2339,18 @@ async function vue(options = {}) {
|
|
|
2371
2339
|
ignoreConstructors: false
|
|
2372
2340
|
}
|
|
2373
2341
|
],
|
|
2374
|
-
"vue/prefer-import-from-vue":
|
|
2342
|
+
"vue/prefer-import-from-vue": "off",
|
|
2375
2343
|
"vue/prefer-separate-static-class": ERROR,
|
|
2376
2344
|
"vue/prefer-template": ERROR,
|
|
2377
2345
|
"vue/prop-name-casing": [ERROR, "camelCase"],
|
|
2378
|
-
"vue/require-default-prop":
|
|
2379
|
-
"vue/require-prop-types":
|
|
2346
|
+
"vue/require-default-prop": "off",
|
|
2347
|
+
"vue/require-prop-types": "off",
|
|
2380
2348
|
"vue/space-infix-ops": ERROR,
|
|
2381
2349
|
"vue/space-unary-ops": [ERROR, {
|
|
2382
2350
|
nonwords: false,
|
|
2383
2351
|
words: true
|
|
2384
2352
|
}],
|
|
2385
|
-
...stylistic
|
|
2353
|
+
...stylistic ? {
|
|
2386
2354
|
"vue/array-bracket-spacing": [ERROR, NEVER],
|
|
2387
2355
|
"vue/arrow-spacing": [ERROR, {
|
|
2388
2356
|
after: true,
|
|
@@ -2457,12 +2425,11 @@ async function vue(options = {}) {
|
|
|
2457
2425
|
}
|
|
2458
2426
|
}];
|
|
2459
2427
|
}
|
|
2460
|
-
|
|
2461
2428
|
//#endregion
|
|
2462
2429
|
//#region src/configs/yaml.ts
|
|
2463
2430
|
async function yaml(options = {}) {
|
|
2464
|
-
const { files = [GLOB_YAML], overrides = {}, stylistic
|
|
2465
|
-
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;
|
|
2466
2433
|
const [pluginYaml, parserYaml] = await Promise.all([interopDefault(import("eslint-plugin-yml")), interopDefault(import("yaml-eslint-parser"))]);
|
|
2467
2434
|
return [{
|
|
2468
2435
|
name: "vinicunca/yaml/setup",
|
|
@@ -2472,7 +2439,7 @@ async function yaml(options = {}) {
|
|
|
2472
2439
|
languageOptions: { parser: parserYaml },
|
|
2473
2440
|
name: "vinicunca/yaml/rules",
|
|
2474
2441
|
rules: {
|
|
2475
|
-
"style/spaced-comment":
|
|
2442
|
+
"style/spaced-comment": "off",
|
|
2476
2443
|
"yaml/block-mapping": ERROR,
|
|
2477
2444
|
"yaml/block-sequence": ERROR,
|
|
2478
2445
|
"yaml/no-empty-key": ERROR,
|
|
@@ -2480,7 +2447,7 @@ async function yaml(options = {}) {
|
|
|
2480
2447
|
"yaml/no-irregular-whitespace": ERROR,
|
|
2481
2448
|
"yaml/plain-scalar": ERROR,
|
|
2482
2449
|
"yaml/vue-custom-block/no-parsing-error": ERROR,
|
|
2483
|
-
...stylistic
|
|
2450
|
+
...stylistic ? {
|
|
2484
2451
|
"yaml/block-mapping-question-indicator-newline": ERROR,
|
|
2485
2452
|
"yaml/block-sequence-hyphen-indicator-newline": ERROR,
|
|
2486
2453
|
"yaml/flow-mapping-curly-newline": ERROR,
|
|
@@ -2500,7 +2467,6 @@ async function yaml(options = {}) {
|
|
|
2500
2467
|
}
|
|
2501
2468
|
}];
|
|
2502
2469
|
}
|
|
2503
|
-
|
|
2504
2470
|
//#endregion
|
|
2505
2471
|
//#region src/base.ts
|
|
2506
2472
|
const flatConfigProps = [
|
|
@@ -2543,7 +2509,7 @@ const defaultPluginRenaming = {
|
|
|
2543
2509
|
* The merged ESLint configurations.
|
|
2544
2510
|
*/
|
|
2545
2511
|
function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
2546
|
-
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, 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;
|
|
2547
2513
|
let isInEditor = options.isInEditor;
|
|
2548
2514
|
if (isInEditor == null) {
|
|
2549
2515
|
isInEditor = isInEditorEnv();
|
|
@@ -2551,108 +2517,108 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2551
2517
|
}
|
|
2552
2518
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2553
2519
|
if (stylisticOptions && !("jsx" in stylisticOptions)) stylisticOptions.jsx = typeof enableJsx === "object" ? true : enableJsx;
|
|
2554
|
-
const configs
|
|
2555
|
-
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({
|
|
2556
2522
|
name: "vinicunca/gitignore",
|
|
2557
2523
|
...enableGitignore
|
|
2558
2524
|
})]));
|
|
2559
|
-
else configs
|
|
2525
|
+
else configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2560
2526
|
name: "vinicunca/gitignore",
|
|
2561
2527
|
strict: false
|
|
2562
2528
|
})]));
|
|
2563
2529
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2564
2530
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2565
|
-
configs
|
|
2531
|
+
configs.push(ignores(userIgnores), javascript({
|
|
2566
2532
|
isInEditor,
|
|
2567
2533
|
overrides: getOverrides(options, "javascript")
|
|
2568
2534
|
}), comments(), imports({ stylistic: stylisticOptions }), command(), perfectionist(), sonar());
|
|
2569
|
-
if (enableNode) configs
|
|
2570
|
-
if (enableJsdoc) configs
|
|
2571
|
-
if (enableImports) configs
|
|
2535
|
+
if (enableNode) configs.push(node());
|
|
2536
|
+
if (enableJsdoc) configs.push(jsdoc({ stylistic: stylisticOptions }));
|
|
2537
|
+
if (enableImports) configs.push(imports({
|
|
2572
2538
|
stylistic: stylisticOptions,
|
|
2573
2539
|
...resolveSubOptions(options, "imports")
|
|
2574
2540
|
}));
|
|
2575
|
-
if (enableE18e) configs
|
|
2541
|
+
if (enableE18e) configs.push(e18e({
|
|
2576
2542
|
isInEditor,
|
|
2577
2543
|
...enableE18e === true ? {} : enableE18e
|
|
2578
2544
|
}));
|
|
2579
|
-
if (enableUnicorn) configs
|
|
2545
|
+
if (enableUnicorn) configs.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2580
2546
|
if (enableVue) componentExts.push("vue");
|
|
2581
|
-
if (enableJsx) configs
|
|
2582
|
-
if (enableTypeScript) configs
|
|
2547
|
+
if (enableJsx) configs.push(jsx(enableJsx === true ? {} : enableJsx));
|
|
2548
|
+
if (enableTypeScript) configs.push(typescript({
|
|
2583
2549
|
...typescriptOptions,
|
|
2584
2550
|
componentExts,
|
|
2585
2551
|
overrides: getOverrides(options, "typescript"),
|
|
2586
|
-
type:
|
|
2552
|
+
type: appType
|
|
2587
2553
|
}));
|
|
2588
|
-
if (stylisticOptions) configs
|
|
2554
|
+
if (stylisticOptions) configs.push(stylistic({
|
|
2589
2555
|
...stylisticOptions,
|
|
2590
2556
|
lessOpinionated: options.lessOpinionated,
|
|
2591
2557
|
overrides: getOverrides(options, "stylistic")
|
|
2592
2558
|
}));
|
|
2593
|
-
if (enableRegexp) configs
|
|
2594
|
-
if (options.test ?? true) configs
|
|
2559
|
+
if (enableRegexp) configs.push(regexp(e$2(enableRegexp) ? {} : enableRegexp));
|
|
2560
|
+
if (options.test ?? true) configs.push(test({
|
|
2595
2561
|
isInEditor,
|
|
2596
2562
|
overrides: getOverrides(options, "test")
|
|
2597
2563
|
}));
|
|
2598
|
-
if (enableVue) configs
|
|
2564
|
+
if (enableVue) configs.push(vue({
|
|
2599
2565
|
...resolveSubOptions(options, "vue"),
|
|
2600
2566
|
overrides: getOverrides(options, "vue"),
|
|
2601
2567
|
stylistic: stylisticOptions,
|
|
2602
2568
|
typescript: !!enableTypeScript
|
|
2603
2569
|
}));
|
|
2604
|
-
if (enableReact) configs
|
|
2570
|
+
if (enableReact) configs.push(react({
|
|
2605
2571
|
...typescriptOptions,
|
|
2606
2572
|
...resolveSubOptions(options, "react"),
|
|
2607
2573
|
overrides: getOverrides(options, "react"),
|
|
2608
2574
|
tsconfigPath
|
|
2609
2575
|
}));
|
|
2610
|
-
if (enableNextjs) configs
|
|
2611
|
-
if (enableSolid) configs
|
|
2576
|
+
if (enableNextjs) configs.push(nextjs({ overrides: getOverrides(options, "nextjs") }));
|
|
2577
|
+
if (enableSolid) configs.push(solid({
|
|
2612
2578
|
overrides: getOverrides(options, "solid"),
|
|
2613
2579
|
tsconfigPath,
|
|
2614
2580
|
typescript: !!enableTypeScript
|
|
2615
2581
|
}));
|
|
2616
|
-
if (enableSvelte) configs
|
|
2582
|
+
if (enableSvelte) configs.push(svelte({
|
|
2617
2583
|
overrides: getOverrides(options, "svelte"),
|
|
2618
2584
|
stylistic: stylisticOptions,
|
|
2619
2585
|
typescript: !!enableTypeScript
|
|
2620
2586
|
}));
|
|
2621
|
-
if (enableUnoCSS) configs
|
|
2587
|
+
if (enableUnoCSS) configs.push(unocss({
|
|
2622
2588
|
...resolveSubOptions(options, "unocss"),
|
|
2623
2589
|
overrides: getOverrides(options, "unocss")
|
|
2624
2590
|
}));
|
|
2625
|
-
if (enableAstro) configs
|
|
2591
|
+
if (enableAstro) configs.push(astro({
|
|
2626
2592
|
overrides: getOverrides(options, "astro"),
|
|
2627
2593
|
stylistic: stylisticOptions
|
|
2628
2594
|
}));
|
|
2629
|
-
if (options.jsonc ?? true) configs
|
|
2595
|
+
if (options.jsonc ?? true) configs.push(jsonc({
|
|
2630
2596
|
overrides: getOverrides(options, "jsonc"),
|
|
2631
2597
|
stylistic: stylisticOptions
|
|
2632
2598
|
}), sortPackageJson(), sortTsconfig());
|
|
2633
2599
|
if (enableCatalogs) {
|
|
2634
2600
|
const optionsPnpm = resolveSubOptions(options, "pnpm");
|
|
2635
|
-
configs
|
|
2601
|
+
configs.push(pnpm({
|
|
2636
2602
|
isInEditor,
|
|
2637
2603
|
json: options.jsonc !== false,
|
|
2638
2604
|
yaml: options.yaml !== false,
|
|
2639
2605
|
...optionsPnpm
|
|
2640
2606
|
}));
|
|
2641
2607
|
}
|
|
2642
|
-
if (options.yaml ?? true) configs
|
|
2608
|
+
if (options.yaml ?? true) configs.push(yaml({
|
|
2643
2609
|
overrides: getOverrides(options, "yaml"),
|
|
2644
2610
|
stylistic: stylisticOptions
|
|
2645
2611
|
}));
|
|
2646
|
-
if (options.toml ?? true) configs
|
|
2612
|
+
if (options.toml ?? true) configs.push(toml({
|
|
2647
2613
|
overrides: getOverrides(options, "toml"),
|
|
2648
2614
|
stylistic: stylisticOptions
|
|
2649
2615
|
}));
|
|
2650
|
-
if (options.markdown ?? true) configs
|
|
2616
|
+
if (options.markdown ?? true) configs.push(markdown({
|
|
2651
2617
|
componentExts,
|
|
2652
2618
|
overrides: getOverrides(options, "markdown")
|
|
2653
2619
|
}));
|
|
2654
|
-
if (options.formatters) configs
|
|
2655
|
-
configs
|
|
2620
|
+
if (options.formatters) configs.push(formatters(options.formatters, e$2(stylisticOptions) ? {} : stylisticOptions));
|
|
2621
|
+
configs.push(disables());
|
|
2656
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.");
|
|
2657
2623
|
/**
|
|
2658
2624
|
* User can optionally pass a flat config item to the first argument.
|
|
@@ -2662,9 +2628,9 @@ function vinicuncaESLint(options = {}, ...userConfigs) {
|
|
|
2662
2628
|
if (key in options) acc[key] = options[key];
|
|
2663
2629
|
return acc;
|
|
2664
2630
|
}, {});
|
|
2665
|
-
if (Object.keys(fusedConfig).length) configs
|
|
2631
|
+
if (Object.keys(fusedConfig).length) configs.push([fusedConfig]);
|
|
2666
2632
|
let composer = new FlatConfigComposer();
|
|
2667
|
-
composer = composer.append(...configs
|
|
2633
|
+
composer = composer.append(...configs, ...userConfigs);
|
|
2668
2634
|
if (autoRenamePlugins) composer = composer.renamePlugins(defaultPluginRenaming);
|
|
2669
2635
|
if (isInEditor) composer = composer.disableRulesFix([
|
|
2670
2636
|
"unused-imports/no-unused-imports",
|
|
@@ -2680,6 +2646,5 @@ function getOverrides(options, key) {
|
|
|
2680
2646
|
function resolveSubOptions(options, key) {
|
|
2681
2647
|
return e$2(options[key]) ? {} : options[key] || {};
|
|
2682
2648
|
}
|
|
2683
|
-
|
|
2684
2649
|
//#endregion
|
|
2685
|
-
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 };
|
|
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 };
|