@coderwyd/eslint-config 1.1.0-beta.3 → 1.1.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/README.md +4 -4
- package/bin/index.js +3 -0
- package/dist/cli.cjs +268 -0
- package/dist/cli.d.cts +2 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +239 -0
- package/dist/index.cjs +413 -556
- package/dist/index.d.cts +116 -131
- package/dist/index.d.ts +116 -131
- package/dist/index.js +414 -537
- package/package.json +75 -41
package/dist/index.js
CHANGED
|
@@ -1,36 +1,19 @@
|
|
|
1
1
|
// src/factory.ts
|
|
2
2
|
import process3 from "process";
|
|
3
3
|
import fs from "fs";
|
|
4
|
-
import { isPackageExists } from "local-pkg";
|
|
5
|
-
import gitignore from "eslint-config-flat-gitignore";
|
|
4
|
+
import { isPackageExists as isPackageExists3 } from "local-pkg";
|
|
6
5
|
|
|
7
6
|
// src/plugins.ts
|
|
8
7
|
import { default as default2 } from "eslint-plugin-antfu";
|
|
9
8
|
import { default as default3 } from "eslint-plugin-eslint-comments";
|
|
10
9
|
import * as pluginImport from "eslint-plugin-i";
|
|
11
|
-
import { default as default4 } from "eslint-plugin-
|
|
12
|
-
import
|
|
13
|
-
import { default as
|
|
14
|
-
import { default as
|
|
15
|
-
import { default as default7 } from "@stylistic/eslint-plugin";
|
|
16
|
-
import { default as default8 } from "@typescript-eslint/eslint-plugin";
|
|
17
|
-
import { default as default9 } from "eslint-plugin-unicorn";
|
|
18
|
-
import { default as default10 } from "eslint-plugin-unused-imports";
|
|
19
|
-
import * as pluginYaml from "eslint-plugin-yml";
|
|
20
|
-
import { default as default11 } from "eslint-plugin-no-only-tests";
|
|
21
|
-
import { default as default12 } from "eslint-plugin-vitest";
|
|
22
|
-
import { default as default13 } from "eslint-plugin-vue";
|
|
23
|
-
import { default as default14 } from "eslint-plugin-react";
|
|
24
|
-
import { default as default15 } from "eslint-plugin-react-hooks";
|
|
25
|
-
import { default as default16 } from "eslint-plugin-astro";
|
|
26
|
-
import * as parserTs from "@typescript-eslint/parser";
|
|
27
|
-
import { default as default17 } from "vue-eslint-parser";
|
|
28
|
-
import { default as default18 } from "yaml-eslint-parser";
|
|
29
|
-
import { default as default19 } from "jsonc-eslint-parser";
|
|
30
|
-
import { default as default20 } from "astro-eslint-parser";
|
|
10
|
+
import { default as default4 } from "eslint-plugin-n";
|
|
11
|
+
import { default as default5 } from "eslint-plugin-unicorn";
|
|
12
|
+
import { default as default6 } from "eslint-plugin-unused-imports";
|
|
13
|
+
import { default as default7 } from "eslint-plugin-perfectionist";
|
|
31
14
|
|
|
32
15
|
// src/configs/comments.ts
|
|
33
|
-
function comments() {
|
|
16
|
+
async function comments() {
|
|
34
17
|
return [
|
|
35
18
|
{
|
|
36
19
|
name: "coderwyd:eslint-comments",
|
|
@@ -65,7 +48,6 @@ var GLOB_MARKDOWN = "**/*.md";
|
|
|
65
48
|
var GLOB_VUE = "**/*.vue";
|
|
66
49
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
67
50
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
68
|
-
var GLOB_ASTRO = "**/*.astro";
|
|
69
51
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
70
52
|
var GLOB_TESTS = [
|
|
71
53
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -94,8 +76,13 @@ var GLOB_EXCLUDE = [
|
|
|
94
76
|
"**/output",
|
|
95
77
|
"**/coverage",
|
|
96
78
|
"**/temp",
|
|
79
|
+
"**/.temp",
|
|
80
|
+
"**/tmp",
|
|
81
|
+
"**/.tmp",
|
|
82
|
+
"**/.history",
|
|
97
83
|
"**/.vitepress/cache",
|
|
98
84
|
"**/.nuxt",
|
|
85
|
+
"**/.next",
|
|
99
86
|
"**/.vercel",
|
|
100
87
|
"**/.changeset",
|
|
101
88
|
"**/.idea",
|
|
@@ -111,7 +98,7 @@ var GLOB_EXCLUDE = [
|
|
|
111
98
|
];
|
|
112
99
|
|
|
113
100
|
// src/configs/ignores.ts
|
|
114
|
-
function ignores() {
|
|
101
|
+
async function ignores() {
|
|
115
102
|
return [
|
|
116
103
|
{
|
|
117
104
|
ignores: GLOB_EXCLUDE
|
|
@@ -120,7 +107,7 @@ function ignores() {
|
|
|
120
107
|
}
|
|
121
108
|
|
|
122
109
|
// src/configs/imports.ts
|
|
123
|
-
function imports(options = {}) {
|
|
110
|
+
async function imports(options = {}) {
|
|
124
111
|
const {
|
|
125
112
|
stylistic: stylistic2 = true
|
|
126
113
|
} = options;
|
|
@@ -151,12 +138,7 @@ function imports(options = {}) {
|
|
|
151
138
|
|
|
152
139
|
// src/configs/javascript.ts
|
|
153
140
|
import globals from "globals";
|
|
154
|
-
|
|
155
|
-
// src/flags.ts
|
|
156
|
-
var OFF = 0;
|
|
157
|
-
|
|
158
|
-
// src/configs/javascript.ts
|
|
159
|
-
function javascript(options = {}) {
|
|
141
|
+
async function javascript(options = {}) {
|
|
160
142
|
const {
|
|
161
143
|
isInEditor = false,
|
|
162
144
|
overrides = {}
|
|
@@ -182,15 +164,17 @@ function javascript(options = {}) {
|
|
|
182
164
|
},
|
|
183
165
|
sourceType: "module"
|
|
184
166
|
},
|
|
167
|
+
linterOptions: {
|
|
168
|
+
reportUnusedDisableDirectives: true
|
|
169
|
+
},
|
|
185
170
|
name: "coderwyd:javascript",
|
|
186
171
|
plugins: {
|
|
187
172
|
"antfu": default2,
|
|
188
|
-
"unused-imports":
|
|
173
|
+
"unused-imports": default6
|
|
189
174
|
},
|
|
190
175
|
rules: {
|
|
191
176
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
192
177
|
"array-callback-return": "error",
|
|
193
|
-
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
194
178
|
"block-scoped-var": "error",
|
|
195
179
|
"constructor-super": "error",
|
|
196
180
|
"default-case-last": "error",
|
|
@@ -228,7 +212,6 @@ function javascript(options = {}) {
|
|
|
228
212
|
"no-implied-eval": "error",
|
|
229
213
|
"no-import-assign": "error",
|
|
230
214
|
"no-invalid-regexp": "error",
|
|
231
|
-
"no-invalid-this": "error",
|
|
232
215
|
"no-irregular-whitespace": "error",
|
|
233
216
|
"no-iterator": "error",
|
|
234
217
|
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
@@ -306,7 +289,6 @@ function javascript(options = {}) {
|
|
|
306
289
|
"no-useless-rename": "error",
|
|
307
290
|
"no-useless-return": "error",
|
|
308
291
|
"no-var": "error",
|
|
309
|
-
"no-void": "error",
|
|
310
292
|
"no-with": "error",
|
|
311
293
|
"object-shorthand": [
|
|
312
294
|
"error",
|
|
@@ -349,7 +331,7 @@ function javascript(options = {}) {
|
|
|
349
331
|
],
|
|
350
332
|
"symbol-description": "error",
|
|
351
333
|
"unicode-bom": ["error", "never"],
|
|
352
|
-
"unused-imports/no-unused-imports": isInEditor ?
|
|
334
|
+
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
353
335
|
"unused-imports/no-unused-vars": [
|
|
354
336
|
"error",
|
|
355
337
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
@@ -365,14 +347,61 @@ function javascript(options = {}) {
|
|
|
365
347
|
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
366
348
|
name: "coderwyd:scripts-overrides",
|
|
367
349
|
rules: {
|
|
368
|
-
"no-console":
|
|
350
|
+
"no-console": "off"
|
|
369
351
|
}
|
|
370
352
|
}
|
|
371
353
|
];
|
|
372
354
|
}
|
|
373
355
|
|
|
356
|
+
// src/utils.ts
|
|
357
|
+
import process from "process";
|
|
358
|
+
import { getPackageInfoSync, isPackageExists } from "local-pkg";
|
|
359
|
+
async function combine(...configs) {
|
|
360
|
+
const resolved = await Promise.all(configs);
|
|
361
|
+
return resolved.flat();
|
|
362
|
+
}
|
|
363
|
+
function renameRules(rules, from, to) {
|
|
364
|
+
return Object.fromEntries(
|
|
365
|
+
Object.entries(rules).map(([key, value]) => {
|
|
366
|
+
if (key.startsWith(from))
|
|
367
|
+
return [to + key.slice(from.length), value];
|
|
368
|
+
return [key, value];
|
|
369
|
+
})
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
function getVueVersion() {
|
|
373
|
+
const pkg = getPackageInfoSync("vue", { paths: [process.cwd()] });
|
|
374
|
+
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0]))
|
|
375
|
+
return +pkg.version[0];
|
|
376
|
+
return 3;
|
|
377
|
+
}
|
|
378
|
+
function toArray(value) {
|
|
379
|
+
return Array.isArray(value) ? value : [value];
|
|
380
|
+
}
|
|
381
|
+
async function interopDefault(m) {
|
|
382
|
+
const resolved = await m;
|
|
383
|
+
return resolved.default || resolved;
|
|
384
|
+
}
|
|
385
|
+
async function ensurePackages(packages) {
|
|
386
|
+
if (process.env.CI || process.stdout.isTTY === false)
|
|
387
|
+
return;
|
|
388
|
+
const nonExistingPackages = packages.filter((i) => !isPackageExists(i));
|
|
389
|
+
if (nonExistingPackages.length === 0)
|
|
390
|
+
return;
|
|
391
|
+
const { default: prompts } = await import("prompts");
|
|
392
|
+
const { result } = await prompts([
|
|
393
|
+
{
|
|
394
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`,
|
|
395
|
+
name: "result",
|
|
396
|
+
type: "confirm"
|
|
397
|
+
}
|
|
398
|
+
]);
|
|
399
|
+
if (result)
|
|
400
|
+
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
401
|
+
}
|
|
402
|
+
|
|
374
403
|
// src/configs/jsdoc.ts
|
|
375
|
-
function jsdoc(options = {}) {
|
|
404
|
+
async function jsdoc(options = {}) {
|
|
376
405
|
const {
|
|
377
406
|
stylistic: stylistic2 = true
|
|
378
407
|
} = options;
|
|
@@ -380,7 +409,8 @@ function jsdoc(options = {}) {
|
|
|
380
409
|
{
|
|
381
410
|
name: "coderwyd:jsdoc",
|
|
382
411
|
plugins: {
|
|
383
|
-
|
|
412
|
+
// @ts-expect-error missing types
|
|
413
|
+
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
384
414
|
},
|
|
385
415
|
rules: {
|
|
386
416
|
"jsdoc/check-access": "warn",
|
|
@@ -408,14 +438,22 @@ function jsdoc(options = {}) {
|
|
|
408
438
|
}
|
|
409
439
|
|
|
410
440
|
// src/configs/jsonc.ts
|
|
411
|
-
function jsonc(options = {}) {
|
|
441
|
+
async function jsonc(options = {}) {
|
|
412
442
|
const {
|
|
413
|
-
|
|
414
|
-
overrides = {}
|
|
443
|
+
files = [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
444
|
+
overrides = {},
|
|
445
|
+
stylistic: stylistic2 = true
|
|
415
446
|
} = options;
|
|
416
447
|
const {
|
|
417
448
|
indent = 2
|
|
418
449
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
450
|
+
const [
|
|
451
|
+
pluginJsonc,
|
|
452
|
+
parserJsonc
|
|
453
|
+
] = await Promise.all([
|
|
454
|
+
interopDefault(import("eslint-plugin-jsonc")),
|
|
455
|
+
interopDefault(import("jsonc-eslint-parser"))
|
|
456
|
+
]);
|
|
419
457
|
return [
|
|
420
458
|
{
|
|
421
459
|
name: "coderwyd:jsonc:setup",
|
|
@@ -424,9 +462,9 @@ function jsonc(options = {}) {
|
|
|
424
462
|
}
|
|
425
463
|
},
|
|
426
464
|
{
|
|
427
|
-
files
|
|
465
|
+
files,
|
|
428
466
|
languageOptions: {
|
|
429
|
-
parser:
|
|
467
|
+
parser: parserJsonc
|
|
430
468
|
},
|
|
431
469
|
name: "coderwyd:jsonc:rules",
|
|
432
470
|
rules: {
|
|
@@ -475,20 +513,22 @@ function jsonc(options = {}) {
|
|
|
475
513
|
}
|
|
476
514
|
|
|
477
515
|
// src/configs/markdown.ts
|
|
478
|
-
function markdown(options = {}) {
|
|
516
|
+
async function markdown(options = {}) {
|
|
479
517
|
const {
|
|
480
518
|
componentExts = [],
|
|
519
|
+
files = [GLOB_MARKDOWN],
|
|
481
520
|
overrides = {}
|
|
482
521
|
} = options;
|
|
483
522
|
return [
|
|
484
523
|
{
|
|
485
524
|
name: "coderwyd:markdown:setup",
|
|
486
525
|
plugins: {
|
|
487
|
-
|
|
526
|
+
// @ts-expect-error missing types
|
|
527
|
+
markdown: await interopDefault(import("eslint-plugin-markdown"))
|
|
488
528
|
}
|
|
489
529
|
},
|
|
490
530
|
{
|
|
491
|
-
files
|
|
531
|
+
files,
|
|
492
532
|
name: "coderwyd:markdown:processor",
|
|
493
533
|
processor: "markdown/markdown"
|
|
494
534
|
},
|
|
@@ -506,44 +546,48 @@ function markdown(options = {}) {
|
|
|
506
546
|
},
|
|
507
547
|
name: "coderwyd:markdown:rules",
|
|
508
548
|
rules: {
|
|
509
|
-
"antfu/no-
|
|
510
|
-
"
|
|
511
|
-
"no-alert":
|
|
512
|
-
"no-console":
|
|
513
|
-
"no-
|
|
514
|
-
"no-
|
|
515
|
-
"no-
|
|
516
|
-
"
|
|
517
|
-
"
|
|
518
|
-
"
|
|
519
|
-
"
|
|
520
|
-
"
|
|
521
|
-
"
|
|
522
|
-
"
|
|
523
|
-
"ts/
|
|
524
|
-
"ts/no-
|
|
525
|
-
"ts/no-
|
|
549
|
+
"antfu/no-ts-export-equal": "off",
|
|
550
|
+
"import/newline-after-import": "off",
|
|
551
|
+
"no-alert": "off",
|
|
552
|
+
"no-console": "off",
|
|
553
|
+
"no-labels": "off",
|
|
554
|
+
"no-lone-blocks": "off",
|
|
555
|
+
"no-restricted-syntax": "off",
|
|
556
|
+
"no-undef": "off",
|
|
557
|
+
"no-unused-expressions": "off",
|
|
558
|
+
"no-unused-labels": "off",
|
|
559
|
+
"no-unused-vars": "off",
|
|
560
|
+
"node/prefer-global/process": "off",
|
|
561
|
+
"style/comma-dangle": "off",
|
|
562
|
+
"style/eol-last": "off",
|
|
563
|
+
"ts/consistent-type-imports": "off",
|
|
564
|
+
"ts/no-namespace": "off",
|
|
565
|
+
"ts/no-redeclare": "off",
|
|
566
|
+
"ts/no-require-imports": "off",
|
|
567
|
+
"ts/no-unused-vars": "off",
|
|
568
|
+
"ts/no-use-before-define": "off",
|
|
569
|
+
"ts/no-var-requires": "off",
|
|
526
570
|
"unicode-bom": "off",
|
|
527
|
-
"unused-imports/no-unused-imports":
|
|
528
|
-
"unused-imports/no-unused-vars":
|
|
571
|
+
"unused-imports/no-unused-imports": "off",
|
|
572
|
+
"unused-imports/no-unused-vars": "off",
|
|
529
573
|
// Type aware rules
|
|
530
574
|
...{
|
|
531
|
-
"ts/await-thenable":
|
|
532
|
-
"ts/dot-notation":
|
|
533
|
-
"ts/no-floating-promises":
|
|
534
|
-
"ts/no-for-in-array":
|
|
535
|
-
"ts/no-implied-eval":
|
|
536
|
-
"ts/no-misused-promises":
|
|
537
|
-
"ts/no-throw-literal":
|
|
538
|
-
"ts/no-unnecessary-type-assertion":
|
|
539
|
-
"ts/no-unsafe-argument":
|
|
540
|
-
"ts/no-unsafe-assignment":
|
|
541
|
-
"ts/no-unsafe-call":
|
|
542
|
-
"ts/no-unsafe-member-access":
|
|
543
|
-
"ts/no-unsafe-return":
|
|
544
|
-
"ts/restrict-plus-operands":
|
|
545
|
-
"ts/restrict-template-expressions":
|
|
546
|
-
"ts/unbound-method":
|
|
575
|
+
"ts/await-thenable": "off",
|
|
576
|
+
"ts/dot-notation": "off",
|
|
577
|
+
"ts/no-floating-promises": "off",
|
|
578
|
+
"ts/no-for-in-array": "off",
|
|
579
|
+
"ts/no-implied-eval": "off",
|
|
580
|
+
"ts/no-misused-promises": "off",
|
|
581
|
+
"ts/no-throw-literal": "off",
|
|
582
|
+
"ts/no-unnecessary-type-assertion": "off",
|
|
583
|
+
"ts/no-unsafe-argument": "off",
|
|
584
|
+
"ts/no-unsafe-assignment": "off",
|
|
585
|
+
"ts/no-unsafe-call": "off",
|
|
586
|
+
"ts/no-unsafe-member-access": "off",
|
|
587
|
+
"ts/no-unsafe-return": "off",
|
|
588
|
+
"ts/restrict-plus-operands": "off",
|
|
589
|
+
"ts/restrict-template-expressions": "off",
|
|
590
|
+
"ts/unbound-method": "off"
|
|
547
591
|
},
|
|
548
592
|
...overrides
|
|
549
593
|
}
|
|
@@ -552,12 +596,12 @@ function markdown(options = {}) {
|
|
|
552
596
|
}
|
|
553
597
|
|
|
554
598
|
// src/configs/node.ts
|
|
555
|
-
function node() {
|
|
599
|
+
async function node() {
|
|
556
600
|
return [
|
|
557
601
|
{
|
|
558
602
|
name: "coderwyd:node",
|
|
559
603
|
plugins: {
|
|
560
|
-
node:
|
|
604
|
+
node: default4
|
|
561
605
|
},
|
|
562
606
|
rules: {
|
|
563
607
|
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
@@ -574,7 +618,7 @@ function node() {
|
|
|
574
618
|
}
|
|
575
619
|
|
|
576
620
|
// src/configs/sort.ts
|
|
577
|
-
function sortPackageJson() {
|
|
621
|
+
async function sortPackageJson() {
|
|
578
622
|
return [
|
|
579
623
|
{
|
|
580
624
|
files: ["**/package.json"],
|
|
@@ -633,7 +677,6 @@ function sortPackageJson() {
|
|
|
633
677
|
"husky",
|
|
634
678
|
"simple-git-hooks",
|
|
635
679
|
"lint-staged",
|
|
636
|
-
"nano-staged",
|
|
637
680
|
"eslintConfig"
|
|
638
681
|
],
|
|
639
682
|
pathPattern: "^$"
|
|
@@ -791,161 +834,58 @@ function sortTsconfig() {
|
|
|
791
834
|
}
|
|
792
835
|
|
|
793
836
|
// src/configs/stylistic.ts
|
|
794
|
-
function stylistic(options = {}) {
|
|
837
|
+
async function stylistic(options = {}) {
|
|
795
838
|
const {
|
|
796
839
|
indent = 2,
|
|
797
|
-
|
|
840
|
+
jsx = true,
|
|
841
|
+
quotes = "single",
|
|
842
|
+
semi = false
|
|
798
843
|
} = options;
|
|
844
|
+
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
845
|
+
const config = pluginStylistic.configs.customize({
|
|
846
|
+
flat: true,
|
|
847
|
+
indent,
|
|
848
|
+
jsx,
|
|
849
|
+
pluginName: "style",
|
|
850
|
+
quotes,
|
|
851
|
+
semi
|
|
852
|
+
});
|
|
799
853
|
return [
|
|
800
854
|
{
|
|
801
855
|
name: "coderwyd:stylistic",
|
|
802
856
|
plugins: {
|
|
803
857
|
antfu: default2,
|
|
804
|
-
style:
|
|
858
|
+
style: pluginStylistic
|
|
805
859
|
},
|
|
806
860
|
rules: {
|
|
861
|
+
...config.rules,
|
|
807
862
|
"antfu/consistent-list-newline": "error",
|
|
808
863
|
"antfu/if-newline": "error",
|
|
864
|
+
"antfu/indent-binary-ops": ["error", { indent }],
|
|
809
865
|
"antfu/top-level-function": "error",
|
|
810
|
-
"curly": ["error", "multi-or-nest", "consistent"]
|
|
811
|
-
"style/array-bracket-spacing": ["error", "never"],
|
|
812
|
-
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
813
|
-
"style/block-spacing": ["error", "always"],
|
|
814
|
-
"style/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
815
|
-
"style/comma-dangle": ["error", "always-multiline"],
|
|
816
|
-
"style/comma-spacing": ["error", { after: true, before: false }],
|
|
817
|
-
"style/comma-style": ["error", "last"],
|
|
818
|
-
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
819
|
-
"style/dot-location": ["error", "property"],
|
|
820
|
-
"style/eol-last": "error",
|
|
821
|
-
"style/indent": ["error", indent, {
|
|
822
|
-
ArrayExpression: 1,
|
|
823
|
-
CallExpression: { arguments: 1 },
|
|
824
|
-
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
825
|
-
FunctionExpression: { body: 1, parameters: 1 },
|
|
826
|
-
ImportDeclaration: 1,
|
|
827
|
-
MemberExpression: 1,
|
|
828
|
-
ObjectExpression: 1,
|
|
829
|
-
SwitchCase: 1,
|
|
830
|
-
VariableDeclarator: 1,
|
|
831
|
-
flatTernaryExpressions: false,
|
|
832
|
-
ignoreComments: false,
|
|
833
|
-
ignoredNodes: [
|
|
834
|
-
"TemplateLiteral *",
|
|
835
|
-
"JSXElement",
|
|
836
|
-
"JSXElement > *",
|
|
837
|
-
"JSXAttribute",
|
|
838
|
-
"JSXIdentifier",
|
|
839
|
-
"JSXNamespacedName",
|
|
840
|
-
"JSXMemberExpression",
|
|
841
|
-
"JSXSpreadAttribute",
|
|
842
|
-
"JSXExpressionContainer",
|
|
843
|
-
"JSXOpeningElement",
|
|
844
|
-
"JSXClosingElement",
|
|
845
|
-
"JSXFragment",
|
|
846
|
-
"JSXOpeningFragment",
|
|
847
|
-
"JSXClosingFragment",
|
|
848
|
-
"JSXText",
|
|
849
|
-
"JSXEmptyExpression",
|
|
850
|
-
"JSXSpreadChild",
|
|
851
|
-
"TSTypeParameterInstantiation",
|
|
852
|
-
"FunctionExpression > .params[decorators.length > 0]",
|
|
853
|
-
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
|
|
854
|
-
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
855
|
-
],
|
|
856
|
-
offsetTernaryExpressions: true,
|
|
857
|
-
outerIIFEBody: 1
|
|
858
|
-
}],
|
|
859
|
-
"style/jsx-quotes": "error",
|
|
860
|
-
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
861
|
-
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
862
|
-
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
863
|
-
"style/max-statements-per-line": ["error", { max: 1 }],
|
|
864
|
-
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
865
|
-
"style/multiline-ternary": ["error", "always-multiline"],
|
|
866
|
-
"style/new-parens": "error",
|
|
867
|
-
"style/no-extra-parens": ["error", "functions"],
|
|
868
|
-
"style/no-floating-decimal": "error",
|
|
869
|
-
"style/no-mixed-operators": ["error", {
|
|
870
|
-
allowSamePrecedence: true,
|
|
871
|
-
groups: [
|
|
872
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
873
|
-
["&&", "||"],
|
|
874
|
-
["in", "instanceof"]
|
|
875
|
-
]
|
|
876
|
-
}],
|
|
877
|
-
"style/no-mixed-spaces-and-tabs": "error",
|
|
878
|
-
"style/no-multi-spaces": "error",
|
|
879
|
-
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
880
|
-
"style/no-tabs": indent === "tab" ? "off" : "error",
|
|
881
|
-
"style/no-trailing-spaces": "error",
|
|
882
|
-
"style/no-whitespace-before-property": "error",
|
|
883
|
-
"style/object-curly-spacing": ["error", "always"],
|
|
884
|
-
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
885
|
-
"style/operator-linebreak": ["error", "before"],
|
|
886
|
-
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
887
|
-
"style/quote-props": ["error", "consistent-as-needed"],
|
|
888
|
-
"style/quotes": ["error", quotes, { allowTemplateLiterals: true, avoidEscape: false }],
|
|
889
|
-
"style/rest-spread-spacing": ["error", "never"],
|
|
890
|
-
"style/semi": ["error", "never"],
|
|
891
|
-
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
892
|
-
"style/space-before-blocks": ["error", "always"],
|
|
893
|
-
"style/space-before-function-paren": ["error", { anonymous: "always", asyncArrow: "always", named: "never" }],
|
|
894
|
-
"style/space-in-parens": ["error", "never"],
|
|
895
|
-
"style/space-infix-ops": "error",
|
|
896
|
-
"style/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
897
|
-
"style/spaced-comment": ["error", "always", {
|
|
898
|
-
block: {
|
|
899
|
-
balanced: true,
|
|
900
|
-
exceptions: ["*"],
|
|
901
|
-
markers: ["!"]
|
|
902
|
-
},
|
|
903
|
-
line: {
|
|
904
|
-
exceptions: ["/", "#"],
|
|
905
|
-
markers: ["/"]
|
|
906
|
-
}
|
|
907
|
-
}],
|
|
908
|
-
"style/template-curly-spacing": "error",
|
|
909
|
-
"style/template-tag-spacing": ["error", "never"],
|
|
910
|
-
"style/type-annotation-spacing": ["error", {}],
|
|
911
|
-
"style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
912
|
-
"style/yield-star-spacing": ["error", "both"]
|
|
866
|
+
"curly": ["error", "multi-or-nest", "consistent"]
|
|
913
867
|
}
|
|
914
868
|
}
|
|
915
869
|
];
|
|
916
870
|
}
|
|
917
871
|
|
|
918
872
|
// src/configs/typescript.ts
|
|
919
|
-
import
|
|
920
|
-
|
|
921
|
-
// src/utils.ts
|
|
922
|
-
function combine(...configs) {
|
|
923
|
-
return configs.flatMap((config) => Array.isArray(config) ? config : [config]);
|
|
924
|
-
}
|
|
925
|
-
function renameRules(rules, from, to) {
|
|
926
|
-
return Object.fromEntries(
|
|
927
|
-
Object.entries(rules).map(([key, value]) => {
|
|
928
|
-
if (key.startsWith(from))
|
|
929
|
-
return [to + key.slice(from.length), value];
|
|
930
|
-
return [key, value];
|
|
931
|
-
})
|
|
932
|
-
);
|
|
933
|
-
}
|
|
934
|
-
|
|
935
|
-
// src/configs/typescript.ts
|
|
936
|
-
function typescript(options) {
|
|
873
|
+
import process2 from "process";
|
|
874
|
+
async function typescript(options = {}) {
|
|
937
875
|
const {
|
|
938
876
|
componentExts = [],
|
|
939
877
|
overrides = {},
|
|
940
|
-
parserOptions = {}
|
|
941
|
-
|
|
942
|
-
|
|
878
|
+
parserOptions = {}
|
|
879
|
+
} = options;
|
|
880
|
+
const files = options.files ?? [
|
|
881
|
+
GLOB_SRC,
|
|
882
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
883
|
+
];
|
|
943
884
|
const typeAwareRules = {
|
|
944
|
-
"dot-notation":
|
|
945
|
-
"no-implied-eval":
|
|
946
|
-
"no-throw-literal":
|
|
885
|
+
"dot-notation": "off",
|
|
886
|
+
"no-implied-eval": "off",
|
|
887
|
+
"no-throw-literal": "off",
|
|
947
888
|
"ts/await-thenable": "error",
|
|
948
|
-
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
949
889
|
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
950
890
|
"ts/no-floating-promises": "error",
|
|
951
891
|
"ts/no-for-in-array": "error",
|
|
@@ -962,27 +902,33 @@ function typescript(options) {
|
|
|
962
902
|
"ts/restrict-template-expressions": "error",
|
|
963
903
|
"ts/unbound-method": "error"
|
|
964
904
|
};
|
|
905
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
906
|
+
const [
|
|
907
|
+
pluginTs,
|
|
908
|
+
parserTs
|
|
909
|
+
] = await Promise.all([
|
|
910
|
+
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
911
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
912
|
+
]);
|
|
965
913
|
return [
|
|
966
914
|
{
|
|
915
|
+
// Install the plugins without globs, so they can be configured separately.
|
|
967
916
|
name: "coderwyd:typescript:setup",
|
|
968
917
|
plugins: {
|
|
969
918
|
antfu: default2,
|
|
970
|
-
|
|
971
|
-
ts: default8
|
|
919
|
+
ts: pluginTs
|
|
972
920
|
}
|
|
973
921
|
},
|
|
974
922
|
{
|
|
975
|
-
files
|
|
976
|
-
GLOB_SRC,
|
|
977
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
|
978
|
-
],
|
|
923
|
+
files,
|
|
979
924
|
languageOptions: {
|
|
980
925
|
parser: parserTs,
|
|
981
926
|
parserOptions: {
|
|
927
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
982
928
|
sourceType: "module",
|
|
983
929
|
...tsconfigPath ? {
|
|
984
|
-
project:
|
|
985
|
-
tsconfigRootDir:
|
|
930
|
+
project: tsconfigPath,
|
|
931
|
+
tsconfigRootDir: process2.cwd()
|
|
986
932
|
} : {},
|
|
987
933
|
...parserOptions
|
|
988
934
|
}
|
|
@@ -990,44 +936,42 @@ function typescript(options) {
|
|
|
990
936
|
name: "coderwyd:typescript:rules",
|
|
991
937
|
rules: {
|
|
992
938
|
...renameRules(
|
|
993
|
-
|
|
939
|
+
pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
994
940
|
"@typescript-eslint/",
|
|
995
941
|
"ts/"
|
|
996
942
|
),
|
|
997
943
|
...renameRules(
|
|
998
|
-
|
|
944
|
+
pluginTs.configs.strict.rules,
|
|
999
945
|
"@typescript-eslint/",
|
|
1000
946
|
"ts/"
|
|
1001
947
|
),
|
|
1002
948
|
"antfu/generic-spacing": "error",
|
|
1003
949
|
"antfu/named-tuple-spacing": "error",
|
|
1004
|
-
"
|
|
1005
|
-
"no-
|
|
1006
|
-
"no-
|
|
1007
|
-
"no-
|
|
1008
|
-
"no-
|
|
1009
|
-
"no-use-before-define": OFF,
|
|
1010
|
-
"no-useless-constructor": OFF,
|
|
1011
|
-
// TS
|
|
950
|
+
"no-dupe-class-members": "off",
|
|
951
|
+
"no-loss-of-precision": "off",
|
|
952
|
+
"no-redeclare": "off",
|
|
953
|
+
"no-use-before-define": "off",
|
|
954
|
+
"no-useless-constructor": "off",
|
|
1012
955
|
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
956
|
+
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1013
957
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1014
958
|
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
1015
959
|
"ts/no-dupe-class-members": "error",
|
|
1016
|
-
"ts/no-dynamic-delete":
|
|
1017
|
-
"ts/no-explicit-any":
|
|
1018
|
-
"ts/no-extraneous-class":
|
|
1019
|
-
"ts/no-
|
|
1020
|
-
"ts/no-invalid-void-type":
|
|
960
|
+
"ts/no-dynamic-delete": "off",
|
|
961
|
+
"ts/no-explicit-any": "off",
|
|
962
|
+
"ts/no-extraneous-class": "off",
|
|
963
|
+
"ts/no-import-type-side-effects": "error",
|
|
964
|
+
"ts/no-invalid-void-type": "off",
|
|
1021
965
|
"ts/no-loss-of-precision": "error",
|
|
1022
|
-
"ts/no-non-null-assertion":
|
|
966
|
+
"ts/no-non-null-assertion": "off",
|
|
1023
967
|
"ts/no-redeclare": "error",
|
|
1024
968
|
"ts/no-require-imports": "error",
|
|
1025
|
-
"ts/no-unused-vars":
|
|
969
|
+
"ts/no-unused-vars": "off",
|
|
1026
970
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1027
|
-
"ts/no-useless-constructor":
|
|
971
|
+
"ts/no-useless-constructor": "off",
|
|
1028
972
|
"ts/prefer-ts-expect-error": "error",
|
|
1029
|
-
"ts/triple-slash-reference":
|
|
1030
|
-
"ts/unified-signatures":
|
|
973
|
+
"ts/triple-slash-reference": "off",
|
|
974
|
+
"ts/unified-signatures": "off",
|
|
1031
975
|
...tsconfigPath ? typeAwareRules : {},
|
|
1032
976
|
...overrides
|
|
1033
977
|
}
|
|
@@ -1036,37 +980,37 @@ function typescript(options) {
|
|
|
1036
980
|
files: ["**/*.d.ts"],
|
|
1037
981
|
name: "coderwyd:typescript:dts-overrides",
|
|
1038
982
|
rules: {
|
|
1039
|
-
"eslint-comments/no-unlimited-disable":
|
|
1040
|
-
"import/no-duplicates":
|
|
1041
|
-
"no-restricted-syntax":
|
|
1042
|
-
"unused-imports/no-unused-vars":
|
|
983
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
984
|
+
"import/no-duplicates": "off",
|
|
985
|
+
"no-restricted-syntax": "off",
|
|
986
|
+
"unused-imports/no-unused-vars": "off"
|
|
1043
987
|
}
|
|
1044
988
|
},
|
|
1045
989
|
{
|
|
1046
|
-
files:
|
|
990
|
+
files: ["**/*.{test,spec}.ts?(x)"],
|
|
1047
991
|
name: "coderwyd:typescript:tests-overrides",
|
|
1048
992
|
rules: {
|
|
1049
|
-
"no-unused-expressions":
|
|
993
|
+
"no-unused-expressions": "off"
|
|
1050
994
|
}
|
|
1051
995
|
},
|
|
1052
996
|
{
|
|
1053
|
-
files: [
|
|
997
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
1054
998
|
name: "coderwyd:typescript:javascript-overrides",
|
|
1055
999
|
rules: {
|
|
1056
|
-
"ts/no-require-imports":
|
|
1057
|
-
"ts/no-var-requires":
|
|
1000
|
+
"ts/no-require-imports": "off",
|
|
1001
|
+
"ts/no-var-requires": "off"
|
|
1058
1002
|
}
|
|
1059
1003
|
}
|
|
1060
1004
|
];
|
|
1061
1005
|
}
|
|
1062
1006
|
|
|
1063
1007
|
// src/configs/unicorn.ts
|
|
1064
|
-
function unicorn() {
|
|
1008
|
+
async function unicorn() {
|
|
1065
1009
|
return [
|
|
1066
1010
|
{
|
|
1067
1011
|
name: "coderwyd:unicorn",
|
|
1068
1012
|
plugins: {
|
|
1069
|
-
unicorn:
|
|
1013
|
+
unicorn: default5
|
|
1070
1014
|
},
|
|
1071
1015
|
rules: {
|
|
1072
1016
|
// Pass error message when throwing errors
|
|
@@ -1101,60 +1045,61 @@ function unicorn() {
|
|
|
1101
1045
|
}
|
|
1102
1046
|
|
|
1103
1047
|
// src/configs/vue.ts
|
|
1104
|
-
|
|
1105
|
-
import { getPackageInfoSync } from "local-pkg";
|
|
1106
|
-
function getVueVersion() {
|
|
1107
|
-
const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
|
|
1108
|
-
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0]))
|
|
1109
|
-
return +pkg.version[0];
|
|
1110
|
-
return 3;
|
|
1111
|
-
}
|
|
1112
|
-
var isVue3 = getVueVersion() === 3;
|
|
1113
|
-
var vue3Rules = {
|
|
1114
|
-
...default13.configs.base.rules,
|
|
1115
|
-
...default13.configs["vue3-essential"].rules,
|
|
1116
|
-
...default13.configs["vue3-strongly-recommended"].rules,
|
|
1117
|
-
...default13.configs["vue3-recommended"].rules
|
|
1118
|
-
};
|
|
1119
|
-
var vue2Rules = {
|
|
1120
|
-
...default13.configs.base.rules,
|
|
1121
|
-
...default13.configs.essential.rules,
|
|
1122
|
-
...default13.configs["strongly-recommended"].rules,
|
|
1123
|
-
...default13.configs.recommended.rules
|
|
1124
|
-
};
|
|
1125
|
-
function vue(options = {}) {
|
|
1048
|
+
async function vue(options = {}) {
|
|
1126
1049
|
const {
|
|
1050
|
+
files = [GLOB_VUE],
|
|
1127
1051
|
overrides = {},
|
|
1128
1052
|
stylistic: stylistic2 = true
|
|
1129
1053
|
} = options;
|
|
1130
1054
|
const {
|
|
1131
1055
|
indent = 2
|
|
1132
1056
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1057
|
+
const isVue3 = getVueVersion() === 3;
|
|
1058
|
+
const [
|
|
1059
|
+
pluginVue,
|
|
1060
|
+
parserVue
|
|
1061
|
+
] = await Promise.all([
|
|
1062
|
+
// @ts-expect-error missing types
|
|
1063
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
1064
|
+
interopDefault(import("vue-eslint-parser"))
|
|
1065
|
+
]);
|
|
1066
|
+
const vue3Rules = {
|
|
1067
|
+
...pluginVue.configs.base.rules,
|
|
1068
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
1069
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1070
|
+
...pluginVue.configs["vue3-recommended"].rules
|
|
1071
|
+
};
|
|
1072
|
+
const vue2Rules = {
|
|
1073
|
+
...pluginVue.configs.base.rules,
|
|
1074
|
+
...pluginVue.configs.essential.rules,
|
|
1075
|
+
...pluginVue.configs["strongly-recommended"].rules,
|
|
1076
|
+
...pluginVue.configs.recommended.rules
|
|
1077
|
+
};
|
|
1133
1078
|
return [
|
|
1134
1079
|
{
|
|
1135
1080
|
name: "coderwyd:vue:setup",
|
|
1136
1081
|
plugins: {
|
|
1137
|
-
vue:
|
|
1082
|
+
vue: pluginVue
|
|
1138
1083
|
}
|
|
1139
1084
|
},
|
|
1140
1085
|
{
|
|
1141
|
-
files
|
|
1086
|
+
files,
|
|
1142
1087
|
languageOptions: {
|
|
1143
|
-
parser:
|
|
1088
|
+
parser: parserVue,
|
|
1144
1089
|
parserOptions: {
|
|
1145
1090
|
ecmaFeatures: {
|
|
1146
1091
|
jsx: true
|
|
1147
1092
|
},
|
|
1148
1093
|
extraFileExtensions: [".vue"],
|
|
1149
|
-
parser: options.typescript ?
|
|
1094
|
+
parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
1150
1095
|
sourceType: "module"
|
|
1151
1096
|
}
|
|
1152
1097
|
},
|
|
1153
1098
|
name: "coderwyd:vue:rules",
|
|
1154
|
-
processor:
|
|
1099
|
+
processor: pluginVue.processors[".vue"],
|
|
1155
1100
|
rules: {
|
|
1156
1101
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
1157
|
-
"node/prefer-global/process":
|
|
1102
|
+
"node/prefer-global/process": "off",
|
|
1158
1103
|
"vue/block-order": ["error", {
|
|
1159
1104
|
order: ["script", "template", "style"]
|
|
1160
1105
|
}],
|
|
@@ -1169,9 +1114,9 @@ function vue(options = {}) {
|
|
|
1169
1114
|
"vue/eqeqeq": ["error", "smart"],
|
|
1170
1115
|
"vue/html-indent": ["error", indent],
|
|
1171
1116
|
"vue/html-quotes": ["error", "double"],
|
|
1172
|
-
"vue/max-attributes-per-line":
|
|
1173
|
-
"vue/multi-word-component-names":
|
|
1174
|
-
"vue/no-dupe-keys":
|
|
1117
|
+
"vue/max-attributes-per-line": "off",
|
|
1118
|
+
"vue/multi-word-component-names": "off",
|
|
1119
|
+
"vue/no-dupe-keys": "off",
|
|
1175
1120
|
"vue/no-empty-pattern": "error",
|
|
1176
1121
|
"vue/no-extra-parens": ["error", "functions"],
|
|
1177
1122
|
"vue/no-irregular-whitespace": "error",
|
|
@@ -1183,11 +1128,11 @@ function vue(options = {}) {
|
|
|
1183
1128
|
"WithStatement"
|
|
1184
1129
|
],
|
|
1185
1130
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1186
|
-
"vue/no-setup-props-reactivity-loss":
|
|
1131
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1187
1132
|
"vue/no-sparse-arrays": "error",
|
|
1188
1133
|
"vue/no-unused-refs": "error",
|
|
1189
1134
|
"vue/no-useless-v-bind": "error",
|
|
1190
|
-
"vue/no-v-html":
|
|
1135
|
+
"vue/no-v-html": "off",
|
|
1191
1136
|
"vue/object-shorthand": [
|
|
1192
1137
|
"error",
|
|
1193
1138
|
"always",
|
|
@@ -1198,8 +1143,9 @@ function vue(options = {}) {
|
|
|
1198
1143
|
],
|
|
1199
1144
|
"vue/prefer-separate-static-class": "error",
|
|
1200
1145
|
"vue/prefer-template": "error",
|
|
1201
|
-
"vue/
|
|
1202
|
-
"vue/require-prop
|
|
1146
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1147
|
+
"vue/require-default-prop": "off",
|
|
1148
|
+
"vue/require-prop-types": "off",
|
|
1203
1149
|
"vue/space-infix-ops": "error",
|
|
1204
1150
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1205
1151
|
...stylistic2 ? {
|
|
@@ -1219,7 +1165,7 @@ function vue(options = {}) {
|
|
|
1219
1165
|
}],
|
|
1220
1166
|
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1221
1167
|
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1222
|
-
"vue/object-curly-newline":
|
|
1168
|
+
"vue/object-curly-newline": "off",
|
|
1223
1169
|
"vue/object-curly-spacing": ["error", "always"],
|
|
1224
1170
|
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1225
1171
|
"vue/operator-linebreak": ["error", "before"],
|
|
@@ -1235,8 +1181,9 @@ function vue(options = {}) {
|
|
|
1235
1181
|
}
|
|
1236
1182
|
|
|
1237
1183
|
// src/configs/yaml.ts
|
|
1238
|
-
function yaml(options = {}) {
|
|
1184
|
+
async function yaml(options = {}) {
|
|
1239
1185
|
const {
|
|
1186
|
+
files = [GLOB_YAML],
|
|
1240
1187
|
overrides = {},
|
|
1241
1188
|
stylistic: stylistic2 = true
|
|
1242
1189
|
} = options;
|
|
@@ -1244,6 +1191,13 @@ function yaml(options = {}) {
|
|
|
1244
1191
|
indent = 2,
|
|
1245
1192
|
quotes = "single"
|
|
1246
1193
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1194
|
+
const [
|
|
1195
|
+
pluginYaml,
|
|
1196
|
+
parserYaml
|
|
1197
|
+
] = await Promise.all([
|
|
1198
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
1199
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
1200
|
+
]);
|
|
1247
1201
|
return [
|
|
1248
1202
|
{
|
|
1249
1203
|
name: "coderwyd:yaml:setup",
|
|
@@ -1252,13 +1206,13 @@ function yaml(options = {}) {
|
|
|
1252
1206
|
}
|
|
1253
1207
|
},
|
|
1254
1208
|
{
|
|
1255
|
-
files
|
|
1209
|
+
files,
|
|
1256
1210
|
languageOptions: {
|
|
1257
|
-
parser:
|
|
1211
|
+
parser: parserYaml
|
|
1258
1212
|
},
|
|
1259
1213
|
name: "coderwyd:yaml:rules",
|
|
1260
1214
|
rules: {
|
|
1261
|
-
"style/spaced-comment":
|
|
1215
|
+
"style/spaced-comment": "off",
|
|
1262
1216
|
"yaml/block-mapping": "error",
|
|
1263
1217
|
"yaml/block-sequence": "error",
|
|
1264
1218
|
"yaml/no-empty-key": "error",
|
|
@@ -1286,32 +1240,42 @@ function yaml(options = {}) {
|
|
|
1286
1240
|
}
|
|
1287
1241
|
|
|
1288
1242
|
// src/configs/test.ts
|
|
1289
|
-
function test(options = {}) {
|
|
1243
|
+
async function test(options = {}) {
|
|
1290
1244
|
const {
|
|
1245
|
+
files = GLOB_TESTS,
|
|
1291
1246
|
isInEditor = false,
|
|
1292
1247
|
overrides = {}
|
|
1293
1248
|
} = options;
|
|
1249
|
+
const [
|
|
1250
|
+
pluginVitest,
|
|
1251
|
+
pluginNoOnlyTests
|
|
1252
|
+
] = await Promise.all([
|
|
1253
|
+
interopDefault(import("eslint-plugin-vitest")),
|
|
1254
|
+
// @ts-expect-error missing types
|
|
1255
|
+
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
1256
|
+
]);
|
|
1294
1257
|
return [
|
|
1295
1258
|
{
|
|
1296
1259
|
name: "coderwyd:test:setup",
|
|
1297
1260
|
plugins: {
|
|
1298
1261
|
test: {
|
|
1299
|
-
...
|
|
1262
|
+
...pluginVitest,
|
|
1300
1263
|
rules: {
|
|
1301
|
-
...
|
|
1264
|
+
...pluginVitest.rules,
|
|
1302
1265
|
// extend `test/no-only-tests` rule
|
|
1303
|
-
...
|
|
1266
|
+
...pluginNoOnlyTests.rules
|
|
1304
1267
|
}
|
|
1305
1268
|
}
|
|
1306
1269
|
}
|
|
1307
1270
|
},
|
|
1308
1271
|
{
|
|
1309
|
-
files
|
|
1272
|
+
files,
|
|
1310
1273
|
name: "coderwyd:test:rules",
|
|
1311
1274
|
rules: {
|
|
1275
|
+
"node/prefer-global/process": "off",
|
|
1312
1276
|
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
1313
1277
|
"test/no-identical-title": "error",
|
|
1314
|
-
"test/no-only-tests": isInEditor ?
|
|
1278
|
+
"test/no-only-tests": isInEditor ? "off" : "error",
|
|
1315
1279
|
"test/prefer-hooks-in-order": "error",
|
|
1316
1280
|
"test/prefer-lowercase-title": "error",
|
|
1317
1281
|
...overrides
|
|
@@ -1320,210 +1284,136 @@ function test(options = {}) {
|
|
|
1320
1284
|
];
|
|
1321
1285
|
}
|
|
1322
1286
|
|
|
1287
|
+
// src/configs/perfectionist.ts
|
|
1288
|
+
async function perfectionist() {
|
|
1289
|
+
return [
|
|
1290
|
+
{
|
|
1291
|
+
name: "coderwyd:perfectionist",
|
|
1292
|
+
plugins: {
|
|
1293
|
+
perfectionist: default7
|
|
1294
|
+
}
|
|
1295
|
+
}
|
|
1296
|
+
];
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1323
1299
|
// src/configs/react.ts
|
|
1324
|
-
import
|
|
1325
|
-
|
|
1300
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1301
|
+
var ReactRefreshAllowConstantExportPackages = [
|
|
1302
|
+
"vite"
|
|
1303
|
+
];
|
|
1304
|
+
async function react(options = {}) {
|
|
1326
1305
|
const {
|
|
1306
|
+
files = [GLOB_JSX, GLOB_TSX],
|
|
1327
1307
|
overrides = {},
|
|
1328
|
-
|
|
1308
|
+
typescript: typescript2 = true
|
|
1329
1309
|
} = options;
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1310
|
+
await ensurePackages([
|
|
1311
|
+
"eslint-plugin-react",
|
|
1312
|
+
"eslint-plugin-react-hooks",
|
|
1313
|
+
"eslint-plugin-react-refresh"
|
|
1314
|
+
]);
|
|
1315
|
+
const [
|
|
1316
|
+
pluginReact,
|
|
1317
|
+
pluginReactHooks,
|
|
1318
|
+
pluginReactRefresh
|
|
1319
|
+
] = await Promise.all([
|
|
1320
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1321
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1322
|
+
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1323
|
+
]);
|
|
1324
|
+
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1325
|
+
(i) => isPackageExists2(i)
|
|
1326
|
+
);
|
|
1334
1327
|
return [
|
|
1335
1328
|
{
|
|
1336
1329
|
name: "coderwyd:react:setup",
|
|
1337
1330
|
plugins: {
|
|
1338
|
-
"react":
|
|
1339
|
-
"react-hooks":
|
|
1340
|
-
|
|
1341
|
-
settings: {
|
|
1342
|
-
"import/extensions": extensions,
|
|
1343
|
-
"import/resolver": {
|
|
1344
|
-
node: { extensions }
|
|
1345
|
-
},
|
|
1346
|
-
"react": {
|
|
1347
|
-
version: "detect"
|
|
1348
|
-
}
|
|
1331
|
+
"react": pluginReact,
|
|
1332
|
+
"react-hooks": pluginReactHooks,
|
|
1333
|
+
"react-refresh": pluginReactRefresh
|
|
1349
1334
|
}
|
|
1350
1335
|
},
|
|
1351
1336
|
{
|
|
1352
|
-
files
|
|
1337
|
+
files,
|
|
1353
1338
|
languageOptions: {
|
|
1354
|
-
globals: globals2.browser,
|
|
1355
1339
|
parserOptions: {
|
|
1356
1340
|
ecmaFeatures: {
|
|
1357
1341
|
jsx: true
|
|
1358
|
-
}
|
|
1359
|
-
// for @typescript/eslint-parser
|
|
1360
|
-
jsxPragma: void 0,
|
|
1361
|
-
// FIXME: @typescript-eslint v6 throws deprecation warnings
|
|
1362
|
-
// See https://github.com/jsx-eslint/eslint-plugin-react/issues/3602
|
|
1363
|
-
// Remove this when they support typescript 5.2
|
|
1364
|
-
suppressDeprecatedPropertyWarnings: true
|
|
1342
|
+
}
|
|
1365
1343
|
}
|
|
1366
1344
|
},
|
|
1367
1345
|
name: "coderwyd:react:rules",
|
|
1368
1346
|
rules: {
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
"
|
|
1372
|
-
|
|
1373
|
-
"react/
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
"react/no-
|
|
1392
|
-
"react/no-
|
|
1393
|
-
"react/
|
|
1347
|
+
// recommended rules react-hooks
|
|
1348
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1349
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1350
|
+
// react refresh
|
|
1351
|
+
"react-refresh/only-export-components": [
|
|
1352
|
+
"warn",
|
|
1353
|
+
{ allowConstantExport: isAllowConstantExport }
|
|
1354
|
+
],
|
|
1355
|
+
// recommended rules react
|
|
1356
|
+
"react/display-name": "error",
|
|
1357
|
+
"react/jsx-key": "error",
|
|
1358
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
1359
|
+
"react/jsx-no-duplicate-props": "error",
|
|
1360
|
+
"react/jsx-no-target-blank": "error",
|
|
1361
|
+
"react/jsx-no-undef": "error",
|
|
1362
|
+
"react/jsx-uses-react": "error",
|
|
1363
|
+
"react/jsx-uses-vars": "error",
|
|
1364
|
+
"react/no-children-prop": "error",
|
|
1365
|
+
"react/no-danger-with-children": "error",
|
|
1366
|
+
"react/no-deprecated": "error",
|
|
1367
|
+
"react/no-direct-mutation-state": "error",
|
|
1368
|
+
"react/no-find-dom-node": "error",
|
|
1369
|
+
"react/no-is-mounted": "error",
|
|
1370
|
+
"react/no-render-return-value": "error",
|
|
1371
|
+
"react/no-string-refs": "error",
|
|
1372
|
+
"react/no-unescaped-entities": "error",
|
|
1373
|
+
"react/no-unknown-property": "error",
|
|
1374
|
+
"react/no-unsafe": "off",
|
|
1375
|
+
"react/prop-types": "error",
|
|
1394
1376
|
"react/react-in-jsx-scope": "off",
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
"react/jsx-
|
|
1398
|
-
"react/
|
|
1399
|
-
multiline: "consistent",
|
|
1400
|
-
singleline: "consistent"
|
|
1401
|
-
}],
|
|
1402
|
-
"react/jsx-curly-spacing": ["error", "never", { allowMultiline: true }],
|
|
1403
|
-
"react/jsx-first-prop-new-line": ["error", "multiline-multiprop"],
|
|
1404
|
-
"react/jsx-fragments": ["error", "syntax"],
|
|
1405
|
-
"react/jsx-indent": ["error", indent, { checkAttributes: false, indentLogicalExpressions: true }],
|
|
1406
|
-
"react/jsx-indent-props": ["error", indent],
|
|
1407
|
-
"react/jsx-max-props-per-line": ["error", { maximum: 1, when: "multiline" }],
|
|
1408
|
-
"react/jsx-no-useless-fragment": "error",
|
|
1409
|
-
"react/jsx-props-no-multi-spaces": "error",
|
|
1410
|
-
"react/jsx-tag-spacing": ["error", {
|
|
1411
|
-
afterOpening: "never",
|
|
1412
|
-
beforeClosing: "never",
|
|
1413
|
-
beforeSelfClosing: "always",
|
|
1414
|
-
closingSlash: "never"
|
|
1415
|
-
}],
|
|
1416
|
-
"react/jsx-wrap-multilines": ["error", {
|
|
1417
|
-
arrow: "parens-new-line",
|
|
1418
|
-
assignment: "parens-new-line",
|
|
1419
|
-
condition: "parens-new-line",
|
|
1420
|
-
declaration: "parens-new-line",
|
|
1421
|
-
logical: "parens-new-line",
|
|
1422
|
-
prop: "parens-new-line",
|
|
1423
|
-
return: "parens-new-line"
|
|
1424
|
-
}],
|
|
1425
|
-
"react/sort-comp": ["error", {
|
|
1426
|
-
groups: {
|
|
1427
|
-
lifecycle: [
|
|
1428
|
-
"displayName",
|
|
1429
|
-
"propTypes",
|
|
1430
|
-
"contextTypes",
|
|
1431
|
-
"childContextTypes",
|
|
1432
|
-
"mixins",
|
|
1433
|
-
"statics",
|
|
1434
|
-
"defaultProps",
|
|
1435
|
-
"constructor",
|
|
1436
|
-
"getDefaultProps",
|
|
1437
|
-
"getInitialState",
|
|
1438
|
-
"state",
|
|
1439
|
-
"getChildContext",
|
|
1440
|
-
"getDerivedStateFromProps",
|
|
1441
|
-
"componentWillMount",
|
|
1442
|
-
"UNSAFE_componentWillMount",
|
|
1443
|
-
"componentDidMount",
|
|
1444
|
-
"componentWillReceiveProps",
|
|
1445
|
-
"UNSAFE_componentWillReceiveProps",
|
|
1446
|
-
"shouldComponentUpdate",
|
|
1447
|
-
"componentWillUpdate",
|
|
1448
|
-
"UNSAFE_componentWillUpdate",
|
|
1449
|
-
"getSnapshotBeforeUpdate",
|
|
1450
|
-
"componentDidUpdate",
|
|
1451
|
-
"componentDidCatch",
|
|
1452
|
-
"componentWillUnmount"
|
|
1453
|
-
],
|
|
1454
|
-
rendering: [
|
|
1455
|
-
"/^render.+$/",
|
|
1456
|
-
"render"
|
|
1457
|
-
]
|
|
1458
|
-
},
|
|
1459
|
-
order: [
|
|
1460
|
-
"static-variables",
|
|
1461
|
-
"static-methods",
|
|
1462
|
-
"instance-variables",
|
|
1463
|
-
"lifecycle",
|
|
1464
|
-
"/^handle.+$/",
|
|
1465
|
-
"/^on.+$/",
|
|
1466
|
-
"getters",
|
|
1467
|
-
"setters",
|
|
1468
|
-
"/^(get|set)(?!(InitialState$|DefaultProps$|ChildContext$)).+$/",
|
|
1469
|
-
"instance-methods",
|
|
1470
|
-
"everything-else",
|
|
1471
|
-
"rendering"
|
|
1472
|
-
]
|
|
1473
|
-
}],
|
|
1474
|
-
"react/style-prop-object": "error",
|
|
1475
|
-
"style/indent": ["error", indent, {
|
|
1476
|
-
SwitchCase: 1,
|
|
1477
|
-
VariableDeclarator: 1,
|
|
1478
|
-
// from: https://github.com/airbnb/javascript/blob/master/packages/eslint-config-airbnb-base/rules/style.js
|
|
1479
|
-
ignoredNodes: [
|
|
1480
|
-
"JSXElement",
|
|
1481
|
-
"JSXElement :not(JSXExpressionContainer, JSXExpressionContainer *)",
|
|
1482
|
-
"JSXAttribute",
|
|
1483
|
-
"JSXIdentifier",
|
|
1484
|
-
"JSXNamespacedName",
|
|
1485
|
-
"JSXMemberExpression",
|
|
1486
|
-
"JSXSpreadAttribute",
|
|
1487
|
-
"JSXOpeningElement",
|
|
1488
|
-
"JSXClosingElement",
|
|
1489
|
-
"JSXFragment",
|
|
1490
|
-
"JSXOpeningFragment",
|
|
1491
|
-
"JSXClosingFragment",
|
|
1492
|
-
"JSXText",
|
|
1493
|
-
"JSXEmptyExpression",
|
|
1494
|
-
"JSXSpreadChild"
|
|
1495
|
-
],
|
|
1496
|
-
offsetTernaryExpressions: true,
|
|
1497
|
-
outerIIFEBody: 1
|
|
1498
|
-
}],
|
|
1499
|
-
"style/jsx-quotes": ["error", "prefer-double"]
|
|
1377
|
+
"react/require-render-return": "error",
|
|
1378
|
+
...typescript2 ? {
|
|
1379
|
+
"react/jsx-no-undef": "off",
|
|
1380
|
+
"react/prop-type": "off"
|
|
1500
1381
|
} : {},
|
|
1382
|
+
// overrides
|
|
1501
1383
|
...overrides
|
|
1502
1384
|
}
|
|
1503
1385
|
}
|
|
1504
1386
|
];
|
|
1505
1387
|
}
|
|
1506
1388
|
|
|
1507
|
-
// src/configs/
|
|
1508
|
-
function
|
|
1509
|
-
const {
|
|
1389
|
+
// src/configs/unocss.ts
|
|
1390
|
+
async function unocss(options = {}) {
|
|
1391
|
+
const {
|
|
1392
|
+
attributify = true,
|
|
1393
|
+
strict = false
|
|
1394
|
+
} = options;
|
|
1395
|
+
await ensurePackages([
|
|
1396
|
+
"@unocss/eslint-plugin"
|
|
1397
|
+
]);
|
|
1398
|
+
const [
|
|
1399
|
+
pluginUnoCSS
|
|
1400
|
+
] = await Promise.all([
|
|
1401
|
+
interopDefault(import("@unocss/eslint-plugin"))
|
|
1402
|
+
]);
|
|
1510
1403
|
return [
|
|
1511
1404
|
{
|
|
1512
|
-
|
|
1513
|
-
languageOptions: {
|
|
1514
|
-
parser: default20,
|
|
1515
|
-
parserOptions: {
|
|
1516
|
-
extraFileExtensions: [".astro"],
|
|
1517
|
-
parser: options.typescript ? parserTs : null
|
|
1518
|
-
}
|
|
1519
|
-
},
|
|
1520
|
-
name: "coderwyd:astro",
|
|
1405
|
+
name: "antfu:unocss",
|
|
1521
1406
|
plugins: {
|
|
1522
|
-
|
|
1407
|
+
unocss: pluginUnoCSS
|
|
1523
1408
|
},
|
|
1524
1409
|
rules: {
|
|
1525
|
-
|
|
1526
|
-
...
|
|
1410
|
+
"unocss/order": "warn",
|
|
1411
|
+
...attributify ? {
|
|
1412
|
+
"unocss/order-attributify": "warn"
|
|
1413
|
+
} : {},
|
|
1414
|
+
...strict ? {
|
|
1415
|
+
"unocss/blocklist": "error"
|
|
1416
|
+
} : {}
|
|
1527
1417
|
}
|
|
1528
1418
|
}
|
|
1529
1419
|
];
|
|
@@ -1546,46 +1436,46 @@ var VuePackages = [
|
|
|
1546
1436
|
"vitepress",
|
|
1547
1437
|
"@slidev/cli"
|
|
1548
1438
|
];
|
|
1549
|
-
|
|
1550
|
-
"react",
|
|
1551
|
-
"next"
|
|
1552
|
-
];
|
|
1553
|
-
var AstroPackages = [
|
|
1554
|
-
"astro"
|
|
1555
|
-
];
|
|
1556
|
-
function coderwyd(options = {}, ...userConfigs) {
|
|
1439
|
+
async function coderwyd(options = {}, ...userConfigs) {
|
|
1557
1440
|
const {
|
|
1558
|
-
|
|
1559
|
-
vue: enableVue = VuePackages.some((i) => isPackageExists(i)),
|
|
1560
|
-
react: enableReact = ReactPackages.some((i) => isPackageExists(i)),
|
|
1561
|
-
astro: enableAstro = AstroPackages.some((i) => isPackageExists(i)),
|
|
1562
|
-
typescript: enableTypeScript = isPackageExists("typescript"),
|
|
1563
|
-
stylistic: enableStylistic = true,
|
|
1441
|
+
componentExts = [],
|
|
1564
1442
|
gitignore: enableGitignore = true,
|
|
1443
|
+
isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
|
|
1565
1444
|
overrides = {},
|
|
1566
|
-
|
|
1445
|
+
react: enableReact = false,
|
|
1446
|
+
typescript: enableTypeScript = isPackageExists3("typescript"),
|
|
1447
|
+
unocss: enableUnoCSS = false,
|
|
1448
|
+
vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
|
|
1567
1449
|
} = options;
|
|
1450
|
+
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1451
|
+
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
1452
|
+
stylisticOptions.jsx = options.jsx ?? true;
|
|
1568
1453
|
const configs = [];
|
|
1569
1454
|
if (enableGitignore) {
|
|
1570
1455
|
if (typeof enableGitignore !== "boolean") {
|
|
1571
|
-
configs.push(
|
|
1456
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1572
1457
|
} else {
|
|
1573
1458
|
if (fs.existsSync(".gitignore"))
|
|
1574
|
-
configs.push(
|
|
1459
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
1575
1460
|
}
|
|
1576
1461
|
}
|
|
1577
1462
|
configs.push(
|
|
1578
1463
|
ignores(),
|
|
1579
|
-
javascript({
|
|
1464
|
+
javascript({
|
|
1465
|
+
isInEditor,
|
|
1466
|
+
overrides: overrides.javascript
|
|
1467
|
+
}),
|
|
1580
1468
|
comments(),
|
|
1581
1469
|
node(),
|
|
1582
1470
|
jsdoc({
|
|
1583
|
-
stylistic:
|
|
1471
|
+
stylistic: stylisticOptions
|
|
1584
1472
|
}),
|
|
1585
1473
|
imports({
|
|
1586
|
-
stylistic:
|
|
1474
|
+
stylistic: stylisticOptions
|
|
1587
1475
|
}),
|
|
1588
|
-
unicorn()
|
|
1476
|
+
unicorn(),
|
|
1477
|
+
// Optional plugins (installed but not enabled by default)
|
|
1478
|
+
perfectionist()
|
|
1589
1479
|
);
|
|
1590
1480
|
if (enableVue)
|
|
1591
1481
|
componentExts.push("vue");
|
|
@@ -1596,17 +1486,18 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1596
1486
|
overrides: overrides.typescript
|
|
1597
1487
|
}));
|
|
1598
1488
|
}
|
|
1599
|
-
if (
|
|
1600
|
-
configs.push(stylistic(
|
|
1601
|
-
|
|
1602
|
-
|
|
1489
|
+
if (stylisticOptions)
|
|
1490
|
+
configs.push(stylistic(stylisticOptions));
|
|
1491
|
+
if (options.test ?? true) {
|
|
1492
|
+
configs.push(test({
|
|
1493
|
+
isInEditor,
|
|
1494
|
+
overrides: overrides.test
|
|
1495
|
+
}));
|
|
1603
1496
|
}
|
|
1604
|
-
if (options.test ?? true)
|
|
1605
|
-
configs.push(test({ isInEditor, overrides: overrides.test }));
|
|
1606
1497
|
if (enableVue) {
|
|
1607
1498
|
configs.push(vue({
|
|
1608
1499
|
overrides: overrides.vue,
|
|
1609
|
-
stylistic:
|
|
1500
|
+
stylistic: stylisticOptions,
|
|
1610
1501
|
typescript: !!enableTypeScript
|
|
1611
1502
|
}));
|
|
1612
1503
|
}
|
|
@@ -1616,15 +1507,17 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1616
1507
|
typescript: !!enableTypeScript
|
|
1617
1508
|
}));
|
|
1618
1509
|
}
|
|
1619
|
-
if (
|
|
1620
|
-
configs.push(
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
}));
|
|
1510
|
+
if (enableUnoCSS) {
|
|
1511
|
+
configs.push(unocss(
|
|
1512
|
+
typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS
|
|
1513
|
+
));
|
|
1624
1514
|
}
|
|
1625
1515
|
if (options.jsonc ?? true) {
|
|
1626
1516
|
configs.push(
|
|
1627
|
-
jsonc(
|
|
1517
|
+
jsonc({
|
|
1518
|
+
overrides: overrides.jsonc,
|
|
1519
|
+
stylistic: stylisticOptions
|
|
1520
|
+
}),
|
|
1628
1521
|
sortPackageJson(),
|
|
1629
1522
|
sortTsconfig()
|
|
1630
1523
|
);
|
|
@@ -1632,11 +1525,15 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1632
1525
|
if (options.yaml ?? true) {
|
|
1633
1526
|
configs.push(yaml({
|
|
1634
1527
|
overrides: overrides.yaml,
|
|
1635
|
-
stylistic:
|
|
1528
|
+
stylistic: stylisticOptions
|
|
1529
|
+
}));
|
|
1530
|
+
}
|
|
1531
|
+
if (options.markdown ?? true) {
|
|
1532
|
+
configs.push(markdown({
|
|
1533
|
+
componentExts,
|
|
1534
|
+
overrides: overrides.markdown
|
|
1636
1535
|
}));
|
|
1637
1536
|
}
|
|
1638
|
-
if (options.markdown ?? true)
|
|
1639
|
-
configs.push(markdown({ componentExts, overrides: overrides.markdown }));
|
|
1640
1537
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1641
1538
|
if (key in options)
|
|
1642
1539
|
acc[key] = options[key];
|
|
@@ -1655,7 +1552,6 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1655
1552
|
var src_default = coderwyd;
|
|
1656
1553
|
export {
|
|
1657
1554
|
GLOB_ALL_SRC,
|
|
1658
|
-
GLOB_ASTRO,
|
|
1659
1555
|
GLOB_CSS,
|
|
1660
1556
|
GLOB_EXCLUDE,
|
|
1661
1557
|
GLOB_HTML,
|
|
@@ -1676,50 +1572,31 @@ export {
|
|
|
1676
1572
|
GLOB_TSX,
|
|
1677
1573
|
GLOB_VUE,
|
|
1678
1574
|
GLOB_YAML,
|
|
1679
|
-
astro,
|
|
1680
1575
|
coderwyd,
|
|
1681
1576
|
combine,
|
|
1682
1577
|
comments,
|
|
1683
1578
|
src_default as default,
|
|
1579
|
+
ensurePackages,
|
|
1684
1580
|
getVueVersion,
|
|
1685
1581
|
ignores,
|
|
1686
1582
|
imports,
|
|
1583
|
+
interopDefault,
|
|
1687
1584
|
javascript,
|
|
1688
1585
|
jsdoc,
|
|
1689
1586
|
jsonc,
|
|
1690
1587
|
markdown,
|
|
1691
1588
|
node,
|
|
1692
|
-
|
|
1693
|
-
default19 as parserJsonc,
|
|
1694
|
-
parserTs,
|
|
1695
|
-
default17 as parserVue,
|
|
1696
|
-
default18 as parserYaml,
|
|
1697
|
-
default2 as pluginAntfu,
|
|
1698
|
-
default16 as pluginAstro,
|
|
1699
|
-
default3 as pluginComments,
|
|
1700
|
-
pluginImport,
|
|
1701
|
-
default4 as pluginJsdoc,
|
|
1702
|
-
pluginJsonc,
|
|
1703
|
-
default5 as pluginMarkdown,
|
|
1704
|
-
default11 as pluginNoOnlyTests,
|
|
1705
|
-
default6 as pluginNode,
|
|
1706
|
-
default14 as pluginReact,
|
|
1707
|
-
default15 as pluginReactHooks,
|
|
1708
|
-
default7 as pluginStylistic,
|
|
1709
|
-
default8 as pluginTs,
|
|
1710
|
-
default9 as pluginUnicorn,
|
|
1711
|
-
default10 as pluginUnusedImports,
|
|
1712
|
-
default12 as pluginVitest,
|
|
1713
|
-
default13 as pluginVue,
|
|
1714
|
-
pluginYaml,
|
|
1589
|
+
perfectionist,
|
|
1715
1590
|
react,
|
|
1716
1591
|
renameRules,
|
|
1717
1592
|
sortPackageJson,
|
|
1718
1593
|
sortTsconfig,
|
|
1719
1594
|
stylistic,
|
|
1720
1595
|
test,
|
|
1596
|
+
toArray,
|
|
1721
1597
|
typescript,
|
|
1722
1598
|
unicorn,
|
|
1599
|
+
unocss,
|
|
1723
1600
|
vue,
|
|
1724
1601
|
yaml
|
|
1725
1602
|
};
|