@lincy/eslint-config 4.6.3 → 5.0.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 +5 -5
- package/dist/index.cjs +233 -124
- package/dist/index.d.cts +940 -1206
- package/dist/index.d.ts +940 -1206
- package/dist/index.js +223 -124
- package/package.json +57 -45
package/dist/index.cjs
CHANGED
|
@@ -50,11 +50,13 @@ __export(src_exports, {
|
|
|
50
50
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
51
51
|
GLOB_STYLE: () => GLOB_STYLE,
|
|
52
52
|
GLOB_SVELTE: () => GLOB_SVELTE,
|
|
53
|
+
GLOB_SVG: () => GLOB_SVG,
|
|
53
54
|
GLOB_TESTS: () => GLOB_TESTS,
|
|
54
55
|
GLOB_TOML: () => GLOB_TOML,
|
|
55
56
|
GLOB_TS: () => GLOB_TS,
|
|
56
57
|
GLOB_TSX: () => GLOB_TSX,
|
|
57
58
|
GLOB_VUE: () => GLOB_VUE,
|
|
59
|
+
GLOB_XML: () => GLOB_XML,
|
|
58
60
|
GLOB_YAML: () => GLOB_YAML,
|
|
59
61
|
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
60
62
|
combine: () => combine,
|
|
@@ -66,9 +68,13 @@ __export(src_exports, {
|
|
|
66
68
|
ignores: () => ignores,
|
|
67
69
|
imports: () => imports,
|
|
68
70
|
interopDefault: () => interopDefault,
|
|
71
|
+
isInEditorEnv: () => isInEditorEnv,
|
|
72
|
+
isInGitHooksOrLintStaged: () => isInGitHooksOrLintStaged,
|
|
73
|
+
isPackageInScope: () => isPackageInScope,
|
|
69
74
|
javascript: () => javascript,
|
|
70
75
|
jsdoc: () => jsdoc,
|
|
71
76
|
jsonc: () => jsonc,
|
|
77
|
+
jsx: () => jsx,
|
|
72
78
|
lincy: () => lincy,
|
|
73
79
|
markdown: () => markdown,
|
|
74
80
|
node: () => node,
|
|
@@ -91,15 +97,17 @@ __export(src_exports, {
|
|
|
91
97
|
});
|
|
92
98
|
module.exports = __toCommonJS(src_exports);
|
|
93
99
|
|
|
100
|
+
// node_modules/.pnpm/tsup@8.2.4_jiti@1.21.6_postcss@8.4.41_tsx@4.19.0_typescript@5.5.4_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
|
|
101
|
+
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
102
|
+
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
103
|
+
|
|
94
104
|
// src/factory.ts
|
|
95
|
-
var import_node_process3 = __toESM(require("process"), 1);
|
|
96
|
-
var import_node_fs = __toESM(require("fs"), 1);
|
|
97
105
|
var import_local_pkg4 = require("local-pkg");
|
|
98
106
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
99
107
|
|
|
100
108
|
// src/plugins.ts
|
|
101
109
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
102
|
-
var import_eslint_plugin_eslint_comments = __toESM(require("eslint-plugin-eslint-comments"), 1);
|
|
110
|
+
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
103
111
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
104
112
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
105
113
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
@@ -110,7 +118,7 @@ var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfecti
|
|
|
110
118
|
async function comments() {
|
|
111
119
|
return [
|
|
112
120
|
{
|
|
113
|
-
name: "eslint
|
|
121
|
+
name: "eslint/comments/rules",
|
|
114
122
|
plugins: {
|
|
115
123
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
116
124
|
},
|
|
@@ -145,6 +153,8 @@ var GLOB_SVELTE = "**/*.svelte";
|
|
|
145
153
|
var GLOB_VUE = "**/*.vue";
|
|
146
154
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
147
155
|
var GLOB_TOML = "**/*.toml";
|
|
156
|
+
var GLOB_XML = "**/*.xml";
|
|
157
|
+
var GLOB_SVG = "**/*.svg";
|
|
148
158
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
149
159
|
var GLOB_GRAPHQL = "**/*.{g,graph}ql";
|
|
150
160
|
var GLOB_MARKDOWN_CODE = `${GLOB_MARKDOWN}/${GLOB_SRC}`;
|
|
@@ -186,6 +196,7 @@ var GLOB_EXCLUDE = [
|
|
|
186
196
|
"**/.output",
|
|
187
197
|
"**/.vite-inspect",
|
|
188
198
|
"**/.yarn",
|
|
199
|
+
"**/vite.config.*.timestamp-*",
|
|
189
200
|
"**/CHANGELOG*.md",
|
|
190
201
|
"**/*.min.*",
|
|
191
202
|
"**/LICENSE*",
|
|
@@ -204,7 +215,8 @@ async function ignores(options = {}) {
|
|
|
204
215
|
ignores: [
|
|
205
216
|
...GLOB_EXCLUDE,
|
|
206
217
|
...ignores2
|
|
207
|
-
]
|
|
218
|
+
],
|
|
219
|
+
name: "eslint/ignores"
|
|
208
220
|
}
|
|
209
221
|
];
|
|
210
222
|
}
|
|
@@ -216,7 +228,7 @@ async function imports(options = {}) {
|
|
|
216
228
|
} = options;
|
|
217
229
|
return [
|
|
218
230
|
{
|
|
219
|
-
name: "eslint
|
|
231
|
+
name: "eslint/imports/rules",
|
|
220
232
|
plugins: {
|
|
221
233
|
antfu: import_eslint_plugin_antfu.default,
|
|
222
234
|
import: pluginImport
|
|
@@ -239,7 +251,7 @@ async function imports(options = {}) {
|
|
|
239
251
|
},
|
|
240
252
|
{
|
|
241
253
|
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
242
|
-
name: "eslint
|
|
254
|
+
name: "eslint/imports/disables/bin",
|
|
243
255
|
rules: {
|
|
244
256
|
"antfu/no-import-dist": "off",
|
|
245
257
|
"antfu/no-import-node-modules-by-path": "off"
|
|
@@ -279,7 +291,10 @@ async function javascript(options = {}) {
|
|
|
279
291
|
linterOptions: {
|
|
280
292
|
reportUnusedDisableDirectives: true
|
|
281
293
|
},
|
|
282
|
-
name: "eslint
|
|
294
|
+
name: "eslint/javascript/setup"
|
|
295
|
+
},
|
|
296
|
+
{
|
|
297
|
+
name: "eslint/javascript/rules",
|
|
283
298
|
plugins: {
|
|
284
299
|
"antfu": import_eslint_plugin_antfu.default,
|
|
285
300
|
"unused-imports": import_eslint_plugin_unused_imports.default
|
|
@@ -358,9 +373,6 @@ async function javascript(options = {}) {
|
|
|
358
373
|
],
|
|
359
374
|
"no-restricted-syntax": [
|
|
360
375
|
"error",
|
|
361
|
-
"DebuggerStatement",
|
|
362
|
-
"LabeledStatement",
|
|
363
|
-
"WithStatement",
|
|
364
376
|
"TSEnumDeclaration[const=true]",
|
|
365
377
|
"TSExportAssignment"
|
|
366
378
|
],
|
|
@@ -463,7 +475,7 @@ async function javascript(options = {}) {
|
|
|
463
475
|
},
|
|
464
476
|
{
|
|
465
477
|
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
466
|
-
name: "eslint
|
|
478
|
+
name: "eslint/scripts/disables",
|
|
467
479
|
rules: {
|
|
468
480
|
"no-console": "off"
|
|
469
481
|
}
|
|
@@ -473,7 +485,10 @@ async function javascript(options = {}) {
|
|
|
473
485
|
|
|
474
486
|
// src/utils.ts
|
|
475
487
|
var import_node_process = __toESM(require("process"), 1);
|
|
488
|
+
var import_node_url = require("url");
|
|
476
489
|
var import_local_pkg = require("local-pkg");
|
|
490
|
+
var scopeUrl = (0, import_node_url.fileURLToPath)(new URL(".", importMetaUrl));
|
|
491
|
+
var isCwdInScope = (0, import_local_pkg.isPackageExists)("@antfu/eslint-config");
|
|
477
492
|
async function combine(...configs2) {
|
|
478
493
|
const resolved = await Promise.all(configs2);
|
|
479
494
|
return resolved.flat();
|
|
@@ -516,25 +531,31 @@ async function interopDefault(m) {
|
|
|
516
531
|
const resolved = await m;
|
|
517
532
|
return resolved.default || resolved;
|
|
518
533
|
}
|
|
534
|
+
function isPackageInScope(name) {
|
|
535
|
+
return (0, import_local_pkg.isPackageExists)(name, { paths: [scopeUrl] });
|
|
536
|
+
}
|
|
519
537
|
async function ensurePackages(packages) {
|
|
520
|
-
if (import_node_process.default.stdout.isTTY === false)
|
|
538
|
+
if (import_node_process.default.env.CI || import_node_process.default.stdout.isTTY === false || isCwdInScope === false)
|
|
521
539
|
return;
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
if (nonExistingPackages.length === 0) {
|
|
540
|
+
const nonExistingPackages = packages.filter((i) => i && !isPackageInScope(i));
|
|
541
|
+
if (nonExistingPackages.length === 0)
|
|
525
542
|
return;
|
|
526
|
-
|
|
527
|
-
const
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
name: "result",
|
|
532
|
-
type: "confirm"
|
|
533
|
-
}
|
|
534
|
-
]);
|
|
535
|
-
if (result) {
|
|
543
|
+
const p = await import("@clack/prompts");
|
|
544
|
+
const result = await p.confirm({
|
|
545
|
+
message: `${nonExistingPackages.length === 1 ? "Package is" : "Packages are"} required for this config: ${nonExistingPackages.join(", ")}. Do you want to install them?`
|
|
546
|
+
});
|
|
547
|
+
if (result)
|
|
536
548
|
await import("@antfu/install-pkg").then((i) => i.installPackage(nonExistingPackages, { dev: true }));
|
|
537
|
-
|
|
549
|
+
}
|
|
550
|
+
function isInEditorEnv() {
|
|
551
|
+
if (import_node_process.default.env.CI)
|
|
552
|
+
return false;
|
|
553
|
+
if (isInGitHooksOrLintStaged())
|
|
554
|
+
return false;
|
|
555
|
+
return !!(import_node_process.default.env.VSCODE_PID || import_node_process.default.env.VSCODE_CWD || import_node_process.default.env.JETBRAINS_IDE || import_node_process.default.env.VIM || import_node_process.default.env.NVIM);
|
|
556
|
+
}
|
|
557
|
+
function isInGitHooksOrLintStaged() {
|
|
558
|
+
return !!(import_node_process.default.env.GIT_PARAMS || import_node_process.default.env.VSCODE_GIT_COMMAND || import_node_process.default.env.npm_lifecycle_script?.startsWith("lint-staged"));
|
|
538
559
|
}
|
|
539
560
|
|
|
540
561
|
// src/configs/jsdoc.ts
|
|
@@ -544,7 +565,7 @@ async function jsdoc(options = {}) {
|
|
|
544
565
|
} = options;
|
|
545
566
|
return [
|
|
546
567
|
{
|
|
547
|
-
name: "eslint
|
|
568
|
+
name: "eslint/jsdoc/rules",
|
|
548
569
|
plugins: {
|
|
549
570
|
jsdoc: await interopDefault(import("eslint-plugin-jsdoc"))
|
|
550
571
|
},
|
|
@@ -589,7 +610,7 @@ async function jsonc(options = {}) {
|
|
|
589
610
|
]);
|
|
590
611
|
return [
|
|
591
612
|
{
|
|
592
|
-
name: "eslint
|
|
613
|
+
name: "eslint/jsonc/setup",
|
|
593
614
|
plugins: {
|
|
594
615
|
jsonc: pluginJsonc
|
|
595
616
|
}
|
|
@@ -599,7 +620,7 @@ async function jsonc(options = {}) {
|
|
|
599
620
|
languageOptions: {
|
|
600
621
|
parser: parserJsonc
|
|
601
622
|
},
|
|
602
|
-
name: "eslint
|
|
623
|
+
name: "eslint/jsonc/rules",
|
|
603
624
|
rules: {
|
|
604
625
|
"jsonc/no-bigint-literals": "error",
|
|
605
626
|
"jsonc/no-binary-expression": "error",
|
|
@@ -645,6 +666,23 @@ async function jsonc(options = {}) {
|
|
|
645
666
|
];
|
|
646
667
|
}
|
|
647
668
|
|
|
669
|
+
// src/configs/jsx.ts
|
|
670
|
+
async function jsx() {
|
|
671
|
+
return [
|
|
672
|
+
{
|
|
673
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
674
|
+
languageOptions: {
|
|
675
|
+
parserOptions: {
|
|
676
|
+
ecmaFeatures: {
|
|
677
|
+
jsx: true
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
},
|
|
681
|
+
name: "eslint/jsx/setup"
|
|
682
|
+
}
|
|
683
|
+
];
|
|
684
|
+
}
|
|
685
|
+
|
|
648
686
|
// src/configs/markdown.ts
|
|
649
687
|
var parserPlain = __toESM(require("eslint-parser-plain"), 1);
|
|
650
688
|
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
@@ -657,7 +695,7 @@ async function markdown(options = {}) {
|
|
|
657
695
|
const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
|
|
658
696
|
return [
|
|
659
697
|
{
|
|
660
|
-
name: "eslint
|
|
698
|
+
name: "eslint/markdown/setup",
|
|
661
699
|
plugins: {
|
|
662
700
|
markdown: markdown2
|
|
663
701
|
}
|
|
@@ -665,7 +703,7 @@ async function markdown(options = {}) {
|
|
|
665
703
|
{
|
|
666
704
|
files,
|
|
667
705
|
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
668
|
-
name: "eslint
|
|
706
|
+
name: "eslint/markdown/processor",
|
|
669
707
|
processor: (0, import_eslint_merge_processors.mergeProcessors)([
|
|
670
708
|
markdown2.processors.markdown,
|
|
671
709
|
import_eslint_merge_processors.processorPassThrough
|
|
@@ -676,7 +714,7 @@ async function markdown(options = {}) {
|
|
|
676
714
|
languageOptions: {
|
|
677
715
|
parser: parserPlain
|
|
678
716
|
},
|
|
679
|
-
name: "eslint
|
|
717
|
+
name: "eslint/markdown/parser"
|
|
680
718
|
},
|
|
681
719
|
{
|
|
682
720
|
files: [
|
|
@@ -690,7 +728,7 @@ async function markdown(options = {}) {
|
|
|
690
728
|
}
|
|
691
729
|
}
|
|
692
730
|
},
|
|
693
|
-
name: "eslint
|
|
731
|
+
name: "eslint/markdown/disables",
|
|
694
732
|
rules: {
|
|
695
733
|
"import/newline-after-import": "off",
|
|
696
734
|
"no-alert": "off",
|
|
@@ -709,6 +747,7 @@ async function markdown(options = {}) {
|
|
|
709
747
|
"ts/no-namespace": "off",
|
|
710
748
|
"ts/no-redeclare": "off",
|
|
711
749
|
"ts/no-require-imports": "off",
|
|
750
|
+
"ts/no-unused-expressions": "off",
|
|
712
751
|
"ts/no-unused-vars": "off",
|
|
713
752
|
"ts/no-use-before-define": "off",
|
|
714
753
|
"ts/no-var-requires": "off",
|
|
@@ -743,7 +782,7 @@ async function markdown(options = {}) {
|
|
|
743
782
|
async function perfectionist() {
|
|
744
783
|
return [
|
|
745
784
|
{
|
|
746
|
-
name: "eslint
|
|
785
|
+
name: "eslint/perfectionist/setup",
|
|
747
786
|
plugins: {
|
|
748
787
|
perfectionist: import_eslint_plugin_perfectionist.default
|
|
749
788
|
}
|
|
@@ -769,7 +808,7 @@ async function stylistic(options = {}) {
|
|
|
769
808
|
} = options;
|
|
770
809
|
const {
|
|
771
810
|
indent,
|
|
772
|
-
jsx,
|
|
811
|
+
jsx: jsx2,
|
|
773
812
|
lessOpinionated,
|
|
774
813
|
quotes,
|
|
775
814
|
semi
|
|
@@ -778,14 +817,14 @@ async function stylistic(options = {}) {
|
|
|
778
817
|
const config = pluginStylistic.configs.customize({
|
|
779
818
|
flat: true,
|
|
780
819
|
indent,
|
|
781
|
-
jsx,
|
|
820
|
+
jsx: jsx2,
|
|
782
821
|
pluginName: "style",
|
|
783
822
|
quotes,
|
|
784
823
|
semi
|
|
785
824
|
});
|
|
786
825
|
return [
|
|
787
826
|
{
|
|
788
|
-
name: "eslint
|
|
827
|
+
name: "eslint/stylistic/rules",
|
|
789
828
|
plugins: {
|
|
790
829
|
antfu: import_eslint_plugin_antfu.default,
|
|
791
830
|
style: pluginStylistic
|
|
@@ -813,17 +852,21 @@ async function stylistic(options = {}) {
|
|
|
813
852
|
// src/configs/formatters.ts
|
|
814
853
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
815
854
|
const defaultIndent = 4;
|
|
816
|
-
await ensurePackages([
|
|
817
|
-
"eslint-plugin-format"
|
|
818
|
-
]);
|
|
819
855
|
if (options === true) {
|
|
856
|
+
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
820
857
|
options = {
|
|
821
858
|
css: false,
|
|
822
859
|
graphql: true,
|
|
823
860
|
html: true,
|
|
824
|
-
markdown: true
|
|
861
|
+
markdown: true,
|
|
862
|
+
svg: isPrettierPluginXmlInScope,
|
|
863
|
+
xml: isPrettierPluginXmlInScope
|
|
825
864
|
};
|
|
826
865
|
}
|
|
866
|
+
await ensurePackages([
|
|
867
|
+
"eslint-plugin-format",
|
|
868
|
+
options.xml || options.svg ? "@prettier/plugin-xml" : void 0
|
|
869
|
+
]);
|
|
827
870
|
const {
|
|
828
871
|
indent,
|
|
829
872
|
quotes,
|
|
@@ -835,6 +878,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
835
878
|
const prettierOptions = Object.assign(
|
|
836
879
|
{
|
|
837
880
|
endOfLine: "lf",
|
|
881
|
+
printWidth: 200,
|
|
838
882
|
semi,
|
|
839
883
|
singleQuote: quotes === "single",
|
|
840
884
|
tabWidth: typeof indent === "number" ? indent : defaultIndent,
|
|
@@ -843,6 +887,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
843
887
|
},
|
|
844
888
|
options.prettierOptions || {}
|
|
845
889
|
);
|
|
890
|
+
const prettierXmlOptions = {
|
|
891
|
+
xmlQuoteAttributes: "double",
|
|
892
|
+
xmlSelfClosingSpace: true,
|
|
893
|
+
xmlSortAttributesByKey: false,
|
|
894
|
+
xmlWhitespaceSensitivity: "ignore"
|
|
895
|
+
};
|
|
846
896
|
const dprintOptions = Object.assign(
|
|
847
897
|
{
|
|
848
898
|
indentWidth: typeof indent === "number" ? indent : defaultIndent,
|
|
@@ -854,7 +904,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
854
904
|
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
855
905
|
const configs2 = [
|
|
856
906
|
{
|
|
857
|
-
name: "eslint
|
|
907
|
+
name: "eslint/formatters/setup",
|
|
858
908
|
plugins: {
|
|
859
909
|
format: pluginFormat
|
|
860
910
|
}
|
|
@@ -867,7 +917,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
867
917
|
languageOptions: {
|
|
868
918
|
parser: parserPlain2
|
|
869
919
|
},
|
|
870
|
-
name: "eslint
|
|
920
|
+
name: "eslint/formatters/css",
|
|
871
921
|
rules: {
|
|
872
922
|
"format/prettier": [
|
|
873
923
|
"error",
|
|
@@ -883,7 +933,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
883
933
|
languageOptions: {
|
|
884
934
|
parser: parserPlain2
|
|
885
935
|
},
|
|
886
|
-
name: "eslint
|
|
936
|
+
name: "eslint/formatters/scss",
|
|
887
937
|
rules: {
|
|
888
938
|
"format/prettier": [
|
|
889
939
|
"error",
|
|
@@ -899,7 +949,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
899
949
|
languageOptions: {
|
|
900
950
|
parser: parserPlain2
|
|
901
951
|
},
|
|
902
|
-
name: "eslint
|
|
952
|
+
name: "eslint/formatters/less",
|
|
903
953
|
rules: {
|
|
904
954
|
"format/prettier": [
|
|
905
955
|
"error",
|
|
@@ -918,7 +968,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
918
968
|
languageOptions: {
|
|
919
969
|
parser: parserPlain2
|
|
920
970
|
},
|
|
921
|
-
name: "eslint
|
|
971
|
+
name: "eslint/formatters/html",
|
|
922
972
|
rules: {
|
|
923
973
|
"format/prettier": [
|
|
924
974
|
"error",
|
|
@@ -930,6 +980,28 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
930
980
|
}
|
|
931
981
|
});
|
|
932
982
|
}
|
|
983
|
+
if (options.svg) {
|
|
984
|
+
configs2.push({
|
|
985
|
+
files: [GLOB_SVG],
|
|
986
|
+
languageOptions: {
|
|
987
|
+
parser: parserPlain2
|
|
988
|
+
},
|
|
989
|
+
name: "eslint/formatters/svg",
|
|
990
|
+
rules: {
|
|
991
|
+
"format/prettier": [
|
|
992
|
+
"error",
|
|
993
|
+
{
|
|
994
|
+
...prettierXmlOptions,
|
|
995
|
+
...prettierOptions,
|
|
996
|
+
parser: "xml",
|
|
997
|
+
plugins: [
|
|
998
|
+
"@prettier/plugin-xml"
|
|
999
|
+
]
|
|
1000
|
+
}
|
|
1001
|
+
]
|
|
1002
|
+
}
|
|
1003
|
+
});
|
|
1004
|
+
}
|
|
933
1005
|
if (options.markdown) {
|
|
934
1006
|
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
935
1007
|
configs2.push({
|
|
@@ -937,12 +1009,11 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
937
1009
|
languageOptions: {
|
|
938
1010
|
parser: parserPlain2
|
|
939
1011
|
},
|
|
940
|
-
name: "eslint
|
|
1012
|
+
name: "eslint/formatters/markdown",
|
|
941
1013
|
rules: {
|
|
942
1014
|
[`format/${formater}`]: [
|
|
943
1015
|
"error",
|
|
944
1016
|
formater === "prettier" ? {
|
|
945
|
-
printWidth: 200,
|
|
946
1017
|
...prettierOptions,
|
|
947
1018
|
embeddedLanguageFormatting: "off",
|
|
948
1019
|
parser: "markdown"
|
|
@@ -960,7 +1031,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
960
1031
|
languageOptions: {
|
|
961
1032
|
parser: parserPlain2
|
|
962
1033
|
},
|
|
963
|
-
name: "eslint
|
|
1034
|
+
name: "eslint/formatters/graphql",
|
|
964
1035
|
rules: {
|
|
965
1036
|
"format/prettier": [
|
|
966
1037
|
"error",
|
|
@@ -979,7 +1050,7 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
979
1050
|
async function node() {
|
|
980
1051
|
return [
|
|
981
1052
|
{
|
|
982
|
-
name: "eslint
|
|
1053
|
+
name: "eslint/node/rules",
|
|
983
1054
|
plugins: {
|
|
984
1055
|
node: import_eslint_plugin_n.default
|
|
985
1056
|
},
|
|
@@ -1005,7 +1076,7 @@ var ReactRefreshAllowConstantExportPackages = [
|
|
|
1005
1076
|
async function react(options = {}) {
|
|
1006
1077
|
const {
|
|
1007
1078
|
files = [GLOB_JSX, GLOB_TSX],
|
|
1008
|
-
jsx = true,
|
|
1079
|
+
jsx: jsx2 = true,
|
|
1009
1080
|
overrides = {},
|
|
1010
1081
|
version = "detect"
|
|
1011
1082
|
} = options;
|
|
@@ -1035,7 +1106,7 @@ async function react(options = {}) {
|
|
|
1035
1106
|
const plugins = pluginReact.configs.all.plugins;
|
|
1036
1107
|
return [
|
|
1037
1108
|
{
|
|
1038
|
-
name: "eslint
|
|
1109
|
+
name: "eslint/react/setup",
|
|
1039
1110
|
plugins: {
|
|
1040
1111
|
"react": plugins["@eslint-react"],
|
|
1041
1112
|
"react-dom": plugins["@eslint-react/dom"],
|
|
@@ -1051,12 +1122,12 @@ async function react(options = {}) {
|
|
|
1051
1122
|
parser: parserTs,
|
|
1052
1123
|
parserOptions: {
|
|
1053
1124
|
ecmaFeatures: {
|
|
1054
|
-
jsx
|
|
1125
|
+
jsx: jsx2
|
|
1055
1126
|
},
|
|
1056
1127
|
...isTypeAware ? { project: tsconfigPath } : {}
|
|
1057
1128
|
}
|
|
1058
1129
|
},
|
|
1059
|
-
name: "eslint
|
|
1130
|
+
name: "eslint/react/rules",
|
|
1060
1131
|
rules: {
|
|
1061
1132
|
// recommended rules from @eslint-react/dom
|
|
1062
1133
|
"react-dom/no-children-in-void-dom-elements": "warn",
|
|
@@ -1160,7 +1231,7 @@ async function sortPackageJson() {
|
|
|
1160
1231
|
return [
|
|
1161
1232
|
{
|
|
1162
1233
|
files: ["**/package.json"],
|
|
1163
|
-
name: "eslint
|
|
1234
|
+
name: "eslint/sort/package-json",
|
|
1164
1235
|
rules: {
|
|
1165
1236
|
"jsonc/sort-array-values": [
|
|
1166
1237
|
"error",
|
|
@@ -1181,6 +1252,7 @@ async function sortPackageJson() {
|
|
|
1181
1252
|
"private",
|
|
1182
1253
|
"packageManager",
|
|
1183
1254
|
"description",
|
|
1255
|
+
"contributors",
|
|
1184
1256
|
"author",
|
|
1185
1257
|
"license",
|
|
1186
1258
|
"funding",
|
|
@@ -1261,7 +1333,7 @@ function sortTsconfig() {
|
|
|
1261
1333
|
return [
|
|
1262
1334
|
{
|
|
1263
1335
|
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1264
|
-
name: "eslint
|
|
1336
|
+
name: "eslint/sort/tsconfig",
|
|
1265
1337
|
rules: {
|
|
1266
1338
|
"jsonc/sort-keys": [
|
|
1267
1339
|
"error",
|
|
@@ -1394,13 +1466,13 @@ async function test(options = {}) {
|
|
|
1394
1466
|
pluginVitest,
|
|
1395
1467
|
pluginNoOnlyTests
|
|
1396
1468
|
] = await Promise.all([
|
|
1397
|
-
interopDefault(import("eslint-plugin
|
|
1469
|
+
interopDefault(import("@vitest/eslint-plugin")),
|
|
1398
1470
|
// @ts-expect-error missing types
|
|
1399
1471
|
interopDefault(import("eslint-plugin-no-only-tests"))
|
|
1400
1472
|
]);
|
|
1401
1473
|
return [
|
|
1402
1474
|
{
|
|
1403
|
-
name: "eslint
|
|
1475
|
+
name: "eslint/test/setup",
|
|
1404
1476
|
plugins: {
|
|
1405
1477
|
test: {
|
|
1406
1478
|
...pluginVitest,
|
|
@@ -1414,7 +1486,7 @@ async function test(options = {}) {
|
|
|
1414
1486
|
},
|
|
1415
1487
|
{
|
|
1416
1488
|
files,
|
|
1417
|
-
name: "eslint
|
|
1489
|
+
name: "eslint/test/rules",
|
|
1418
1490
|
rules: {
|
|
1419
1491
|
"node/prefer-global/process": "off",
|
|
1420
1492
|
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
@@ -1423,6 +1495,7 @@ async function test(options = {}) {
|
|
|
1423
1495
|
"test/no-only-tests": isInEditor ? "off" : "error",
|
|
1424
1496
|
"test/prefer-hooks-in-order": "error",
|
|
1425
1497
|
"test/prefer-lowercase-title": "error",
|
|
1498
|
+
"ts/explicit-function-return-type": "off",
|
|
1426
1499
|
...overrides
|
|
1427
1500
|
}
|
|
1428
1501
|
}
|
|
@@ -1435,19 +1508,22 @@ async function typescript(options = {}) {
|
|
|
1435
1508
|
const {
|
|
1436
1509
|
componentExts = [],
|
|
1437
1510
|
overrides = {},
|
|
1438
|
-
parserOptions = {}
|
|
1511
|
+
parserOptions = {},
|
|
1512
|
+
type = "app"
|
|
1439
1513
|
} = options;
|
|
1440
1514
|
const files = options.files ?? [
|
|
1441
1515
|
GLOB_SRC,
|
|
1442
1516
|
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1443
1517
|
];
|
|
1518
|
+
const ignoresTypeAware = options.ignoresTypeAware ?? [
|
|
1519
|
+
`${GLOB_MARKDOWN}/**`
|
|
1520
|
+
];
|
|
1444
1521
|
const filesTypeAware = options.filesTypeAware ?? [GLOB_TS, GLOB_TSX];
|
|
1445
|
-
const tsconfigPath = options?.tsconfigPath ?
|
|
1522
|
+
const tsconfigPath = options?.tsconfigPath ? options.tsconfigPath : void 0;
|
|
1446
1523
|
const isTypeAware = !!tsconfigPath;
|
|
1447
1524
|
const typeAwareRules = {
|
|
1448
1525
|
"dot-notation": "off",
|
|
1449
1526
|
"no-implied-eval": "off",
|
|
1450
|
-
"no-throw-literal": "off",
|
|
1451
1527
|
"ts/await-thenable": "error",
|
|
1452
1528
|
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1453
1529
|
"ts/no-floating-promises": "error",
|
|
@@ -1460,9 +1536,12 @@ async function typescript(options = {}) {
|
|
|
1460
1536
|
"ts/no-unsafe-call": "error",
|
|
1461
1537
|
"ts/no-unsafe-member-access": "error",
|
|
1462
1538
|
"ts/no-unsafe-return": "error",
|
|
1539
|
+
"ts/promise-function-async": "error",
|
|
1463
1540
|
"ts/restrict-plus-operands": "error",
|
|
1464
1541
|
"ts/restrict-template-expressions": "error",
|
|
1465
|
-
"ts/
|
|
1542
|
+
"ts/return-await": ["error", "in-try-catch"],
|
|
1543
|
+
"ts/strict-boolean-expressions": ["error", { allowNullableBoolean: true, allowNullableObject: true }],
|
|
1544
|
+
"ts/switch-exhaustiveness-check": "error",
|
|
1466
1545
|
"ts/unbound-method": "error"
|
|
1467
1546
|
};
|
|
1468
1547
|
const [
|
|
@@ -1482,19 +1561,22 @@ async function typescript(options = {}) {
|
|
|
1482
1561
|
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1483
1562
|
sourceType: "module",
|
|
1484
1563
|
...typeAware ? {
|
|
1485
|
-
|
|
1564
|
+
projectService: {
|
|
1565
|
+
allowDefaultProject: ["./*.js"],
|
|
1566
|
+
defaultProject: tsconfigPath
|
|
1567
|
+
},
|
|
1486
1568
|
tsconfigRootDir: import_node_process2.default.cwd()
|
|
1487
1569
|
} : {},
|
|
1488
1570
|
...parserOptions
|
|
1489
1571
|
}
|
|
1490
1572
|
},
|
|
1491
|
-
name: `eslint
|
|
1573
|
+
name: `eslint/typescript/${typeAware ? "type-aware-parser" : "parser"}`
|
|
1492
1574
|
};
|
|
1493
1575
|
}
|
|
1494
1576
|
return [
|
|
1495
1577
|
{
|
|
1496
1578
|
// Install the plugins without globs, so they can be configured separately.
|
|
1497
|
-
name: "eslint
|
|
1579
|
+
name: "eslint/typescript/setup",
|
|
1498
1580
|
plugins: {
|
|
1499
1581
|
antfu: import_eslint_plugin_antfu.default,
|
|
1500
1582
|
ts: pluginTs
|
|
@@ -1502,14 +1584,14 @@ async function typescript(options = {}) {
|
|
|
1502
1584
|
},
|
|
1503
1585
|
// assign type-aware parser for type-aware files and type-unaware parser for the rest
|
|
1504
1586
|
...isTypeAware ? [
|
|
1505
|
-
makeParser(
|
|
1506
|
-
makeParser(
|
|
1587
|
+
makeParser(false, files),
|
|
1588
|
+
makeParser(true, filesTypeAware, ignoresTypeAware)
|
|
1507
1589
|
] : [
|
|
1508
1590
|
makeParser(false, files)
|
|
1509
1591
|
],
|
|
1510
1592
|
{
|
|
1511
1593
|
files,
|
|
1512
|
-
name: "eslint
|
|
1594
|
+
name: "eslint/typescript/rules",
|
|
1513
1595
|
rules: {
|
|
1514
1596
|
...renameRules(
|
|
1515
1597
|
pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
@@ -1525,12 +1607,15 @@ async function typescript(options = {}) {
|
|
|
1525
1607
|
"no-use-before-define": "off",
|
|
1526
1608
|
"no-useless-constructor": "off",
|
|
1527
1609
|
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
1528
|
-
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1529
1610
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1530
|
-
"ts/consistent-type-imports": ["error", {
|
|
1611
|
+
"ts/consistent-type-imports": ["error", {
|
|
1612
|
+
disallowTypeAnnotations: false,
|
|
1613
|
+
prefer: "type-imports"
|
|
1614
|
+
}],
|
|
1531
1615
|
"ts/method-signature-style": ["error", "property"],
|
|
1532
1616
|
"ts/no-dupe-class-members": "error",
|
|
1533
1617
|
"ts/no-dynamic-delete": "off",
|
|
1618
|
+
"ts/no-empty-object-type": ["error", { allowInterfaces: "always" }],
|
|
1534
1619
|
"ts/no-explicit-any": "off",
|
|
1535
1620
|
"ts/no-extraneous-class": "off",
|
|
1536
1621
|
"ts/no-import-type-side-effects": "error",
|
|
@@ -1542,23 +1627,31 @@ async function typescript(options = {}) {
|
|
|
1542
1627
|
"ts/no-unused-vars": "off",
|
|
1543
1628
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1544
1629
|
"ts/no-useless-constructor": "off",
|
|
1545
|
-
"ts/
|
|
1630
|
+
"ts/no-wrapper-object-types": "error",
|
|
1546
1631
|
"ts/triple-slash-reference": "off",
|
|
1547
1632
|
"ts/unified-signatures": "off",
|
|
1633
|
+
...type === "lib" ? {
|
|
1634
|
+
"ts/explicit-function-return-type": ["error", {
|
|
1635
|
+
allowExpressions: true,
|
|
1636
|
+
allowHigherOrderFunctions: true,
|
|
1637
|
+
allowIIFEs: true
|
|
1638
|
+
}]
|
|
1639
|
+
} : {},
|
|
1548
1640
|
...overrides
|
|
1549
1641
|
}
|
|
1550
1642
|
},
|
|
1551
1643
|
...isTypeAware ? [{
|
|
1552
1644
|
files: filesTypeAware,
|
|
1553
|
-
|
|
1645
|
+
ignores: ignoresTypeAware,
|
|
1646
|
+
name: "eslint/typescript/rules-type-aware",
|
|
1554
1647
|
rules: {
|
|
1555
|
-
...
|
|
1648
|
+
...typeAwareRules,
|
|
1556
1649
|
...overrides
|
|
1557
1650
|
}
|
|
1558
1651
|
}] : [],
|
|
1559
1652
|
{
|
|
1560
|
-
files: ["**/*.d
|
|
1561
|
-
name: "eslint
|
|
1653
|
+
files: ["**/*.d.?([cm])ts"],
|
|
1654
|
+
name: "eslint/typescript/disables/dts",
|
|
1562
1655
|
rules: {
|
|
1563
1656
|
"eslint-comments/no-unlimited-disable": "off",
|
|
1564
1657
|
"import/no-duplicates": "off",
|
|
@@ -1568,14 +1661,14 @@ async function typescript(options = {}) {
|
|
|
1568
1661
|
},
|
|
1569
1662
|
{
|
|
1570
1663
|
files: ["**/*.{test,spec}.ts?(x)"],
|
|
1571
|
-
name: "eslint
|
|
1664
|
+
name: "eslint/typescript/disables/test",
|
|
1572
1665
|
rules: {
|
|
1573
1666
|
"no-unused-expressions": "off"
|
|
1574
1667
|
}
|
|
1575
1668
|
},
|
|
1576
1669
|
{
|
|
1577
1670
|
files: ["**/*.js", "**/*.cjs"],
|
|
1578
|
-
name: "eslint
|
|
1671
|
+
name: "eslint/typescript/disables/cjs",
|
|
1579
1672
|
rules: {
|
|
1580
1673
|
"ts/no-require-imports": "off",
|
|
1581
1674
|
"ts/no-var-requires": "off"
|
|
@@ -1585,40 +1678,32 @@ async function typescript(options = {}) {
|
|
|
1585
1678
|
}
|
|
1586
1679
|
|
|
1587
1680
|
// src/configs/unicorn.ts
|
|
1588
|
-
async function unicorn() {
|
|
1681
|
+
async function unicorn(options = {}) {
|
|
1589
1682
|
return [
|
|
1590
1683
|
{
|
|
1591
|
-
name: "eslint
|
|
1684
|
+
name: "eslint/unicorn/rules",
|
|
1592
1685
|
plugins: {
|
|
1593
1686
|
unicorn: import_eslint_plugin_unicorn.default
|
|
1594
1687
|
},
|
|
1595
1688
|
rules: {
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
|
|
1614
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1615
|
-
"unicorn/prefer-number-properties": "error",
|
|
1616
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1617
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1618
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
1619
|
-
"unicorn/prefer-type-error": "error",
|
|
1620
|
-
// Use new when throwing error
|
|
1621
|
-
"unicorn/throw-new-error": "error"
|
|
1689
|
+
...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
|
|
1690
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
1691
|
+
"unicorn/consistent-function-scoping": "error",
|
|
1692
|
+
"unicorn/error-message": "error",
|
|
1693
|
+
"unicorn/escape-case": "error",
|
|
1694
|
+
"unicorn/new-for-builtins": "error",
|
|
1695
|
+
"unicorn/no-instanceof-array": "error",
|
|
1696
|
+
"unicorn/no-new-array": "error",
|
|
1697
|
+
"unicorn/no-new-buffer": "error",
|
|
1698
|
+
"unicorn/number-literal-case": "error",
|
|
1699
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1700
|
+
"unicorn/prefer-includes": "error",
|
|
1701
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1702
|
+
"unicorn/prefer-number-properties": "error",
|
|
1703
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1704
|
+
"unicorn/prefer-type-error": "error",
|
|
1705
|
+
"unicorn/throw-new-error": "error"
|
|
1706
|
+
}
|
|
1622
1707
|
}
|
|
1623
1708
|
}
|
|
1624
1709
|
];
|
|
@@ -1641,7 +1726,7 @@ async function unocss(options = {}) {
|
|
|
1641
1726
|
]);
|
|
1642
1727
|
return [
|
|
1643
1728
|
{
|
|
1644
|
-
name: "eslint
|
|
1729
|
+
name: "eslint/unocss/rules",
|
|
1645
1730
|
plugins: {
|
|
1646
1731
|
unocss: pluginUnoCSS
|
|
1647
1732
|
},
|
|
@@ -1706,7 +1791,7 @@ async function vue(options = {}) {
|
|
|
1706
1791
|
watchEffect: "readonly"
|
|
1707
1792
|
}
|
|
1708
1793
|
},
|
|
1709
|
-
name: "eslint
|
|
1794
|
+
name: "eslint/vue/setup",
|
|
1710
1795
|
plugins: {
|
|
1711
1796
|
vue: pluginVue
|
|
1712
1797
|
}
|
|
@@ -1724,7 +1809,7 @@ async function vue(options = {}) {
|
|
|
1724
1809
|
sourceType: "module"
|
|
1725
1810
|
}
|
|
1726
1811
|
},
|
|
1727
|
-
name: "eslint
|
|
1812
|
+
name: "eslint/vue/rules",
|
|
1728
1813
|
processor: sfcBlocks === false ? pluginVue.processors[".vue"] : (0, import_eslint_merge_processors2.mergeProcessors)([
|
|
1729
1814
|
pluginVue.processors[".vue"],
|
|
1730
1815
|
processorVueBlocks({
|
|
@@ -1853,7 +1938,7 @@ async function yaml(options = {}) {
|
|
|
1853
1938
|
]);
|
|
1854
1939
|
return [
|
|
1855
1940
|
{
|
|
1856
|
-
name: "eslint
|
|
1941
|
+
name: "eslint/yaml/setup",
|
|
1857
1942
|
plugins: {
|
|
1858
1943
|
yaml: pluginYaml
|
|
1859
1944
|
}
|
|
@@ -1863,7 +1948,7 @@ async function yaml(options = {}) {
|
|
|
1863
1948
|
languageOptions: {
|
|
1864
1949
|
parser: parserYaml
|
|
1865
1950
|
},
|
|
1866
|
-
name: "eslint
|
|
1951
|
+
name: "eslint/yaml/rules",
|
|
1867
1952
|
rules: {
|
|
1868
1953
|
"style/spaced-comment": "off",
|
|
1869
1954
|
"yaml/block-mapping": "error",
|
|
@@ -1911,7 +1996,7 @@ async function toml(options = {}) {
|
|
|
1911
1996
|
]);
|
|
1912
1997
|
return [
|
|
1913
1998
|
{
|
|
1914
|
-
name: "eslint
|
|
1999
|
+
name: "eslint/toml/setup",
|
|
1915
2000
|
plugins: {
|
|
1916
2001
|
toml: pluginToml
|
|
1917
2002
|
}
|
|
@@ -1921,7 +2006,7 @@ async function toml(options = {}) {
|
|
|
1921
2006
|
languageOptions: {
|
|
1922
2007
|
parser: parserToml
|
|
1923
2008
|
},
|
|
1924
|
-
name: "eslint
|
|
2009
|
+
name: "eslint/toml/rules",
|
|
1925
2010
|
rules: {
|
|
1926
2011
|
"style/spaced-comment": "off",
|
|
1927
2012
|
"toml/comma-style": "error",
|
|
@@ -1954,8 +2039,6 @@ async function toml(options = {}) {
|
|
|
1954
2039
|
// src/factory.ts
|
|
1955
2040
|
var flatConfigProps = [
|
|
1956
2041
|
"name",
|
|
1957
|
-
"files",
|
|
1958
|
-
"ignores",
|
|
1959
2042
|
"languageOptions",
|
|
1960
2043
|
"linterOptions",
|
|
1961
2044
|
"processor",
|
|
@@ -1990,29 +2073,40 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1990
2073
|
autoRenamePlugins = true,
|
|
1991
2074
|
componentExts = [],
|
|
1992
2075
|
gitignore: enableGitignore = true,
|
|
1993
|
-
|
|
2076
|
+
jsx: enableJsx = true,
|
|
1994
2077
|
overrides = {},
|
|
1995
2078
|
react: enableReact = ReactPackages.some((i) => (0, import_local_pkg4.isPackageExists)(i)),
|
|
1996
2079
|
regexp: enableRegexp = true,
|
|
1997
2080
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
2081
|
+
unicorn: enableUnicorn = true,
|
|
1998
2082
|
unocss: enableUnoCSS = false,
|
|
1999
2083
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
2000
2084
|
} = options;
|
|
2085
|
+
let isInEditor = options.isInEditor;
|
|
2086
|
+
if (isInEditor == null) {
|
|
2087
|
+
isInEditor = isInEditorEnv();
|
|
2088
|
+
if (isInEditor)
|
|
2089
|
+
console.log("[@lincy/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2090
|
+
}
|
|
2001
2091
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
2002
2092
|
const tsconfigPath = typeof enableTypeScript !== "boolean" && "tsconfigPath" in enableTypeScript ? enableTypeScript.tsconfigPath : void 0;
|
|
2003
2093
|
if (stylisticOptions) {
|
|
2004
2094
|
if (!("jsx" in stylisticOptions)) {
|
|
2005
|
-
stylisticOptions.jsx =
|
|
2095
|
+
stylisticOptions.jsx = enableJsx;
|
|
2006
2096
|
}
|
|
2007
2097
|
}
|
|
2008
2098
|
const configs2 = [];
|
|
2009
2099
|
if (enableGitignore) {
|
|
2010
2100
|
if (typeof enableGitignore !== "boolean") {
|
|
2011
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(
|
|
2101
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2102
|
+
name: "eslint/gitignore",
|
|
2103
|
+
...enableGitignore
|
|
2104
|
+
})]));
|
|
2012
2105
|
} else {
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2106
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2107
|
+
name: "eslint/gitignore",
|
|
2108
|
+
strict: false
|
|
2109
|
+
})]));
|
|
2016
2110
|
}
|
|
2017
2111
|
}
|
|
2018
2112
|
configs2.push(
|
|
@@ -2031,10 +2125,12 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2031
2125
|
imports({
|
|
2032
2126
|
stylistic: stylisticOptions
|
|
2033
2127
|
}),
|
|
2034
|
-
unicorn(),
|
|
2035
2128
|
// Optional plugins (installed but not enabled by default)
|
|
2036
2129
|
perfectionist()
|
|
2037
2130
|
);
|
|
2131
|
+
if (enableUnicorn) {
|
|
2132
|
+
configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2133
|
+
}
|
|
2038
2134
|
if (enableVue) {
|
|
2039
2135
|
componentExts.push("vue");
|
|
2040
2136
|
}
|
|
@@ -2043,9 +2139,13 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2043
2139
|
...typeof enableTypeScript !== "boolean" ? enableTypeScript : {},
|
|
2044
2140
|
componentExts,
|
|
2045
2141
|
overrides: overrides.typescript,
|
|
2046
|
-
tsconfigPath
|
|
2142
|
+
tsconfigPath,
|
|
2143
|
+
type: options.type
|
|
2047
2144
|
}));
|
|
2048
2145
|
}
|
|
2146
|
+
if (enableJsx) {
|
|
2147
|
+
configs2.push(jsx());
|
|
2148
|
+
}
|
|
2049
2149
|
if (stylisticOptions) {
|
|
2050
2150
|
configs2.push(stylistic({
|
|
2051
2151
|
overrides: overrides.stylistic,
|
|
@@ -2123,6 +2223,9 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
2123
2223
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2124
2224
|
));
|
|
2125
2225
|
}
|
|
2226
|
+
if ("files" in options) {
|
|
2227
|
+
throw new Error("[@lincy/eslint-config] \u7B2C\u4E00\u4E2A\u53C2\u6570\u4E0D\u5E94\u5305\u542B\u201Cfiles\u201D\u5C5E\u6027\uFF0C\u56E0\u4E3A\u9009\u9879\u5E94\u8BE5\u662F\u5168\u5C40\u7684\u3002\u8BF7\u5C06\u5176\u653E\u5728\u7B2C\u4E8C\u4E2A\u6216\u66F4\u540E\u9762\u7684\u914D\u7F6E\u4E2D\u3002");
|
|
2228
|
+
}
|
|
2126
2229
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
2127
2230
|
if (key in options) {
|
|
2128
2231
|
acc[key] = options[key];
|
|
@@ -2167,11 +2270,13 @@ var src_default = lincy;
|
|
|
2167
2270
|
GLOB_SRC_EXT,
|
|
2168
2271
|
GLOB_STYLE,
|
|
2169
2272
|
GLOB_SVELTE,
|
|
2273
|
+
GLOB_SVG,
|
|
2170
2274
|
GLOB_TESTS,
|
|
2171
2275
|
GLOB_TOML,
|
|
2172
2276
|
GLOB_TS,
|
|
2173
2277
|
GLOB_TSX,
|
|
2174
2278
|
GLOB_VUE,
|
|
2279
|
+
GLOB_XML,
|
|
2175
2280
|
GLOB_YAML,
|
|
2176
2281
|
StylisticConfigDefaults,
|
|
2177
2282
|
combine,
|
|
@@ -2182,9 +2287,13 @@ var src_default = lincy;
|
|
|
2182
2287
|
ignores,
|
|
2183
2288
|
imports,
|
|
2184
2289
|
interopDefault,
|
|
2290
|
+
isInEditorEnv,
|
|
2291
|
+
isInGitHooksOrLintStaged,
|
|
2292
|
+
isPackageInScope,
|
|
2185
2293
|
javascript,
|
|
2186
2294
|
jsdoc,
|
|
2187
2295
|
jsonc,
|
|
2296
|
+
jsx,
|
|
2188
2297
|
lincy,
|
|
2189
2298
|
markdown,
|
|
2190
2299
|
node,
|