@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.js
CHANGED
|
@@ -25,8 +25,10 @@ var GLOB_SVELTE = "**/*.svelte";
|
|
|
25
25
|
var GLOB_VUE = "**/*.vue";
|
|
26
26
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
27
27
|
var GLOB_TOML = "**/*.toml";
|
|
28
|
+
var GLOB_XML = "**/*.xml";
|
|
28
29
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
29
30
|
var GLOB_ASTRO = "**/*.astro";
|
|
31
|
+
var GLOB_ASTRO_TS = "**/*.astro/*.ts";
|
|
30
32
|
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
31
33
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
32
34
|
var GLOB_TESTS = [
|
|
@@ -45,6 +47,7 @@ var GLOB_ALL_SRC = [
|
|
|
45
47
|
GLOB_SVELTE,
|
|
46
48
|
GLOB_VUE,
|
|
47
49
|
GLOB_YAML,
|
|
50
|
+
GLOB_XML,
|
|
48
51
|
GLOB_HTML
|
|
49
52
|
];
|
|
50
53
|
var GLOB_EXCLUDE = [
|
|
@@ -71,6 +74,7 @@ var GLOB_EXCLUDE = [
|
|
|
71
74
|
"**/.output",
|
|
72
75
|
"**/.vite-inspect",
|
|
73
76
|
"**/.yarn",
|
|
77
|
+
"**/vite.config.*.timestamp-*",
|
|
74
78
|
"**/CHANGELOG*.md",
|
|
75
79
|
"**/*.min.*",
|
|
76
80
|
"**/LICENSE*",
|
|
@@ -102,8 +106,8 @@ var parserPlain = {
|
|
|
102
106
|
}
|
|
103
107
|
})
|
|
104
108
|
};
|
|
105
|
-
async function combine(...
|
|
106
|
-
const resolved = await Promise.all(
|
|
109
|
+
async function combine(...configs2) {
|
|
110
|
+
const resolved = await Promise.all(configs2);
|
|
107
111
|
return resolved.flat();
|
|
108
112
|
}
|
|
109
113
|
function renameRules(rules, map) {
|
|
@@ -118,8 +122,8 @@ function renameRules(rules, map) {
|
|
|
118
122
|
})
|
|
119
123
|
);
|
|
120
124
|
}
|
|
121
|
-
function renamePluginInConfigs(
|
|
122
|
-
return
|
|
125
|
+
function renamePluginInConfigs(configs2, map) {
|
|
126
|
+
return configs2.map((i) => {
|
|
123
127
|
const clone = { ...i };
|
|
124
128
|
if (clone.rules) {
|
|
125
129
|
clone.rules = renameRules(clone.rules, map);
|
|
@@ -187,15 +191,28 @@ async function astro(options = {}) {
|
|
|
187
191
|
{
|
|
188
192
|
files,
|
|
189
193
|
languageOptions: {
|
|
194
|
+
globals: pluginAstro.environments.astro.globals,
|
|
190
195
|
parser: parserAstro,
|
|
191
196
|
parserOptions: {
|
|
192
197
|
extraFileExtensions: [".astro"],
|
|
193
198
|
parser: parserTs
|
|
194
|
-
}
|
|
199
|
+
},
|
|
200
|
+
sourceType: "module"
|
|
195
201
|
},
|
|
196
202
|
name: "kirklin/astro/rules",
|
|
203
|
+
processor: "astro/client-side-ts",
|
|
197
204
|
rules: {
|
|
205
|
+
// use recommended rules
|
|
206
|
+
"astro/missing-client-only-directive-value": "error",
|
|
207
|
+
"astro/no-conflict-set-directives": "error",
|
|
208
|
+
"astro/no-deprecated-astro-canonicalurl": "error",
|
|
209
|
+
"astro/no-deprecated-astro-fetchcontent": "error",
|
|
210
|
+
"astro/no-deprecated-astro-resolve": "error",
|
|
211
|
+
"astro/no-deprecated-getentrybyslug": "error",
|
|
198
212
|
"astro/no-set-html-directive": "off",
|
|
213
|
+
"astro/no-unused-define-vars-in-style": "error",
|
|
214
|
+
"astro/semi": "off",
|
|
215
|
+
"astro/valid-compile": "error",
|
|
199
216
|
...stylistic2 ? {
|
|
200
217
|
"style/indent": "off",
|
|
201
218
|
"style/jsx-closing-tag-location": "off",
|
|
@@ -260,7 +277,7 @@ var StylisticConfigDefaults = {
|
|
|
260
277
|
async function stylistic(options = {}) {
|
|
261
278
|
const {
|
|
262
279
|
indent,
|
|
263
|
-
jsx,
|
|
280
|
+
jsx: jsx2,
|
|
264
281
|
lessOpinionated = false,
|
|
265
282
|
overrides = {},
|
|
266
283
|
quotes,
|
|
@@ -273,7 +290,7 @@ async function stylistic(options = {}) {
|
|
|
273
290
|
const config = pluginStylistic.configs.customize({
|
|
274
291
|
flat: true,
|
|
275
292
|
indent,
|
|
276
|
-
jsx,
|
|
293
|
+
jsx: jsx2,
|
|
277
294
|
pluginName: "style",
|
|
278
295
|
quotes,
|
|
279
296
|
semi
|
|
@@ -307,18 +324,20 @@ async function stylistic(options = {}) {
|
|
|
307
324
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
308
325
|
if (options === true) {
|
|
309
326
|
options = {
|
|
310
|
-
astro: isPackageExists2("astro"),
|
|
327
|
+
astro: isPackageExists2("prettier-plugin-astro"),
|
|
311
328
|
css: true,
|
|
312
329
|
graphql: true,
|
|
313
330
|
html: true,
|
|
314
331
|
markdown: true,
|
|
315
|
-
slidev: isPackageExists2("@slidev/cli")
|
|
332
|
+
slidev: isPackageExists2("@slidev/cli"),
|
|
333
|
+
xml: isPackageExists2("@prettier/plugin-xml")
|
|
316
334
|
};
|
|
317
335
|
}
|
|
318
336
|
await ensurePackages([
|
|
319
337
|
"eslint-plugin-format",
|
|
320
338
|
options.markdown && options.slidev ? "prettier-plugin-slidev" : void 0,
|
|
321
|
-
options.astro ? "prettier-plugin-astro" : void 0
|
|
339
|
+
options.astro ? "prettier-plugin-astro" : void 0,
|
|
340
|
+
options.xml ? "@prettier/plugin-xml" : void 0
|
|
322
341
|
]);
|
|
323
342
|
if (options.slidev && options.markdown !== true && options.markdown !== "prettier") {
|
|
324
343
|
throw new Error("`slidev` option only works when `markdown` is enabled with `prettier`");
|
|
@@ -342,6 +361,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
342
361
|
},
|
|
343
362
|
options.prettierOptions || {}
|
|
344
363
|
);
|
|
364
|
+
const prettierXmlOptions = {
|
|
365
|
+
xmlQuoteAttributes: "double",
|
|
366
|
+
xmlSelfClosingSpace: true,
|
|
367
|
+
xmlSortAttributesByKey: false,
|
|
368
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
369
|
+
};
|
|
345
370
|
const dprintOptions = Object.assign(
|
|
346
371
|
{
|
|
347
372
|
indentWidth: typeof indent === "number" ? indent : 2,
|
|
@@ -351,7 +376,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
351
376
|
options.dprintOptions || {}
|
|
352
377
|
);
|
|
353
378
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
354
|
-
const
|
|
379
|
+
const configs2 = [
|
|
355
380
|
{
|
|
356
381
|
name: "kirklin/formatter/setup",
|
|
357
382
|
plugins: {
|
|
@@ -360,7 +385,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
360
385
|
}
|
|
361
386
|
];
|
|
362
387
|
if (options.css) {
|
|
363
|
-
|
|
388
|
+
configs2.push(
|
|
364
389
|
{
|
|
365
390
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
366
391
|
languageOptions: {
|
|
@@ -412,7 +437,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
412
437
|
);
|
|
413
438
|
}
|
|
414
439
|
if (options.html) {
|
|
415
|
-
|
|
440
|
+
configs2.push({
|
|
416
441
|
files: [GLOB_HTML],
|
|
417
442
|
languageOptions: {
|
|
418
443
|
parser: parserPlain
|
|
@@ -429,10 +454,32 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
429
454
|
}
|
|
430
455
|
});
|
|
431
456
|
}
|
|
457
|
+
if (options.xml) {
|
|
458
|
+
configs2.push({
|
|
459
|
+
files: [GLOB_XML],
|
|
460
|
+
languageOptions: {
|
|
461
|
+
parser: parserPlain
|
|
462
|
+
},
|
|
463
|
+
name: "kirklin/formatter/xml",
|
|
464
|
+
rules: {
|
|
465
|
+
"format/prettier": [
|
|
466
|
+
"error",
|
|
467
|
+
{
|
|
468
|
+
...prettierXmlOptions,
|
|
469
|
+
...prettierOptions,
|
|
470
|
+
parser: "xml",
|
|
471
|
+
plugins: [
|
|
472
|
+
"@prettier/plugin-xml"
|
|
473
|
+
]
|
|
474
|
+
}
|
|
475
|
+
]
|
|
476
|
+
}
|
|
477
|
+
});
|
|
478
|
+
}
|
|
432
479
|
if (options.markdown) {
|
|
433
480
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
434
481
|
const GLOB_SLIDEV = !options.slidev ? [] : options.slidev === true ? ["**/slides.md"] : options.slidev.files;
|
|
435
|
-
|
|
482
|
+
configs2.push({
|
|
436
483
|
files: [GLOB_MARKDOWN],
|
|
437
484
|
ignores: GLOB_SLIDEV,
|
|
438
485
|
languageOptions: {
|
|
@@ -455,7 +502,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
455
502
|
}
|
|
456
503
|
});
|
|
457
504
|
if (options.slidev) {
|
|
458
|
-
|
|
505
|
+
configs2.push({
|
|
459
506
|
files: GLOB_SLIDEV,
|
|
460
507
|
languageOptions: {
|
|
461
508
|
parser: parserPlain
|
|
@@ -479,7 +526,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
479
526
|
}
|
|
480
527
|
}
|
|
481
528
|
if (options.astro) {
|
|
482
|
-
|
|
529
|
+
configs2.push({
|
|
483
530
|
files: [GLOB_ASTRO],
|
|
484
531
|
languageOptions: {
|
|
485
532
|
parser: parserPlain
|
|
@@ -498,9 +545,20 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
498
545
|
]
|
|
499
546
|
}
|
|
500
547
|
});
|
|
548
|
+
configs2.push({
|
|
549
|
+
files: [GLOB_ASTRO, GLOB_ASTRO_TS],
|
|
550
|
+
name: "kirklin/formatter/astro/disables",
|
|
551
|
+
rules: {
|
|
552
|
+
"style/arrow-parens": "off",
|
|
553
|
+
"style/block-spacing": "off",
|
|
554
|
+
"style/comma-dangle": "off",
|
|
555
|
+
"style/indent": "off",
|
|
556
|
+
"style/no-multi-spaces": "off"
|
|
557
|
+
}
|
|
558
|
+
});
|
|
501
559
|
}
|
|
502
560
|
if (options.graphql) {
|
|
503
|
-
|
|
561
|
+
configs2.push({
|
|
504
562
|
files: [GLOB_GRAPHQL],
|
|
505
563
|
languageOptions: {
|
|
506
564
|
parser: parserPlain
|
|
@@ -517,7 +575,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
517
575
|
}
|
|
518
576
|
});
|
|
519
577
|
}
|
|
520
|
-
return
|
|
578
|
+
return configs2;
|
|
521
579
|
}
|
|
522
580
|
|
|
523
581
|
// src/configs/ignores.ts
|
|
@@ -601,6 +659,9 @@ async function javascript(options = {}) {
|
|
|
601
659
|
linterOptions: {
|
|
602
660
|
reportUnusedDisableDirectives: true
|
|
603
661
|
},
|
|
662
|
+
name: "kirklin/javascript/setup"
|
|
663
|
+
},
|
|
664
|
+
{
|
|
604
665
|
name: "kirklin/javascript/rules",
|
|
605
666
|
plugins: {
|
|
606
667
|
"kirklin": default2,
|
|
@@ -828,6 +889,23 @@ async function jsdoc(options = {}) {
|
|
|
828
889
|
];
|
|
829
890
|
}
|
|
830
891
|
|
|
892
|
+
// src/configs/jsx.ts
|
|
893
|
+
async function jsx() {
|
|
894
|
+
return [
|
|
895
|
+
{
|
|
896
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
897
|
+
languageOptions: {
|
|
898
|
+
parserOptions: {
|
|
899
|
+
ecmaFeatures: {
|
|
900
|
+
jsx: true
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
},
|
|
904
|
+
name: "kirklin/jsx/setup"
|
|
905
|
+
}
|
|
906
|
+
];
|
|
907
|
+
}
|
|
908
|
+
|
|
831
909
|
// src/configs/jsonc.ts
|
|
832
910
|
async function jsonc(options = {}) {
|
|
833
911
|
const {
|
|
@@ -975,25 +1053,6 @@ async function markdown(options = {}) {
|
|
|
975
1053
|
"unicode-bom": "off",
|
|
976
1054
|
"unused-imports/no-unused-imports": "off",
|
|
977
1055
|
"unused-imports/no-unused-vars": "off",
|
|
978
|
-
// Type aware rules
|
|
979
|
-
...{
|
|
980
|
-
"ts/await-thenable": "off",
|
|
981
|
-
"ts/dot-notation": "off",
|
|
982
|
-
"ts/no-floating-promises": "off",
|
|
983
|
-
"ts/no-for-in-array": "off",
|
|
984
|
-
"ts/no-implied-eval": "off",
|
|
985
|
-
"ts/no-misused-promises": "off",
|
|
986
|
-
"ts/no-throw-literal": "off",
|
|
987
|
-
"ts/no-unnecessary-type-assertion": "off",
|
|
988
|
-
"ts/no-unsafe-argument": "off",
|
|
989
|
-
"ts/no-unsafe-assignment": "off",
|
|
990
|
-
"ts/no-unsafe-call": "off",
|
|
991
|
-
"ts/no-unsafe-member-access": "off",
|
|
992
|
-
"ts/no-unsafe-return": "off",
|
|
993
|
-
"ts/restrict-plus-operands": "off",
|
|
994
|
-
"ts/restrict-template-expressions": "off",
|
|
995
|
-
"ts/unbound-method": "off"
|
|
996
|
-
},
|
|
997
1056
|
...overrides
|
|
998
1057
|
}
|
|
999
1058
|
}
|
|
@@ -1050,7 +1109,7 @@ var NextJsPackages = [
|
|
|
1050
1109
|
];
|
|
1051
1110
|
async function react(options = {}) {
|
|
1052
1111
|
const {
|
|
1053
|
-
files = [GLOB_TS, GLOB_TSX],
|
|
1112
|
+
files = [GLOB_JS, GLOB_JSX, GLOB_TS, GLOB_TSX],
|
|
1054
1113
|
overrides = {}
|
|
1055
1114
|
} = options;
|
|
1056
1115
|
await ensurePackages([
|
|
@@ -1290,6 +1349,7 @@ async function sortPackageJson() {
|
|
|
1290
1349
|
"packageManager",
|
|
1291
1350
|
"description",
|
|
1292
1351
|
"author",
|
|
1352
|
+
"contributors",
|
|
1293
1353
|
"license",
|
|
1294
1354
|
"funding",
|
|
1295
1355
|
"homepage",
|
|
@@ -1702,10 +1762,15 @@ async function typescript(options = {}) {
|
|
|
1702
1762
|
parserOptions = {}
|
|
1703
1763
|
} = options;
|
|
1704
1764
|
const files = options.files ?? [
|
|
1705
|
-
|
|
1765
|
+
GLOB_TS,
|
|
1766
|
+
GLOB_TSX,
|
|
1706
1767
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1707
1768
|
];
|
|
1708
1769
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1770
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1771
|
+
`${GLOB_MARKDOWN}/**`,
|
|
1772
|
+
GLOB_ASTRO_TS
|
|
1773
|
+
];
|
|
1709
1774
|
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1710
1775
|
const isTypeAware = !!tsconfigPath;
|
|
1711
1776
|
const typeAwareRules = {
|
|
@@ -1725,8 +1790,12 @@ async function typescript(options = {}) {
|
|
|
1725
1790
|
"ts/no-unsafe-call": "error",
|
|
1726
1791
|
"ts/no-unsafe-member-access": "error",
|
|
1727
1792
|
"ts/no-unsafe-return": "error",
|
|
1793
|
+
"ts/promise-function-async": "error",
|
|
1728
1794
|
"ts/restrict-plus-operands": "error",
|
|
1729
1795
|
"ts/restrict-template-expressions": "error",
|
|
1796
|
+
"ts/return-await": ["error", "in-try-catch"],
|
|
1797
|
+
"ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }],
|
|
1798
|
+
"ts/switch-exhaustiveness-check": "error",
|
|
1730
1799
|
"ts/unbound-method": "error"
|
|
1731
1800
|
};
|
|
1732
1801
|
const [
|
|
@@ -1766,9 +1835,11 @@ async function typescript(options = {}) {
|
|
|
1766
1835
|
},
|
|
1767
1836
|
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
1768
1837
|
...isTypeAware ? [
|
|
1769
|
-
makeParser(true, filesTypeAware),
|
|
1838
|
+
makeParser(true, filesTypeAware, ignoresTypeAware),
|
|
1770
1839
|
makeParser(false, files, filesTypeAware)
|
|
1771
|
-
] : [
|
|
1840
|
+
] : [
|
|
1841
|
+
makeParser(false, files)
|
|
1842
|
+
],
|
|
1772
1843
|
{
|
|
1773
1844
|
files,
|
|
1774
1845
|
name: "kirklin/typescript/rules",
|
|
@@ -1813,14 +1884,12 @@ async function typescript(options = {}) {
|
|
|
1813
1884
|
},
|
|
1814
1885
|
...isTypeAware ? [{
|
|
1815
1886
|
files: filesTypeAware,
|
|
1887
|
+
ignores: ignoresTypeAware,
|
|
1816
1888
|
name: "kirklin/typescript/rules-type-aware",
|
|
1817
|
-
rules:
|
|
1818
|
-
...tsconfigPath ? typeAwareRules : {},
|
|
1819
|
-
...overrides
|
|
1820
|
-
}
|
|
1889
|
+
rules: typeAwareRules
|
|
1821
1890
|
}] : [],
|
|
1822
1891
|
{
|
|
1823
|
-
files: ["**/*.d
|
|
1892
|
+
files: ["**/*.d.?([cm])ts"],
|
|
1824
1893
|
name: "kirklin/typescript/disables/dts",
|
|
1825
1894
|
rules: {
|
|
1826
1895
|
"eslint-comments/no-unlimited-disable": "off",
|
|
@@ -2151,6 +2220,32 @@ async function yaml(options = {}) {
|
|
|
2151
2220
|
];
|
|
2152
2221
|
}
|
|
2153
2222
|
|
|
2223
|
+
// src/configs/regexp.ts
|
|
2224
|
+
import { configs } from "eslint-plugin-regexp";
|
|
2225
|
+
async function regexp(options = {}) {
|
|
2226
|
+
const config = configs["flat/recommended"];
|
|
2227
|
+
const rules = {
|
|
2228
|
+
...config.rules
|
|
2229
|
+
};
|
|
2230
|
+
if (options.level === "warn") {
|
|
2231
|
+
for (const key in rules) {
|
|
2232
|
+
if (rules[key] === "error") {
|
|
2233
|
+
rules[key] = "warn";
|
|
2234
|
+
}
|
|
2235
|
+
}
|
|
2236
|
+
}
|
|
2237
|
+
return [
|
|
2238
|
+
{
|
|
2239
|
+
...config,
|
|
2240
|
+
name: "kirklin/regexp/rules",
|
|
2241
|
+
rules: {
|
|
2242
|
+
...rules,
|
|
2243
|
+
...options.overrides
|
|
2244
|
+
}
|
|
2245
|
+
}
|
|
2246
|
+
];
|
|
2247
|
+
}
|
|
2248
|
+
|
|
2154
2249
|
// src/factory.ts
|
|
2155
2250
|
var flatConfigProps = [
|
|
2156
2251
|
"name",
|
|
@@ -2187,8 +2282,10 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2187
2282
|
autoRenamePlugins = true,
|
|
2188
2283
|
componentExts = [],
|
|
2189
2284
|
gitignore: enableGitignore = true,
|
|
2190
|
-
isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM) && !process3.env.CI),
|
|
2285
|
+
isInEditor = !!((process3.env.VSCODE_PID || process3.env.VSCODE_CWD || process3.env.JETBRAINS_IDE || process3.env.VIM || process3.env.NVIM) && !process3.env.CI),
|
|
2286
|
+
jsx: enableJsx = true,
|
|
2191
2287
|
react: enableReact = false,
|
|
2288
|
+
regexp: enableRegexp = true,
|
|
2192
2289
|
solid: enableSolid = false,
|
|
2193
2290
|
svelte: enableSvelte = false,
|
|
2194
2291
|
typescript: enableTypeScript = isPackageExists4("typescript"),
|
|
@@ -2197,19 +2294,21 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2197
2294
|
} = options;
|
|
2198
2295
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2199
2296
|
if (stylisticOptions && !("jsx" in stylisticOptions)) {
|
|
2200
|
-
stylisticOptions.jsx =
|
|
2297
|
+
stylisticOptions.jsx = enableJsx;
|
|
2201
2298
|
}
|
|
2202
|
-
const
|
|
2299
|
+
const configs2 = [];
|
|
2203
2300
|
if (enableGitignore) {
|
|
2204
2301
|
if (typeof enableGitignore !== "boolean") {
|
|
2205
|
-
|
|
2302
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
2206
2303
|
} else {
|
|
2207
2304
|
if (fs.existsSync(".gitignore")) {
|
|
2208
|
-
|
|
2305
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
2209
2306
|
}
|
|
2210
2307
|
}
|
|
2211
2308
|
}
|
|
2212
|
-
|
|
2309
|
+
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2310
|
+
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2311
|
+
configs2.push(
|
|
2213
2312
|
ignores(),
|
|
2214
2313
|
javascript({
|
|
2215
2314
|
isInEditor,
|
|
@@ -2231,28 +2330,34 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2231
2330
|
if (enableVue) {
|
|
2232
2331
|
componentExts.push("vue");
|
|
2233
2332
|
}
|
|
2333
|
+
if (enableJsx) {
|
|
2334
|
+
configs2.push(jsx());
|
|
2335
|
+
}
|
|
2234
2336
|
if (enableTypeScript) {
|
|
2235
|
-
|
|
2236
|
-
...
|
|
2337
|
+
configs2.push(typescript({
|
|
2338
|
+
...typescriptOptions,
|
|
2237
2339
|
componentExts,
|
|
2238
2340
|
overrides: getOverrides(options, "typescript")
|
|
2239
2341
|
}));
|
|
2240
2342
|
}
|
|
2241
2343
|
if (stylisticOptions) {
|
|
2242
|
-
|
|
2344
|
+
configs2.push(stylistic({
|
|
2243
2345
|
...stylisticOptions,
|
|
2244
2346
|
lessOpinionated: options.lessOpinionated,
|
|
2245
2347
|
overrides: getOverrides(options, "stylistic")
|
|
2246
2348
|
}));
|
|
2247
2349
|
}
|
|
2350
|
+
if (enableRegexp) {
|
|
2351
|
+
configs2.push(regexp(typeof enableRegexp === "boolean" ? {} : enableRegexp));
|
|
2352
|
+
}
|
|
2248
2353
|
if (options.test ?? true) {
|
|
2249
|
-
|
|
2354
|
+
configs2.push(test({
|
|
2250
2355
|
isInEditor,
|
|
2251
2356
|
overrides: getOverrides(options, "test")
|
|
2252
2357
|
}));
|
|
2253
2358
|
}
|
|
2254
2359
|
if (enableVue) {
|
|
2255
|
-
|
|
2360
|
+
configs2.push(vue({
|
|
2256
2361
|
...resolveSubOptions(options, "vue"),
|
|
2257
2362
|
overrides: getOverrides(options, "vue"),
|
|
2258
2363
|
stylistic: stylisticOptions,
|
|
@@ -2260,39 +2365,39 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2260
2365
|
}));
|
|
2261
2366
|
}
|
|
2262
2367
|
if (enableReact) {
|
|
2263
|
-
|
|
2368
|
+
configs2.push(react({
|
|
2264
2369
|
overrides: getOverrides(options, "react"),
|
|
2265
|
-
tsconfigPath
|
|
2370
|
+
tsconfigPath
|
|
2266
2371
|
}));
|
|
2267
2372
|
}
|
|
2268
2373
|
if (enableSolid) {
|
|
2269
|
-
|
|
2374
|
+
configs2.push(solid({
|
|
2270
2375
|
overrides: getOverrides(options, "solid"),
|
|
2271
|
-
tsconfigPath
|
|
2376
|
+
tsconfigPath,
|
|
2272
2377
|
typescript: !!enableTypeScript
|
|
2273
2378
|
}));
|
|
2274
2379
|
}
|
|
2275
2380
|
if (enableSvelte) {
|
|
2276
|
-
|
|
2381
|
+
configs2.push(svelte({
|
|
2277
2382
|
overrides: getOverrides(options, "svelte"),
|
|
2278
2383
|
stylistic: stylisticOptions,
|
|
2279
2384
|
typescript: !!enableTypeScript
|
|
2280
2385
|
}));
|
|
2281
2386
|
}
|
|
2282
2387
|
if (enableUnoCSS) {
|
|
2283
|
-
|
|
2388
|
+
configs2.push(unocss({
|
|
2284
2389
|
...resolveSubOptions(options, "unocss"),
|
|
2285
2390
|
overrides: getOverrides(options, "unocss")
|
|
2286
2391
|
}));
|
|
2287
2392
|
}
|
|
2288
2393
|
if (enableAstro) {
|
|
2289
|
-
|
|
2394
|
+
configs2.push(astro({
|
|
2290
2395
|
overrides: getOverrides(options, "astro"),
|
|
2291
2396
|
stylistic: stylisticOptions
|
|
2292
2397
|
}));
|
|
2293
2398
|
}
|
|
2294
2399
|
if (options.jsonc ?? true) {
|
|
2295
|
-
|
|
2400
|
+
configs2.push(
|
|
2296
2401
|
jsonc({
|
|
2297
2402
|
overrides: getOverrides(options, "jsonc"),
|
|
2298
2403
|
stylistic: stylisticOptions
|
|
@@ -2302,19 +2407,19 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2302
2407
|
);
|
|
2303
2408
|
}
|
|
2304
2409
|
if (options.yaml ?? true) {
|
|
2305
|
-
|
|
2410
|
+
configs2.push(yaml({
|
|
2306
2411
|
overrides: getOverrides(options, "yaml"),
|
|
2307
2412
|
stylistic: stylisticOptions
|
|
2308
2413
|
}));
|
|
2309
2414
|
}
|
|
2310
2415
|
if (options.toml ?? true) {
|
|
2311
|
-
|
|
2416
|
+
configs2.push(toml({
|
|
2312
2417
|
overrides: getOverrides(options, "toml"),
|
|
2313
2418
|
stylistic: stylisticOptions
|
|
2314
2419
|
}));
|
|
2315
2420
|
}
|
|
2316
2421
|
if (options.markdown ?? true) {
|
|
2317
|
-
|
|
2422
|
+
configs2.push(
|
|
2318
2423
|
markdown(
|
|
2319
2424
|
{
|
|
2320
2425
|
componentExts,
|
|
@@ -2324,7 +2429,7 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2324
2429
|
);
|
|
2325
2430
|
}
|
|
2326
2431
|
if (options.formatters) {
|
|
2327
|
-
|
|
2432
|
+
configs2.push(formatters(
|
|
2328
2433
|
options.formatters,
|
|
2329
2434
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2330
2435
|
));
|
|
@@ -2336,11 +2441,11 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2336
2441
|
return acc;
|
|
2337
2442
|
}, {});
|
|
2338
2443
|
if (Object.keys(fusedConfig).length) {
|
|
2339
|
-
|
|
2444
|
+
configs2.push([fusedConfig]);
|
|
2340
2445
|
}
|
|
2341
2446
|
let composer = new FlatConfigComposer();
|
|
2342
2447
|
composer = composer.append(
|
|
2343
|
-
...
|
|
2448
|
+
...configs2,
|
|
2344
2449
|
...userConfigs
|
|
2345
2450
|
);
|
|
2346
2451
|
if (autoRenamePlugins) {
|
|
@@ -2364,6 +2469,7 @@ var src_default = kirklin;
|
|
|
2364
2469
|
export {
|
|
2365
2470
|
GLOB_ALL_SRC,
|
|
2366
2471
|
GLOB_ASTRO,
|
|
2472
|
+
GLOB_ASTRO_TS,
|
|
2367
2473
|
GLOB_CSS,
|
|
2368
2474
|
GLOB_EXCLUDE,
|
|
2369
2475
|
GLOB_GRAPHQL,
|
|
@@ -2388,6 +2494,7 @@ export {
|
|
|
2388
2494
|
GLOB_TS,
|
|
2389
2495
|
GLOB_TSX,
|
|
2390
2496
|
GLOB_VUE,
|
|
2497
|
+
GLOB_XML,
|
|
2391
2498
|
GLOB_YAML,
|
|
2392
2499
|
StylisticConfigDefaults,
|
|
2393
2500
|
astro,
|
|
@@ -2405,12 +2512,14 @@ export {
|
|
|
2405
2512
|
javascript,
|
|
2406
2513
|
jsdoc,
|
|
2407
2514
|
jsonc,
|
|
2515
|
+
jsx,
|
|
2408
2516
|
kirklin,
|
|
2409
2517
|
markdown,
|
|
2410
2518
|
node,
|
|
2411
2519
|
parserPlain,
|
|
2412
2520
|
perfectionist,
|
|
2413
2521
|
react,
|
|
2522
|
+
regexp,
|
|
2414
2523
|
renamePluginInConfigs,
|
|
2415
2524
|
renameRules,
|
|
2416
2525
|
resolveSubOptions,
|