@coderwyd/eslint-config 1.1.0-beta.3 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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 +414 -556
- package/dist/index.d.cts +116 -131
- package/dist/index.d.ts +116 -131
- package/dist/index.js +415 -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,39 +980,40 @@ 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: {
|
|
1016
|
+
"unicorn/better-regex": "error",
|
|
1072
1017
|
// Pass error message when throwing errors
|
|
1073
1018
|
"unicorn/error-message": "error",
|
|
1074
1019
|
// Uppercase regex escapes
|
|
@@ -1101,60 +1046,61 @@ function unicorn() {
|
|
|
1101
1046
|
}
|
|
1102
1047
|
|
|
1103
1048
|
// 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 = {}) {
|
|
1049
|
+
async function vue(options = {}) {
|
|
1126
1050
|
const {
|
|
1051
|
+
files = [GLOB_VUE],
|
|
1127
1052
|
overrides = {},
|
|
1128
1053
|
stylistic: stylistic2 = true
|
|
1129
1054
|
} = options;
|
|
1130
1055
|
const {
|
|
1131
1056
|
indent = 2
|
|
1132
1057
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1058
|
+
const isVue3 = getVueVersion() === 3;
|
|
1059
|
+
const [
|
|
1060
|
+
pluginVue,
|
|
1061
|
+
parserVue
|
|
1062
|
+
] = await Promise.all([
|
|
1063
|
+
// @ts-expect-error missing types
|
|
1064
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
1065
|
+
interopDefault(import("vue-eslint-parser"))
|
|
1066
|
+
]);
|
|
1067
|
+
const vue3Rules = {
|
|
1068
|
+
...pluginVue.configs.base.rules,
|
|
1069
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
1070
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1071
|
+
...pluginVue.configs["vue3-recommended"].rules
|
|
1072
|
+
};
|
|
1073
|
+
const vue2Rules = {
|
|
1074
|
+
...pluginVue.configs.base.rules,
|
|
1075
|
+
...pluginVue.configs.essential.rules,
|
|
1076
|
+
...pluginVue.configs["strongly-recommended"].rules,
|
|
1077
|
+
...pluginVue.configs.recommended.rules
|
|
1078
|
+
};
|
|
1133
1079
|
return [
|
|
1134
1080
|
{
|
|
1135
1081
|
name: "coderwyd:vue:setup",
|
|
1136
1082
|
plugins: {
|
|
1137
|
-
vue:
|
|
1083
|
+
vue: pluginVue
|
|
1138
1084
|
}
|
|
1139
1085
|
},
|
|
1140
1086
|
{
|
|
1141
|
-
files
|
|
1087
|
+
files,
|
|
1142
1088
|
languageOptions: {
|
|
1143
|
-
parser:
|
|
1089
|
+
parser: parserVue,
|
|
1144
1090
|
parserOptions: {
|
|
1145
1091
|
ecmaFeatures: {
|
|
1146
1092
|
jsx: true
|
|
1147
1093
|
},
|
|
1148
1094
|
extraFileExtensions: [".vue"],
|
|
1149
|
-
parser: options.typescript ?
|
|
1095
|
+
parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
1150
1096
|
sourceType: "module"
|
|
1151
1097
|
}
|
|
1152
1098
|
},
|
|
1153
1099
|
name: "coderwyd:vue:rules",
|
|
1154
|
-
processor:
|
|
1100
|
+
processor: pluginVue.processors[".vue"],
|
|
1155
1101
|
rules: {
|
|
1156
1102
|
...isVue3 ? vue3Rules : vue2Rules,
|
|
1157
|
-
"node/prefer-global/process":
|
|
1103
|
+
"node/prefer-global/process": "off",
|
|
1158
1104
|
"vue/block-order": ["error", {
|
|
1159
1105
|
order: ["script", "template", "style"]
|
|
1160
1106
|
}],
|
|
@@ -1169,9 +1115,9 @@ function vue(options = {}) {
|
|
|
1169
1115
|
"vue/eqeqeq": ["error", "smart"],
|
|
1170
1116
|
"vue/html-indent": ["error", indent],
|
|
1171
1117
|
"vue/html-quotes": ["error", "double"],
|
|
1172
|
-
"vue/max-attributes-per-line":
|
|
1173
|
-
"vue/multi-word-component-names":
|
|
1174
|
-
"vue/no-dupe-keys":
|
|
1118
|
+
"vue/max-attributes-per-line": "off",
|
|
1119
|
+
"vue/multi-word-component-names": "off",
|
|
1120
|
+
"vue/no-dupe-keys": "off",
|
|
1175
1121
|
"vue/no-empty-pattern": "error",
|
|
1176
1122
|
"vue/no-extra-parens": ["error", "functions"],
|
|
1177
1123
|
"vue/no-irregular-whitespace": "error",
|
|
@@ -1183,11 +1129,11 @@ function vue(options = {}) {
|
|
|
1183
1129
|
"WithStatement"
|
|
1184
1130
|
],
|
|
1185
1131
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1186
|
-
"vue/no-setup-props-reactivity-loss":
|
|
1132
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1187
1133
|
"vue/no-sparse-arrays": "error",
|
|
1188
1134
|
"vue/no-unused-refs": "error",
|
|
1189
1135
|
"vue/no-useless-v-bind": "error",
|
|
1190
|
-
"vue/no-v-html":
|
|
1136
|
+
"vue/no-v-html": "off",
|
|
1191
1137
|
"vue/object-shorthand": [
|
|
1192
1138
|
"error",
|
|
1193
1139
|
"always",
|
|
@@ -1198,8 +1144,9 @@ function vue(options = {}) {
|
|
|
1198
1144
|
],
|
|
1199
1145
|
"vue/prefer-separate-static-class": "error",
|
|
1200
1146
|
"vue/prefer-template": "error",
|
|
1201
|
-
"vue/
|
|
1202
|
-
"vue/require-prop
|
|
1147
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1148
|
+
"vue/require-default-prop": "off",
|
|
1149
|
+
"vue/require-prop-types": "off",
|
|
1203
1150
|
"vue/space-infix-ops": "error",
|
|
1204
1151
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1205
1152
|
...stylistic2 ? {
|
|
@@ -1219,7 +1166,7 @@ function vue(options = {}) {
|
|
|
1219
1166
|
}],
|
|
1220
1167
|
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1221
1168
|
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1222
|
-
"vue/object-curly-newline":
|
|
1169
|
+
"vue/object-curly-newline": "off",
|
|
1223
1170
|
"vue/object-curly-spacing": ["error", "always"],
|
|
1224
1171
|
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1225
1172
|
"vue/operator-linebreak": ["error", "before"],
|
|
@@ -1235,8 +1182,9 @@ function vue(options = {}) {
|
|
|
1235
1182
|
}
|
|
1236
1183
|
|
|
1237
1184
|
// src/configs/yaml.ts
|
|
1238
|
-
function yaml(options = {}) {
|
|
1185
|
+
async function yaml(options = {}) {
|
|
1239
1186
|
const {
|
|
1187
|
+
files = [GLOB_YAML],
|
|
1240
1188
|
overrides = {},
|
|
1241
1189
|
stylistic: stylistic2 = true
|
|
1242
1190
|
} = options;
|
|
@@ -1244,6 +1192,13 @@ function yaml(options = {}) {
|
|
|
1244
1192
|
indent = 2,
|
|
1245
1193
|
quotes = "single"
|
|
1246
1194
|
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1195
|
+
const [
|
|
1196
|
+
pluginYaml,
|
|
1197
|
+
parserYaml
|
|
1198
|
+
] = await Promise.all([
|
|
1199
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
1200
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
1201
|
+
]);
|
|
1247
1202
|
return [
|
|
1248
1203
|
{
|
|
1249
1204
|
name: "coderwyd:yaml:setup",
|
|
@@ -1252,13 +1207,13 @@ function yaml(options = {}) {
|
|
|
1252
1207
|
}
|
|
1253
1208
|
},
|
|
1254
1209
|
{
|
|
1255
|
-
files
|
|
1210
|
+
files,
|
|
1256
1211
|
languageOptions: {
|
|
1257
|
-
parser:
|
|
1212
|
+
parser: parserYaml
|
|
1258
1213
|
},
|
|
1259
1214
|
name: "coderwyd:yaml:rules",
|
|
1260
1215
|
rules: {
|
|
1261
|
-
"style/spaced-comment":
|
|
1216
|
+
"style/spaced-comment": "off",
|
|
1262
1217
|
"yaml/block-mapping": "error",
|
|
1263
1218
|
"yaml/block-sequence": "error",
|
|
1264
1219
|
"yaml/no-empty-key": "error",
|
|
@@ -1286,32 +1241,42 @@ function yaml(options = {}) {
|
|
|
1286
1241
|
}
|
|
1287
1242
|
|
|
1288
1243
|
// src/configs/test.ts
|
|
1289
|
-
function test(options = {}) {
|
|
1244
|
+
async function test(options = {}) {
|
|
1290
1245
|
const {
|
|
1246
|
+
files = GLOB_TESTS,
|
|
1291
1247
|
isInEditor = false,
|
|
1292
1248
|
overrides = {}
|
|
1293
1249
|
} = options;
|
|
1250
|
+
const [
|
|
1251
|
+
pluginVitest,
|
|
1252
|
+
pluginNoOnlyTests
|
|
1253
|
+
] = await Promise.all([
|
|
1254
|
+
interopDefault(import("eslint-plugin-vitest")),
|
|
1255
|
+
// @ts-expect-error missing types
|
|
1256
|
+
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
1257
|
+
]);
|
|
1294
1258
|
return [
|
|
1295
1259
|
{
|
|
1296
1260
|
name: "coderwyd:test:setup",
|
|
1297
1261
|
plugins: {
|
|
1298
1262
|
test: {
|
|
1299
|
-
...
|
|
1263
|
+
...pluginVitest,
|
|
1300
1264
|
rules: {
|
|
1301
|
-
...
|
|
1265
|
+
...pluginVitest.rules,
|
|
1302
1266
|
// extend `test/no-only-tests` rule
|
|
1303
|
-
...
|
|
1267
|
+
...pluginNoOnlyTests.rules
|
|
1304
1268
|
}
|
|
1305
1269
|
}
|
|
1306
1270
|
}
|
|
1307
1271
|
},
|
|
1308
1272
|
{
|
|
1309
|
-
files
|
|
1273
|
+
files,
|
|
1310
1274
|
name: "coderwyd:test:rules",
|
|
1311
1275
|
rules: {
|
|
1276
|
+
"node/prefer-global/process": "off",
|
|
1312
1277
|
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
1313
1278
|
"test/no-identical-title": "error",
|
|
1314
|
-
"test/no-only-tests": isInEditor ?
|
|
1279
|
+
"test/no-only-tests": isInEditor ? "off" : "error",
|
|
1315
1280
|
"test/prefer-hooks-in-order": "error",
|
|
1316
1281
|
"test/prefer-lowercase-title": "error",
|
|
1317
1282
|
...overrides
|
|
@@ -1320,210 +1285,136 @@ function test(options = {}) {
|
|
|
1320
1285
|
];
|
|
1321
1286
|
}
|
|
1322
1287
|
|
|
1288
|
+
// src/configs/perfectionist.ts
|
|
1289
|
+
async function perfectionist() {
|
|
1290
|
+
return [
|
|
1291
|
+
{
|
|
1292
|
+
name: "coderwyd:perfectionist",
|
|
1293
|
+
plugins: {
|
|
1294
|
+
perfectionist: default7
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
];
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1323
1300
|
// src/configs/react.ts
|
|
1324
|
-
import
|
|
1325
|
-
|
|
1301
|
+
import { isPackageExists as isPackageExists2 } from "local-pkg";
|
|
1302
|
+
var ReactRefreshAllowConstantExportPackages = [
|
|
1303
|
+
"vite"
|
|
1304
|
+
];
|
|
1305
|
+
async function react(options = {}) {
|
|
1326
1306
|
const {
|
|
1307
|
+
files = [GLOB_JSX, GLOB_TSX],
|
|
1327
1308
|
overrides = {},
|
|
1328
|
-
|
|
1309
|
+
typescript: typescript2 = true
|
|
1329
1310
|
} = options;
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1311
|
+
await ensurePackages([
|
|
1312
|
+
"eslint-plugin-react",
|
|
1313
|
+
"eslint-plugin-react-hooks",
|
|
1314
|
+
"eslint-plugin-react-refresh"
|
|
1315
|
+
]);
|
|
1316
|
+
const [
|
|
1317
|
+
pluginReact,
|
|
1318
|
+
pluginReactHooks,
|
|
1319
|
+
pluginReactRefresh
|
|
1320
|
+
] = await Promise.all([
|
|
1321
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1322
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1323
|
+
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1324
|
+
]);
|
|
1325
|
+
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1326
|
+
(i) => isPackageExists2(i)
|
|
1327
|
+
);
|
|
1334
1328
|
return [
|
|
1335
1329
|
{
|
|
1336
1330
|
name: "coderwyd:react:setup",
|
|
1337
1331
|
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
|
-
}
|
|
1332
|
+
"react": pluginReact,
|
|
1333
|
+
"react-hooks": pluginReactHooks,
|
|
1334
|
+
"react-refresh": pluginReactRefresh
|
|
1349
1335
|
}
|
|
1350
1336
|
},
|
|
1351
1337
|
{
|
|
1352
|
-
files
|
|
1338
|
+
files,
|
|
1353
1339
|
languageOptions: {
|
|
1354
|
-
globals: globals2.browser,
|
|
1355
1340
|
parserOptions: {
|
|
1356
1341
|
ecmaFeatures: {
|
|
1357
1342
|
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
|
|
1343
|
+
}
|
|
1365
1344
|
}
|
|
1366
1345
|
},
|
|
1367
1346
|
name: "coderwyd:react:rules",
|
|
1368
1347
|
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/
|
|
1348
|
+
// recommended rules react-hooks
|
|
1349
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1350
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1351
|
+
// react refresh
|
|
1352
|
+
"react-refresh/only-export-components": [
|
|
1353
|
+
"warn",
|
|
1354
|
+
{ allowConstantExport: isAllowConstantExport }
|
|
1355
|
+
],
|
|
1356
|
+
// recommended rules react
|
|
1357
|
+
"react/display-name": "error",
|
|
1358
|
+
"react/jsx-key": "error",
|
|
1359
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
1360
|
+
"react/jsx-no-duplicate-props": "error",
|
|
1361
|
+
"react/jsx-no-target-blank": "error",
|
|
1362
|
+
"react/jsx-no-undef": "error",
|
|
1363
|
+
"react/jsx-uses-react": "error",
|
|
1364
|
+
"react/jsx-uses-vars": "error",
|
|
1365
|
+
"react/no-children-prop": "error",
|
|
1366
|
+
"react/no-danger-with-children": "error",
|
|
1367
|
+
"react/no-deprecated": "error",
|
|
1368
|
+
"react/no-direct-mutation-state": "error",
|
|
1369
|
+
"react/no-find-dom-node": "error",
|
|
1370
|
+
"react/no-is-mounted": "error",
|
|
1371
|
+
"react/no-render-return-value": "error",
|
|
1372
|
+
"react/no-string-refs": "error",
|
|
1373
|
+
"react/no-unescaped-entities": "error",
|
|
1374
|
+
"react/no-unknown-property": "error",
|
|
1375
|
+
"react/no-unsafe": "off",
|
|
1376
|
+
"react/prop-types": "error",
|
|
1394
1377
|
"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"]
|
|
1378
|
+
"react/require-render-return": "error",
|
|
1379
|
+
...typescript2 ? {
|
|
1380
|
+
"react/jsx-no-undef": "off",
|
|
1381
|
+
"react/prop-type": "off"
|
|
1500
1382
|
} : {},
|
|
1383
|
+
// overrides
|
|
1501
1384
|
...overrides
|
|
1502
1385
|
}
|
|
1503
1386
|
}
|
|
1504
1387
|
];
|
|
1505
1388
|
}
|
|
1506
1389
|
|
|
1507
|
-
// src/configs/
|
|
1508
|
-
function
|
|
1509
|
-
const {
|
|
1390
|
+
// src/configs/unocss.ts
|
|
1391
|
+
async function unocss(options = {}) {
|
|
1392
|
+
const {
|
|
1393
|
+
attributify = true,
|
|
1394
|
+
strict = false
|
|
1395
|
+
} = options;
|
|
1396
|
+
await ensurePackages([
|
|
1397
|
+
"@unocss/eslint-plugin"
|
|
1398
|
+
]);
|
|
1399
|
+
const [
|
|
1400
|
+
pluginUnoCSS
|
|
1401
|
+
] = await Promise.all([
|
|
1402
|
+
interopDefault(import("@unocss/eslint-plugin"))
|
|
1403
|
+
]);
|
|
1510
1404
|
return [
|
|
1511
1405
|
{
|
|
1512
|
-
|
|
1513
|
-
languageOptions: {
|
|
1514
|
-
parser: default20,
|
|
1515
|
-
parserOptions: {
|
|
1516
|
-
extraFileExtensions: [".astro"],
|
|
1517
|
-
parser: options.typescript ? parserTs : null
|
|
1518
|
-
}
|
|
1519
|
-
},
|
|
1520
|
-
name: "coderwyd:astro",
|
|
1406
|
+
name: "coderwyd:unocss",
|
|
1521
1407
|
plugins: {
|
|
1522
|
-
|
|
1408
|
+
unocss: pluginUnoCSS
|
|
1523
1409
|
},
|
|
1524
1410
|
rules: {
|
|
1525
|
-
|
|
1526
|
-
...
|
|
1411
|
+
"unocss/order": "warn",
|
|
1412
|
+
...attributify ? {
|
|
1413
|
+
"unocss/order-attributify": "warn"
|
|
1414
|
+
} : {},
|
|
1415
|
+
...strict ? {
|
|
1416
|
+
"unocss/blocklist": "error"
|
|
1417
|
+
} : {}
|
|
1527
1418
|
}
|
|
1528
1419
|
}
|
|
1529
1420
|
];
|
|
@@ -1546,46 +1437,46 @@ var VuePackages = [
|
|
|
1546
1437
|
"vitepress",
|
|
1547
1438
|
"@slidev/cli"
|
|
1548
1439
|
];
|
|
1549
|
-
|
|
1550
|
-
"react",
|
|
1551
|
-
"next"
|
|
1552
|
-
];
|
|
1553
|
-
var AstroPackages = [
|
|
1554
|
-
"astro"
|
|
1555
|
-
];
|
|
1556
|
-
function coderwyd(options = {}, ...userConfigs) {
|
|
1440
|
+
async function coderwyd(options = {}, ...userConfigs) {
|
|
1557
1441
|
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,
|
|
1442
|
+
componentExts = [],
|
|
1564
1443
|
gitignore: enableGitignore = true,
|
|
1444
|
+
isInEditor = !!((process3.env.VSCODE_PID || process3.env.JETBRAINS_IDE) && !process3.env.CI),
|
|
1565
1445
|
overrides = {},
|
|
1566
|
-
|
|
1446
|
+
react: enableReact = false,
|
|
1447
|
+
typescript: enableTypeScript = isPackageExists3("typescript"),
|
|
1448
|
+
unocss: enableUnoCSS = false,
|
|
1449
|
+
vue: enableVue = VuePackages.some((i) => isPackageExists3(i))
|
|
1567
1450
|
} = options;
|
|
1451
|
+
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
1452
|
+
if (stylisticOptions && !("jsx" in stylisticOptions))
|
|
1453
|
+
stylisticOptions.jsx = options.jsx ?? true;
|
|
1568
1454
|
const configs = [];
|
|
1569
1455
|
if (enableGitignore) {
|
|
1570
1456
|
if (typeof enableGitignore !== "boolean") {
|
|
1571
|
-
configs.push(
|
|
1457
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1572
1458
|
} else {
|
|
1573
1459
|
if (fs.existsSync(".gitignore"))
|
|
1574
|
-
configs.push(
|
|
1460
|
+
configs.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
1575
1461
|
}
|
|
1576
1462
|
}
|
|
1577
1463
|
configs.push(
|
|
1578
1464
|
ignores(),
|
|
1579
|
-
javascript({
|
|
1465
|
+
javascript({
|
|
1466
|
+
isInEditor,
|
|
1467
|
+
overrides: overrides.javascript
|
|
1468
|
+
}),
|
|
1580
1469
|
comments(),
|
|
1581
1470
|
node(),
|
|
1582
1471
|
jsdoc({
|
|
1583
|
-
stylistic:
|
|
1472
|
+
stylistic: stylisticOptions
|
|
1584
1473
|
}),
|
|
1585
1474
|
imports({
|
|
1586
|
-
stylistic:
|
|
1475
|
+
stylistic: stylisticOptions
|
|
1587
1476
|
}),
|
|
1588
|
-
unicorn()
|
|
1477
|
+
unicorn(),
|
|
1478
|
+
// Optional plugins (installed but not enabled by default)
|
|
1479
|
+
perfectionist()
|
|
1589
1480
|
);
|
|
1590
1481
|
if (enableVue)
|
|
1591
1482
|
componentExts.push("vue");
|
|
@@ -1596,17 +1487,18 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1596
1487
|
overrides: overrides.typescript
|
|
1597
1488
|
}));
|
|
1598
1489
|
}
|
|
1599
|
-
if (
|
|
1600
|
-
configs.push(stylistic(
|
|
1601
|
-
|
|
1602
|
-
|
|
1490
|
+
if (stylisticOptions)
|
|
1491
|
+
configs.push(stylistic(stylisticOptions));
|
|
1492
|
+
if (options.test ?? true) {
|
|
1493
|
+
configs.push(test({
|
|
1494
|
+
isInEditor,
|
|
1495
|
+
overrides: overrides.test
|
|
1496
|
+
}));
|
|
1603
1497
|
}
|
|
1604
|
-
if (options.test ?? true)
|
|
1605
|
-
configs.push(test({ isInEditor, overrides: overrides.test }));
|
|
1606
1498
|
if (enableVue) {
|
|
1607
1499
|
configs.push(vue({
|
|
1608
1500
|
overrides: overrides.vue,
|
|
1609
|
-
stylistic:
|
|
1501
|
+
stylistic: stylisticOptions,
|
|
1610
1502
|
typescript: !!enableTypeScript
|
|
1611
1503
|
}));
|
|
1612
1504
|
}
|
|
@@ -1616,15 +1508,17 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1616
1508
|
typescript: !!enableTypeScript
|
|
1617
1509
|
}));
|
|
1618
1510
|
}
|
|
1619
|
-
if (
|
|
1620
|
-
configs.push(
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
}));
|
|
1511
|
+
if (enableUnoCSS) {
|
|
1512
|
+
configs.push(unocss(
|
|
1513
|
+
typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS
|
|
1514
|
+
));
|
|
1624
1515
|
}
|
|
1625
1516
|
if (options.jsonc ?? true) {
|
|
1626
1517
|
configs.push(
|
|
1627
|
-
jsonc(
|
|
1518
|
+
jsonc({
|
|
1519
|
+
overrides: overrides.jsonc,
|
|
1520
|
+
stylistic: stylisticOptions
|
|
1521
|
+
}),
|
|
1628
1522
|
sortPackageJson(),
|
|
1629
1523
|
sortTsconfig()
|
|
1630
1524
|
);
|
|
@@ -1632,11 +1526,15 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1632
1526
|
if (options.yaml ?? true) {
|
|
1633
1527
|
configs.push(yaml({
|
|
1634
1528
|
overrides: overrides.yaml,
|
|
1635
|
-
stylistic:
|
|
1529
|
+
stylistic: stylisticOptions
|
|
1530
|
+
}));
|
|
1531
|
+
}
|
|
1532
|
+
if (options.markdown ?? true) {
|
|
1533
|
+
configs.push(markdown({
|
|
1534
|
+
componentExts,
|
|
1535
|
+
overrides: overrides.markdown
|
|
1636
1536
|
}));
|
|
1637
1537
|
}
|
|
1638
|
-
if (options.markdown ?? true)
|
|
1639
|
-
configs.push(markdown({ componentExts, overrides: overrides.markdown }));
|
|
1640
1538
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1641
1539
|
if (key in options)
|
|
1642
1540
|
acc[key] = options[key];
|
|
@@ -1655,7 +1553,6 @@ function coderwyd(options = {}, ...userConfigs) {
|
|
|
1655
1553
|
var src_default = coderwyd;
|
|
1656
1554
|
export {
|
|
1657
1555
|
GLOB_ALL_SRC,
|
|
1658
|
-
GLOB_ASTRO,
|
|
1659
1556
|
GLOB_CSS,
|
|
1660
1557
|
GLOB_EXCLUDE,
|
|
1661
1558
|
GLOB_HTML,
|
|
@@ -1676,50 +1573,31 @@ export {
|
|
|
1676
1573
|
GLOB_TSX,
|
|
1677
1574
|
GLOB_VUE,
|
|
1678
1575
|
GLOB_YAML,
|
|
1679
|
-
astro,
|
|
1680
1576
|
coderwyd,
|
|
1681
1577
|
combine,
|
|
1682
1578
|
comments,
|
|
1683
1579
|
src_default as default,
|
|
1580
|
+
ensurePackages,
|
|
1684
1581
|
getVueVersion,
|
|
1685
1582
|
ignores,
|
|
1686
1583
|
imports,
|
|
1584
|
+
interopDefault,
|
|
1687
1585
|
javascript,
|
|
1688
1586
|
jsdoc,
|
|
1689
1587
|
jsonc,
|
|
1690
1588
|
markdown,
|
|
1691
1589
|
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,
|
|
1590
|
+
perfectionist,
|
|
1715
1591
|
react,
|
|
1716
1592
|
renameRules,
|
|
1717
1593
|
sortPackageJson,
|
|
1718
1594
|
sortTsconfig,
|
|
1719
1595
|
stylistic,
|
|
1720
1596
|
test,
|
|
1597
|
+
toArray,
|
|
1721
1598
|
typescript,
|
|
1722
1599
|
unicorn,
|
|
1600
|
+
unocss,
|
|
1723
1601
|
vue,
|
|
1724
1602
|
yaml
|
|
1725
1603
|
};
|