@lincy/eslint-config 4.5.1 → 4.6.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 +13 -0
- package/dist/index.cjs +99 -57
- package/dist/index.d.cts +831 -222
- package/dist/index.d.ts +831 -222
- package/dist/index.js +97 -57
- package/package.json +35 -34
package/README.md
CHANGED
|
@@ -204,6 +204,12 @@ export default lincy({
|
|
|
204
204
|
* @example 可选: false | { files?: string[] }
|
|
205
205
|
*/
|
|
206
206
|
markdown: false,
|
|
207
|
+
/**
|
|
208
|
+
* 是否启用 regexp 规则
|
|
209
|
+
* @default 默认值: true,
|
|
210
|
+
* @example 可选: false | { level?: 'error' | 'warn' }
|
|
211
|
+
*/
|
|
212
|
+
regexp: true,
|
|
207
213
|
/**
|
|
208
214
|
* 是否启用 formatters 规则
|
|
209
215
|
* @default 默认值: false,
|
|
@@ -249,6 +255,9 @@ export default lincy({
|
|
|
249
255
|
},
|
|
250
256
|
unocss: {
|
|
251
257
|
// unocss 规则
|
|
258
|
+
},
|
|
259
|
+
regexp: {
|
|
260
|
+
// regexp 规则
|
|
252
261
|
}
|
|
253
262
|
},
|
|
254
263
|
|
|
@@ -321,6 +330,7 @@ import {
|
|
|
321
330
|
node,
|
|
322
331
|
perfectionist,
|
|
323
332
|
react,
|
|
333
|
+
regexp,
|
|
324
334
|
sortPackageJson,
|
|
325
335
|
sortTsconfig,
|
|
326
336
|
stylistic,
|
|
@@ -350,6 +360,7 @@ export default combine(
|
|
|
350
360
|
yaml(),
|
|
351
361
|
toml(),
|
|
352
362
|
markdown(),
|
|
363
|
+
regexp(),
|
|
353
364
|
)
|
|
354
365
|
```
|
|
355
366
|
|
|
@@ -397,6 +408,7 @@ export default lincy(
|
|
|
397
408
|
jsonc: true,
|
|
398
409
|
yaml: true,
|
|
399
410
|
markdown: true,
|
|
411
|
+
regexp: true,
|
|
400
412
|
overrides: {}
|
|
401
413
|
},
|
|
402
414
|
{
|
|
@@ -450,6 +462,7 @@ export default lincy({
|
|
|
450
462
|
jsonc: {},
|
|
451
463
|
markdown: {},
|
|
452
464
|
test: {},
|
|
465
|
+
regexp: {},
|
|
453
466
|
|
|
454
467
|
// 追加自定义排除文件(夹)
|
|
455
468
|
ignores: [
|
package/dist/index.cjs
CHANGED
|
@@ -33,6 +33,7 @@ __export(src_exports, {
|
|
|
33
33
|
GLOB_ALL_SRC: () => GLOB_ALL_SRC,
|
|
34
34
|
GLOB_CSS: () => GLOB_CSS,
|
|
35
35
|
GLOB_EXCLUDE: () => GLOB_EXCLUDE,
|
|
36
|
+
GLOB_GRAPHQL: () => GLOB_GRAPHQL,
|
|
36
37
|
GLOB_HTML: () => GLOB_HTML,
|
|
37
38
|
GLOB_JS: () => GLOB_JS,
|
|
38
39
|
GLOB_JSON: () => GLOB_JSON,
|
|
@@ -73,6 +74,7 @@ __export(src_exports, {
|
|
|
73
74
|
node: () => node,
|
|
74
75
|
perfectionist: () => perfectionist,
|
|
75
76
|
react: () => react,
|
|
77
|
+
regexp: () => regexp,
|
|
76
78
|
renamePluginInConfigs: () => renamePluginInConfigs,
|
|
77
79
|
renameRules: () => renameRules,
|
|
78
80
|
sortPackageJson: () => sortPackageJson,
|
|
@@ -144,6 +146,7 @@ var GLOB_VUE = "**/*.vue";
|
|
|
144
146
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
145
147
|
var GLOB_TOML = "**/*.toml";
|
|
146
148
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
149
|
+
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
147
150
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
148
151
|
var GLOB_TESTS = [
|
|
149
152
|
`**/__tests__/**/*.${GLOB_SRC_EXT}`,
|
|
@@ -213,14 +216,14 @@ async function imports(options = {}) {
|
|
|
213
216
|
} = options;
|
|
214
217
|
return [
|
|
215
218
|
{
|
|
216
|
-
name: "eslint:imports",
|
|
219
|
+
name: "eslint:imports:rules",
|
|
217
220
|
plugins: {
|
|
218
221
|
antfu: import_eslint_plugin_antfu.default,
|
|
219
222
|
import: pluginImport
|
|
220
223
|
},
|
|
221
224
|
rules: {
|
|
222
225
|
"antfu/import-dedupe": "error",
|
|
223
|
-
"antfu/no-import-dist": "
|
|
226
|
+
"antfu/no-import-dist": "error",
|
|
224
227
|
"antfu/no-import-node-modules-by-path": "error",
|
|
225
228
|
"import/first": "error",
|
|
226
229
|
"import/no-duplicates": "error",
|
|
@@ -233,6 +236,14 @@ async function imports(options = {}) {
|
|
|
233
236
|
"import/newline-after-import": ["error", { considerComments: true, count: 1 }]
|
|
234
237
|
} : {}
|
|
235
238
|
}
|
|
239
|
+
},
|
|
240
|
+
{
|
|
241
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
242
|
+
name: "eslint:imports:disables:bin",
|
|
243
|
+
rules: {
|
|
244
|
+
"antfu/no-import-dist": "off",
|
|
245
|
+
"antfu/no-import-node-modules-by-path": "off"
|
|
246
|
+
}
|
|
236
247
|
}
|
|
237
248
|
];
|
|
238
249
|
}
|
|
@@ -268,14 +279,13 @@ async function javascript(options = {}) {
|
|
|
268
279
|
linterOptions: {
|
|
269
280
|
reportUnusedDisableDirectives: true
|
|
270
281
|
},
|
|
271
|
-
name: "eslint:javascript",
|
|
282
|
+
name: "eslint:javascript:rules",
|
|
272
283
|
plugins: {
|
|
273
284
|
"antfu": import_eslint_plugin_antfu.default,
|
|
274
285
|
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
275
286
|
},
|
|
276
287
|
rules: {
|
|
277
288
|
"accessor-pairs": ["error", { enforceForClassMembers: true, setWithoutGet: true }],
|
|
278
|
-
"antfu/top-level-function": "error",
|
|
279
289
|
"array-callback-return": "error",
|
|
280
290
|
"block-scoped-var": "error",
|
|
281
291
|
"constructor-super": "error",
|
|
@@ -294,7 +304,6 @@ async function javascript(options = {}) {
|
|
|
294
304
|
// 'no-console': ['error', { allow: ['warn', 'error'] }],
|
|
295
305
|
"no-console": "off",
|
|
296
306
|
"no-const-assign": "error",
|
|
297
|
-
"no-constant-condition": "warn",
|
|
298
307
|
"no-control-regex": "error",
|
|
299
308
|
"no-debugger": "error",
|
|
300
309
|
"no-delete-var": "error",
|
|
@@ -316,7 +325,6 @@ async function javascript(options = {}) {
|
|
|
316
325
|
"no-implied-eval": "error",
|
|
317
326
|
"no-import-assign": "error",
|
|
318
327
|
"no-invalid-regexp": "error",
|
|
319
|
-
"no-invalid-this": "error",
|
|
320
328
|
"no-irregular-whitespace": "error",
|
|
321
329
|
"no-iterator": "error",
|
|
322
330
|
"no-labels": ["error", { allowLoop: false, allowSwitch: false }],
|
|
@@ -326,7 +334,7 @@ async function javascript(options = {}) {
|
|
|
326
334
|
"no-multi-str": "error",
|
|
327
335
|
"no-new": "error",
|
|
328
336
|
"no-new-func": "error",
|
|
329
|
-
"no-new-
|
|
337
|
+
"no-new-native-nonconstructor": "error",
|
|
330
338
|
"no-new-wrappers": "error",
|
|
331
339
|
"no-obj-calls": "error",
|
|
332
340
|
"no-octal": "error",
|
|
@@ -393,7 +401,6 @@ async function javascript(options = {}) {
|
|
|
393
401
|
"no-useless-rename": "error",
|
|
394
402
|
"no-useless-return": "error",
|
|
395
403
|
"no-var": "error",
|
|
396
|
-
"no-void": "error",
|
|
397
404
|
"no-with": "error",
|
|
398
405
|
"object-shorthand": [
|
|
399
406
|
"error",
|
|
@@ -434,13 +441,18 @@ async function javascript(options = {}) {
|
|
|
434
441
|
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
435
442
|
}
|
|
436
443
|
],
|
|
437
|
-
"style/arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
438
444
|
"symbol-description": "error",
|
|
439
445
|
"unicode-bom": ["error", "never"],
|
|
440
446
|
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
441
447
|
"unused-imports/no-unused-vars": [
|
|
442
448
|
"error",
|
|
443
|
-
{
|
|
449
|
+
{
|
|
450
|
+
args: "after-used",
|
|
451
|
+
argsIgnorePattern: "^_",
|
|
452
|
+
ignoreRestSiblings: true,
|
|
453
|
+
vars: "all",
|
|
454
|
+
varsIgnorePattern: "^_"
|
|
455
|
+
}
|
|
444
456
|
],
|
|
445
457
|
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
446
458
|
"valid-typeof": ["error", { requireStringLiterals: true }],
|
|
@@ -451,7 +463,7 @@ async function javascript(options = {}) {
|
|
|
451
463
|
},
|
|
452
464
|
{
|
|
453
465
|
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
454
|
-
name: "eslint:scripts
|
|
466
|
+
name: "eslint:scripts:disables",
|
|
455
467
|
rules: {
|
|
456
468
|
"no-console": "off"
|
|
457
469
|
}
|
|
@@ -462,8 +474,8 @@ async function javascript(options = {}) {
|
|
|
462
474
|
// src/utils.ts
|
|
463
475
|
var import_node_process = __toESM(require("process"), 1);
|
|
464
476
|
var import_local_pkg = require("local-pkg");
|
|
465
|
-
async function combine(...
|
|
466
|
-
const resolved = await Promise.all(
|
|
477
|
+
async function combine(...configs2) {
|
|
478
|
+
const resolved = await Promise.all(configs2);
|
|
467
479
|
return resolved.flat();
|
|
468
480
|
}
|
|
469
481
|
function renameRules(rules, map) {
|
|
@@ -478,8 +490,8 @@ function renameRules(rules, map) {
|
|
|
478
490
|
})
|
|
479
491
|
);
|
|
480
492
|
}
|
|
481
|
-
function renamePluginInConfigs(
|
|
482
|
-
return
|
|
493
|
+
function renamePluginInConfigs(configs2, map) {
|
|
494
|
+
return configs2.map((i) => {
|
|
483
495
|
const clone = { ...i };
|
|
484
496
|
if (clone.rules) {
|
|
485
497
|
clone.rules = renameRules(clone.rules, map);
|
|
@@ -532,7 +544,7 @@ async function jsdoc(options = {}) {
|
|
|
532
544
|
} = options;
|
|
533
545
|
return [
|
|
534
546
|
{
|
|
535
|
-
name: "eslint:jsdoc",
|
|
547
|
+
name: "eslint:jsdoc:rules",
|
|
536
548
|
plugins: {
|
|
537
549
|
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
538
550
|
},
|
|
@@ -711,7 +723,6 @@ async function markdown(options = {}) {
|
|
|
711
723
|
"ts/no-for-in-array": "off",
|
|
712
724
|
"ts/no-implied-eval": "off",
|
|
713
725
|
"ts/no-misused-promises": "off",
|
|
714
|
-
"ts/no-throw-literal": "off",
|
|
715
726
|
"ts/no-unnecessary-type-assertion": "off",
|
|
716
727
|
"ts/no-unsafe-argument": "off",
|
|
717
728
|
"ts/no-unsafe-assignment": "off",
|
|
@@ -732,7 +743,7 @@ async function markdown(options = {}) {
|
|
|
732
743
|
async function perfectionist() {
|
|
733
744
|
return [
|
|
734
745
|
{
|
|
735
|
-
name: "eslint:perfectionist",
|
|
746
|
+
name: "eslint:perfectionist:setup",
|
|
736
747
|
plugins: {
|
|
737
748
|
perfectionist: import_eslint_plugin_perfectionist.default
|
|
738
749
|
}
|
|
@@ -785,9 +796,9 @@ async function stylistic(options = {}) {
|
|
|
785
796
|
...lessOpinionated ? {
|
|
786
797
|
curly: ["error", "all"]
|
|
787
798
|
} : {
|
|
799
|
+
"antfu/curly": "error",
|
|
788
800
|
"antfu/if-newline": "error",
|
|
789
|
-
"antfu/top-level-function": "error"
|
|
790
|
-
"curly": ["error", "multi-or-nest", "consistent"]
|
|
801
|
+
"antfu/top-level-function": "error"
|
|
791
802
|
},
|
|
792
803
|
// 覆盖`stylistic`默认规则
|
|
793
804
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
@@ -800,6 +811,7 @@ async function stylistic(options = {}) {
|
|
|
800
811
|
|
|
801
812
|
// src/configs/formatters.ts
|
|
802
813
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
814
|
+
const defaultIndent = 4;
|
|
803
815
|
await ensurePackages([
|
|
804
816
|
"eslint-plugin-format"
|
|
805
817
|
]);
|
|
@@ -824,7 +836,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
824
836
|
endOfLine: "lf",
|
|
825
837
|
semi,
|
|
826
838
|
singleQuote: quotes === "single",
|
|
827
|
-
tabWidth: typeof indent === "number" ? indent :
|
|
839
|
+
tabWidth: typeof indent === "number" ? indent : defaultIndent,
|
|
828
840
|
trailingComma: "all",
|
|
829
841
|
useTabs: indent === "tab"
|
|
830
842
|
},
|
|
@@ -832,14 +844,14 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
832
844
|
);
|
|
833
845
|
const dprintOptions = Object.assign(
|
|
834
846
|
{
|
|
835
|
-
indentWidth: typeof indent === "number" ? indent :
|
|
847
|
+
indentWidth: typeof indent === "number" ? indent : defaultIndent,
|
|
836
848
|
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
837
849
|
useTabs: indent === "tab"
|
|
838
850
|
},
|
|
839
851
|
options.dprintOptions || {}
|
|
840
852
|
);
|
|
841
853
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
842
|
-
const
|
|
854
|
+
const configs2 = [
|
|
843
855
|
{
|
|
844
856
|
name: "eslint:formatters:setup",
|
|
845
857
|
plugins: {
|
|
@@ -848,7 +860,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
848
860
|
}
|
|
849
861
|
];
|
|
850
862
|
if (options.css) {
|
|
851
|
-
|
|
863
|
+
configs2.push(
|
|
852
864
|
{
|
|
853
865
|
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
854
866
|
languageOptions: {
|
|
@@ -900,7 +912,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
900
912
|
);
|
|
901
913
|
}
|
|
902
914
|
if (options.html) {
|
|
903
|
-
|
|
915
|
+
configs2.push({
|
|
904
916
|
files: [GLOB_HTML],
|
|
905
917
|
languageOptions: {
|
|
906
918
|
parser: parserPlain2
|
|
@@ -919,7 +931,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
919
931
|
}
|
|
920
932
|
if (options.markdown) {
|
|
921
933
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
922
|
-
|
|
934
|
+
configs2.push({
|
|
923
935
|
files: [GLOB_MARKDOWN],
|
|
924
936
|
languageOptions: {
|
|
925
937
|
parser: parserPlain2
|
|
@@ -942,8 +954,8 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
942
954
|
});
|
|
943
955
|
}
|
|
944
956
|
if (options.graphql) {
|
|
945
|
-
|
|
946
|
-
files: [
|
|
957
|
+
configs2.push({
|
|
958
|
+
files: [GLOB_GRAPHQL],
|
|
947
959
|
languageOptions: {
|
|
948
960
|
parser: parserPlain2
|
|
949
961
|
},
|
|
@@ -959,14 +971,14 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
959
971
|
}
|
|
960
972
|
});
|
|
961
973
|
}
|
|
962
|
-
return
|
|
974
|
+
return configs2;
|
|
963
975
|
}
|
|
964
976
|
|
|
965
977
|
// src/configs/node.ts
|
|
966
978
|
async function node() {
|
|
967
979
|
return [
|
|
968
980
|
{
|
|
969
|
-
name: "eslint:node",
|
|
981
|
+
name: "eslint:node:rules",
|
|
970
982
|
plugins: {
|
|
971
983
|
node: import_eslint_plugin_n.default
|
|
972
984
|
},
|
|
@@ -1084,7 +1096,6 @@ async function react(options = {}) {
|
|
|
1084
1096
|
"react/no-create-ref": "error",
|
|
1085
1097
|
"react/no-direct-mutation-state": "error",
|
|
1086
1098
|
"react/no-duplicate-key": "error",
|
|
1087
|
-
"react/no-implicit-key": "error",
|
|
1088
1099
|
"react/no-missing-key": "error",
|
|
1089
1100
|
"react/no-nested-components": "warn",
|
|
1090
1101
|
"react/no-redundant-should-component-update": "error",
|
|
@@ -1118,6 +1129,32 @@ async function react(options = {}) {
|
|
|
1118
1129
|
];
|
|
1119
1130
|
}
|
|
1120
1131
|
|
|
1132
|
+
// src/configs/regexp.ts
|
|
1133
|
+
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
1134
|
+
async function regexp(options = {}) {
|
|
1135
|
+
const config = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
1136
|
+
const rules = {
|
|
1137
|
+
...config.rules
|
|
1138
|
+
};
|
|
1139
|
+
if (options.level === "warn") {
|
|
1140
|
+
for (const key in rules) {
|
|
1141
|
+
if (rules[key] === "error") {
|
|
1142
|
+
rules[key] = "warn";
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
}
|
|
1146
|
+
return [
|
|
1147
|
+
{
|
|
1148
|
+
...config,
|
|
1149
|
+
name: "eslint/regexp/rules",
|
|
1150
|
+
rules: {
|
|
1151
|
+
...rules,
|
|
1152
|
+
...options.overrides
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
];
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1121
1158
|
// src/configs/sort.ts
|
|
1122
1159
|
async function sortPackageJson() {
|
|
1123
1160
|
return [
|
|
@@ -1417,7 +1454,6 @@ async function typescript(options = {}) {
|
|
|
1417
1454
|
"ts/no-for-in-array": "error",
|
|
1418
1455
|
"ts/no-implied-eval": "error",
|
|
1419
1456
|
"ts/no-misused-promises": "error",
|
|
1420
|
-
"ts/no-throw-literal": "error",
|
|
1421
1457
|
"ts/no-unnecessary-type-assertion": "error",
|
|
1422
1458
|
"ts/no-unsafe-argument": "error",
|
|
1423
1459
|
"ts/no-unsafe-assignment": "error",
|
|
@@ -1511,17 +1547,17 @@ async function typescript(options = {}) {
|
|
|
1511
1547
|
...overrides
|
|
1512
1548
|
}
|
|
1513
1549
|
},
|
|
1514
|
-
{
|
|
1550
|
+
...isTypeAware ? [{
|
|
1515
1551
|
files: filesTypeAware,
|
|
1516
1552
|
name: "eslint:typescript:rules-type-aware",
|
|
1517
1553
|
rules: {
|
|
1518
1554
|
...tsconfigPath ? typeAwareRules : {},
|
|
1519
1555
|
...overrides
|
|
1520
1556
|
}
|
|
1521
|
-
},
|
|
1557
|
+
}] : [],
|
|
1522
1558
|
{
|
|
1523
1559
|
files: ["**/*.d.ts"],
|
|
1524
|
-
name: "eslint:typescript:dts
|
|
1560
|
+
name: "eslint:typescript:disables:dts",
|
|
1525
1561
|
rules: {
|
|
1526
1562
|
"eslint-comments/no-unlimited-disable": "off",
|
|
1527
1563
|
"import/no-duplicates": "off",
|
|
@@ -1531,14 +1567,14 @@ async function typescript(options = {}) {
|
|
|
1531
1567
|
},
|
|
1532
1568
|
{
|
|
1533
1569
|
files: ["**/*.{test,spec}.ts?(x)"],
|
|
1534
|
-
name: "eslint:typescript:
|
|
1570
|
+
name: "eslint:typescript:disables:test",
|
|
1535
1571
|
rules: {
|
|
1536
1572
|
"no-unused-expressions": "off"
|
|
1537
1573
|
}
|
|
1538
1574
|
},
|
|
1539
1575
|
{
|
|
1540
1576
|
files: ["**/*.js", "**/*.cjs"],
|
|
1541
|
-
name: "eslint:typescript:
|
|
1577
|
+
name: "eslint:typescript:disables:cjs",
|
|
1542
1578
|
rules: {
|
|
1543
1579
|
"ts/no-require-imports": "off",
|
|
1544
1580
|
"ts/no-var-requires": "off"
|
|
@@ -1566,8 +1602,6 @@ async function unicorn() {
|
|
|
1566
1602
|
"unicorn/no-new-array": "error",
|
|
1567
1603
|
// Prevent deprecated `new Buffer()`
|
|
1568
1604
|
"unicorn/no-new-buffer": "error",
|
|
1569
|
-
// Keep regex literals safe!
|
|
1570
|
-
"unicorn/no-unsafe-regex": "error",
|
|
1571
1605
|
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1572
1606
|
"unicorn/number-literal-case": "error",
|
|
1573
1607
|
// textContent instead of innerText
|
|
@@ -1717,7 +1751,6 @@ async function vue(options = {}) {
|
|
|
1717
1751
|
}],
|
|
1718
1752
|
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1719
1753
|
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1720
|
-
"vue/component-tags-order": "off",
|
|
1721
1754
|
"vue/custom-event-name-casing": vueVersion === "3" ? ["error", "camelCase"] : ["error", "kebab-case"],
|
|
1722
1755
|
...vueVersion === "2" ? {
|
|
1723
1756
|
"vue/require-explicit-emits": "off"
|
|
@@ -1959,6 +1992,7 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1959
1992
|
isInEditor = !!((import_node_process3.default.env.VSCODE_PID || import_node_process3.default.env.JETBRAINS_IDE || import_node_process3.default.env.VIM) && !import_node_process3.default.env.CI),
|
|
1960
1993
|
overrides = {},
|
|
1961
1994
|
react: enableReact = ReactPackages.some((i) => (0, import_local_pkg4.isPackageExists)(i)),
|
|
1995
|
+
regexp: enableRegexp = true,
|
|
1962
1996
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
1963
1997
|
unocss: enableUnoCSS = false,
|
|
1964
1998
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
@@ -1969,17 +2003,17 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1969
2003
|
stylisticOptions.jsx = options.jsx ?? true;
|
|
1970
2004
|
}
|
|
1971
2005
|
}
|
|
1972
|
-
const
|
|
2006
|
+
const configs2 = [];
|
|
1973
2007
|
if (enableGitignore) {
|
|
1974
2008
|
if (typeof enableGitignore !== "boolean") {
|
|
1975
|
-
|
|
2009
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(enableGitignore)]));
|
|
1976
2010
|
} else {
|
|
1977
2011
|
if (import_node_fs.default.existsSync(".gitignore")) {
|
|
1978
|
-
|
|
2012
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r()]));
|
|
1979
2013
|
}
|
|
1980
2014
|
}
|
|
1981
2015
|
}
|
|
1982
|
-
|
|
2016
|
+
configs2.push(
|
|
1983
2017
|
ignores({
|
|
1984
2018
|
ignores: overrides.ignores
|
|
1985
2019
|
}),
|
|
@@ -2003,27 +2037,33 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2003
2037
|
componentExts.push("vue");
|
|
2004
2038
|
}
|
|
2005
2039
|
if (enableTypeScript) {
|
|
2006
|
-
|
|
2040
|
+
configs2.push(typescript({
|
|
2007
2041
|
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
2008
2042
|
componentExts,
|
|
2009
2043
|
overrides: overrides.typescript
|
|
2010
2044
|
}));
|
|
2011
2045
|
}
|
|
2012
2046
|
if (stylisticOptions) {
|
|
2013
|
-
|
|
2047
|
+
configs2.push(stylistic({
|
|
2014
2048
|
overrides: overrides.stylistic,
|
|
2015
2049
|
stylistic: stylisticOptions
|
|
2016
2050
|
}));
|
|
2017
2051
|
}
|
|
2052
|
+
if (enableRegexp) {
|
|
2053
|
+
configs2.push(regexp({
|
|
2054
|
+
...typeof enableRegexp === "boolean" ? {} : enableRegexp,
|
|
2055
|
+
overrides: overrides.regexp
|
|
2056
|
+
}));
|
|
2057
|
+
}
|
|
2018
2058
|
if (options.test ?? true) {
|
|
2019
|
-
|
|
2059
|
+
configs2.push(test({
|
|
2020
2060
|
...typeof options.test !== "boolean" ? options.test : {},
|
|
2021
2061
|
isInEditor,
|
|
2022
2062
|
overrides: overrides.test
|
|
2023
2063
|
}));
|
|
2024
2064
|
}
|
|
2025
2065
|
if (enableVue) {
|
|
2026
|
-
|
|
2066
|
+
configs2.push(vue({
|
|
2027
2067
|
...typeof options.vue !== "boolean" ? options.vue : {},
|
|
2028
2068
|
overrides: overrides.vue,
|
|
2029
2069
|
stylistic: stylisticOptions,
|
|
@@ -2031,20 +2071,20 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2031
2071
|
}));
|
|
2032
2072
|
}
|
|
2033
2073
|
if (enableReact) {
|
|
2034
|
-
|
|
2074
|
+
configs2.push(react({
|
|
2035
2075
|
...typeof enableReact !== "boolean" ? enableReact : {},
|
|
2036
2076
|
overrides: overrides.react,
|
|
2037
2077
|
typescript: !!enableTypeScript
|
|
2038
2078
|
}));
|
|
2039
2079
|
}
|
|
2040
2080
|
if (enableUnoCSS) {
|
|
2041
|
-
|
|
2081
|
+
configs2.push(unocss({
|
|
2042
2082
|
...typeof enableUnoCSS === "boolean" ? {} : enableUnoCSS,
|
|
2043
2083
|
overrides: overrides.unocss
|
|
2044
2084
|
}));
|
|
2045
2085
|
}
|
|
2046
2086
|
if (options.jsonc ?? true) {
|
|
2047
|
-
|
|
2087
|
+
configs2.push(
|
|
2048
2088
|
jsonc({
|
|
2049
2089
|
...typeof options.jsonc !== "boolean" ? options.jsonc : {},
|
|
2050
2090
|
overrides: overrides.jsonc,
|
|
@@ -2055,27 +2095,27 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2055
2095
|
);
|
|
2056
2096
|
}
|
|
2057
2097
|
if (options.yaml ?? true) {
|
|
2058
|
-
|
|
2098
|
+
configs2.push(yaml({
|
|
2059
2099
|
...typeof options.yaml !== "boolean" ? options.yaml : {},
|
|
2060
2100
|
overrides: overrides.yaml,
|
|
2061
2101
|
stylistic: stylisticOptions
|
|
2062
2102
|
}));
|
|
2063
2103
|
}
|
|
2064
2104
|
if (options.toml) {
|
|
2065
|
-
|
|
2105
|
+
configs2.push(toml({
|
|
2066
2106
|
overrides: overrides.toml,
|
|
2067
2107
|
stylistic: stylisticOptions
|
|
2068
2108
|
}));
|
|
2069
2109
|
}
|
|
2070
2110
|
if (options.markdown ?? true) {
|
|
2071
|
-
|
|
2111
|
+
configs2.push(markdown({
|
|
2072
2112
|
...typeof options.markdown !== "boolean" ? options.markdown : {},
|
|
2073
2113
|
componentExts,
|
|
2074
2114
|
overrides: overrides.markdown
|
|
2075
2115
|
}));
|
|
2076
2116
|
}
|
|
2077
2117
|
if (options.formatters) {
|
|
2078
|
-
|
|
2118
|
+
configs2.push(formatters(
|
|
2079
2119
|
options.formatters,
|
|
2080
2120
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2081
2121
|
));
|
|
@@ -2087,11 +2127,11 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2087
2127
|
return acc;
|
|
2088
2128
|
}, {});
|
|
2089
2129
|
if (Object.keys(fusedConfig).length) {
|
|
2090
|
-
|
|
2130
|
+
configs2.push([fusedConfig]);
|
|
2091
2131
|
}
|
|
2092
2132
|
let composer = new import_eslint_flat_config_utils.FlatConfigComposer();
|
|
2093
2133
|
composer = composer.append(
|
|
2094
|
-
...
|
|
2134
|
+
...configs2,
|
|
2095
2135
|
...userConfigs
|
|
2096
2136
|
);
|
|
2097
2137
|
if (autoRenamePlugins) {
|
|
@@ -2107,6 +2147,7 @@ var src_default = lincy;
|
|
|
2107
2147
|
GLOB_ALL_SRC,
|
|
2108
2148
|
GLOB_CSS,
|
|
2109
2149
|
GLOB_EXCLUDE,
|
|
2150
|
+
GLOB_GRAPHQL,
|
|
2110
2151
|
GLOB_HTML,
|
|
2111
2152
|
GLOB_JS,
|
|
2112
2153
|
GLOB_JSON,
|
|
@@ -2146,6 +2187,7 @@ var src_default = lincy;
|
|
|
2146
2187
|
node,
|
|
2147
2188
|
perfectionist,
|
|
2148
2189
|
react,
|
|
2190
|
+
regexp,
|
|
2149
2191
|
renamePluginInConfigs,
|
|
2150
2192
|
renameRules,
|
|
2151
2193
|
sortPackageJson,
|