@lincy/eslint-config 3.0.10 → 3.1.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 +72 -23
- package/dist/index.cjs +181 -140
- package/dist/index.d.cts +17 -6
- package/dist/index.d.ts +17 -6
- package/dist/index.js +212 -172
- package/package.json +16 -17
package/dist/index.cjs
CHANGED
|
@@ -36,7 +36,6 @@ __export(src_exports, {
|
|
|
36
36
|
ignores: () => ignores,
|
|
37
37
|
imports: () => imports,
|
|
38
38
|
javascript: () => javascript,
|
|
39
|
-
javascriptStylistic: () => javascriptStylistic,
|
|
40
39
|
jsdoc: () => jsdoc,
|
|
41
40
|
jsonc: () => jsonc,
|
|
42
41
|
lincy: () => lincy,
|
|
@@ -54,22 +53,24 @@ __export(src_exports, {
|
|
|
54
53
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
55
54
|
pluginNoOnlyTests: () => import_eslint_plugin_no_only_tests.default,
|
|
56
55
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
pluginTs: () => import_eslint_plugin.default,
|
|
56
|
+
pluginStylistic: () => import_eslint_plugin.default,
|
|
57
|
+
pluginTs: () => import_eslint_plugin2.default,
|
|
60
58
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
61
59
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
62
60
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
63
61
|
pluginYml: () => import_eslint_plugin_yml.default,
|
|
62
|
+
recordRulesState: () => recordRulesState,
|
|
63
|
+
recordRulesStateConfigs: () => recordRulesStateConfigs,
|
|
64
64
|
renameRules: () => renameRules,
|
|
65
65
|
sortPackageJson: () => sortPackageJson,
|
|
66
66
|
sortTsconfig: () => sortTsconfig,
|
|
67
|
+
stylistic: () => stylistic,
|
|
67
68
|
test: () => test,
|
|
68
69
|
typescript: () => typescript,
|
|
69
|
-
typescriptStylistic: () => typescriptStylistic,
|
|
70
70
|
typescriptWithLanguageServer: () => typescriptWithLanguageServer,
|
|
71
71
|
unicorn: () => unicorn,
|
|
72
72
|
vue: () => vue,
|
|
73
|
+
warnUnnecessaryOffRules: () => warnUnnecessaryOffRules,
|
|
73
74
|
yml: () => yml
|
|
74
75
|
});
|
|
75
76
|
module.exports = __toCommonJS(src_exports);
|
|
@@ -80,6 +81,7 @@ var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
|
80
81
|
|
|
81
82
|
// src/factory.ts
|
|
82
83
|
var import_node_process2 = __toESM(require("process"), 1);
|
|
84
|
+
var import_node_fs = __toESM(require("fs"), 1);
|
|
83
85
|
|
|
84
86
|
// node_modules/.pnpm/local-pkg@0.4.3/node_modules/local-pkg/index.mjs
|
|
85
87
|
var import_path = require("path");
|
|
@@ -137,8 +139,8 @@ function searchPackageJSON(dir) {
|
|
|
137
139
|
return packageJsonPath;
|
|
138
140
|
}
|
|
139
141
|
|
|
140
|
-
// src/
|
|
141
|
-
var
|
|
142
|
+
// src/factory.ts
|
|
143
|
+
var import_eslint_config_flat_gitignore = __toESM(require("eslint-config-flat-gitignore"), 1);
|
|
142
144
|
|
|
143
145
|
// src/plugins.ts
|
|
144
146
|
var import_eslint_plugin_antfu = __toESM(require("eslint-plugin-antfu"), 1);
|
|
@@ -148,9 +150,8 @@ var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
|
148
150
|
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
149
151
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
150
152
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
151
|
-
var
|
|
152
|
-
var
|
|
153
|
-
var import_eslint_plugin = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
153
|
+
var import_eslint_plugin = __toESM(require("@stylistic/eslint-plugin"), 1);
|
|
154
|
+
var import_eslint_plugin2 = __toESM(require("@typescript-eslint/eslint-plugin"), 1);
|
|
154
155
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
155
156
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
156
157
|
var import_eslint_plugin_vue = __toESM(require("eslint-plugin-vue"), 1);
|
|
@@ -168,8 +169,10 @@ var comments = [
|
|
|
168
169
|
"eslint-comments": import_eslint_plugin_eslint_comments.default
|
|
169
170
|
},
|
|
170
171
|
rules: {
|
|
171
|
-
|
|
172
|
-
"eslint-comments/
|
|
172
|
+
"eslint-comments/no-aggregating-enable": "error",
|
|
173
|
+
"eslint-comments/no-duplicate-disable": "error",
|
|
174
|
+
"eslint-comments/no-unlimited-disable": "error",
|
|
175
|
+
"eslint-comments/no-unused-enable": "error"
|
|
173
176
|
}
|
|
174
177
|
}
|
|
175
178
|
];
|
|
@@ -242,6 +245,11 @@ var imports = [
|
|
|
242
245
|
|
|
243
246
|
// src/configs/javascript.ts
|
|
244
247
|
var import_globals = __toESM(require("globals"), 1);
|
|
248
|
+
|
|
249
|
+
// src/flags.ts
|
|
250
|
+
var OFF = 0;
|
|
251
|
+
|
|
252
|
+
// src/configs/javascript.ts
|
|
245
253
|
function javascript(options = {}) {
|
|
246
254
|
return [
|
|
247
255
|
{
|
|
@@ -276,9 +284,6 @@ function javascript(options = {}) {
|
|
|
276
284
|
"array-callback-return": "error",
|
|
277
285
|
"arrow-parens": ["error", "as-needed", { requireForBlockBody: true }],
|
|
278
286
|
"block-scoped-var": "error",
|
|
279
|
-
"camelcase": OFF,
|
|
280
|
-
"complexity": OFF,
|
|
281
|
-
"consistent-return": OFF,
|
|
282
287
|
"constructor-super": "error",
|
|
283
288
|
"default-case-last": "error",
|
|
284
289
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
@@ -287,7 +292,7 @@ function javascript(options = {}) {
|
|
|
287
292
|
"max-statements-per-line": ["error", { max: 1 }],
|
|
288
293
|
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
289
294
|
"new-parens": "error",
|
|
290
|
-
"no-alert": "
|
|
295
|
+
"no-alert": "error",
|
|
291
296
|
"no-array-constructor": "error",
|
|
292
297
|
"no-async-promise-executor": "error",
|
|
293
298
|
"no-caller": "error",
|
|
@@ -346,7 +351,6 @@ function javascript(options = {}) {
|
|
|
346
351
|
"no-obj-calls": "error",
|
|
347
352
|
"no-octal": "error",
|
|
348
353
|
"no-octal-escape": "error",
|
|
349
|
-
"no-param-reassign": OFF,
|
|
350
354
|
"no-proto": "error",
|
|
351
355
|
"no-prototype-builtins": "error",
|
|
352
356
|
"no-redeclare": ["error", { builtinGlobals: false }],
|
|
@@ -370,8 +374,6 @@ function javascript(options = {}) {
|
|
|
370
374
|
"LabeledStatement",
|
|
371
375
|
"WithStatement"
|
|
372
376
|
],
|
|
373
|
-
"no-return-assign": OFF,
|
|
374
|
-
"no-return-await": OFF,
|
|
375
377
|
"no-self-assign": ["error", { props: true }],
|
|
376
378
|
"no-self-compare": "error",
|
|
377
379
|
"no-sequences": "error",
|
|
@@ -406,7 +408,6 @@ function javascript(options = {}) {
|
|
|
406
408
|
"no-useless-catch": "error",
|
|
407
409
|
"no-useless-computed-key": "error",
|
|
408
410
|
"no-useless-constructor": "error",
|
|
409
|
-
"no-useless-escape": OFF,
|
|
410
411
|
"no-useless-rename": "error",
|
|
411
412
|
"no-useless-return": "error",
|
|
412
413
|
"no-var": "error",
|
|
@@ -442,7 +443,6 @@ function javascript(options = {}) {
|
|
|
442
443
|
"prefer-spread": "error",
|
|
443
444
|
"prefer-template": "error",
|
|
444
445
|
"quote-props": ["error", "consistent-as-needed"],
|
|
445
|
-
"require-await": OFF,
|
|
446
446
|
"sort-imports": [
|
|
447
447
|
"error",
|
|
448
448
|
{
|
|
@@ -457,7 +457,7 @@ function javascript(options = {}) {
|
|
|
457
457
|
"unicode-bom": ["error", "never"],
|
|
458
458
|
"unused-imports/no-unused-imports": options.isInEditor ? OFF : "error",
|
|
459
459
|
"unused-imports/no-unused-vars": [
|
|
460
|
-
"
|
|
460
|
+
"error",
|
|
461
461
|
{ args: "after-used", argsIgnorePattern: "^_", vars: "all", varsIgnorePattern: "^_" }
|
|
462
462
|
],
|
|
463
463
|
"use-isnan": ["error", { enforceForIndexOf: true, enforceForSwitchCase: true }],
|
|
@@ -468,7 +468,7 @@ function javascript(options = {}) {
|
|
|
468
468
|
}
|
|
469
469
|
},
|
|
470
470
|
{
|
|
471
|
-
files: [
|
|
471
|
+
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
472
472
|
rules: {
|
|
473
473
|
"no-console": OFF
|
|
474
474
|
}
|
|
@@ -483,19 +483,25 @@ var jsdoc = [
|
|
|
483
483
|
jsdoc: import_eslint_plugin_jsdoc.default
|
|
484
484
|
},
|
|
485
485
|
rules: {
|
|
486
|
-
|
|
487
|
-
"jsdoc/check-
|
|
488
|
-
"jsdoc/check-
|
|
489
|
-
"jsdoc/
|
|
490
|
-
"jsdoc/
|
|
491
|
-
"jsdoc/
|
|
492
|
-
"jsdoc/
|
|
493
|
-
"jsdoc/
|
|
494
|
-
"jsdoc/
|
|
495
|
-
"jsdoc/
|
|
496
|
-
"jsdoc/
|
|
497
|
-
"jsdoc/require-
|
|
498
|
-
"jsdoc/
|
|
486
|
+
"jsdoc/check-access": "warn",
|
|
487
|
+
"jsdoc/check-alignment": "warn",
|
|
488
|
+
"jsdoc/check-param-names": "warn",
|
|
489
|
+
"jsdoc/check-property-names": "warn",
|
|
490
|
+
"jsdoc/check-types": "warn",
|
|
491
|
+
"jsdoc/empty-tags": "warn",
|
|
492
|
+
"jsdoc/implements-on-classes": "warn",
|
|
493
|
+
"jsdoc/multiline-blocks": "warn",
|
|
494
|
+
"jsdoc/no-defaults": "warn",
|
|
495
|
+
"jsdoc/no-multi-asterisks": "warn",
|
|
496
|
+
"jsdoc/no-types": "warn",
|
|
497
|
+
"jsdoc/require-param-name": "warn",
|
|
498
|
+
"jsdoc/require-property": "warn",
|
|
499
|
+
"jsdoc/require-property-description": "warn",
|
|
500
|
+
"jsdoc/require-property-name": "warn",
|
|
501
|
+
"jsdoc/require-returns-check": "warn",
|
|
502
|
+
"jsdoc/require-returns-description": "warn",
|
|
503
|
+
"jsdoc/require-yields-check": "warn",
|
|
504
|
+
"jsdoc/valid-types": "warn"
|
|
499
505
|
}
|
|
500
506
|
}
|
|
501
507
|
];
|
|
@@ -511,16 +517,42 @@ var jsonc = [
|
|
|
511
517
|
jsonc: import_eslint_plugin_jsonc.default
|
|
512
518
|
},
|
|
513
519
|
rules: {
|
|
514
|
-
...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
|
|
515
520
|
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
516
521
|
"jsonc/comma-dangle": ["error", "never"],
|
|
517
522
|
"jsonc/comma-style": ["error", "last"],
|
|
518
523
|
"jsonc/indent": ["error", 2],
|
|
519
524
|
"jsonc/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
525
|
+
"jsonc/no-bigint-literals": "error",
|
|
526
|
+
"jsonc/no-binary-expression": "error",
|
|
527
|
+
"jsonc/no-binary-numeric-literals": "error",
|
|
528
|
+
"jsonc/no-dupe-keys": "error",
|
|
529
|
+
"jsonc/no-escape-sequence-in-identifier": "error",
|
|
530
|
+
"jsonc/no-floating-decimal": "error",
|
|
531
|
+
"jsonc/no-hexadecimal-numeric-literals": "error",
|
|
532
|
+
"jsonc/no-infinity": "error",
|
|
533
|
+
"jsonc/no-multi-str": "error",
|
|
534
|
+
"jsonc/no-nan": "error",
|
|
535
|
+
"jsonc/no-number-props": "error",
|
|
536
|
+
"jsonc/no-numeric-separators": "error",
|
|
537
|
+
"jsonc/no-octal": "error",
|
|
520
538
|
"jsonc/no-octal-escape": "error",
|
|
539
|
+
"jsonc/no-octal-numeric-literals": "error",
|
|
540
|
+
"jsonc/no-parenthesized": "error",
|
|
541
|
+
"jsonc/no-plus-sign": "error",
|
|
542
|
+
"jsonc/no-regexp-literals": "error",
|
|
543
|
+
"jsonc/no-sparse-arrays": "error",
|
|
544
|
+
"jsonc/no-template-literals": "error",
|
|
545
|
+
"jsonc/no-undefined-value": "error",
|
|
546
|
+
"jsonc/no-unicode-codepoint-escapes": "error",
|
|
547
|
+
"jsonc/no-useless-escape": "error",
|
|
521
548
|
"jsonc/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
522
549
|
"jsonc/object-curly-spacing": ["error", "always"],
|
|
523
|
-
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }]
|
|
550
|
+
"jsonc/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
551
|
+
"jsonc/quote-props": "error",
|
|
552
|
+
"jsonc/quotes": "error",
|
|
553
|
+
"jsonc/space-unary-ops": "error",
|
|
554
|
+
"jsonc/valid-json-number": "error",
|
|
555
|
+
"jsonc/vue-custom-block/no-parsing-error": "error"
|
|
524
556
|
}
|
|
525
557
|
}
|
|
526
558
|
];
|
|
@@ -551,21 +583,19 @@ function markdown(options = {}) {
|
|
|
551
583
|
}
|
|
552
584
|
},
|
|
553
585
|
plugins: {
|
|
554
|
-
ts:
|
|
586
|
+
ts: import_eslint_plugin2.default
|
|
555
587
|
},
|
|
556
588
|
rules: {
|
|
557
|
-
...import_eslint_plugin_markdown.default.configs.recommended.overrides[1].rules,
|
|
558
589
|
"antfu/no-cjs-exports": OFF,
|
|
559
590
|
"antfu/no-ts-export-equal": OFF,
|
|
560
|
-
"
|
|
591
|
+
"eol-last": OFF,
|
|
561
592
|
"no-alert": OFF,
|
|
562
593
|
"no-console": OFF,
|
|
563
|
-
"no-restricted-imports": OFF,
|
|
564
594
|
"no-undef": OFF,
|
|
565
595
|
"no-unused-expressions": OFF,
|
|
566
596
|
"no-unused-vars": OFF,
|
|
567
597
|
"node/prefer-global/process": OFF,
|
|
568
|
-
"
|
|
598
|
+
"style/comma-dangle": OFF,
|
|
569
599
|
"ts/consistent-type-imports": OFF,
|
|
570
600
|
"ts/no-namespace": OFF,
|
|
571
601
|
"ts/no-redeclare": OFF,
|
|
@@ -573,6 +603,7 @@ function markdown(options = {}) {
|
|
|
573
603
|
"ts/no-unused-vars": OFF,
|
|
574
604
|
"ts/no-use-before-define": OFF,
|
|
575
605
|
"ts/no-var-requires": OFF,
|
|
606
|
+
"unicode-bom": "off",
|
|
576
607
|
"unused-imports/no-unused-imports": OFF,
|
|
577
608
|
"unused-imports/no-unused-vars": OFF
|
|
578
609
|
}
|
|
@@ -810,29 +841,24 @@ var sortTsconfig = [
|
|
|
810
841
|
];
|
|
811
842
|
|
|
812
843
|
// src/configs/stylistic.ts
|
|
813
|
-
var
|
|
814
|
-
var tsPackage = import_metadata.packages.find((i) => i.shortId === "ts");
|
|
815
|
-
var javascriptStylistic = [
|
|
844
|
+
var stylistic = [
|
|
816
845
|
{
|
|
817
846
|
plugins: {
|
|
818
|
-
style:
|
|
847
|
+
style: import_eslint_plugin.default
|
|
819
848
|
},
|
|
820
849
|
rules: {
|
|
850
|
+
"antfu/consistent-list-newline": "error",
|
|
821
851
|
"antfu/if-newline": "error",
|
|
822
|
-
"comma-dangle": ["error", "always-multiline"],
|
|
823
852
|
"curly": ["error", "multi-or-nest", "consistent"],
|
|
824
|
-
"quotes": ["error", "single"],
|
|
825
|
-
"semi": ["error", "never"],
|
|
826
853
|
"style/array-bracket-spacing": ["error", "never"],
|
|
827
854
|
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
828
855
|
"style/block-spacing": ["error", "always"],
|
|
829
856
|
"style/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
857
|
+
"style/comma-dangle": ["error", "always-multiline"],
|
|
830
858
|
"style/comma-spacing": ["error", { after: true, before: false }],
|
|
831
859
|
"style/comma-style": ["error", "last"],
|
|
832
860
|
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
833
861
|
"style/dot-location": ["error", "property"],
|
|
834
|
-
"style/func-call-spacing": OFF,
|
|
835
|
-
"style/generator-star-spacing": OFF,
|
|
836
862
|
"style/indent": ["error", 4, {
|
|
837
863
|
ArrayExpression: 1,
|
|
838
864
|
CallExpression: { arguments: 1 },
|
|
@@ -874,6 +900,7 @@ var javascriptStylistic = [
|
|
|
874
900
|
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
875
901
|
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
876
902
|
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
903
|
+
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
877
904
|
"style/multiline-ternary": ["error", "always-multiline"],
|
|
878
905
|
"style/no-mixed-spaces-and-tabs": "error",
|
|
879
906
|
"style/no-multi-spaces": "error",
|
|
@@ -886,7 +913,9 @@ var javascriptStylistic = [
|
|
|
886
913
|
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
887
914
|
"style/operator-linebreak": ["error", "before"],
|
|
888
915
|
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
916
|
+
"style/quotes": ["error", "single"],
|
|
889
917
|
"style/rest-spread-spacing": ["error", "never"],
|
|
918
|
+
"style/semi": ["error", "never"],
|
|
890
919
|
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
891
920
|
"style/space-before-blocks": ["error", "always"],
|
|
892
921
|
"style/space-before-function-paren": ["error", { anonymous: "always", asyncArrow: "always", named: "never" }],
|
|
@@ -906,53 +935,11 @@ var javascriptStylistic = [
|
|
|
906
935
|
}],
|
|
907
936
|
"style/template-curly-spacing": "error",
|
|
908
937
|
"style/template-tag-spacing": ["error", "never"],
|
|
938
|
+
"style/type-annotation-spacing": ["error", {}],
|
|
909
939
|
"style/yield-star-spacing": ["error", "both"]
|
|
910
940
|
}
|
|
911
941
|
}
|
|
912
942
|
];
|
|
913
|
-
var typescriptStylistic = [
|
|
914
|
-
{
|
|
915
|
-
plugins: {
|
|
916
|
-
"style-ts": import_eslint_plugin_ts.default,
|
|
917
|
-
"ts": import_eslint_plugin.default
|
|
918
|
-
},
|
|
919
|
-
rules: {
|
|
920
|
-
...stylisticJsToTS(javascriptStylistic[0].rules),
|
|
921
|
-
"comma-dangle": OFF,
|
|
922
|
-
"quotes": OFF,
|
|
923
|
-
"semi": OFF,
|
|
924
|
-
"style-ts/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
925
|
-
"style-ts/type-annotation-spacing": ["error", {}],
|
|
926
|
-
"ts/comma-dangle": ["error", "always-multiline"],
|
|
927
|
-
"ts/quotes": ["error", "single"],
|
|
928
|
-
"ts/semi": ["error", "never"]
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
];
|
|
932
|
-
function stylisticJsToTS(input) {
|
|
933
|
-
return {
|
|
934
|
-
// turn off all stylistic rules from style
|
|
935
|
-
...Object.fromEntries(
|
|
936
|
-
Object.entries(input).map(([key]) => {
|
|
937
|
-
if (!key.startsWith("style/"))
|
|
938
|
-
return null;
|
|
939
|
-
const basename = key.replace("style/", "");
|
|
940
|
-
if (tsPackage.rules.find((i) => i.name === basename))
|
|
941
|
-
return [key, OFF];
|
|
942
|
-
return null;
|
|
943
|
-
}).filter(Boolean)
|
|
944
|
-
),
|
|
945
|
-
// rename all stylistic rules from style to style/ts
|
|
946
|
-
...Object.fromEntries(
|
|
947
|
-
Object.entries(input).map(([key, value]) => {
|
|
948
|
-
if (!key.startsWith("style/"))
|
|
949
|
-
return null;
|
|
950
|
-
const basename = key.replace("style/", "");
|
|
951
|
-
return tsPackage.rules.find((i) => i.name === basename) ? [`style-ts/${basename}`, value] : null;
|
|
952
|
-
}).filter(Boolean)
|
|
953
|
-
)
|
|
954
|
-
};
|
|
955
|
-
}
|
|
956
943
|
|
|
957
944
|
// src/configs/typescript.ts
|
|
958
945
|
var import_node_process = __toESM(require("process"), 1);
|
|
@@ -970,6 +957,30 @@ function renameRules(rules, from, to) {
|
|
|
970
957
|
})
|
|
971
958
|
);
|
|
972
959
|
}
|
|
960
|
+
var rulesOn = /* @__PURE__ */ new Set();
|
|
961
|
+
var rulesOff = /* @__PURE__ */ new Set();
|
|
962
|
+
function recordRulesStateConfigs(configs) {
|
|
963
|
+
for (const config of configs)
|
|
964
|
+
recordRulesState(config.rules ?? {});
|
|
965
|
+
return configs;
|
|
966
|
+
}
|
|
967
|
+
function recordRulesState(rules) {
|
|
968
|
+
for (const [key, value] of Object.entries(rules ?? {})) {
|
|
969
|
+
const firstValue = Array.isArray(value) ? value[0] : value;
|
|
970
|
+
if (firstValue == null)
|
|
971
|
+
continue;
|
|
972
|
+
if (firstValue === "off" || firstValue === 0)
|
|
973
|
+
rulesOff.add(key);
|
|
974
|
+
else
|
|
975
|
+
rulesOn.add(key);
|
|
976
|
+
}
|
|
977
|
+
return rules;
|
|
978
|
+
}
|
|
979
|
+
function warnUnnecessaryOffRules() {
|
|
980
|
+
const unnecessaryOffRules = [...rulesOff].filter((key) => !rulesOn.has(key));
|
|
981
|
+
for (const off of unnecessaryOffRules)
|
|
982
|
+
console.warn(`[eslint] rule \`${off}\` is never turned on, you can remove the rule from your config`);
|
|
983
|
+
}
|
|
973
984
|
|
|
974
985
|
// src/configs/typescript.ts
|
|
975
986
|
function typescript(options) {
|
|
@@ -992,16 +1003,16 @@ function typescript(options) {
|
|
|
992
1003
|
plugins: {
|
|
993
1004
|
antfu: import_eslint_plugin_antfu.default,
|
|
994
1005
|
import: import_eslint_plugin_i.default,
|
|
995
|
-
ts:
|
|
1006
|
+
ts: import_eslint_plugin2.default
|
|
996
1007
|
},
|
|
997
1008
|
rules: {
|
|
998
1009
|
...renameRules(
|
|
999
|
-
|
|
1010
|
+
import_eslint_plugin2.default.configs["eslint-recommended"].overrides[0].rules,
|
|
1000
1011
|
"@typescript-eslint/",
|
|
1001
1012
|
"ts/"
|
|
1002
1013
|
),
|
|
1003
1014
|
...renameRules(
|
|
1004
|
-
|
|
1015
|
+
import_eslint_plugin2.default.configs.strict.rules,
|
|
1005
1016
|
"@typescript-eslint/",
|
|
1006
1017
|
"ts/"
|
|
1007
1018
|
),
|
|
@@ -1017,33 +1028,24 @@ function typescript(options) {
|
|
|
1017
1028
|
"no-redeclare": OFF,
|
|
1018
1029
|
"no-use-before-define": OFF,
|
|
1019
1030
|
"no-useless-constructor": OFF,
|
|
1020
|
-
// TS
|
|
1021
1031
|
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
1022
|
-
"ts/ban-ts-ignore": OFF,
|
|
1023
|
-
"ts/consistent-indexed-object-style": OFF,
|
|
1024
1032
|
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1025
1033
|
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
1026
|
-
"ts/explicit-function-return-type": OFF,
|
|
1027
|
-
"ts/explicit-member-accessibility": OFF,
|
|
1028
|
-
"ts/explicit-module-boundary-types": OFF,
|
|
1029
|
-
"ts/naming-convention": OFF,
|
|
1030
1034
|
"ts/no-dupe-class-members": "error",
|
|
1031
|
-
"ts/no-
|
|
1032
|
-
"ts/no-empty-interface": OFF,
|
|
1035
|
+
"ts/no-dynamic-delete": OFF,
|
|
1033
1036
|
"ts/no-explicit-any": OFF,
|
|
1034
1037
|
"ts/no-extra-parens": ["error", "functions"],
|
|
1035
1038
|
"ts/no-invalid-this": "error",
|
|
1036
|
-
"ts/no-loss-of-precision": "error",
|
|
1037
1039
|
"ts/no-invalid-void-type": OFF,
|
|
1040
|
+
"ts/no-loss-of-precision": "error",
|
|
1038
1041
|
"ts/no-non-null-assertion": OFF,
|
|
1039
1042
|
"ts/no-redeclare": "error",
|
|
1040
1043
|
"ts/no-require-imports": "error",
|
|
1041
|
-
"ts/unified-signatures": OFF,
|
|
1042
1044
|
"ts/no-unused-vars": OFF,
|
|
1043
1045
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1044
|
-
"ts/parameter-properties": OFF,
|
|
1045
1046
|
"ts/prefer-ts-expect-error": "error",
|
|
1046
|
-
"ts/triple-slash-reference": OFF
|
|
1047
|
+
"ts/triple-slash-reference": OFF,
|
|
1048
|
+
"ts/unified-signatures": OFF
|
|
1047
1049
|
}
|
|
1048
1050
|
},
|
|
1049
1051
|
{
|
|
@@ -1091,13 +1093,12 @@ function typescriptWithLanguageServer(options) {
|
|
|
1091
1093
|
}
|
|
1092
1094
|
},
|
|
1093
1095
|
plugins: {
|
|
1094
|
-
ts:
|
|
1096
|
+
ts: import_eslint_plugin2.default
|
|
1095
1097
|
},
|
|
1096
1098
|
rules: {
|
|
1097
1099
|
"dot-notation": OFF,
|
|
1098
1100
|
"no-implied-eval": OFF,
|
|
1099
1101
|
"no-throw-literal": OFF,
|
|
1100
|
-
"require-await": OFF,
|
|
1101
1102
|
"ts/await-thenable": "error",
|
|
1102
1103
|
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1103
1104
|
"ts/no-floating-promises": "error",
|
|
@@ -1111,7 +1112,6 @@ function typescriptWithLanguageServer(options) {
|
|
|
1111
1112
|
"ts/no-unsafe-call": "error",
|
|
1112
1113
|
"ts/no-unsafe-member-access": "error",
|
|
1113
1114
|
"ts/no-unsafe-return": "error",
|
|
1114
|
-
"ts/require-await": "error",
|
|
1115
1115
|
"ts/restrict-plus-operands": "error",
|
|
1116
1116
|
"ts/restrict-template-expressions": "error",
|
|
1117
1117
|
"ts/unbound-method": "error"
|
|
@@ -1194,6 +1194,7 @@ function vue(options = {}) {
|
|
|
1194
1194
|
...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
|
|
1195
1195
|
...import_eslint_plugin_vue.default.configs.recommended.rules
|
|
1196
1196
|
},
|
|
1197
|
+
"node/prefer-global/process": OFF,
|
|
1197
1198
|
"vue/array-bracket-spacing": ["error", "never"],
|
|
1198
1199
|
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1199
1200
|
"vue/block-order": ["error", {
|
|
@@ -1218,24 +1219,24 @@ function vue(options = {}) {
|
|
|
1218
1219
|
"vue/dot-location": ["error", "property"],
|
|
1219
1220
|
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1220
1221
|
"vue/eqeqeq": ["error", "smart"],
|
|
1222
|
+
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1223
|
+
exceptions: ["-"]
|
|
1224
|
+
}],
|
|
1221
1225
|
"vue/html-indent": ["error", 4, {
|
|
1226
|
+
alignAttributesVertically: true,
|
|
1222
1227
|
attribute: 1,
|
|
1223
1228
|
baseIndent: 1,
|
|
1224
1229
|
closeBracket: 0,
|
|
1225
|
-
alignAttributesVertically: true,
|
|
1226
1230
|
ignores: []
|
|
1227
1231
|
}],
|
|
1228
|
-
"vue/html-comment-content-spacing": ["error", "always", {
|
|
1229
|
-
exceptions: ["-"]
|
|
1230
|
-
}],
|
|
1231
1232
|
"vue/html-self-closing": ["error", {
|
|
1232
1233
|
html: {
|
|
1233
|
-
|
|
1234
|
+
component: "any",
|
|
1234
1235
|
normal: "any",
|
|
1235
|
-
|
|
1236
|
+
void: "never"
|
|
1236
1237
|
},
|
|
1237
|
-
|
|
1238
|
-
|
|
1238
|
+
math: "always",
|
|
1239
|
+
svg: "always"
|
|
1239
1240
|
}],
|
|
1240
1241
|
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1241
1242
|
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
@@ -1254,7 +1255,6 @@ function vue(options = {}) {
|
|
|
1254
1255
|
"WithStatement"
|
|
1255
1256
|
],
|
|
1256
1257
|
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1257
|
-
// reactivity transform
|
|
1258
1258
|
"vue/no-setup-props-reactivity-loss": OFF,
|
|
1259
1259
|
"vue/no-sparse-arrays": "error",
|
|
1260
1260
|
"vue/no-unused-refs": "error",
|
|
@@ -1279,11 +1279,11 @@ function vue(options = {}) {
|
|
|
1279
1279
|
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1280
1280
|
"vue/require-default-prop": OFF,
|
|
1281
1281
|
"vue/require-prop-types": OFF,
|
|
1282
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
1282
1283
|
"vue/space-in-parens": ["error", "never"],
|
|
1283
1284
|
"vue/space-infix-ops": "error",
|
|
1284
1285
|
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1285
|
-
"vue/template-curly-spacing": "error"
|
|
1286
|
-
"vue/singleline-html-element-content-newline": "off"
|
|
1286
|
+
"vue/template-curly-spacing": "error"
|
|
1287
1287
|
}
|
|
1288
1288
|
}
|
|
1289
1289
|
];
|
|
@@ -1300,11 +1300,25 @@ var yml = [
|
|
|
1300
1300
|
yml: import_eslint_plugin_yml.default
|
|
1301
1301
|
},
|
|
1302
1302
|
rules: {
|
|
1303
|
-
...import_eslint_plugin_yml.default.configs.standard.rules,
|
|
1304
1303
|
"style/spaced-comment": OFF,
|
|
1305
|
-
"yml/
|
|
1306
|
-
"yml/
|
|
1307
|
-
"yml/
|
|
1304
|
+
"yml/block-mapping": "error",
|
|
1305
|
+
"yml/block-mapping-question-indicator-newline": "error",
|
|
1306
|
+
"yml/block-sequence": "error",
|
|
1307
|
+
"yml/block-sequence-hyphen-indicator-newline": "error",
|
|
1308
|
+
"yml/flow-mapping-curly-newline": "error",
|
|
1309
|
+
"yml/flow-mapping-curly-spacing": "error",
|
|
1310
|
+
"yml/flow-sequence-bracket-newline": "error",
|
|
1311
|
+
"yml/flow-sequence-bracket-spacing": "error",
|
|
1312
|
+
"yml/indent": ["error", 2],
|
|
1313
|
+
"yml/key-spacing": "error",
|
|
1314
|
+
"yml/no-empty-key": "error",
|
|
1315
|
+
"yml/no-empty-sequence-entry": "error",
|
|
1316
|
+
"yml/no-irregular-whitespace": "error",
|
|
1317
|
+
"yml/no-tab-indent": "error",
|
|
1318
|
+
"yml/plain-scalar": "error",
|
|
1319
|
+
"yml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1320
|
+
"yml/spaced-comment": "error",
|
|
1321
|
+
"yml/vue-custom-block/no-parsing-error": "error"
|
|
1308
1322
|
}
|
|
1309
1323
|
}
|
|
1310
1324
|
];
|
|
@@ -1325,12 +1339,32 @@ function test(options = {}) {
|
|
|
1325
1339
|
}
|
|
1326
1340
|
|
|
1327
1341
|
// src/factory.ts
|
|
1342
|
+
var flatConfigProps = [
|
|
1343
|
+
"files",
|
|
1344
|
+
"ignores",
|
|
1345
|
+
"languageOptions",
|
|
1346
|
+
"linterOptions",
|
|
1347
|
+
"processor",
|
|
1348
|
+
"plugins",
|
|
1349
|
+
"rules",
|
|
1350
|
+
"settings"
|
|
1351
|
+
];
|
|
1328
1352
|
function lincy(options = {}, ...userConfigs) {
|
|
1329
1353
|
const isInEditor = options.isInEditor ?? !!((import_node_process2.default.env.VSCODE_PID || import_node_process2.default.env.JETBRAINS_IDE) && !import_node_process2.default.env.CI);
|
|
1330
1354
|
const enableVue = options.vue ?? (isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli"));
|
|
1331
1355
|
const enableTypeScript = options.typescript ?? isPackageExists("typescript");
|
|
1332
1356
|
const enableStylistic = options.stylistic ?? true;
|
|
1333
|
-
const
|
|
1357
|
+
const enableGitignore = options.gitignore ?? true;
|
|
1358
|
+
const configs = [];
|
|
1359
|
+
if (enableGitignore) {
|
|
1360
|
+
if (typeof enableGitignore !== "boolean") {
|
|
1361
|
+
configs.push([(0, import_eslint_config_flat_gitignore.default)(enableGitignore)]);
|
|
1362
|
+
} else {
|
|
1363
|
+
if (import_node_fs.default.existsSync(".gitignore"))
|
|
1364
|
+
configs.push([(0, import_eslint_config_flat_gitignore.default)()]);
|
|
1365
|
+
}
|
|
1366
|
+
}
|
|
1367
|
+
configs.push(
|
|
1334
1368
|
ignores,
|
|
1335
1369
|
javascript({ isInEditor }),
|
|
1336
1370
|
comments,
|
|
@@ -1338,12 +1372,10 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1338
1372
|
jsdoc,
|
|
1339
1373
|
imports,
|
|
1340
1374
|
unicorn
|
|
1341
|
-
|
|
1375
|
+
);
|
|
1342
1376
|
const componentExts = [];
|
|
1343
1377
|
if (enableVue)
|
|
1344
1378
|
componentExts.push("vue");
|
|
1345
|
-
if (enableStylistic)
|
|
1346
|
-
configs.push(javascriptStylistic);
|
|
1347
1379
|
if (enableTypeScript) {
|
|
1348
1380
|
configs.push(typescript({ componentExts }));
|
|
1349
1381
|
if (typeof enableTypeScript !== "boolean") {
|
|
@@ -1352,9 +1384,9 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1352
1384
|
componentExts
|
|
1353
1385
|
}));
|
|
1354
1386
|
}
|
|
1355
|
-
if (enableStylistic)
|
|
1356
|
-
configs.push(typescriptStylistic);
|
|
1357
1387
|
}
|
|
1388
|
+
if (enableStylistic)
|
|
1389
|
+
configs.push(stylistic);
|
|
1358
1390
|
if (options.test ?? true)
|
|
1359
1391
|
configs.push(test({ isInEditor }));
|
|
1360
1392
|
if (enableVue)
|
|
@@ -1370,10 +1402,18 @@ function lincy(options = {}, ...userConfigs) {
|
|
|
1370
1402
|
configs.push(yml);
|
|
1371
1403
|
if (options.markdown ?? true)
|
|
1372
1404
|
configs.push(markdown({ componentExts }));
|
|
1373
|
-
|
|
1405
|
+
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1406
|
+
if (key in options)
|
|
1407
|
+
acc[key] = options[key];
|
|
1408
|
+
return acc;
|
|
1409
|
+
}, {});
|
|
1410
|
+
if (Object.keys(fusedConfig).length)
|
|
1411
|
+
configs.push([fusedConfig]);
|
|
1412
|
+
const merged = combine(
|
|
1374
1413
|
...configs,
|
|
1375
1414
|
...userConfigs
|
|
1376
1415
|
);
|
|
1416
|
+
return merged;
|
|
1377
1417
|
}
|
|
1378
1418
|
|
|
1379
1419
|
// src/index.ts
|
|
@@ -1385,7 +1425,6 @@ var src_default = lincy;
|
|
|
1385
1425
|
ignores,
|
|
1386
1426
|
imports,
|
|
1387
1427
|
javascript,
|
|
1388
|
-
javascriptStylistic,
|
|
1389
1428
|
jsdoc,
|
|
1390
1429
|
jsonc,
|
|
1391
1430
|
lincy,
|
|
@@ -1403,21 +1442,23 @@ var src_default = lincy;
|
|
|
1403
1442
|
pluginMarkdown,
|
|
1404
1443
|
pluginNoOnlyTests,
|
|
1405
1444
|
pluginNode,
|
|
1406
|
-
|
|
1407
|
-
pluginStylisticTs,
|
|
1445
|
+
pluginStylistic,
|
|
1408
1446
|
pluginTs,
|
|
1409
1447
|
pluginUnicorn,
|
|
1410
1448
|
pluginUnusedImports,
|
|
1411
1449
|
pluginVue,
|
|
1412
1450
|
pluginYml,
|
|
1451
|
+
recordRulesState,
|
|
1452
|
+
recordRulesStateConfigs,
|
|
1413
1453
|
renameRules,
|
|
1414
1454
|
sortPackageJson,
|
|
1415
1455
|
sortTsconfig,
|
|
1456
|
+
stylistic,
|
|
1416
1457
|
test,
|
|
1417
1458
|
typescript,
|
|
1418
|
-
typescriptStylistic,
|
|
1419
1459
|
typescriptWithLanguageServer,
|
|
1420
1460
|
unicorn,
|
|
1421
1461
|
vue,
|
|
1462
|
+
warnUnnecessaryOffRules,
|
|
1422
1463
|
yml
|
|
1423
1464
|
});
|