@kirklin/eslint-config 2.4.0 → 2.5.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 +12 -6
- package/README.zh-cn.md +12 -6
- package/dist/cli.cjs +62 -51
- package/dist/cli.js +62 -51
- package/dist/index.cjs +184 -71
- package/dist/index.d.cts +893 -225
- package/dist/index.d.ts +893 -225
- package/dist/index.js +180 -71
- package/package.json +54 -45
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var src_exports = {};
|
|
|
32
32
|
__export(src_exports, {
|
|
33
33
|
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
34
|
GLOB_ASTRO: () => GLOB_ASTRO,
|
|
35
|
+
GLOB_ASTRO_TS: () => GLOB_ASTRO_TS,
|
|
35
36
|
GLOB_CSS: () => GLOB_CSS,
|
|
36
37
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
37
38
|
GLOB_GRAPHQL: () => GLOB_GRAPHQL,
|
|
@@ -56,6 +57,7 @@ __export(src_exports, {
|
|
|
56
57
|
GLOB_TS: () => GLOB_TS,
|
|
57
58
|
GLOB_TSX: () => GLOB_TSX,
|
|
58
59
|
GLOB_VUE: () => GLOB_VUE,
|
|
60
|
+
GLOB_XML: () => GLOB_XML,
|
|
59
61
|
GLOB_YAML: () => GLOB_YAML,
|
|
60
62
|
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
61
63
|
astro: () => astro,
|
|
@@ -73,12 +75,14 @@ __export(src_exports, {
|
|
|
73
75
|
javascript: () => javascript,
|
|
74
76
|
jsdoc: () => jsdoc,
|
|
75
77
|
jsonc: () => jsonc,
|
|
78
|
+
jsx: () => jsx,
|
|
76
79
|
kirklin: () => kirklin,
|
|
77
80
|
markdown: () => markdown,
|
|
78
81
|
node: () => node,
|
|
79
82
|
parserPlain: () => parserPlain,
|
|
80
83
|
perfectionist: () => perfectionist,
|
|
81
84
|
react: () => react,
|
|
85
|
+
regexp: () => regexp,
|
|
82
86
|
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
83
87
|
renameRules: () => renameRules,
|
|
84
88
|
resolveSubOptions: () => resolveSubOptions,
|
|
@@ -125,8 +129,10 @@ var GLOB_SVELTE = "**/*.svelte";
|
|
|
125
129
|
var GLOB_VUE = "**/*.vue";
|
|
126
130
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
127
131
|
var GLOB_TOML = "**/*.toml";
|
|
132
|
+
var GLOB_XML = "**/*.xml";
|
|
128
133
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
129
134
|
var GLOB_ASTRO = "**/*.astro";
|
|
135
|
+
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
130
136
|
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
131
137
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
132
138
|
var GLOB_TESTS = [
|
|
@@ -145,6 +151,7 @@ var GLOB_ALL_SRC = [
|
|
|
145
151
|
GLOB_SVELTE,
|
|
146
152
|
GLOB_VUE,
|
|
147
153
|
GLOB_YAML,
|
|
154
|
+
GLOB_XML,
|
|
148
155
|
GLOB_HTML
|
|
149
156
|
];
|
|
150
157
|
var GLOB_EXCLUDE = [
|
|
@@ -171,6 +178,7 @@ var GLOB_EXCLUDE = [
|
|
|
171
178
|
"**/.output",
|
|
172
179
|
"**/.vite-inspect",
|
|
173
180
|
"**/.yarn",
|
|
181
|
+
"**/vite.config.*.timestamp-*",
|
|
174
182
|
"**/CHANGELOG*.md",
|
|
175
183
|
"**/*.min.*",
|
|
176
184
|
"**/LICENSE*",
|
|
@@ -202,8 +210,8 @@ var parserPlain = {
|
|
|
202
210
|
}
|
|
203
211
|
})
|
|
204
212
|
};
|
|
205
|
-
async function combine(...
|
|
206
|
-
const resolved = await Promise.all(
|
|
213
|
+
async function combine(...configs2) {
|
|
214
|
+
const resolved = await Promise.all(configs2);
|
|
207
215
|
return resolved.flat();
|
|
208
216
|
}
|
|
209
217
|
function renameRules(rules, map) {
|
|
@@ -218,8 +226,8 @@ function renameRules(rules, map) {
|
|
|
218
226
|
})
|
|
219
227
|
);
|
|
220
228
|
}
|
|
221
|
-
function renamePluginInConfigs(
|
|
222
|
-
return
|
|
229
|
+
function renamePluginInConfigs(configs2, map) {
|
|
230
|
+
return configs2.map((i) => {
|
|
223
231
|
const clone = { ...i };
|
|
224
232
|
if (clone.rules) {
|
|
225
233
|
clone.rules = renameRules(clone.rules, map);
|
|
@@ -287,15 +295,28 @@ async function astro(options = {}) {
|
|
|
287
295
|
{
|
|
288
296
|
files,
|
|
289
297
|
languageOptions: {
|
|
298
|
+
globals: pluginAstro.environments.astro.globals,
|
|
290
299
|
parser: parserAstro,
|
|
291
300
|
parserOptions: {
|
|
292
301
|
extraFileExtensions: [".astro"],
|
|
293
302
|
parser: parserTs
|
|
294
|
-
}
|
|
303
|
+
},
|
|
304
|
+
sourceType: "module"
|
|
295
305
|
},
|
|
296
306
|
name: "kirklin/astro/rules",
|
|
307
|
+
processor: "astro/client-side-ts",
|
|
297
308
|
rules: {
|
|
309
|
+
// use recommended rules
|
|
310
|
+
"astro/missing-client-only-directive-value": "error",
|
|
311
|
+
"astro/no-conflict-set-directives": "error",
|
|
312
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
313
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
314
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
315
|
+
"astro/no-deprecated-getentrybyslug": "error",
|
|
298
316
|
"astro/no-set-html-directive": "off",
|
|
317
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
318
|
+
"astro/semi": "off",
|
|
319
|
+
"astro/valid-compile": "error",
|
|
299
320
|
...stylistic2 ? {
|
|
300
321
|
"style/indent": "off",
|
|
301
322
|
"style/jsx-closing-tag-location": "off",
|
|
@@ -360,7 +381,7 @@ var StylisticConfigDefaults = {
|
|
|
360
381
|
async function stylistic(options = {}) {
|
|
361
382
|
const {
|
|
362
383
|
indent,
|
|
363
|
-
jsx,
|
|
384
|
+
jsx: jsx2,
|
|
364
385
|
lessOpinionated = false,
|
|
365
386
|
overrides = {},
|
|
366
387
|
quotes,
|
|
@@ -373,7 +394,7 @@ async function stylistic(options = {}) {
|
|
|
373
394
|
const config = pluginStylistic.configs.customize({
|
|
374
395
|
flat: true,
|
|
375
396
|
indent,
|
|
376
|
-
jsx,
|
|
397
|
+
jsx: jsx2,
|
|
377
398
|
pluginName: "style",
|
|
378
399
|
quotes,
|
|
379
400
|
semi
|
|
@@ -407,18 +428,20 @@ async function stylistic(options = {}) {
|
|
|
407
428
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
408
429
|
if (options === true) {
|
|
409
430
|
options = {
|
|
410
|
-
astro: (0, import_local_pkg2.isPackageExists)("astro"),
|
|
431
|
+
astro: (0, import_local_pkg2.isPackageExists)("prettier-plugin-astro"),
|
|
411
432
|
css: true,
|
|
412
433
|
graphql: true,
|
|
413
434
|
html: true,
|
|
414
435
|
markdown: true,
|
|
415
|
-
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli")
|
|
436
|
+
slidev: (0, import_local_pkg2.isPackageExists)("@slidev/cli"),
|
|
437
|
+
xml: (0, import_local_pkg2.isPackageExists)("@prettier/plugin-xml")
|
|
416
438
|
};
|
|
417
439
|
}
|
|
418
440
|
await ensurePackages([
|
|
419
441
|
"eslint-plugin-format",
|
|
420
442
|
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
|
|
421
|
-
options.astro ? "prettier-plugin-astro" : void 0
|
|
443
|
+
options.astro ? "prettier-plugin-astro" : void 0,
|
|
444
|
+
options.xml ? "@prettier/plugin-xml" : void 0
|
|
422
445
|
]);
|
|
423
446
|
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") {
|
|
424
447
|
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
@@ -442,6 +465,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
442
465
|
},
|
|
443
466
|
options.prettierOptions || {}
|
|
444
467
|
);
|
|
468
|
+
const prettierXmlOptions = {
|
|
469
|
+
xmlQuoteAttributes: "double",
|
|
470
|
+
xmlSelfClosingSpace: true,
|
|
471
|
+
xmlSortAttributesByKey: false,
|
|
472
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
473
|
+
};
|
|
445
474
|
const dprintOptions = Object.assign(
|
|
446
475
|
{
|
|
447
476
|
indentWidth: typeof indent === "number" ? indent : 2,
|
|
@@ -451,7 +480,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
451
480
|
options.dprintOptions || {}
|
|
452
481
|
);
|
|
453
482
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
454
|
-
const
|
|
483
|
+
const configs2 = [
|
|
455
484
|
{
|
|
456
485
|
name: "kirklin/formatter/setup",
|
|
457
486
|
plugins: {
|
|
@@ -460,7 +489,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
460
489
|
}
|
|
461
490
|
];
|
|
462
491
|
if (options.css) {
|
|
463
|
-
|
|
492
|
+
configs2.push(
|
|
464
493
|
{
|
|
465
494
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
466
495
|
languageOptions: {
|
|
@@ -512,7 +541,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
512
541
|
);
|
|
513
542
|
}
|
|
514
543
|
if (options.html) {
|
|
515
|
-
|
|
544
|
+
configs2.push({
|
|
516
545
|
files: [GLOB_HTML],
|
|
517
546
|
languageOptions: {
|
|
518
547
|
parser: parserPlain
|
|
@@ -529,10 +558,32 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
529
558
|
}
|
|
530
559
|
});
|
|
531
560
|
}
|
|
561
|
+
if (options.xml) {
|
|
562
|
+
configs2.push({
|
|
563
|
+
files: [GLOB_XML],
|
|
564
|
+
languageOptions: {
|
|
565
|
+
parser: parserPlain
|
|
566
|
+
},
|
|
567
|
+
name: "kirklin/formatter/xml",
|
|
568
|
+
rules: {
|
|
569
|
+
"format/prettier": [
|
|
570
|
+
"error",
|
|
571
|
+
{
|
|
572
|
+
...prettierXmlOptions,
|
|
573
|
+
...prettierOptions,
|
|
574
|
+
parser: "xml",
|
|
575
|
+
plugins: [
|
|
576
|
+
"@prettier/plugin-xml"
|
|
577
|
+
]
|
|
578
|
+
}
|
|
579
|
+
]
|
|
580
|
+
}
|
|
581
|
+
});
|
|
582
|
+
}
|
|
532
583
|
if (options.markdown) {
|
|
533
584
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
534
585
|
const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
535
|
-
|
|
586
|
+
configs2.push({
|
|
536
587
|
files: [GLOB_MARKDOWN],
|
|
537
588
|
ignores: GLOB_SLIDEV,
|
|
538
589
|
languageOptions: {
|
|
@@ -555,7 +606,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
555
606
|
}
|
|
556
607
|
});
|
|
557
608
|
if (options.slidev) {
|
|
558
|
-
|
|
609
|
+
configs2.push({
|
|
559
610
|
files: GLOB_SLIDEV,
|
|
560
611
|
languageOptions: {
|
|
561
612
|
parser: parserPlain
|
|
@@ -579,7 +630,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
579
630
|
}
|
|
580
631
|
}
|
|
581
632
|
if (options.astro) {
|
|
582
|
-
|
|
633
|
+
configs2.push({
|
|
583
634
|
files: [GLOB_ASTRO],
|
|
584
635
|
languageOptions: {
|
|
585
636
|
parser: parserPlain
|
|
@@ -598,9 +649,20 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
598
649
|
]
|
|
599
650
|
}
|
|
600
651
|
});
|
|
652
|
+
configs2.push({
|
|
653
|
+
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
654
|
+
name: "kirklin/formatter/astro/disables",
|
|
655
|
+
rules: {
|
|
656
|
+
"style/arrow-parens": "off",
|
|
657
|
+
"style/block-spacing": "off",
|
|
658
|
+
"style/comma-dangle": "off",
|
|
659
|
+
"style/indent": "off",
|
|
660
|
+
"style/no-multi-spaces": "off"
|
|
661
|
+
}
|
|
662
|
+
});
|
|
601
663
|
}
|
|
602
664
|
if (options.graphql) {
|
|
603
|
-
|
|
665
|
+
configs2.push({
|
|
604
666
|
files: [GLOB_GRAPHQL],
|
|
605
667
|
languageOptions: {
|
|
606
668
|
parser: parserPlain
|
|
@@ -617,7 +679,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
617
679
|
}
|
|
618
680
|
});
|
|
619
681
|
}
|
|
620
|
-
return
|
|
682
|
+
return configs2;
|
|
621
683
|
}
|
|
622
684
|
|
|
623
685
|
// src/configs/ignores.ts
|
|
@@ -701,6 +763,9 @@ async function javascript(options = {}) {
|
|
|
701
763
|
linterOptions: {
|
|
702
764
|
reportUnusedDisableDirectives: true
|
|
703
765
|
},
|
|
766
|
+
name: "kirklin/javascript/setup"
|
|
767
|
+
},
|
|
768
|
+
{
|
|
704
769
|
name: "kirklin/javascript/rules",
|
|
705
770
|
plugins: {
|
|
706
771
|
"kirklin": import_eslint_plugin_kirklin.default,
|
|
@@ -928,6 +993,23 @@ async function jsdoc(options = {}) {
|
|
|
928
993
|
];
|
|
929
994
|
}
|
|
930
995
|
|
|
996
|
+
// src/configs/jsx.ts
|
|
997
|
+
async function jsx() {
|
|
998
|
+
return [
|
|
999
|
+
{
|
|
1000
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
1001
|
+
languageOptions: {
|
|
1002
|
+
parserOptions: {
|
|
1003
|
+
ecmaFeatures: {
|
|
1004
|
+
jsx: true
|
|
1005
|
+
}
|
|
1006
|
+
}
|
|
1007
|
+
},
|
|
1008
|
+
name: "kirklin/jsx/setup"
|
|
1009
|
+
}
|
|
1010
|
+
];
|
|
1011
|
+
}
|
|
1012
|
+
|
|
931
1013
|
// src/configs/jsonc.ts
|
|
932
1014
|
async function jsonc(options = {}) {
|
|
933
1015
|
const {
|
|
@@ -1075,25 +1157,6 @@ async function markdown(options = {}) {
|
|
|
1075
1157
|
"unicode-bom": "off",
|
|
1076
1158
|
"unused-imports/no-unused-imports": "off",
|
|
1077
1159
|
"unused-imports/no-unused-vars": "off",
|
|
1078
|
-
// Type aware rules
|
|
1079
|
-
...{
|
|
1080
|
-
"ts/await-thenable": "off",
|
|
1081
|
-
"ts/dot-notation": "off",
|
|
1082
|
-
"ts/no-floating-promises": "off",
|
|
1083
|
-
"ts/no-for-in-array": "off",
|
|
1084
|
-
"ts/no-implied-eval": "off",
|
|
1085
|
-
"ts/no-misused-promises": "off",
|
|
1086
|
-
"ts/no-throw-literal": "off",
|
|
1087
|
-
"ts/no-unnecessary-type-assertion": "off",
|
|
1088
|
-
"ts/no-unsafe-argument": "off",
|
|
1089
|
-
"ts/no-unsafe-assignment": "off",
|
|
1090
|
-
"ts/no-unsafe-call": "off",
|
|
1091
|
-
"ts/no-unsafe-member-access": "off",
|
|
1092
|
-
"ts/no-unsafe-return": "off",
|
|
1093
|
-
"ts/restrict-plus-operands": "off",
|
|
1094
|
-
"ts/restrict-template-expressions": "off",
|
|
1095
|
-
"ts/unbound-method": "off"
|
|
1096
|
-
},
|
|
1097
1160
|
...overrides
|
|
1098
1161
|
}
|
|
1099
1162
|
}
|
|
@@ -1150,7 +1213,7 @@ var NextJsPackages = [
|
|
|
1150
1213
|
];
|
|
1151
1214
|
async function react(options = {}) {
|
|
1152
1215
|
const {
|
|
1153
|
-
files = [GLOB_TS, GLOB_TSX],
|
|
1216
|
+
files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
|
|
1154
1217
|
overrides = {}
|
|
1155
1218
|
} = options;
|
|
1156
1219
|
await ensurePackages([
|
|
@@ -1390,6 +1453,7 @@ async function sortPackageJson() {
|
|
|
1390
1453
|
"packageManager",
|
|
1391
1454
|
"description",
|
|
1392
1455
|
"author",
|
|
1456
|
+
"contributors",
|
|
1393
1457
|
"license",
|
|
1394
1458
|
"funding",
|
|
1395
1459
|
"homepage",
|
|
@@ -1802,10 +1866,15 @@ async function typescript(options = {}) {
|
|
|
1802
1866
|
parserOptions = {}
|
|
1803
1867
|
} = options;
|
|
1804
1868
|
const files = options.files ?? [
|
|
1805
|
-
|
|
1869
|
+
GLOB_TS,
|
|
1870
|
+
GLOB_TSX,
|
|
1806
1871
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1807
1872
|
];
|
|
1808
1873
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1874
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1875
|
+
`${GLOB_MARKDOWN}/**`,
|
|
1876
|
+
GLOB_ASTRO_TS
|
|
1877
|
+
];
|
|
1809
1878
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1810
1879
|
const isTypeAware = !!tsconfigPath;
|
|
1811
1880
|
const typeAwareRules = {
|
|
@@ -1825,8 +1894,12 @@ async function typescript(options = {}) {
|
|
|
1825
1894
|
"ts/no-unsafe-call": "error",
|
|
1826
1895
|
"ts/no-unsafe-member-access": "error",
|
|
1827
1896
|
"ts/no-unsafe-return": "error",
|
|
1897
|
+
"ts/promise-function-async": "error",
|
|
1828
1898
|
"ts/restrict-plus-operands": "error",
|
|
1829
1899
|
"ts/restrict-template-expressions": "error",
|
|
1900
|
+
"ts/return-await": ["error", "in-try-catch"],
|
|
1901
|
+
"ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }],
|
|
1902
|
+
"ts/switch-exhaustiveness-check": "error",
|
|
1830
1903
|
"ts/unbound-method": "error"
|
|
1831
1904
|
};
|
|
1832
1905
|
const [
|
|
@@ -1866,9 +1939,11 @@ async function typescript(options = {}) {
|
|
|
1866
1939
|
},
|
|
1867
1940
|
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
1868
1941
|
...isTypeAware ? [
|
|
1869
|
-
makeParser(true, filesTypeAware),
|
|
1942
|
+
makeParser(true, filesTypeAware, ignoresTypeAware),
|
|
1870
1943
|
makeParser(false, files, filesTypeAware)
|
|
1871
|
-
] : [
|
|
1944
|
+
] : [
|
|
1945
|
+
makeParser(false, files)
|
|
1946
|
+
],
|
|
1872
1947
|
{
|
|
1873
1948
|
files,
|
|
1874
1949
|
name: "kirklin/typescript/rules",
|
|
@@ -1913,14 +1988,12 @@ async function typescript(options = {}) {
|
|
|
1913
1988
|
},
|
|
1914
1989
|
...isTypeAware ? [{
|
|
1915
1990
|
files: filesTypeAware,
|
|
1991
|
+
ignores: ignoresTypeAware,
|
|
1916
1992
|
name: "kirklin/typescript/rules-type-aware",
|
|
1917
|
-
rules:
|
|
1918
|
-
...tsconfigPath ? typeAwareRules : {},
|
|
1919
|
-
...overrides
|
|
1920
|
-
}
|
|
1993
|
+
rules: typeAwareRules
|
|
1921
1994
|
}] : [],
|
|
1922
1995
|
{
|
|
1923
|
-
files: ["**/*.d
|
|
1996
|
+
files: ["**/*.d.?([cm])ts"],
|
|
1924
1997
|
name: "kirklin/typescript/disables/dts",
|
|
1925
1998
|
rules: {
|
|
1926
1999
|
"eslint-comments/no-unlimited-disable": "off",
|
|
@@ -2251,6 +2324,32 @@ async function yaml(options = {}) {
|
|
|
2251
2324
|
];
|
|
2252
2325
|
}
|
|
2253
2326
|
|
|
2327
|
+
// src/configs/regexp.ts
|
|
2328
|
+
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
2329
|
+
async function regexp(options = {}) {
|
|
2330
|
+
const config = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
2331
|
+
const rules = {
|
|
2332
|
+
...config.rules
|
|
2333
|
+
};
|
|
2334
|
+
if (options.level === "warn") {
|
|
2335
|
+
for (const key in rules) {
|
|
2336
|
+
if (rules[key] === "error") {
|
|
2337
|
+
rules[key] = "warn";
|
|
2338
|
+
}
|
|
2339
|
+
}
|
|
2340
|
+
}
|
|
2341
|
+
return [
|
|
2342
|
+
{
|
|
2343
|
+
...config,
|
|
2344
|
+
name: "kirklin/regexp/rules",
|
|
2345
|
+
rules: {
|
|
2346
|
+
...rules,
|
|
2347
|
+
...options.overrides
|
|
2348
|
+
}
|
|
2349
|
+
}
|
|
2350
|
+
];
|
|
2351
|
+
}
|
|
2352
|
+
|
|
2254
2353
|
// src/factory.ts
|
|
2255
2354
|
var flatConfigProps = [
|
|
2256
2355
|
"name",
|
|
@@ -2287,8 +2386,10 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2287
2386
|
autoRenamePlugins = true,
|
|
2288
2387
|
componentExts = [],
|
|
2289
2388
|
gitignore: enableGitignore = true,
|
|
2290
|
-
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
2389
|
+
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.VSCODE_CWD || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM || import_node_process3.default.env.NVIM) && !import_node_process3.default.env.CI),
|
|
2390
|
+
jsx: enableJsx = true,
|
|
2291
2391
|
react: enableReact = false,
|
|
2392
|
+
regexp: enableRegexp = true,
|
|
2292
2393
|
solid: enableSolid = false,
|
|
2293
2394
|
svelte: enableSvelte = false,
|
|
2294
2395
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
@@ -2297,19 +2398,21 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2297
2398
|
} = options;
|
|
2298
2399
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2299
2400
|
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2300
|
-
stylisticOptions.jsx =
|
|
2401
|
+
stylisticOptions.jsx = enableJsx;
|
|
2301
2402
|
}
|
|
2302
|
-
const
|
|
2403
|
+
const configs2 = [];
|
|
2303
2404
|
if (enableGitignore) {
|
|
2304
2405
|
if (typeof enableGitignore !== "boolean") {
|
|
2305
|
-
|
|
2406
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2306
2407
|
} else {
|
|
2307
2408
|
if (import_node_fs.default.existsSync(".gitignore")) {
|
|
2308
|
-
|
|
2409
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2309
2410
|
}
|
|
2310
2411
|
}
|
|
2311
2412
|
}
|
|
2312
|
-
|
|
2413
|
+
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2414
|
+
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2415
|
+
configs2.push(
|
|
2313
2416
|
ignores(),
|
|
2314
2417
|
javascript({
|
|
2315
2418
|
isInEditor,
|
|
@@ -2331,28 +2434,34 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2331
2434
|
if (enableVue) {
|
|
2332
2435
|
componentExts.push("vue");
|
|
2333
2436
|
}
|
|
2437
|
+
if (enableJsx) {
|
|
2438
|
+
configs2.push(jsx());
|
|
2439
|
+
}
|
|
2334
2440
|
if (enableTypeScript) {
|
|
2335
|
-
|
|
2336
|
-
...
|
|
2441
|
+
configs2.push(typescript({
|
|
2442
|
+
...typescriptOptions,
|
|
2337
2443
|
componentExts,
|
|
2338
2444
|
overrides: getOverrides(options, "typescript")
|
|
2339
2445
|
}));
|
|
2340
2446
|
}
|
|
2341
2447
|
if (stylisticOptions) {
|
|
2342
|
-
|
|
2448
|
+
configs2.push(stylistic({
|
|
2343
2449
|
...stylisticOptions,
|
|
2344
2450
|
lessOpinionated: options.lessOpinionated,
|
|
2345
2451
|
overrides: getOverrides(options, "stylistic")
|
|
2346
2452
|
}));
|
|
2347
2453
|
}
|
|
2454
|
+
if (enableRegexp) {
|
|
2455
|
+
configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
2456
|
+
}
|
|
2348
2457
|
if (options.test ?? true) {
|
|
2349
|
-
|
|
2458
|
+
configs2.push(test({
|
|
2350
2459
|
isInEditor,
|
|
2351
2460
|
overrides: getOverrides(options, "test")
|
|
2352
2461
|
}));
|
|
2353
2462
|
}
|
|
2354
2463
|
if (enableVue) {
|
|
2355
|
-
|
|
2464
|
+
configs2.push(vue({
|
|
2356
2465
|
...resolveSubOptions(options, "vue"),
|
|
2357
2466
|
overrides: getOverrides(options, "vue"),
|
|
2358
2467
|
stylistic: stylisticOptions,
|
|
@@ -2360,39 +2469,39 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2360
2469
|
}));
|
|
2361
2470
|
}
|
|
2362
2471
|
if (enableReact) {
|
|
2363
|
-
|
|
2472
|
+
configs2.push(react({
|
|
2364
2473
|
overrides: getOverrides(options, "react"),
|
|
2365
|
-
tsconfigPath
|
|
2474
|
+
tsconfigPath
|
|
2366
2475
|
}));
|
|
2367
2476
|
}
|
|
2368
2477
|
if (enableSolid) {
|
|
2369
|
-
|
|
2478
|
+
configs2.push(solid({
|
|
2370
2479
|
overrides: getOverrides(options, "solid"),
|
|
2371
|
-
tsconfigPath
|
|
2480
|
+
tsconfigPath,
|
|
2372
2481
|
typescript: !!enableTypeScript
|
|
2373
2482
|
}));
|
|
2374
2483
|
}
|
|
2375
2484
|
if (enableSvelte) {
|
|
2376
|
-
|
|
2485
|
+
configs2.push(svelte({
|
|
2377
2486
|
overrides: getOverrides(options, "svelte"),
|
|
2378
2487
|
stylistic: stylisticOptions,
|
|
2379
2488
|
typescript: !!enableTypeScript
|
|
2380
2489
|
}));
|
|
2381
2490
|
}
|
|
2382
2491
|
if (enableUnoCSS) {
|
|
2383
|
-
|
|
2492
|
+
configs2.push(unocss({
|
|
2384
2493
|
...resolveSubOptions(options, "unocss"),
|
|
2385
2494
|
overrides: getOverrides(options, "unocss")
|
|
2386
2495
|
}));
|
|
2387
2496
|
}
|
|
2388
2497
|
if (enableAstro) {
|
|
2389
|
-
|
|
2498
|
+
configs2.push(astro({
|
|
2390
2499
|
overrides: getOverrides(options, "astro"),
|
|
2391
2500
|
stylistic: stylisticOptions
|
|
2392
2501
|
}));
|
|
2393
2502
|
}
|
|
2394
2503
|
if (options.jsonc ?? true) {
|
|
2395
|
-
|
|
2504
|
+
configs2.push(
|
|
2396
2505
|
jsonc({
|
|
2397
2506
|
overrides: getOverrides(options, "jsonc"),
|
|
2398
2507
|
stylistic: stylisticOptions
|
|
@@ -2402,19 +2511,19 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2402
2511
|
);
|
|
2403
2512
|
}
|
|
2404
2513
|
if (options.yaml ?? true) {
|
|
2405
|
-
|
|
2514
|
+
configs2.push(yaml({
|
|
2406
2515
|
overrides: getOverrides(options, "yaml"),
|
|
2407
2516
|
stylistic: stylisticOptions
|
|
2408
2517
|
}));
|
|
2409
2518
|
}
|
|
2410
2519
|
if (options.toml ?? true) {
|
|
2411
|
-
|
|
2520
|
+
configs2.push(toml({
|
|
2412
2521
|
overrides: getOverrides(options, "toml"),
|
|
2413
2522
|
stylistic: stylisticOptions
|
|
2414
2523
|
}));
|
|
2415
2524
|
}
|
|
2416
2525
|
if (options.markdown ?? true) {
|
|
2417
|
-
|
|
2526
|
+
configs2.push(
|
|
2418
2527
|
markdown(
|
|
2419
2528
|
{
|
|
2420
2529
|
componentExts,
|
|
@@ -2424,7 +2533,7 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2424
2533
|
);
|
|
2425
2534
|
}
|
|
2426
2535
|
if (options.formatters) {
|
|
2427
|
-
|
|
2536
|
+
configs2.push(formatters(
|
|
2428
2537
|
options.formatters,
|
|
2429
2538
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2430
2539
|
));
|
|
@@ -2436,11 +2545,11 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2436
2545
|
return acc;
|
|
2437
2546
|
}, {});
|
|
2438
2547
|
if (Object.keys(fusedConfig).length) {
|
|
2439
|
-
|
|
2548
|
+
configs2.push([fusedConfig]);
|
|
2440
2549
|
}
|
|
2441
2550
|
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2442
2551
|
composer = composer.append(
|
|
2443
|
-
...
|
|
2552
|
+
...configs2,
|
|
2444
2553
|
...userConfigs
|
|
2445
2554
|
);
|
|
2446
2555
|
if (autoRenamePlugins) {
|
|
@@ -2465,6 +2574,7 @@ var src_default = kirklin;
|
|
|
2465
2574
|
0 && (module.exports = {
|
|
2466
2575
|
GLOB_ALL_SRC,
|
|
2467
2576
|
GLOB_ASTRO,
|
|
2577
|
+
GLOB_ASTRO_TS,
|
|
2468
2578
|
GLOB_CSS,
|
|
2469
2579
|
GLOB_EXCLUDE,
|
|
2470
2580
|
GLOB_GRAPHQL,
|
|
@@ -2489,6 +2599,7 @@ var src_default = kirklin;
|
|
|
2489
2599
|
GLOB_TS,
|
|
2490
2600
|
GLOB_TSX,
|
|
2491
2601
|
GLOB_VUE,
|
|
2602
|
+
GLOB_XML,
|
|
2492
2603
|
GLOB_YAML,
|
|
2493
2604
|
StylisticConfigDefaults,
|
|
2494
2605
|
astro,
|
|
@@ -2505,12 +2616,14 @@ var src_default = kirklin;
|
|
|
2505
2616
|
javascript,
|
|
2506
2617
|
jsdoc,
|
|
2507
2618
|
jsonc,
|
|
2619
|
+
jsx,
|
|
2508
2620
|
kirklin,
|
|
2509
2621
|
markdown,
|
|
2510
2622
|
node,
|
|
2511
2623
|
parserPlain,
|
|
2512
2624
|
perfectionist,
|
|
2513
2625
|
react,
|
|
2626
|
+
regexp,
|
|
2514
2627
|
renamePluginInConfigs,
|
|
2515
2628
|
renameRules,
|
|
2516
2629
|
resolveSubOptions,
|