@kirklin/eslint-config 2.6.1 → 2.7.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/LICENSE +21 -21
- package/README.md +6 -4
- package/README.zh-cn.md +3 -1
- package/dist/cli.cjs +140 -138
- package/dist/cli.js +140 -138
- package/dist/index.cjs +231 -181
- package/dist/index.d.cts +1271 -559
- package/dist/index.d.ts +1271 -559
- package/dist/index.js +240 -191
- package/package.json +54 -55
package/dist/index.cjs
CHANGED
|
@@ -67,6 +67,7 @@ __export(src_exports, {
|
|
|
67
67
|
comments: () => comments,
|
|
68
68
|
default: () => src_default,
|
|
69
69
|
defaultPluginRenaming: () => defaultPluginRenaming,
|
|
70
|
+
disables: () => disables,
|
|
70
71
|
ensurePackages: () => ensurePackages,
|
|
71
72
|
formatters: () => formatters,
|
|
72
73
|
getOverrides: () => getOverrides,
|
|
@@ -106,13 +107,13 @@ __export(src_exports, {
|
|
|
106
107
|
});
|
|
107
108
|
module.exports = __toCommonJS(src_exports);
|
|
108
109
|
|
|
109
|
-
// node_modules/.pnpm/tsup@8.
|
|
110
|
+
// node_modules/.pnpm/tsup@8.3.5_jiti@2.4.0_postcss@8.4.47_tsx@4.19.2_typescript@5.6.3_yaml@2.5.0/node_modules/tsup/assets/cjs_shims.js
|
|
110
111
|
var getImportMetaUrl = () => typeof document === "undefined" ? new URL(`file:${__filename}`).href : document.currentScript && document.currentScript.src || new URL("main.js", document.baseURI).href;
|
|
111
112
|
var importMetaUrl = /* @__PURE__ */ getImportMetaUrl();
|
|
112
113
|
|
|
113
114
|
// src/factory.ts
|
|
114
|
-
var import_local_pkg4 = require("local-pkg");
|
|
115
115
|
var import_eslint_flat_config_utils = require("eslint-flat-config-utils");
|
|
116
|
+
var import_local_pkg4 = require("local-pkg");
|
|
116
117
|
|
|
117
118
|
// src/globs.ts
|
|
118
119
|
var GLOB_SRC_EXT = "?([cm])[jt]s?(x)";
|
|
@@ -346,7 +347,6 @@ async function astro(options = {}) {
|
|
|
346
347
|
...stylistic2 ? {
|
|
347
348
|
"style/indent": "off",
|
|
348
349
|
"style/jsx-closing-tag-location": "off",
|
|
349
|
-
"style/jsx-indent": "off",
|
|
350
350
|
"style/jsx-one-expression-per-line": "off",
|
|
351
351
|
"style/no-multiple-empty-lines": "off"
|
|
352
352
|
} : {},
|
|
@@ -368,13 +368,13 @@ async function command() {
|
|
|
368
368
|
}
|
|
369
369
|
|
|
370
370
|
// src/plugins.ts
|
|
371
|
-
var import_eslint_plugin_kirklin = __toESM(require("eslint-plugin-kirklin"), 1);
|
|
372
371
|
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
373
372
|
var pluginImport = __toESM(require("eslint-plugin-import-x"), 1);
|
|
373
|
+
var import_eslint_plugin_kirklin = __toESM(require("eslint-plugin-kirklin"), 1);
|
|
374
374
|
var import_eslint_plugin_n = __toESM(require("eslint-plugin-n"), 1);
|
|
375
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
375
376
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
376
377
|
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
377
|
-
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
378
378
|
|
|
379
379
|
// src/configs/comments.ts
|
|
380
380
|
async function comments() {
|
|
@@ -394,6 +394,63 @@ async function comments() {
|
|
|
394
394
|
];
|
|
395
395
|
}
|
|
396
396
|
|
|
397
|
+
// src/configs/disables.ts
|
|
398
|
+
async function disables() {
|
|
399
|
+
return [
|
|
400
|
+
{
|
|
401
|
+
files: [`**/scripts/${GLOB_SRC}`],
|
|
402
|
+
name: "kirklin/disables/scripts",
|
|
403
|
+
rules: {
|
|
404
|
+
"kirklin/no-top-level-await": "off",
|
|
405
|
+
"no-console": "off",
|
|
406
|
+
"ts/explicit-function-return-type": "off"
|
|
407
|
+
}
|
|
408
|
+
},
|
|
409
|
+
{
|
|
410
|
+
files: [`**/cli/${GLOB_SRC}`, `**/cli.${GLOB_SRC_EXT}`],
|
|
411
|
+
name: "kirklin/disables/cli",
|
|
412
|
+
rules: {
|
|
413
|
+
"kirklin/no-top-level-await": "off",
|
|
414
|
+
"no-console": "off"
|
|
415
|
+
}
|
|
416
|
+
},
|
|
417
|
+
{
|
|
418
|
+
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
419
|
+
name: "kirklin/disables/bin",
|
|
420
|
+
rules: {
|
|
421
|
+
"kirklin/no-import-dist": "off",
|
|
422
|
+
"kirklin/no-import-node-modules-by-path": "off"
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
files: ["**/*.d.?([cm])ts"],
|
|
427
|
+
name: "kirklin/disables/dts",
|
|
428
|
+
rules: {
|
|
429
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
430
|
+
"import/no-duplicates": "off",
|
|
431
|
+
"no-restricted-syntax": "off",
|
|
432
|
+
"unused-imports/no-unused-vars": "off"
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
437
|
+
name: "kirklin/disables/cjs",
|
|
438
|
+
rules: {
|
|
439
|
+
"ts/no-require-imports": "off"
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
files: [`**/*.config.${GLOB_SRC_EXT}`, `**/*.config.*.${GLOB_SRC_EXT}`],
|
|
444
|
+
name: "kirklin/disables/config-files",
|
|
445
|
+
rules: {
|
|
446
|
+
"kirklin/no-top-level-await": "off",
|
|
447
|
+
"no-console": "off",
|
|
448
|
+
"ts/explicit-function-return-type": "off"
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
];
|
|
452
|
+
}
|
|
453
|
+
|
|
397
454
|
// src/configs/formatters.ts
|
|
398
455
|
var import_local_pkg2 = require("local-pkg");
|
|
399
456
|
|
|
@@ -434,6 +491,7 @@ async function stylistic(options = {}) {
|
|
|
434
491
|
},
|
|
435
492
|
rules: {
|
|
436
493
|
...config.rules,
|
|
494
|
+
"kirklin/consistent-chaining": "error",
|
|
437
495
|
"kirklin/consistent-list-newline": "error",
|
|
438
496
|
"style/brace-style": ["error", "1tbs", { allowSingleLine: false }],
|
|
439
497
|
"style/member-delimiter-style": ["error", { multiline: { delimiter: "semi" } }],
|
|
@@ -451,6 +509,16 @@ async function stylistic(options = {}) {
|
|
|
451
509
|
}
|
|
452
510
|
|
|
453
511
|
// src/configs/formatters.ts
|
|
512
|
+
function mergePrettierOptions(options, overrides = {}) {
|
|
513
|
+
return {
|
|
514
|
+
...options,
|
|
515
|
+
...overrides,
|
|
516
|
+
plugins: [
|
|
517
|
+
...overrides.plugins || [],
|
|
518
|
+
...options.plugins || []
|
|
519
|
+
]
|
|
520
|
+
};
|
|
521
|
+
}
|
|
454
522
|
async function formatters(options = {}, stylistic2 = {}) {
|
|
455
523
|
if (options === true) {
|
|
456
524
|
const isPrettierPluginXmlInScope = isPackageInScope("@prettier/plugin-xml");
|
|
@@ -528,10 +596,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
528
596
|
rules: {
|
|
529
597
|
"format/prettier": [
|
|
530
598
|
"error",
|
|
531
|
-
{
|
|
532
|
-
...prettierOptions,
|
|
599
|
+
mergePrettierOptions(prettierOptions, {
|
|
533
600
|
parser: "css"
|
|
534
|
-
}
|
|
601
|
+
})
|
|
535
602
|
]
|
|
536
603
|
}
|
|
537
604
|
},
|
|
@@ -544,10 +611,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
544
611
|
rules: {
|
|
545
612
|
"format/prettier": [
|
|
546
613
|
"error",
|
|
547
|
-
{
|
|
548
|
-
...prettierOptions,
|
|
614
|
+
mergePrettierOptions(prettierOptions, {
|
|
549
615
|
parser: "scss"
|
|
550
|
-
}
|
|
616
|
+
})
|
|
551
617
|
]
|
|
552
618
|
}
|
|
553
619
|
},
|
|
@@ -560,10 +626,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
560
626
|
rules: {
|
|
561
627
|
"format/prettier": [
|
|
562
628
|
"error",
|
|
563
|
-
{
|
|
564
|
-
...prettierOptions,
|
|
629
|
+
mergePrettierOptions(prettierOptions, {
|
|
565
630
|
parser: "less"
|
|
566
|
-
}
|
|
631
|
+
})
|
|
567
632
|
]
|
|
568
633
|
}
|
|
569
634
|
}
|
|
@@ -579,10 +644,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
579
644
|
rules: {
|
|
580
645
|
"format/prettier": [
|
|
581
646
|
"error",
|
|
582
|
-
{
|
|
583
|
-
...prettierOptions,
|
|
647
|
+
mergePrettierOptions(prettierOptions, {
|
|
584
648
|
parser: "html"
|
|
585
|
-
}
|
|
649
|
+
})
|
|
586
650
|
]
|
|
587
651
|
}
|
|
588
652
|
});
|
|
@@ -597,14 +661,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
597
661
|
rules: {
|
|
598
662
|
"format/prettier": [
|
|
599
663
|
"error",
|
|
600
|
-
{
|
|
601
|
-
...prettierXmlOptions,
|
|
602
|
-
...prettierOptions,
|
|
664
|
+
mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
|
|
603
665
|
parser: "xml",
|
|
604
666
|
plugins: [
|
|
605
667
|
"@prettier/plugin-xml"
|
|
606
668
|
]
|
|
607
|
-
}
|
|
669
|
+
})
|
|
608
670
|
]
|
|
609
671
|
}
|
|
610
672
|
});
|
|
@@ -619,14 +681,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
619
681
|
rules: {
|
|
620
682
|
"format/prettier": [
|
|
621
683
|
"error",
|
|
622
|
-
{
|
|
623
|
-
...prettierXmlOptions,
|
|
624
|
-
...prettierOptions,
|
|
684
|
+
mergePrettierOptions({ ...prettierXmlOptions, ...prettierOptions }, {
|
|
625
685
|
parser: "xml",
|
|
626
686
|
plugins: [
|
|
627
687
|
"@prettier/plugin-xml"
|
|
628
688
|
]
|
|
629
|
-
}
|
|
689
|
+
})
|
|
630
690
|
]
|
|
631
691
|
}
|
|
632
692
|
});
|
|
@@ -644,11 +704,10 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
644
704
|
rules: {
|
|
645
705
|
[`format/${formater}`]: [
|
|
646
706
|
"error",
|
|
647
|
-
formater === "prettier" ? {
|
|
648
|
-
...prettierOptions,
|
|
707
|
+
formater === "prettier" ? mergePrettierOptions(prettierOptions, {
|
|
649
708
|
embeddedLanguageFormatting: "off",
|
|
650
709
|
parser: "markdown"
|
|
651
|
-
} : {
|
|
710
|
+
}) : {
|
|
652
711
|
...dprintOptions,
|
|
653
712
|
language: "markdown"
|
|
654
713
|
}
|
|
@@ -665,14 +724,13 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
665
724
|
rules: {
|
|
666
725
|
"format/prettier": [
|
|
667
726
|
"error",
|
|
668
|
-
{
|
|
669
|
-
...prettierOptions,
|
|
727
|
+
mergePrettierOptions(prettierOptions, {
|
|
670
728
|
embeddedLanguageFormatting: "off",
|
|
671
729
|
parser: "slidev",
|
|
672
730
|
plugins: [
|
|
673
731
|
"prettier-plugin-slidev"
|
|
674
732
|
]
|
|
675
|
-
}
|
|
733
|
+
})
|
|
676
734
|
]
|
|
677
735
|
}
|
|
678
736
|
});
|
|
@@ -688,13 +746,12 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
688
746
|
rules: {
|
|
689
747
|
"format/prettier": [
|
|
690
748
|
"error",
|
|
691
|
-
{
|
|
692
|
-
...prettierOptions,
|
|
749
|
+
mergePrettierOptions(prettierOptions, {
|
|
693
750
|
parser: "astro",
|
|
694
751
|
plugins: [
|
|
695
752
|
"prettier-plugin-astro"
|
|
696
753
|
]
|
|
697
|
-
}
|
|
754
|
+
})
|
|
698
755
|
]
|
|
699
756
|
}
|
|
700
757
|
});
|
|
@@ -722,10 +779,9 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
722
779
|
rules: {
|
|
723
780
|
"format/prettier": [
|
|
724
781
|
"error",
|
|
725
|
-
{
|
|
726
|
-
...prettierOptions,
|
|
782
|
+
mergePrettierOptions(prettierOptions, {
|
|
727
783
|
parser: "graphql"
|
|
728
|
-
}
|
|
784
|
+
})
|
|
729
785
|
]
|
|
730
786
|
}
|
|
731
787
|
});
|
|
@@ -734,10 +790,14 @@ async function formatters(options = {}, stylistic2 = {}) {
|
|
|
734
790
|
}
|
|
735
791
|
|
|
736
792
|
// src/configs/ignores.ts
|
|
737
|
-
async function ignores() {
|
|
793
|
+
async function ignores(userIgnores = []) {
|
|
738
794
|
return [
|
|
739
795
|
{
|
|
740
|
-
ignores:
|
|
796
|
+
ignores: [
|
|
797
|
+
...GLOB_EXCLUDE,
|
|
798
|
+
...userIgnores
|
|
799
|
+
],
|
|
800
|
+
name: "kirklin/ignores"
|
|
741
801
|
}
|
|
742
802
|
];
|
|
743
803
|
}
|
|
@@ -761,7 +821,6 @@ async function imports(options = {}) {
|
|
|
761
821
|
"import/no-named-default": "error",
|
|
762
822
|
"import/no-self-import": "error",
|
|
763
823
|
"import/no-webpack-loader-syntax": "error",
|
|
764
|
-
"import/order": "error",
|
|
765
824
|
"kirklin/import-dedupe": "error",
|
|
766
825
|
"kirklin/no-import-dist": "error",
|
|
767
826
|
"kirklin/no-import-node-modules-by-path": "error",
|
|
@@ -769,14 +828,6 @@ async function imports(options = {}) {
|
|
|
769
828
|
"import/newline-after-import": ["error", { count: 1 }]
|
|
770
829
|
} : {}
|
|
771
830
|
}
|
|
772
|
-
},
|
|
773
|
-
{
|
|
774
|
-
files: ["**/bin/**/*", `**/bin.${GLOB_SRC_EXT}`],
|
|
775
|
-
name: "kirklin/imports/disables/bin",
|
|
776
|
-
rules: {
|
|
777
|
-
"kirklin/no-import-dist": "off",
|
|
778
|
-
"kirklin/no-import-node-modules-by-path": "off"
|
|
779
|
-
}
|
|
780
831
|
}
|
|
781
832
|
];
|
|
782
833
|
}
|
|
@@ -828,6 +879,7 @@ async function javascript(options = {}) {
|
|
|
828
879
|
"default-case-last": "error",
|
|
829
880
|
"dot-notation": ["error", { allowKeywords: true }],
|
|
830
881
|
"eqeqeq": ["error", "smart"],
|
|
882
|
+
"kirklin/no-top-level-await": "error",
|
|
831
883
|
"new-cap": ["error", { capIsNew: false, newIsCap: true, properties: true }],
|
|
832
884
|
"no-alert": "error",
|
|
833
885
|
"no-array-constructor": "error",
|
|
@@ -893,9 +945,6 @@ async function javascript(options = {}) {
|
|
|
893
945
|
],
|
|
894
946
|
"no-restricted-syntax": [
|
|
895
947
|
"error",
|
|
896
|
-
"DebuggerStatement",
|
|
897
|
-
"LabeledStatement",
|
|
898
|
-
"WithStatement",
|
|
899
948
|
"TSEnumDeclaration[const=true]",
|
|
900
949
|
"TSExportAssignment"
|
|
901
950
|
],
|
|
@@ -966,16 +1015,6 @@ async function javascript(options = {}) {
|
|
|
966
1015
|
"prefer-rest-params": "error",
|
|
967
1016
|
"prefer-spread": "error",
|
|
968
1017
|
"prefer-template": "error",
|
|
969
|
-
"sort-imports": [
|
|
970
|
-
"error",
|
|
971
|
-
{
|
|
972
|
-
allowSeparatedGroups: false,
|
|
973
|
-
ignoreCase: false,
|
|
974
|
-
ignoreDeclarationSort: true,
|
|
975
|
-
ignoreMemberSort: false,
|
|
976
|
-
memberSyntaxSortOrder: ["none", "all", "multiple", "single"]
|
|
977
|
-
}
|
|
978
|
-
],
|
|
979
1018
|
"symbol-description": "error",
|
|
980
1019
|
"unicode-bom": ["error", "never"],
|
|
981
1020
|
"unused-imports/no-unused-imports": isInEditor ? "off" : "error",
|
|
@@ -995,13 +1034,6 @@ async function javascript(options = {}) {
|
|
|
995
1034
|
"yoda": ["error", "never"],
|
|
996
1035
|
...overrides
|
|
997
1036
|
}
|
|
998
|
-
},
|
|
999
|
-
{
|
|
1000
|
-
files: [`scripts/${GLOB_SRC}`, `cli.${GLOB_SRC_EXT}`],
|
|
1001
|
-
name: "kirklin/javascript/disables/cli",
|
|
1002
|
-
rules: {
|
|
1003
|
-
"no-console": "off"
|
|
1004
|
-
}
|
|
1005
1037
|
}
|
|
1006
1038
|
];
|
|
1007
1039
|
}
|
|
@@ -1042,23 +1074,6 @@ async function jsdoc(options = {}) {
|
|
|
1042
1074
|
];
|
|
1043
1075
|
}
|
|
1044
1076
|
|
|
1045
|
-
// src/configs/jsx.ts
|
|
1046
|
-
async function jsx() {
|
|
1047
|
-
return [
|
|
1048
|
-
{
|
|
1049
|
-
files: [GLOB_JSX, GLOB_TSX],
|
|
1050
|
-
languageOptions: {
|
|
1051
|
-
parserOptions: {
|
|
1052
|
-
ecmaFeatures: {
|
|
1053
|
-
jsx: true
|
|
1054
|
-
}
|
|
1055
|
-
}
|
|
1056
|
-
},
|
|
1057
|
-
name: "kirklin/jsx/setup"
|
|
1058
|
-
}
|
|
1059
|
-
];
|
|
1060
|
-
}
|
|
1061
|
-
|
|
1062
1077
|
// src/configs/jsonc.ts
|
|
1063
1078
|
async function jsonc(options = {}) {
|
|
1064
1079
|
const {
|
|
@@ -1134,6 +1149,23 @@ async function jsonc(options = {}) {
|
|
|
1134
1149
|
];
|
|
1135
1150
|
}
|
|
1136
1151
|
|
|
1152
|
+
// src/configs/jsx.ts
|
|
1153
|
+
async function jsx() {
|
|
1154
|
+
return [
|
|
1155
|
+
{
|
|
1156
|
+
files: [GLOB_JSX, GLOB_TSX],
|
|
1157
|
+
languageOptions: {
|
|
1158
|
+
parserOptions: {
|
|
1159
|
+
ecmaFeatures: {
|
|
1160
|
+
jsx: true
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
},
|
|
1164
|
+
name: "kirklin/jsx/setup"
|
|
1165
|
+
}
|
|
1166
|
+
];
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1137
1169
|
// src/configs/markdown.ts
|
|
1138
1170
|
var import_eslint_merge_processors = require("eslint-merge-processors");
|
|
1139
1171
|
async function markdown(options = {}) {
|
|
@@ -1142,7 +1174,7 @@ async function markdown(options = {}) {
|
|
|
1142
1174
|
files = [GLOB_MARKDOWN],
|
|
1143
1175
|
overrides = {}
|
|
1144
1176
|
} = options;
|
|
1145
|
-
const markdown2 = await interopDefault(import("eslint
|
|
1177
|
+
const markdown2 = await interopDefault(import("@eslint/markdown"));
|
|
1146
1178
|
return [
|
|
1147
1179
|
{
|
|
1148
1180
|
name: "kirklin/markdown/setup",
|
|
@@ -1184,6 +1216,7 @@ async function markdown(options = {}) {
|
|
|
1184
1216
|
name: "kirklin/markdown/disables",
|
|
1185
1217
|
rules: {
|
|
1186
1218
|
"import/newline-after-import": "off",
|
|
1219
|
+
"kirklin/no-top-level-await": "off",
|
|
1187
1220
|
"no-alert": "off",
|
|
1188
1221
|
"no-console": "off",
|
|
1189
1222
|
"no-labels": "off",
|
|
@@ -1197,13 +1230,13 @@ async function markdown(options = {}) {
|
|
|
1197
1230
|
"style/comma-dangle": "off",
|
|
1198
1231
|
"style/eol-last": "off",
|
|
1199
1232
|
"ts/consistent-type-imports": "off",
|
|
1233
|
+
"ts/explicit-function-return-type": "off",
|
|
1200
1234
|
"ts/no-namespace": "off",
|
|
1201
1235
|
"ts/no-redeclare": "off",
|
|
1202
1236
|
"ts/no-require-imports": "off",
|
|
1203
1237
|
"ts/no-unused-expressions": "off",
|
|
1204
1238
|
"ts/no-unused-vars": "off",
|
|
1205
1239
|
"ts/no-use-before-define": "off",
|
|
1206
|
-
"ts/no-var-requires": "off",
|
|
1207
1240
|
"unicode-bom": "off",
|
|
1208
1241
|
"unused-imports/no-unused-imports": "off",
|
|
1209
1242
|
"unused-imports/no-unused-vars": "off",
|
|
@@ -1242,6 +1275,27 @@ async function perfectionist() {
|
|
|
1242
1275
|
name: "kirklin/perfectionist/setup",
|
|
1243
1276
|
plugins: {
|
|
1244
1277
|
perfectionist: import_eslint_plugin_perfectionist.default
|
|
1278
|
+
},
|
|
1279
|
+
rules: {
|
|
1280
|
+
"perfectionist/sort-exports": ["error", { order: "asc", type: "natural" }],
|
|
1281
|
+
"perfectionist/sort-imports": ["error", {
|
|
1282
|
+
groups: [
|
|
1283
|
+
"type",
|
|
1284
|
+
["parent-type", "sibling-type", "index-type"],
|
|
1285
|
+
"builtin",
|
|
1286
|
+
"external",
|
|
1287
|
+
["internal", "internal-type"],
|
|
1288
|
+
["parent", "sibling", "index"],
|
|
1289
|
+
"side-effect",
|
|
1290
|
+
"object",
|
|
1291
|
+
"unknown"
|
|
1292
|
+
],
|
|
1293
|
+
newlinesBetween: "ignore",
|
|
1294
|
+
order: "asc",
|
|
1295
|
+
type: "natural"
|
|
1296
|
+
}],
|
|
1297
|
+
"perfectionist/sort-named-exports": ["error", { order: "asc", type: "natural" }],
|
|
1298
|
+
"perfectionist/sort-named-imports": ["error", { order: "asc", type: "natural" }]
|
|
1245
1299
|
}
|
|
1246
1300
|
}
|
|
1247
1301
|
];
|
|
@@ -1336,6 +1390,13 @@ async function react(options = {}) {
|
|
|
1336
1390
|
allowConstantExport: isAllowConstantExport,
|
|
1337
1391
|
allowExportNames: [
|
|
1338
1392
|
...isUsingNext ? [
|
|
1393
|
+
"dynamic",
|
|
1394
|
+
"dynamicParams",
|
|
1395
|
+
"revalidate",
|
|
1396
|
+
"fetchCache",
|
|
1397
|
+
"runtime",
|
|
1398
|
+
"preferredRegion",
|
|
1399
|
+
"maxDuration",
|
|
1339
1400
|
"config",
|
|
1340
1401
|
"generateStaticParams",
|
|
1341
1402
|
"metadata",
|
|
@@ -1400,6 +1461,32 @@ async function react(options = {}) {
|
|
|
1400
1461
|
];
|
|
1401
1462
|
}
|
|
1402
1463
|
|
|
1464
|
+
// src/configs/regexp.ts
|
|
1465
|
+
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
1466
|
+
async function regexp(options = {}) {
|
|
1467
|
+
const config = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
1468
|
+
const rules = {
|
|
1469
|
+
...config.rules
|
|
1470
|
+
};
|
|
1471
|
+
if (options.level === "warn") {
|
|
1472
|
+
for (const key in rules) {
|
|
1473
|
+
if (rules[key] === "error") {
|
|
1474
|
+
rules[key] = "warn";
|
|
1475
|
+
}
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
return [
|
|
1479
|
+
{
|
|
1480
|
+
...config,
|
|
1481
|
+
name: "kirklin/regexp/rules",
|
|
1482
|
+
rules: {
|
|
1483
|
+
...rules,
|
|
1484
|
+
...options.overrides
|
|
1485
|
+
}
|
|
1486
|
+
}
|
|
1487
|
+
];
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1403
1490
|
// src/configs/solid.ts
|
|
1404
1491
|
async function solid(options = {}) {
|
|
1405
1492
|
const {
|
|
@@ -1792,7 +1879,7 @@ async function svelte(options = {}) {
|
|
|
1792
1879
|
// superseded by svelte/no-trailing-spaces
|
|
1793
1880
|
"svelte/derived-has-same-inputs-outputs": "error",
|
|
1794
1881
|
"svelte/html-closing-bracket-spacing": "error",
|
|
1795
|
-
"svelte/html-quotes": ["error", { prefer:
|
|
1882
|
+
"svelte/html-quotes": ["error", { prefer: "double" }],
|
|
1796
1883
|
"svelte/indent": ["error", { alignAttributesVertically: true, indent }],
|
|
1797
1884
|
"svelte/mustache-spacing": "error",
|
|
1798
1885
|
"svelte/no-spaces-around-equal-signs-in-attribute": "error",
|
|
@@ -1840,14 +1927,19 @@ async function test(options = {}) {
|
|
|
1840
1927
|
files,
|
|
1841
1928
|
name: "kirklin/test/rules",
|
|
1842
1929
|
rules: {
|
|
1843
|
-
"node/prefer-global/process": "off",
|
|
1844
1930
|
"test/consistent-test-it": ["error", { fn: "it", withinDescribe: "it" }],
|
|
1845
1931
|
"test/no-identical-title": "error",
|
|
1846
1932
|
"test/no-import-node-test": "error",
|
|
1847
1933
|
"test/no-only-tests": isInEditor ? "off" : "error",
|
|
1848
1934
|
"test/prefer-hooks-in-order": "error",
|
|
1849
1935
|
"test/prefer-lowercase-title": "error",
|
|
1850
|
-
|
|
1936
|
+
// Disables
|
|
1937
|
+
...{
|
|
1938
|
+
"kirklin/no-top-level-await": "off",
|
|
1939
|
+
"no-unused-expressions": "off",
|
|
1940
|
+
"node/prefer-global/process": "off",
|
|
1941
|
+
"ts/explicit-function-return-type": "off"
|
|
1942
|
+
},
|
|
1851
1943
|
...overrides
|
|
1852
1944
|
}
|
|
1853
1945
|
}
|
|
@@ -2016,7 +2108,6 @@ async function typescript(options = {}) {
|
|
|
2016
2108
|
{ "@typescript-eslint": "ts" }
|
|
2017
2109
|
),
|
|
2018
2110
|
"no-dupe-class-members": "off",
|
|
2019
|
-
"no-loss-of-precision": "off",
|
|
2020
2111
|
"no-redeclare": "off",
|
|
2021
2112
|
"no-use-before-define": "off",
|
|
2022
2113
|
"no-useless-constructor": "off",
|
|
@@ -2035,10 +2126,14 @@ async function typescript(options = {}) {
|
|
|
2035
2126
|
"ts/no-extraneous-class": "off",
|
|
2036
2127
|
"ts/no-import-type-side-effects": "error",
|
|
2037
2128
|
"ts/no-invalid-void-type": "off",
|
|
2038
|
-
"ts/no-loss-of-precision": "error",
|
|
2039
2129
|
"ts/no-non-null-assertion": "off",
|
|
2040
|
-
"ts/no-redeclare": "error",
|
|
2130
|
+
"ts/no-redeclare": ["error", { builtinGlobals: false }],
|
|
2041
2131
|
"ts/no-require-imports": "error",
|
|
2132
|
+
"ts/no-unused-expressions": ["error", {
|
|
2133
|
+
allowShortCircuit: true,
|
|
2134
|
+
allowTaggedTemplates: true,
|
|
2135
|
+
allowTernary: true
|
|
2136
|
+
}],
|
|
2042
2137
|
"ts/no-unused-vars": "off",
|
|
2043
2138
|
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
2044
2139
|
"ts/no-useless-constructor": "off",
|
|
@@ -2063,37 +2158,12 @@ async function typescript(options = {}) {
|
|
|
2063
2158
|
...typeAwareRules,
|
|
2064
2159
|
...overridesTypeAware
|
|
2065
2160
|
}
|
|
2066
|
-
}] : []
|
|
2067
|
-
{
|
|
2068
|
-
files: ["**/*.d.?([cm])ts"],
|
|
2069
|
-
name: "kirklin/typescript/disables/dts",
|
|
2070
|
-
rules: {
|
|
2071
|
-
"eslint-comments/no-unlimited-disable": "off",
|
|
2072
|
-
"import/no-duplicates": "off",
|
|
2073
|
-
"no-restricted-syntax": "off",
|
|
2074
|
-
"unused-imports/no-unused-vars": "off"
|
|
2075
|
-
}
|
|
2076
|
-
},
|
|
2077
|
-
{
|
|
2078
|
-
files: ["**/*.{test,spec}.ts?(x)"],
|
|
2079
|
-
name: "kirklin/typescript/disables/test",
|
|
2080
|
-
rules: {
|
|
2081
|
-
"no-unused-expressions": "off"
|
|
2082
|
-
}
|
|
2083
|
-
},
|
|
2084
|
-
{
|
|
2085
|
-
files: ["**/*.js", "**/*.cjs"],
|
|
2086
|
-
name: "kirklin/typescript/disables/cjs",
|
|
2087
|
-
rules: {
|
|
2088
|
-
"ts/no-require-imports": "off",
|
|
2089
|
-
"ts/no-var-requires": "off"
|
|
2090
|
-
}
|
|
2091
|
-
}
|
|
2161
|
+
}] : []
|
|
2092
2162
|
];
|
|
2093
2163
|
}
|
|
2094
2164
|
|
|
2095
2165
|
// src/configs/unicorn.ts
|
|
2096
|
-
async function unicorn() {
|
|
2166
|
+
async function unicorn(options = {}) {
|
|
2097
2167
|
return [
|
|
2098
2168
|
{
|
|
2099
2169
|
name: "kirklin/unicorn/rules",
|
|
@@ -2101,32 +2171,23 @@ async function unicorn() {
|
|
|
2101
2171
|
unicorn: import_eslint_plugin_unicorn.default
|
|
2102
2172
|
},
|
|
2103
2173
|
rules: {
|
|
2104
|
-
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
|
|
2111
|
-
|
|
2112
|
-
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2118
|
-
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
"unicorn/prefer-node-protocol": "error",
|
|
2122
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
2123
|
-
"unicorn/prefer-number-properties": "error",
|
|
2124
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
2125
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
2126
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
2127
|
-
"unicorn/prefer-type-error": "error",
|
|
2128
|
-
// Use new when throwing error
|
|
2129
|
-
"unicorn/throw-new-error": "error"
|
|
2174
|
+
...options.allRecommended ? import_eslint_plugin_unicorn.default.configs["flat/recommended"].rules : {
|
|
2175
|
+
"unicorn/consistent-empty-array-spread": "error",
|
|
2176
|
+
"unicorn/error-message": "error",
|
|
2177
|
+
"unicorn/escape-case": "error",
|
|
2178
|
+
"unicorn/new-for-builtins": "error",
|
|
2179
|
+
"unicorn/no-instanceof-array": "error",
|
|
2180
|
+
"unicorn/no-new-array": "error",
|
|
2181
|
+
"unicorn/no-new-buffer": "error",
|
|
2182
|
+
"unicorn/number-literal-case": "error",
|
|
2183
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
2184
|
+
"unicorn/prefer-includes": "error",
|
|
2185
|
+
"unicorn/prefer-node-protocol": "error",
|
|
2186
|
+
"unicorn/prefer-number-properties": "error",
|
|
2187
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
2188
|
+
"unicorn/prefer-type-error": "error",
|
|
2189
|
+
"unicorn/throw-new-error": "error"
|
|
2190
|
+
}
|
|
2130
2191
|
}
|
|
2131
2192
|
}
|
|
2132
2193
|
];
|
|
@@ -2183,7 +2244,6 @@ async function vue(options = {}) {
|
|
|
2183
2244
|
parserVue,
|
|
2184
2245
|
processorVueBlocks
|
|
2185
2246
|
] = await Promise.all([
|
|
2186
|
-
// @ts-expect-error missing types
|
|
2187
2247
|
interopDefault(import("eslint-plugin-vue")),
|
|
2188
2248
|
interopDefault(import("vue-eslint-parser")),
|
|
2189
2249
|
interopDefault(import("eslint-processor-vue-blocks"))
|
|
@@ -2250,7 +2310,9 @@ async function vue(options = {}) {
|
|
|
2250
2310
|
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
2251
2311
|
...pluginVue.configs["vue3-recommended"].rules
|
|
2252
2312
|
},
|
|
2313
|
+
"kirklin/no-top-level-await": "off",
|
|
2253
2314
|
"node/prefer-global/process": "off",
|
|
2315
|
+
"ts/explicit-function-return-type": "off",
|
|
2254
2316
|
"vue/block-order": ["error", {
|
|
2255
2317
|
order: ["script", "template", "style"]
|
|
2256
2318
|
}],
|
|
@@ -2387,7 +2449,7 @@ async function yaml(options = {}) {
|
|
|
2387
2449
|
"yaml/indent": ["error", indent === "tab" ? 2 : indent],
|
|
2388
2450
|
"yaml/key-spacing": "error",
|
|
2389
2451
|
"yaml/no-tab-indent": "error",
|
|
2390
|
-
"yaml/quotes": ["error", { avoidEscape: false, prefer:
|
|
2452
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: "double" }],
|
|
2391
2453
|
"yaml/spaced-comment": "error"
|
|
2392
2454
|
} : {},
|
|
2393
2455
|
...overrides
|
|
@@ -2396,37 +2458,9 @@ async function yaml(options = {}) {
|
|
|
2396
2458
|
];
|
|
2397
2459
|
}
|
|
2398
2460
|
|
|
2399
|
-
// src/configs/regexp.ts
|
|
2400
|
-
var import_eslint_plugin_regexp = require("eslint-plugin-regexp");
|
|
2401
|
-
async function regexp(options = {}) {
|
|
2402
|
-
const config = import_eslint_plugin_regexp.configs["flat/recommended"];
|
|
2403
|
-
const rules = {
|
|
2404
|
-
...config.rules
|
|
2405
|
-
};
|
|
2406
|
-
if (options.level === "warn") {
|
|
2407
|
-
for (const key in rules) {
|
|
2408
|
-
if (rules[key] === "error") {
|
|
2409
|
-
rules[key] = "warn";
|
|
2410
|
-
}
|
|
2411
|
-
}
|
|
2412
|
-
}
|
|
2413
|
-
return [
|
|
2414
|
-
{
|
|
2415
|
-
...config,
|
|
2416
|
-
name: "kirklin/regexp/rules",
|
|
2417
|
-
rules: {
|
|
2418
|
-
...rules,
|
|
2419
|
-
...options.overrides
|
|
2420
|
-
}
|
|
2421
|
-
}
|
|
2422
|
-
];
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
2461
|
// src/factory.ts
|
|
2426
2462
|
var flatConfigProps = [
|
|
2427
2463
|
"name",
|
|
2428
|
-
"files",
|
|
2429
|
-
"ignores",
|
|
2430
2464
|
"languageOptions",
|
|
2431
2465
|
"linterOptions",
|
|
2432
2466
|
"processor",
|
|
@@ -2464,6 +2498,7 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2464
2498
|
solid: enableSolid = false,
|
|
2465
2499
|
svelte: enableSvelte = false,
|
|
2466
2500
|
typescript: enableTypeScript = (0, import_local_pkg4.isPackageExists)("typescript"),
|
|
2501
|
+
unicorn: enableUnicorn = true,
|
|
2467
2502
|
unocss: enableUnoCSS = false,
|
|
2468
2503
|
vue: enableVue = VuePackages.some((i) => (0, import_local_pkg4.isPackageExists)(i))
|
|
2469
2504
|
} = options;
|
|
@@ -2471,7 +2506,7 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2471
2506
|
if (isInEditor == null) {
|
|
2472
2507
|
isInEditor = isInEditorEnv();
|
|
2473
2508
|
if (isInEditor) {
|
|
2474
|
-
console.
|
|
2509
|
+
console.info("[@kirklin/eslint-config] Detected running in editor, some rules are disabled.");
|
|
2475
2510
|
}
|
|
2476
2511
|
}
|
|
2477
2512
|
const stylisticOptions = options.stylistic === false ? false : typeof options.stylistic === "object" ? options.stylistic : {};
|
|
@@ -2481,15 +2516,21 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2481
2516
|
const configs2 = [];
|
|
2482
2517
|
if (enableGitignore) {
|
|
2483
2518
|
if (typeof enableGitignore !== "boolean") {
|
|
2484
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r(
|
|
2519
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2520
|
+
name: "kirklin/gitignore",
|
|
2521
|
+
...enableGitignore
|
|
2522
|
+
})]));
|
|
2485
2523
|
} else {
|
|
2486
|
-
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2524
|
+
configs2.push(interopDefault(import("eslint-config-flat-gitignore")).then((r) => [r({
|
|
2525
|
+
name: "kirklin/gitignore",
|
|
2526
|
+
strict: false
|
|
2527
|
+
})]));
|
|
2487
2528
|
}
|
|
2488
2529
|
}
|
|
2489
2530
|
const typescriptOptions = resolveSubOptions(options, "typescript");
|
|
2490
2531
|
const tsconfigPath = "tsconfigPath" in typescriptOptions ? typescriptOptions.tsconfigPath : void 0;
|
|
2491
2532
|
configs2.push(
|
|
2492
|
-
ignores(),
|
|
2533
|
+
ignores(options.ignores),
|
|
2493
2534
|
javascript({
|
|
2494
2535
|
isInEditor,
|
|
2495
2536
|
overrides: getOverrides(options, "javascript")
|
|
@@ -2502,11 +2543,13 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2502
2543
|
imports({
|
|
2503
2544
|
stylistic: stylisticOptions
|
|
2504
2545
|
}),
|
|
2505
|
-
unicorn(),
|
|
2506
2546
|
command(),
|
|
2507
2547
|
// Optional plugins (installed but not enabled by default)
|
|
2508
2548
|
perfectionist()
|
|
2509
2549
|
);
|
|
2550
|
+
if (enableUnicorn) {
|
|
2551
|
+
configs2.push(unicorn(enableUnicorn === true ? {} : enableUnicorn));
|
|
2552
|
+
}
|
|
2510
2553
|
if (enableVue) {
|
|
2511
2554
|
componentExts.push("vue");
|
|
2512
2555
|
}
|
|
@@ -2615,6 +2658,12 @@ function kirklin(options = {}, ...userConfigs) {
|
|
|
2615
2658
|
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
2616
2659
|
));
|
|
2617
2660
|
}
|
|
2661
|
+
configs2.push(
|
|
2662
|
+
disables()
|
|
2663
|
+
);
|
|
2664
|
+
if ("files" in options) {
|
|
2665
|
+
throw new Error('[@kirklin/eslint-config] The first argument should not contain the "files" property as the options are supposed to be global. Place it in the second or later config instead.');
|
|
2666
|
+
}
|
|
2618
2667
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
2619
2668
|
if (key in options) {
|
|
2620
2669
|
acc[key] = options[key];
|
|
@@ -2685,6 +2734,7 @@ var src_default = kirklin;
|
|
|
2685
2734
|
command,
|
|
2686
2735
|
comments,
|
|
2687
2736
|
defaultPluginRenaming,
|
|
2737
|
+
disables,
|
|
2688
2738
|
ensurePackages,
|
|
2689
2739
|
formatters,
|
|
2690
2740
|
getOverrides,
|