@lincy/eslint-config 4.1.0 → 4.2.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 +26 -20
- package/dist/index.cjs +963 -856
- package/dist/index.d.cts +175 -29
- package/dist/index.d.ts +175 -29
- package/dist/index.js +960 -857
- package/package.json +24 -17
package/dist/index.cjs
CHANGED
|
@@ -42,6 +42,8 @@ __export(src_exports, {
|
|
|
42
42
|
GLOB_LESS: () => GLOB_LESS,
|
|
43
43
|
GLOB_MARKDOWN: () => GLOB_MARKDOWN,
|
|
44
44
|
GLOB_MARKDOWN_CODE: () => GLOB_MARKDOWN_CODE,
|
|
45
|
+
GLOB_MARKDOWN_IN_MARKDOWN: () => GLOB_MARKDOWN_IN_MARKDOWN,
|
|
46
|
+
GLOB_POSTCSS: () => GLOB_POSTCSS,
|
|
45
47
|
GLOB_SCSS: () => GLOB_SCSS,
|
|
46
48
|
GLOB_SRC: () => GLOB_SRC,
|
|
47
49
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
@@ -51,10 +53,12 @@ __export(src_exports, {
|
|
|
51
53
|
GLOB_TSX: () => GLOB_TSX,
|
|
52
54
|
GLOB_VUE: () => GLOB_VUE,
|
|
53
55
|
GLOB_YAML: () => GLOB_YAML,
|
|
56
|
+
StylisticConfigDefaults: () => StylisticConfigDefaults,
|
|
54
57
|
combine: () => combine,
|
|
55
58
|
comments: () => comments,
|
|
56
59
|
default: () => src_default,
|
|
57
60
|
ensurePackages: () => ensurePackages,
|
|
61
|
+
formatters: () => formatters,
|
|
58
62
|
ignores: () => ignores,
|
|
59
63
|
imports: () => imports,
|
|
60
64
|
interopDefault: () => interopDefault,
|
|
@@ -121,12 +125,14 @@ var GLOB_TS = "**/*.?([cm])ts";
|
|
|
121
125
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
122
126
|
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
123
127
|
var GLOB_CSS = "**/*.css";
|
|
128
|
+
var GLOB_POSTCSS = "**/*.{p,post}css";
|
|
124
129
|
var GLOB_LESS = "**/*.less";
|
|
125
130
|
var GLOB_SCSS = "**/*.scss";
|
|
126
131
|
var GLOB_JSON = "**/*.json";
|
|
127
132
|
var GLOB_JSON5 = "**/*.json5";
|
|
128
133
|
var GLOB_JSONC = "**/*.jsonc";
|
|
129
134
|
var GLOB_MARKDOWN = "**/*.md";
|
|
135
|
+
var GLOB_MARKDOWN_IN_MARKDOWN = "**/*.md/*.md";
|
|
130
136
|
var GLOB_VUE = "**/*.vue";
|
|
131
137
|
var GLOB_YAML = "**/*.y?(a)ml";
|
|
132
138
|
var GLOB_HTML = "**/*.htm?(l)";
|
|
@@ -594,24 +600,56 @@ async function jsonc(options = {}) {
|
|
|
594
600
|
}
|
|
595
601
|
|
|
596
602
|
// src/configs/markdown.ts
|
|
597
|
-
async function markdown(options = {}) {
|
|
603
|
+
async function markdown(options = {}, formatMarkdown = false) {
|
|
598
604
|
const {
|
|
599
605
|
componentExts = [],
|
|
600
606
|
files = [GLOB_MARKDOWN],
|
|
601
607
|
overrides = {}
|
|
602
608
|
} = options;
|
|
609
|
+
const markdown2 = await interopDefault(import("eslint-plugin-markdown"));
|
|
610
|
+
const baseProcessor = markdown2.processors.markdown;
|
|
611
|
+
const processor = !formatMarkdown ? {
|
|
612
|
+
meta: {
|
|
613
|
+
name: "markdown-processor"
|
|
614
|
+
},
|
|
615
|
+
supportsAutofix: true,
|
|
616
|
+
...baseProcessor
|
|
617
|
+
} : {
|
|
618
|
+
meta: {
|
|
619
|
+
name: "markdown-processor-with-content"
|
|
620
|
+
},
|
|
621
|
+
postprocess(messages, filename) {
|
|
622
|
+
const markdownContent = messages.pop();
|
|
623
|
+
const codeSnippets = baseProcessor.postprocess(messages, filename);
|
|
624
|
+
return [
|
|
625
|
+
...markdownContent || [],
|
|
626
|
+
...codeSnippets || []
|
|
627
|
+
];
|
|
628
|
+
},
|
|
629
|
+
preprocess(text, filename) {
|
|
630
|
+
const result = baseProcessor.preprocess(text, filename);
|
|
631
|
+
return [
|
|
632
|
+
...result,
|
|
633
|
+
{
|
|
634
|
+
filename: ".__markdown_content__",
|
|
635
|
+
text
|
|
636
|
+
}
|
|
637
|
+
];
|
|
638
|
+
},
|
|
639
|
+
supportsAutofix: true
|
|
640
|
+
};
|
|
603
641
|
return [
|
|
604
642
|
{
|
|
605
643
|
name: "eslint:markdown:setup",
|
|
606
644
|
plugins: {
|
|
607
|
-
|
|
608
|
-
markdown: await interopDefault(import("eslint-plugin-markdown"))
|
|
645
|
+
markdown: markdown2
|
|
609
646
|
}
|
|
610
647
|
},
|
|
611
648
|
{
|
|
612
649
|
files,
|
|
650
|
+
ignores: [GLOB_MARKDOWN_IN_MARKDOWN],
|
|
613
651
|
name: "eslint:markdown:processor",
|
|
614
|
-
processor
|
|
652
|
+
processor
|
|
615
653
|
},
|
|
616
654
|
{
|
|
617
655
|
files: [
|
|
@@ -625,9 +663,8 @@ async function markdown(options = {}) {
|
|
|
625
663
|
}
|
|
626
664
|
}
|
|
627
665
|
},
|
|
628
|
-
name: "eslint:markdown:
|
|
666
|
+
name: "eslint:markdown:disables",
|
|
629
667
|
rules: {
|
|
630
|
-
"antfu/no-ts-export-equal": "off",
|
|
631
668
|
"import/newline-after-import": "off",
|
|
632
669
|
"no-alert": "off",
|
|
633
670
|
"no-console": "off",
|
|
@@ -676,256 +713,45 @@ async function markdown(options = {}) {
|
|
|
676
713
|
];
|
|
677
714
|
}
|
|
678
715
|
|
|
679
|
-
// src/configs/
|
|
680
|
-
async function
|
|
716
|
+
// src/configs/perfectionist.ts
|
|
717
|
+
async function perfectionist() {
|
|
681
718
|
return [
|
|
682
719
|
{
|
|
683
|
-
name: "eslint:
|
|
720
|
+
name: "eslint:perfectionist",
|
|
684
721
|
plugins: {
|
|
685
|
-
|
|
686
|
-
},
|
|
687
|
-
rules: {
|
|
688
|
-
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
689
|
-
"node/no-deprecated-api": "error",
|
|
690
|
-
"node/no-exports-assign": "error",
|
|
691
|
-
"node/no-new-require": "error",
|
|
692
|
-
"node/no-path-concat": "error",
|
|
693
|
-
"node/prefer-global/buffer": ["error", "never"],
|
|
694
|
-
"node/prefer-global/process": ["error", "never"],
|
|
695
|
-
"node/process-exit-as-throw": "error"
|
|
696
|
-
}
|
|
697
|
-
}
|
|
698
|
-
];
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
// src/configs/sort.ts
|
|
702
|
-
async function sortPackageJson() {
|
|
703
|
-
return [
|
|
704
|
-
{
|
|
705
|
-
files: ["**/package.json"],
|
|
706
|
-
name: "eslint:sort-package-json",
|
|
707
|
-
rules: {
|
|
708
|
-
"jsonc/sort-array-values": [
|
|
709
|
-
"error",
|
|
710
|
-
{
|
|
711
|
-
order: { type: "asc" },
|
|
712
|
-
pathPattern: "^files$"
|
|
713
|
-
}
|
|
714
|
-
],
|
|
715
|
-
"jsonc/sort-keys": [
|
|
716
|
-
"error",
|
|
717
|
-
{
|
|
718
|
-
order: [
|
|
719
|
-
"publisher",
|
|
720
|
-
"name",
|
|
721
|
-
"displayName",
|
|
722
|
-
"type",
|
|
723
|
-
"version",
|
|
724
|
-
"private",
|
|
725
|
-
"packageManager",
|
|
726
|
-
"description",
|
|
727
|
-
"author",
|
|
728
|
-
"license",
|
|
729
|
-
"funding",
|
|
730
|
-
"homepage",
|
|
731
|
-
"repository",
|
|
732
|
-
"bugs",
|
|
733
|
-
"keywords",
|
|
734
|
-
"categories",
|
|
735
|
-
"sideEffects",
|
|
736
|
-
"exports",
|
|
737
|
-
"main",
|
|
738
|
-
"module",
|
|
739
|
-
"unpkg",
|
|
740
|
-
"jsdelivr",
|
|
741
|
-
"types",
|
|
742
|
-
"typesVersions",
|
|
743
|
-
"bin",
|
|
744
|
-
"icon",
|
|
745
|
-
"files",
|
|
746
|
-
"engines",
|
|
747
|
-
"activationEvents",
|
|
748
|
-
"contributes",
|
|
749
|
-
"scripts",
|
|
750
|
-
"peerDependencies",
|
|
751
|
-
"peerDependenciesMeta",
|
|
752
|
-
"dependencies",
|
|
753
|
-
"optionalDependencies",
|
|
754
|
-
"devDependencies",
|
|
755
|
-
"pnpm",
|
|
756
|
-
"overrides",
|
|
757
|
-
"resolutions",
|
|
758
|
-
"husky",
|
|
759
|
-
"simple-git-hooks",
|
|
760
|
-
"lint-staged",
|
|
761
|
-
"eslintConfig"
|
|
762
|
-
],
|
|
763
|
-
pathPattern: "^$"
|
|
764
|
-
},
|
|
765
|
-
{
|
|
766
|
-
order: { type: "asc" },
|
|
767
|
-
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
768
|
-
},
|
|
769
|
-
{
|
|
770
|
-
order: { type: "asc" },
|
|
771
|
-
pathPattern: "^resolutions$"
|
|
772
|
-
},
|
|
773
|
-
{
|
|
774
|
-
order: { type: "asc" },
|
|
775
|
-
pathPattern: "^pnpm.overrides$"
|
|
776
|
-
},
|
|
777
|
-
{
|
|
778
|
-
order: [
|
|
779
|
-
"types",
|
|
780
|
-
"import",
|
|
781
|
-
"require",
|
|
782
|
-
"default"
|
|
783
|
-
],
|
|
784
|
-
pathPattern: "^exports.*$"
|
|
785
|
-
}
|
|
786
|
-
]
|
|
787
|
-
}
|
|
788
|
-
}
|
|
789
|
-
];
|
|
790
|
-
}
|
|
791
|
-
function sortTsconfig() {
|
|
792
|
-
return [
|
|
793
|
-
{
|
|
794
|
-
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
795
|
-
name: "eslint:sort-tsconfig",
|
|
796
|
-
rules: {
|
|
797
|
-
"jsonc/sort-keys": [
|
|
798
|
-
"error",
|
|
799
|
-
{
|
|
800
|
-
order: [
|
|
801
|
-
"extends",
|
|
802
|
-
"compilerOptions",
|
|
803
|
-
"references",
|
|
804
|
-
"files",
|
|
805
|
-
"include",
|
|
806
|
-
"exclude"
|
|
807
|
-
],
|
|
808
|
-
pathPattern: "^$"
|
|
809
|
-
},
|
|
810
|
-
{
|
|
811
|
-
order: [
|
|
812
|
-
/* Projects */
|
|
813
|
-
"incremental",
|
|
814
|
-
"composite",
|
|
815
|
-
"tsBuildInfoFile",
|
|
816
|
-
"disableSourceOfProjectReferenceRedirect",
|
|
817
|
-
"disableSolutionSearching",
|
|
818
|
-
"disableReferencedProjectLoad",
|
|
819
|
-
/* Language and Environment */
|
|
820
|
-
"target",
|
|
821
|
-
"jsx",
|
|
822
|
-
"jsxFactory",
|
|
823
|
-
"jsxFragmentFactory",
|
|
824
|
-
"jsxImportSource",
|
|
825
|
-
"lib",
|
|
826
|
-
"moduleDetection",
|
|
827
|
-
"noLib",
|
|
828
|
-
"reactNamespace",
|
|
829
|
-
"useDefineForClassFields",
|
|
830
|
-
"emitDecoratorMetadata",
|
|
831
|
-
"experimentalDecorators",
|
|
832
|
-
/* Modules */
|
|
833
|
-
"baseUrl",
|
|
834
|
-
"rootDir",
|
|
835
|
-
"rootDirs",
|
|
836
|
-
"customConditions",
|
|
837
|
-
"module",
|
|
838
|
-
"moduleResolution",
|
|
839
|
-
"moduleSuffixes",
|
|
840
|
-
"noResolve",
|
|
841
|
-
"paths",
|
|
842
|
-
"resolveJsonModule",
|
|
843
|
-
"resolvePackageJsonExports",
|
|
844
|
-
"resolvePackageJsonImports",
|
|
845
|
-
"typeRoots",
|
|
846
|
-
"types",
|
|
847
|
-
"allowArbitraryExtensions",
|
|
848
|
-
"allowImportingTsExtensions",
|
|
849
|
-
"allowUmdGlobalAccess",
|
|
850
|
-
/* JavaScript Support */
|
|
851
|
-
"allowJs",
|
|
852
|
-
"checkJs",
|
|
853
|
-
"maxNodeModuleJsDepth",
|
|
854
|
-
/* Type Checking */
|
|
855
|
-
"strict",
|
|
856
|
-
"strictBindCallApply",
|
|
857
|
-
"strictFunctionTypes",
|
|
858
|
-
"strictNullChecks",
|
|
859
|
-
"strictPropertyInitialization",
|
|
860
|
-
"allowUnreachableCode",
|
|
861
|
-
"allowUnusedLabels",
|
|
862
|
-
"alwaysStrict",
|
|
863
|
-
"exactOptionalPropertyTypes",
|
|
864
|
-
"noFallthroughCasesInSwitch",
|
|
865
|
-
"noImplicitAny",
|
|
866
|
-
"noImplicitOverride",
|
|
867
|
-
"noImplicitReturns",
|
|
868
|
-
"noImplicitThis",
|
|
869
|
-
"noPropertyAccessFromIndexSignature",
|
|
870
|
-
"noUncheckedIndexedAccess",
|
|
871
|
-
"noUnusedLocals",
|
|
872
|
-
"noUnusedParameters",
|
|
873
|
-
"useUnknownInCatchVariables",
|
|
874
|
-
/* Emit */
|
|
875
|
-
"declaration",
|
|
876
|
-
"declarationDir",
|
|
877
|
-
"declarationMap",
|
|
878
|
-
"downlevelIteration",
|
|
879
|
-
"emitBOM",
|
|
880
|
-
"emitDeclarationOnly",
|
|
881
|
-
"importHelpers",
|
|
882
|
-
"importsNotUsedAsValues",
|
|
883
|
-
"inlineSourceMap",
|
|
884
|
-
"inlineSources",
|
|
885
|
-
"mapRoot",
|
|
886
|
-
"newLine",
|
|
887
|
-
"noEmit",
|
|
888
|
-
"noEmitHelpers",
|
|
889
|
-
"noEmitOnError",
|
|
890
|
-
"outDir",
|
|
891
|
-
"outFile",
|
|
892
|
-
"preserveConstEnums",
|
|
893
|
-
"preserveValueImports",
|
|
894
|
-
"removeComments",
|
|
895
|
-
"sourceMap",
|
|
896
|
-
"sourceRoot",
|
|
897
|
-
"stripInternal",
|
|
898
|
-
/* Interop Constraints */
|
|
899
|
-
"allowSyntheticDefaultImports",
|
|
900
|
-
"esModuleInterop",
|
|
901
|
-
"forceConsistentCasingInFileNames",
|
|
902
|
-
"isolatedModules",
|
|
903
|
-
"preserveSymlinks",
|
|
904
|
-
"verbatimModuleSyntax",
|
|
905
|
-
/* Completeness */
|
|
906
|
-
"skipDefaultLibCheck",
|
|
907
|
-
"skipLibCheck"
|
|
908
|
-
],
|
|
909
|
-
pathPattern: "^compilerOptions$"
|
|
910
|
-
}
|
|
911
|
-
]
|
|
722
|
+
perfectionist: import_eslint_plugin_perfectionist.default
|
|
912
723
|
}
|
|
913
724
|
}
|
|
914
725
|
];
|
|
915
726
|
}
|
|
916
727
|
|
|
917
728
|
// src/configs/stylistic.ts
|
|
729
|
+
var StylisticConfigDefaults = {
|
|
730
|
+
indent: 4,
|
|
731
|
+
jsx: true,
|
|
732
|
+
quotes: "single",
|
|
733
|
+
semi: false
|
|
734
|
+
};
|
|
918
735
|
async function stylistic(options = {}) {
|
|
919
736
|
const {
|
|
920
737
|
overrides = {},
|
|
921
|
-
stylistic: stylistic2 =
|
|
738
|
+
stylistic: stylistic2 = StylisticConfigDefaults
|
|
922
739
|
} = options;
|
|
923
740
|
const {
|
|
924
|
-
indent
|
|
925
|
-
jsx
|
|
926
|
-
quotes
|
|
927
|
-
|
|
741
|
+
indent,
|
|
742
|
+
jsx,
|
|
743
|
+
quotes,
|
|
744
|
+
semi
|
|
745
|
+
} = typeof stylistic2 === "boolean" ? StylisticConfigDefaults : stylistic2;
|
|
928
746
|
const pluginStylistic = await interopDefault(import("@stylistic/eslint-plugin"));
|
|
747
|
+
const config = pluginStylistic.configs.customize({
|
|
748
|
+
flat: true,
|
|
749
|
+
indent,
|
|
750
|
+
jsx,
|
|
751
|
+
pluginName: "style",
|
|
752
|
+
quotes,
|
|
753
|
+
semi
|
|
754
|
+
});
|
|
929
755
|
return [
|
|
930
756
|
{
|
|
931
757
|
name: "eslint:stylistic",
|
|
@@ -934,530 +760,602 @@ async function stylistic(options = {}) {
|
|
|
934
760
|
style: pluginStylistic
|
|
935
761
|
},
|
|
936
762
|
rules: {
|
|
763
|
+
...config.rules,
|
|
937
764
|
"antfu/consistent-list-newline": "off",
|
|
938
765
|
"antfu/if-newline": "error",
|
|
939
|
-
"antfu/indent-binary-ops": ["error", { indent }],
|
|
940
766
|
"antfu/top-level-function": "error",
|
|
941
767
|
"curly": ["error", "multi-or-nest", "consistent"],
|
|
942
|
-
"style/array-bracket-spacing": ["error", "never"],
|
|
943
|
-
"style/arrow-spacing": ["error", { after: true, before: true }],
|
|
944
|
-
"style/block-spacing": ["error", "always"],
|
|
945
|
-
"style/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
946
|
-
"style/comma-dangle": ["error", "always-multiline"],
|
|
947
|
-
"style/comma-spacing": ["error", { after: true, before: false }],
|
|
948
|
-
"style/comma-style": ["error", "last"],
|
|
949
|
-
"style/computed-property-spacing": ["error", "never", { enforceForClassMembers: true }],
|
|
950
|
-
"style/dot-location": ["error", "property"],
|
|
951
|
-
"style/eol-last": "error",
|
|
952
|
-
"style/indent": ["error", indent, {
|
|
953
|
-
ArrayExpression: 1,
|
|
954
|
-
CallExpression: { arguments: 1 },
|
|
955
|
-
flatTernaryExpressions: false,
|
|
956
|
-
FunctionDeclaration: { body: 1, parameters: 1 },
|
|
957
|
-
FunctionExpression: { body: 1, parameters: 1 },
|
|
958
|
-
ignoreComments: false,
|
|
959
|
-
ignoredNodes: [
|
|
960
|
-
"TemplateLiteral *",
|
|
961
|
-
"JSXElement",
|
|
962
|
-
"JSXElement > *",
|
|
963
|
-
"JSXAttribute",
|
|
964
|
-
"JSXIdentifier",
|
|
965
|
-
"JSXNamespacedName",
|
|
966
|
-
"JSXMemberExpression",
|
|
967
|
-
"JSXSpreadAttribute",
|
|
968
|
-
"JSXExpressionContainer",
|
|
969
|
-
"JSXOpeningElement",
|
|
970
|
-
"JSXClosingElement",
|
|
971
|
-
"JSXFragment",
|
|
972
|
-
"JSXOpeningFragment",
|
|
973
|
-
"JSXClosingFragment",
|
|
974
|
-
"JSXText",
|
|
975
|
-
"JSXEmptyExpression",
|
|
976
|
-
"JSXSpreadChild",
|
|
977
|
-
"TSUnionType",
|
|
978
|
-
"TSIntersectionType",
|
|
979
|
-
"TSTypeParameterInstantiation",
|
|
980
|
-
"FunctionExpression > .params[decorators.length > 0]",
|
|
981
|
-
"FunctionExpression > .params > :matches(Decorator, :not(:first-child))",
|
|
982
|
-
"ClassBody.body > PropertyDefinition[decorators.length > 0] > .key"
|
|
983
|
-
],
|
|
984
|
-
ImportDeclaration: 1,
|
|
985
|
-
MemberExpression: 1,
|
|
986
|
-
ObjectExpression: 1,
|
|
987
|
-
offsetTernaryExpressions: true,
|
|
988
|
-
outerIIFEBody: 1,
|
|
989
|
-
SwitchCase: 1,
|
|
990
|
-
VariableDeclarator: 1
|
|
991
|
-
}],
|
|
992
|
-
"style/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
993
|
-
"style/keyword-spacing": ["error", { after: true, before: true }],
|
|
994
|
-
"style/lines-between-class-members": ["error", "always", { exceptAfterSingleLine: true }],
|
|
995
|
-
"style/max-statements-per-line": ["error", { max: 1 }],
|
|
996
|
-
"style/member-delimiter-style": ["error", { multiline: { delimiter: "none" } }],
|
|
997
768
|
"style/multiline-ternary": ["error", "never"],
|
|
998
|
-
"style/new-parens": "error",
|
|
999
|
-
"style/no-extra-parens": ["error", "functions"],
|
|
1000
|
-
"style/no-floating-decimal": "error",
|
|
1001
|
-
"style/no-mixed-operators": ["error", {
|
|
1002
|
-
allowSamePrecedence: true,
|
|
1003
|
-
groups: [
|
|
1004
|
-
["==", "!=", "===", "!==", ">", ">=", "<", "<="],
|
|
1005
|
-
["&&", "||"],
|
|
1006
|
-
["in", "instanceof"]
|
|
1007
|
-
]
|
|
1008
|
-
}],
|
|
1009
|
-
"style/no-mixed-spaces-and-tabs": "error",
|
|
1010
|
-
"style/no-multi-spaces": "error",
|
|
1011
|
-
"style/no-multiple-empty-lines": ["error", { max: 1, maxBOF: 0, maxEOF: 0 }],
|
|
1012
|
-
"style/no-tabs": indent === "tab" ? "off" : "error",
|
|
1013
|
-
"style/no-trailing-spaces": "error",
|
|
1014
|
-
"style/no-whitespace-before-property": "error",
|
|
1015
|
-
"style/object-curly-newline": ["error", { consistent: true, multiline: true }],
|
|
1016
|
-
"style/object-curly-spacing": ["error", "always"],
|
|
1017
|
-
"style/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1018
|
-
"style/operator-linebreak": ["error", "before"],
|
|
1019
|
-
"style/padded-blocks": ["error", { blocks: "never", classes: "never", switches: "never" }],
|
|
1020
|
-
"style/quote-props": ["error", "consistent-as-needed"],
|
|
1021
|
-
"style/quotes": ["error", quotes, { allowTemplateLiterals: true, avoidEscape: false }],
|
|
1022
|
-
"style/rest-spread-spacing": ["error", "never"],
|
|
1023
|
-
"style/semi": ["error", "never"],
|
|
1024
|
-
"style/semi-spacing": ["error", { after: true, before: false }],
|
|
1025
|
-
"style/space-before-blocks": ["error", "always"],
|
|
1026
|
-
"style/space-before-function-paren": ["error", { anonymous: "always", asyncArrow: "always", named: "never" }],
|
|
1027
|
-
"style/space-in-parens": ["error", "never"],
|
|
1028
|
-
"style/space-infix-ops": "error",
|
|
1029
|
-
"style/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1030
|
-
"style/spaced-comment": ["error", "always", {
|
|
1031
|
-
block: {
|
|
1032
|
-
balanced: true,
|
|
1033
|
-
exceptions: ["*"],
|
|
1034
|
-
markers: ["!"]
|
|
1035
|
-
},
|
|
1036
|
-
line: {
|
|
1037
|
-
exceptions: ["/", "#"],
|
|
1038
|
-
markers: ["/"]
|
|
1039
|
-
}
|
|
1040
|
-
}],
|
|
1041
|
-
"style/template-curly-spacing": "error",
|
|
1042
|
-
"style/template-tag-spacing": ["error", "never"],
|
|
1043
|
-
"style/type-annotation-spacing": ["error", {}],
|
|
1044
|
-
"style/wrap-iife": ["error", "any", { functionPrototypeMethods: true }],
|
|
1045
|
-
"style/yield-star-spacing": ["error", "both"],
|
|
1046
|
-
...jsx ? {
|
|
1047
|
-
"style/jsx-closing-bracket-location": "error",
|
|
1048
|
-
"style/jsx-closing-tag-location": "error",
|
|
1049
|
-
"style/jsx-curly-brace-presence": ["error", { propElementValues: "always" }],
|
|
1050
|
-
"style/jsx-curly-newline": "error",
|
|
1051
|
-
"style/jsx-curly-spacing": ["error", "never"],
|
|
1052
|
-
"style/jsx-equals-spacing": "error",
|
|
1053
|
-
"style/jsx-first-prop-new-line": "error",
|
|
1054
|
-
"style/jsx-indent": ["error", indent, { checkAttributes: true, indentLogicalExpressions: true }],
|
|
1055
|
-
"style/jsx-indent-props": ["error", indent],
|
|
1056
|
-
"style/jsx-max-props-per-line": ["error", { maximum: 4 }],
|
|
1057
|
-
// 在 JSX 中的单行上强制执行最多 props 数量
|
|
1058
|
-
"style/jsx-newline": "off",
|
|
1059
|
-
// 在 jsx 元素和表达式之后换行
|
|
1060
|
-
"style/jsx-one-expression-per-line": ["error", { allow: "single-child" }],
|
|
1061
|
-
"style/jsx-quotes": ["error", "prefer-double"],
|
|
1062
|
-
// 强制在 JSX 属性中一致使用双引号或单引号
|
|
1063
|
-
"style/jsx-tag-spacing": ["error", {
|
|
1064
|
-
afterOpening: "never",
|
|
1065
|
-
beforeClosing: "never",
|
|
1066
|
-
beforeSelfClosing: "always",
|
|
1067
|
-
closingSlash: "never"
|
|
1068
|
-
}],
|
|
1069
|
-
"style/jsx-wrap-multilines": ["error", {
|
|
1070
|
-
arrow: "parens-new-line",
|
|
1071
|
-
assignment: "parens-new-line",
|
|
1072
|
-
condition: "parens-new-line",
|
|
1073
|
-
declaration: "parens-new-line",
|
|
1074
|
-
logical: "parens-new-line",
|
|
1075
|
-
prop: "parens-new-line",
|
|
1076
|
-
return: "parens-new-line"
|
|
1077
|
-
}]
|
|
1078
|
-
} : {},
|
|
1079
769
|
...overrides
|
|
1080
770
|
}
|
|
1081
771
|
}
|
|
1082
772
|
];
|
|
1083
773
|
}
|
|
1084
774
|
|
|
1085
|
-
// src/configs/
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
componentExts = [],
|
|
1090
|
-
overrides = {},
|
|
1091
|
-
parserOptions = {}
|
|
1092
|
-
} = options;
|
|
1093
|
-
const files = options.files ?? [
|
|
1094
|
-
GLOB_SRC,
|
|
1095
|
-
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1096
|
-
];
|
|
1097
|
-
const typeAwareRules = {
|
|
1098
|
-
"dot-notation": "off",
|
|
1099
|
-
"no-implied-eval": "off",
|
|
1100
|
-
"no-throw-literal": "off",
|
|
1101
|
-
"ts/await-thenable": "error",
|
|
1102
|
-
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1103
|
-
"ts/no-floating-promises": "error",
|
|
1104
|
-
"ts/no-for-in-array": "error",
|
|
1105
|
-
"ts/no-implied-eval": "error",
|
|
1106
|
-
"ts/no-misused-promises": "error",
|
|
1107
|
-
"ts/no-throw-literal": "error",
|
|
1108
|
-
"ts/no-unnecessary-type-assertion": "error",
|
|
1109
|
-
"ts/no-unsafe-argument": "error",
|
|
1110
|
-
"ts/no-unsafe-assignment": "error",
|
|
1111
|
-
"ts/no-unsafe-call": "error",
|
|
1112
|
-
"ts/no-unsafe-member-access": "error",
|
|
1113
|
-
"ts/no-unsafe-return": "error",
|
|
1114
|
-
"ts/restrict-plus-operands": "error",
|
|
1115
|
-
"ts/restrict-template-expressions": "error",
|
|
1116
|
-
"ts/unbound-method": "error"
|
|
1117
|
-
};
|
|
1118
|
-
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1119
|
-
const [
|
|
1120
|
-
pluginTs,
|
|
1121
|
-
parserTs
|
|
1122
|
-
] = await Promise.all([
|
|
1123
|
-
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
1124
|
-
interopDefault(import("@typescript-eslint/parser"))
|
|
775
|
+
// src/configs/formatters.ts
|
|
776
|
+
async function formatters(options = {}, stylistic2 = {}) {
|
|
777
|
+
await ensurePackages([
|
|
778
|
+
"eslint-plugin-format"
|
|
1125
779
|
]);
|
|
1126
|
-
|
|
780
|
+
if (options === true) {
|
|
781
|
+
options = {
|
|
782
|
+
css: true,
|
|
783
|
+
graphql: false,
|
|
784
|
+
html: true,
|
|
785
|
+
markdown: true,
|
|
786
|
+
toml: true
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
const {
|
|
790
|
+
indent,
|
|
791
|
+
quotes,
|
|
792
|
+
semi
|
|
793
|
+
} = {
|
|
794
|
+
...StylisticConfigDefaults,
|
|
795
|
+
...stylistic2
|
|
796
|
+
};
|
|
797
|
+
const prettierOptions = Object.assign(
|
|
1127
798
|
{
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
}
|
|
799
|
+
semi,
|
|
800
|
+
singleQuote: quotes === "single",
|
|
801
|
+
tabWidth: typeof indent === "number" ? indent : 2,
|
|
802
|
+
trailingComma: "all",
|
|
803
|
+
useTabs: indent === "tab"
|
|
1134
804
|
},
|
|
805
|
+
options.prettierOptions || {}
|
|
806
|
+
);
|
|
807
|
+
const dprintOptions = Object.assign(
|
|
1135
808
|
{
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
809
|
+
indentWidth: typeof indent === "number" ? indent : 2,
|
|
810
|
+
quoteStyle: quotes === "single" ? "preferSingle" : "preferDouble",
|
|
811
|
+
useTabs: indent === "tab"
|
|
812
|
+
},
|
|
813
|
+
options.dprintOptions || {}
|
|
814
|
+
);
|
|
815
|
+
const pluginFormat = await interopDefault(import("eslint-plugin-format"));
|
|
816
|
+
const configs = [
|
|
817
|
+
{
|
|
818
|
+
name: "eslint:formatters:setup",
|
|
819
|
+
plugins: {
|
|
820
|
+
format: pluginFormat
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
];
|
|
824
|
+
if (options.css) {
|
|
825
|
+
configs.push(
|
|
826
|
+
{
|
|
827
|
+
files: [GLOB_CSS, GLOB_POSTCSS],
|
|
828
|
+
languageOptions: {
|
|
829
|
+
parser: pluginFormat.parserPlain
|
|
830
|
+
},
|
|
831
|
+
name: "eslint:formatter:css",
|
|
832
|
+
rules: {
|
|
833
|
+
"format/prettier": [
|
|
834
|
+
"error",
|
|
835
|
+
{
|
|
836
|
+
...prettierOptions,
|
|
837
|
+
parser: "css"
|
|
838
|
+
}
|
|
839
|
+
]
|
|
1147
840
|
}
|
|
1148
841
|
},
|
|
1149
|
-
|
|
842
|
+
{
|
|
843
|
+
files: [GLOB_SCSS],
|
|
844
|
+
languageOptions: {
|
|
845
|
+
parser: pluginFormat.parserPlain
|
|
846
|
+
},
|
|
847
|
+
name: "eslint:formatter:scss",
|
|
848
|
+
rules: {
|
|
849
|
+
"format/prettier": [
|
|
850
|
+
"error",
|
|
851
|
+
{
|
|
852
|
+
...prettierOptions,
|
|
853
|
+
parser: "scss"
|
|
854
|
+
}
|
|
855
|
+
]
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
files: [GLOB_LESS],
|
|
860
|
+
languageOptions: {
|
|
861
|
+
parser: pluginFormat.parserPlain
|
|
862
|
+
},
|
|
863
|
+
name: "eslint:formatter:less",
|
|
864
|
+
rules: {
|
|
865
|
+
"format/prettier": [
|
|
866
|
+
"error",
|
|
867
|
+
{
|
|
868
|
+
...prettierOptions,
|
|
869
|
+
parser: "less"
|
|
870
|
+
}
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
);
|
|
875
|
+
}
|
|
876
|
+
if (options.html) {
|
|
877
|
+
configs.push({
|
|
878
|
+
files: ["**/*.html"],
|
|
879
|
+
languageOptions: {
|
|
880
|
+
parser: pluginFormat.parserPlain
|
|
881
|
+
},
|
|
882
|
+
name: "eslint:formatter:html",
|
|
1150
883
|
rules: {
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
"@typescript-eslint/",
|
|
1159
|
-
"ts/"
|
|
1160
|
-
),
|
|
1161
|
-
"antfu/generic-spacing": "error",
|
|
1162
|
-
"antfu/named-tuple-spacing": "error",
|
|
1163
|
-
"no-dupe-class-members": "off",
|
|
1164
|
-
"no-invalid-this": "off",
|
|
1165
|
-
"no-loss-of-precision": "off",
|
|
1166
|
-
"no-redeclare": "off",
|
|
1167
|
-
"no-use-before-define": "off",
|
|
1168
|
-
"no-useless-constructor": "off",
|
|
1169
|
-
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
1170
|
-
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1171
|
-
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1172
|
-
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
1173
|
-
"ts/no-dupe-class-members": "error",
|
|
1174
|
-
"ts/no-dynamic-delete": "off",
|
|
1175
|
-
"ts/no-explicit-any": "off",
|
|
1176
|
-
"ts/no-extraneous-class": "off",
|
|
1177
|
-
"ts/no-import-type-side-effects": "error",
|
|
1178
|
-
"ts/no-invalid-this": "error",
|
|
1179
|
-
"ts/no-invalid-void-type": "off",
|
|
1180
|
-
"ts/no-loss-of-precision": "error",
|
|
1181
|
-
"ts/no-non-null-assertion": "off",
|
|
1182
|
-
"ts/no-redeclare": "error",
|
|
1183
|
-
"ts/no-require-imports": "error",
|
|
1184
|
-
"ts/no-unused-vars": "off",
|
|
1185
|
-
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1186
|
-
"ts/no-useless-constructor": "off",
|
|
1187
|
-
"ts/prefer-ts-expect-error": "error",
|
|
1188
|
-
"ts/triple-slash-reference": "off",
|
|
1189
|
-
"ts/unified-signatures": "off",
|
|
1190
|
-
...tsconfigPath ? typeAwareRules : {},
|
|
1191
|
-
...overrides
|
|
884
|
+
"format/prettier": [
|
|
885
|
+
"error",
|
|
886
|
+
{
|
|
887
|
+
...prettierOptions,
|
|
888
|
+
parser: "html"
|
|
889
|
+
}
|
|
890
|
+
]
|
|
1192
891
|
}
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
if (options.toml) {
|
|
895
|
+
configs.push({
|
|
896
|
+
files: ["**/*.toml"],
|
|
897
|
+
languageOptions: {
|
|
898
|
+
parser: pluginFormat.parserPlain
|
|
899
|
+
},
|
|
900
|
+
name: "eslint:formatter:toml",
|
|
1197
901
|
rules: {
|
|
1198
|
-
"
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
902
|
+
"format/dprint": [
|
|
903
|
+
"error",
|
|
904
|
+
{
|
|
905
|
+
...dprintOptions,
|
|
906
|
+
language: "toml"
|
|
907
|
+
}
|
|
908
|
+
]
|
|
1202
909
|
}
|
|
1203
|
-
}
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
if (options.markdown) {
|
|
913
|
+
const formater = options.markdown === true ? "prettier" : options.markdown;
|
|
914
|
+
configs.push({
|
|
915
|
+
files: ["**/*.__markdown_content__"],
|
|
916
|
+
languageOptions: {
|
|
917
|
+
parser: pluginFormat.parserPlain
|
|
918
|
+
},
|
|
919
|
+
name: "eslint:formatter:markdown",
|
|
1207
920
|
rules: {
|
|
1208
|
-
|
|
921
|
+
[`format/${formater}`]: [
|
|
922
|
+
"error",
|
|
923
|
+
formater === "prettier" ? {
|
|
924
|
+
...prettierOptions,
|
|
925
|
+
embeddedLanguageFormatting: "off",
|
|
926
|
+
parser: "markdown"
|
|
927
|
+
} : {
|
|
928
|
+
...dprintOptions,
|
|
929
|
+
language: "markdown"
|
|
930
|
+
}
|
|
931
|
+
]
|
|
1209
932
|
}
|
|
1210
|
-
}
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
if (options.graphql) {
|
|
936
|
+
configs.push({
|
|
937
|
+
files: ["**/*.graphql"],
|
|
938
|
+
languageOptions: {
|
|
939
|
+
parser: pluginFormat.parserPlain
|
|
940
|
+
},
|
|
941
|
+
name: "eslint:formatter:graphql",
|
|
1214
942
|
rules: {
|
|
1215
|
-
"
|
|
1216
|
-
|
|
943
|
+
"format/prettier": [
|
|
944
|
+
"error",
|
|
945
|
+
{
|
|
946
|
+
...prettierOptions,
|
|
947
|
+
parser: "graphql"
|
|
948
|
+
}
|
|
949
|
+
]
|
|
1217
950
|
}
|
|
1218
|
-
}
|
|
1219
|
-
|
|
951
|
+
});
|
|
952
|
+
}
|
|
953
|
+
return configs;
|
|
1220
954
|
}
|
|
1221
955
|
|
|
1222
|
-
// src/configs/
|
|
1223
|
-
async function
|
|
956
|
+
// src/configs/node.ts
|
|
957
|
+
async function node() {
|
|
1224
958
|
return [
|
|
1225
959
|
{
|
|
1226
|
-
name: "eslint:
|
|
960
|
+
name: "eslint:node",
|
|
1227
961
|
plugins: {
|
|
1228
|
-
|
|
962
|
+
node: import_eslint_plugin_n.default
|
|
1229
963
|
},
|
|
1230
964
|
rules: {
|
|
1231
|
-
|
|
1232
|
-
"
|
|
1233
|
-
|
|
1234
|
-
"
|
|
1235
|
-
|
|
1236
|
-
"
|
|
1237
|
-
|
|
1238
|
-
"
|
|
1239
|
-
// Prevent deprecated `new Buffer()`
|
|
1240
|
-
"unicorn/no-new-buffer": "error",
|
|
1241
|
-
// Keep regex literals safe!
|
|
1242
|
-
"unicorn/no-unsafe-regex": "error",
|
|
1243
|
-
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1244
|
-
"unicorn/number-literal-case": "error",
|
|
1245
|
-
// textContent instead of innerText
|
|
1246
|
-
"unicorn/prefer-dom-node-text-content": "error",
|
|
1247
|
-
// includes over indexOf when checking for existence
|
|
1248
|
-
"unicorn/prefer-includes": "error",
|
|
1249
|
-
// Prefer using the node: protocol
|
|
1250
|
-
"unicorn/prefer-node-protocol": "error",
|
|
1251
|
-
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1252
|
-
"unicorn/prefer-number-properties": "error",
|
|
1253
|
-
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1254
|
-
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1255
|
-
// Enforce throwing type error when throwing error while checking typeof
|
|
1256
|
-
"unicorn/prefer-type-error": "error",
|
|
1257
|
-
// Use new when throwing error
|
|
1258
|
-
"unicorn/throw-new-error": "error"
|
|
965
|
+
"node/handle-callback-err": ["error", "^(err|error)$"],
|
|
966
|
+
"node/no-deprecated-api": "error",
|
|
967
|
+
"node/no-exports-assign": "error",
|
|
968
|
+
"node/no-new-require": "error",
|
|
969
|
+
"node/no-path-concat": "error",
|
|
970
|
+
"node/prefer-global/buffer": ["error", "never"],
|
|
971
|
+
"node/prefer-global/process": ["error", "never"],
|
|
972
|
+
"node/process-exit-as-throw": "error"
|
|
1259
973
|
}
|
|
1260
974
|
}
|
|
1261
975
|
];
|
|
1262
976
|
}
|
|
1263
977
|
|
|
1264
|
-
// src/configs/
|
|
978
|
+
// src/configs/react.ts
|
|
1265
979
|
var import_local_pkg2 = require("local-pkg");
|
|
1266
|
-
var
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
async function vue(options = {}) {
|
|
980
|
+
var ReactRefreshAllowConstantExportPackages = [
|
|
981
|
+
"vite"
|
|
982
|
+
];
|
|
983
|
+
async function react(options = {}) {
|
|
1271
984
|
const {
|
|
1272
|
-
files = [
|
|
985
|
+
files = [GLOB_JSX, GLOB_TSX],
|
|
986
|
+
jsx = true,
|
|
1273
987
|
overrides = {},
|
|
1274
|
-
|
|
988
|
+
typescript: typescript2 = true,
|
|
989
|
+
version = "detect"
|
|
1275
990
|
} = options;
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
991
|
+
await ensurePackages([
|
|
992
|
+
"eslint-plugin-react",
|
|
993
|
+
"eslint-plugin-react-hooks",
|
|
994
|
+
"eslint-plugin-react-refresh"
|
|
995
|
+
]);
|
|
1279
996
|
const [
|
|
1280
|
-
|
|
1281
|
-
|
|
997
|
+
pluginReact,
|
|
998
|
+
pluginReactHooks,
|
|
999
|
+
pluginReactRefresh
|
|
1282
1000
|
] = await Promise.all([
|
|
1283
1001
|
// @ts-expect-error missing types
|
|
1284
|
-
interopDefault(import("eslint-plugin-
|
|
1285
|
-
|
|
1002
|
+
interopDefault(import("eslint-plugin-react")),
|
|
1003
|
+
// @ts-expect-error missing types
|
|
1004
|
+
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1005
|
+
// @ts-expect-error missing types
|
|
1006
|
+
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1286
1007
|
]);
|
|
1008
|
+
const _isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1009
|
+
(i) => (0, import_local_pkg2.isPackageExists)(i)
|
|
1010
|
+
);
|
|
1287
1011
|
return [
|
|
1288
1012
|
{
|
|
1289
|
-
name: "eslint:
|
|
1013
|
+
name: "eslint:react:setup",
|
|
1290
1014
|
plugins: {
|
|
1291
|
-
|
|
1015
|
+
"react": pluginReact,
|
|
1016
|
+
"react-hooks": pluginReactHooks,
|
|
1017
|
+
"react-refresh": pluginReactRefresh
|
|
1292
1018
|
}
|
|
1293
1019
|
},
|
|
1294
1020
|
{
|
|
1295
1021
|
files,
|
|
1296
1022
|
languageOptions: {
|
|
1297
|
-
parser: parserVue,
|
|
1298
1023
|
parserOptions: {
|
|
1299
1024
|
ecmaFeatures: {
|
|
1300
|
-
jsx
|
|
1301
|
-
}
|
|
1302
|
-
extraFileExtensions: [".vue"],
|
|
1303
|
-
parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
1304
|
-
sourceType: "module"
|
|
1025
|
+
jsx
|
|
1026
|
+
}
|
|
1305
1027
|
}
|
|
1306
1028
|
},
|
|
1307
|
-
name: "eslint:
|
|
1308
|
-
processor: pluginVue.processors[".vue"],
|
|
1029
|
+
name: "eslint:react:rules",
|
|
1309
1030
|
rules: {
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
"
|
|
1321
|
-
"
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
"
|
|
1325
|
-
"
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
"
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
"
|
|
1335
|
-
"
|
|
1336
|
-
"
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
"
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
"
|
|
1353
|
-
"
|
|
1354
|
-
"
|
|
1355
|
-
"
|
|
1356
|
-
"
|
|
1357
|
-
|
|
1358
|
-
"
|
|
1359
|
-
"
|
|
1360
|
-
"
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
"
|
|
1368
|
-
"
|
|
1369
|
-
"
|
|
1370
|
-
"
|
|
1371
|
-
"
|
|
1372
|
-
"
|
|
1373
|
-
"
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
"
|
|
1378
|
-
"
|
|
1379
|
-
"
|
|
1380
|
-
"
|
|
1381
|
-
"
|
|
1382
|
-
"
|
|
1383
|
-
"
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1388
|
-
|
|
1389
|
-
|
|
1390
|
-
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1031
|
+
// react-hooks
|
|
1032
|
+
"react-hooks/exhaustive-deps": "warn",
|
|
1033
|
+
"react-hooks/rules-of-hooks": "error",
|
|
1034
|
+
// react-refresh
|
|
1035
|
+
// 'react-refresh/only-export-components': [
|
|
1036
|
+
// 'warn',
|
|
1037
|
+
// { allowConstantExport: _isAllowConstantExport },
|
|
1038
|
+
// ],
|
|
1039
|
+
"react-refresh/only-export-components": "off",
|
|
1040
|
+
// react
|
|
1041
|
+
"react/boolean-prop-naming": "error",
|
|
1042
|
+
"react/button-has-type": "error",
|
|
1043
|
+
"react/default-props-match-prop-types": "error",
|
|
1044
|
+
"react/destructuring-assignment": "error",
|
|
1045
|
+
"react/display-name": "error",
|
|
1046
|
+
"react/forbid-component-props": "off",
|
|
1047
|
+
// 禁止组件上使用某些 props
|
|
1048
|
+
"react/forbid-dom-props": "error",
|
|
1049
|
+
"react/forbid-elements": "error",
|
|
1050
|
+
"react/forbid-foreign-prop-types": "error",
|
|
1051
|
+
"react/forbid-prop-types": "error",
|
|
1052
|
+
"react/function-component-definition": "error",
|
|
1053
|
+
"react/hook-use-state": "off",
|
|
1054
|
+
// useState 钩子值和 setter 变量的解构和对称命名
|
|
1055
|
+
"react/iframe-missing-sandbox": "error",
|
|
1056
|
+
"react/jsx-boolean-value": "error",
|
|
1057
|
+
"react/jsx-filename-extension": "off",
|
|
1058
|
+
// 禁止可能包含 JSX 文件扩展名
|
|
1059
|
+
"react/jsx-fragments": "error",
|
|
1060
|
+
"react/jsx-handler-names": "error",
|
|
1061
|
+
"react/jsx-key": "error",
|
|
1062
|
+
"react/jsx-max-depth": "off",
|
|
1063
|
+
// 强制 JSX 最大深度
|
|
1064
|
+
"react/jsx-no-bind": "off",
|
|
1065
|
+
// .bind()JSX 属性中禁止使用箭头函数
|
|
1066
|
+
"react/jsx-no-comment-textnodes": "error",
|
|
1067
|
+
"react/jsx-no-constructed-context-values": "error",
|
|
1068
|
+
"react/jsx-no-duplicate-props": "error",
|
|
1069
|
+
"react/jsx-no-leaked-render": "error",
|
|
1070
|
+
"react/jsx-no-literals": "off",
|
|
1071
|
+
// 禁止在 JSX 中使用字符串文字
|
|
1072
|
+
"react/jsx-no-script-url": "error",
|
|
1073
|
+
"react/jsx-no-target-blank": "error",
|
|
1074
|
+
"react/jsx-no-undef": "error",
|
|
1075
|
+
"react/jsx-no-useless-fragment": "error",
|
|
1076
|
+
"react/jsx-pascal-case": "error",
|
|
1077
|
+
"react/jsx-props-no-spreading": "off",
|
|
1078
|
+
// 强制任何 JSX 属性都不会传播
|
|
1079
|
+
"react/jsx-uses-react": "error",
|
|
1080
|
+
"react/jsx-uses-vars": "error",
|
|
1081
|
+
"react/no-access-state-in-setstate": "error",
|
|
1082
|
+
"react/no-adjacent-inline-elements": "error",
|
|
1083
|
+
"react/no-array-index-key": "error",
|
|
1084
|
+
"react/no-arrow-function-lifecycle": "error",
|
|
1085
|
+
"react/no-children-prop": "error",
|
|
1086
|
+
"react/no-danger": "off",
|
|
1087
|
+
// 禁止使用 dangerouslySetInnerHTML
|
|
1088
|
+
"react/no-danger-with-children": "error",
|
|
1089
|
+
"react/no-deprecated": "error",
|
|
1090
|
+
"react/no-did-mount-set-state": "error",
|
|
1091
|
+
"react/no-did-update-set-state": "error",
|
|
1092
|
+
"react/no-direct-mutation-state": "error",
|
|
1093
|
+
"react/no-find-dom-node": "error",
|
|
1094
|
+
"react/no-invalid-html-attribute": "error",
|
|
1095
|
+
"react/no-is-mounted": "error",
|
|
1096
|
+
"react/no-multi-comp": "error",
|
|
1097
|
+
"react/no-namespace": "error",
|
|
1098
|
+
"react/no-object-type-as-default-prop": "error",
|
|
1099
|
+
"react/no-redundant-should-component-update": "error",
|
|
1100
|
+
"react/no-render-return-value": "error",
|
|
1101
|
+
"react/no-set-state": "error",
|
|
1102
|
+
"react/no-string-refs": "error",
|
|
1103
|
+
"react/no-this-in-sfc": "error",
|
|
1104
|
+
"react/no-typos": "error",
|
|
1105
|
+
"react/no-unescaped-entities": "error",
|
|
1106
|
+
"react/no-unknown-property": "error",
|
|
1107
|
+
"react/no-unsafe": "off",
|
|
1108
|
+
// 禁止使用不安全的生命周期方法
|
|
1109
|
+
"react/no-unstable-nested-components": "error",
|
|
1110
|
+
"react/no-unused-class-component-methods": "error",
|
|
1111
|
+
"react/no-unused-prop-types": "error",
|
|
1112
|
+
"react/no-unused-state": "error",
|
|
1113
|
+
"react/no-will-update-set-state": "error",
|
|
1114
|
+
"react/prefer-es6-class": "error",
|
|
1115
|
+
"react/prefer-exact-props": "error",
|
|
1116
|
+
"react/prefer-read-only-props": "error",
|
|
1117
|
+
"react/prefer-stateless-function": "error",
|
|
1118
|
+
"react/prop-types": "error",
|
|
1119
|
+
"react/react-in-jsx-scope": "off",
|
|
1120
|
+
// 使用 JSX 时需要引入 React
|
|
1121
|
+
"react/require-default-props": "off",
|
|
1122
|
+
// 为每个非必需 prop 强制执行 defaultProps 定义
|
|
1123
|
+
"react/require-optimization": "error",
|
|
1124
|
+
"react/require-render-return": "error",
|
|
1125
|
+
"react/self-closing-comp": "error",
|
|
1126
|
+
"react/sort-comp": "error",
|
|
1127
|
+
"react/sort-default-props": "error",
|
|
1128
|
+
"react/sort-prop-types": "error",
|
|
1129
|
+
"react/state-in-constructor": "error",
|
|
1130
|
+
"react/static-property-placement": "error",
|
|
1131
|
+
"react/style-prop-object": "error",
|
|
1132
|
+
"react/void-dom-elements-no-children": "error",
|
|
1133
|
+
...typescript2 ? {
|
|
1134
|
+
"react/jsx-no-undef": "off",
|
|
1135
|
+
"react/prop-type": "off"
|
|
1404
1136
|
} : {},
|
|
1405
1137
|
...overrides
|
|
1138
|
+
},
|
|
1139
|
+
settings: {
|
|
1140
|
+
react: {
|
|
1141
|
+
version
|
|
1142
|
+
}
|
|
1406
1143
|
}
|
|
1407
1144
|
}
|
|
1408
1145
|
];
|
|
1409
1146
|
}
|
|
1410
1147
|
|
|
1411
|
-
// src/configs/
|
|
1412
|
-
async function
|
|
1413
|
-
const {
|
|
1414
|
-
files = [GLOB_YAML],
|
|
1415
|
-
overrides = {},
|
|
1416
|
-
stylistic: stylistic2 = true
|
|
1417
|
-
} = options;
|
|
1418
|
-
const [
|
|
1419
|
-
pluginYaml,
|
|
1420
|
-
parserYaml
|
|
1421
|
-
] = await Promise.all([
|
|
1422
|
-
interopDefault(import("eslint-plugin-yml")),
|
|
1423
|
-
interopDefault(import("yaml-eslint-parser"))
|
|
1424
|
-
]);
|
|
1148
|
+
// src/configs/sort.ts
|
|
1149
|
+
async function sortPackageJson() {
|
|
1425
1150
|
return [
|
|
1426
1151
|
{
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1152
|
+
files: ["**/package.json"],
|
|
1153
|
+
name: "eslint:sort-package-json",
|
|
1154
|
+
rules: {
|
|
1155
|
+
"jsonc/sort-array-values": [
|
|
1156
|
+
"error",
|
|
1157
|
+
{
|
|
1158
|
+
order: { type: "asc" },
|
|
1159
|
+
pathPattern: "^files$"
|
|
1160
|
+
}
|
|
1161
|
+
],
|
|
1162
|
+
"jsonc/sort-keys": [
|
|
1163
|
+
"error",
|
|
1164
|
+
{
|
|
1165
|
+
order: [
|
|
1166
|
+
"publisher",
|
|
1167
|
+
"name",
|
|
1168
|
+
"displayName",
|
|
1169
|
+
"type",
|
|
1170
|
+
"version",
|
|
1171
|
+
"private",
|
|
1172
|
+
"packageManager",
|
|
1173
|
+
"description",
|
|
1174
|
+
"author",
|
|
1175
|
+
"license",
|
|
1176
|
+
"funding",
|
|
1177
|
+
"homepage",
|
|
1178
|
+
"repository",
|
|
1179
|
+
"bugs",
|
|
1180
|
+
"keywords",
|
|
1181
|
+
"categories",
|
|
1182
|
+
"sideEffects",
|
|
1183
|
+
"exports",
|
|
1184
|
+
"main",
|
|
1185
|
+
"module",
|
|
1186
|
+
"unpkg",
|
|
1187
|
+
"jsdelivr",
|
|
1188
|
+
"types",
|
|
1189
|
+
"typesVersions",
|
|
1190
|
+
"bin",
|
|
1191
|
+
"icon",
|
|
1192
|
+
"files",
|
|
1193
|
+
"engines",
|
|
1194
|
+
"activationEvents",
|
|
1195
|
+
"contributes",
|
|
1196
|
+
"scripts",
|
|
1197
|
+
"peerDependencies",
|
|
1198
|
+
"peerDependenciesMeta",
|
|
1199
|
+
"dependencies",
|
|
1200
|
+
"optionalDependencies",
|
|
1201
|
+
"devDependencies",
|
|
1202
|
+
"pnpm",
|
|
1203
|
+
"overrides",
|
|
1204
|
+
"resolutions",
|
|
1205
|
+
"husky",
|
|
1206
|
+
"simple-git-hooks",
|
|
1207
|
+
"lint-staged",
|
|
1208
|
+
"eslintConfig"
|
|
1209
|
+
],
|
|
1210
|
+
pathPattern: "^$"
|
|
1211
|
+
},
|
|
1212
|
+
{
|
|
1213
|
+
order: { type: "asc" },
|
|
1214
|
+
pathPattern: "^(?:dev|peer|optional|bundled)?[Dd]ependencies$"
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
order: { type: "asc" },
|
|
1218
|
+
pathPattern: "^resolutions$"
|
|
1219
|
+
},
|
|
1220
|
+
{
|
|
1221
|
+
order: { type: "asc" },
|
|
1222
|
+
pathPattern: "^pnpm.overrides$"
|
|
1223
|
+
},
|
|
1224
|
+
{
|
|
1225
|
+
order: [
|
|
1226
|
+
"types",
|
|
1227
|
+
"import",
|
|
1228
|
+
"require",
|
|
1229
|
+
"default"
|
|
1230
|
+
],
|
|
1231
|
+
pathPattern: "^exports.*$"
|
|
1232
|
+
}
|
|
1233
|
+
]
|
|
1430
1234
|
}
|
|
1431
|
-
}
|
|
1235
|
+
}
|
|
1236
|
+
];
|
|
1237
|
+
}
|
|
1238
|
+
function sortTsconfig() {
|
|
1239
|
+
return [
|
|
1432
1240
|
{
|
|
1433
|
-
files,
|
|
1434
|
-
|
|
1435
|
-
parser: parserYaml
|
|
1436
|
-
},
|
|
1437
|
-
name: "eslint:yaml:rules",
|
|
1241
|
+
files: ["**/tsconfig.json", "**/tsconfig.*.json"],
|
|
1242
|
+
name: "eslint:sort-tsconfig",
|
|
1438
1243
|
rules: {
|
|
1439
|
-
"
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1244
|
+
"jsonc/sort-keys": [
|
|
1245
|
+
"error",
|
|
1246
|
+
{
|
|
1247
|
+
order: [
|
|
1248
|
+
"extends",
|
|
1249
|
+
"compilerOptions",
|
|
1250
|
+
"references",
|
|
1251
|
+
"files",
|
|
1252
|
+
"include",
|
|
1253
|
+
"exclude"
|
|
1254
|
+
],
|
|
1255
|
+
pathPattern: "^$"
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
order: [
|
|
1259
|
+
/* Projects */
|
|
1260
|
+
"incremental",
|
|
1261
|
+
"composite",
|
|
1262
|
+
"tsBuildInfoFile",
|
|
1263
|
+
"disableSourceOfProjectReferenceRedirect",
|
|
1264
|
+
"disableSolutionSearching",
|
|
1265
|
+
"disableReferencedProjectLoad",
|
|
1266
|
+
/* Language and Environment */
|
|
1267
|
+
"target",
|
|
1268
|
+
"jsx",
|
|
1269
|
+
"jsxFactory",
|
|
1270
|
+
"jsxFragmentFactory",
|
|
1271
|
+
"jsxImportSource",
|
|
1272
|
+
"lib",
|
|
1273
|
+
"moduleDetection",
|
|
1274
|
+
"noLib",
|
|
1275
|
+
"reactNamespace",
|
|
1276
|
+
"useDefineForClassFields",
|
|
1277
|
+
"emitDecoratorMetadata",
|
|
1278
|
+
"experimentalDecorators",
|
|
1279
|
+
/* Modules */
|
|
1280
|
+
"baseUrl",
|
|
1281
|
+
"rootDir",
|
|
1282
|
+
"rootDirs",
|
|
1283
|
+
"customConditions",
|
|
1284
|
+
"module",
|
|
1285
|
+
"moduleResolution",
|
|
1286
|
+
"moduleSuffixes",
|
|
1287
|
+
"noResolve",
|
|
1288
|
+
"paths",
|
|
1289
|
+
"resolveJsonModule",
|
|
1290
|
+
"resolvePackageJsonExports",
|
|
1291
|
+
"resolvePackageJsonImports",
|
|
1292
|
+
"typeRoots",
|
|
1293
|
+
"types",
|
|
1294
|
+
"allowArbitraryExtensions",
|
|
1295
|
+
"allowImportingTsExtensions",
|
|
1296
|
+
"allowUmdGlobalAccess",
|
|
1297
|
+
/* JavaScript Support */
|
|
1298
|
+
"allowJs",
|
|
1299
|
+
"checkJs",
|
|
1300
|
+
"maxNodeModuleJsDepth",
|
|
1301
|
+
/* Type Checking */
|
|
1302
|
+
"strict",
|
|
1303
|
+
"strictBindCallApply",
|
|
1304
|
+
"strictFunctionTypes",
|
|
1305
|
+
"strictNullChecks",
|
|
1306
|
+
"strictPropertyInitialization",
|
|
1307
|
+
"allowUnreachableCode",
|
|
1308
|
+
"allowUnusedLabels",
|
|
1309
|
+
"alwaysStrict",
|
|
1310
|
+
"exactOptionalPropertyTypes",
|
|
1311
|
+
"noFallthroughCasesInSwitch",
|
|
1312
|
+
"noImplicitAny",
|
|
1313
|
+
"noImplicitOverride",
|
|
1314
|
+
"noImplicitReturns",
|
|
1315
|
+
"noImplicitThis",
|
|
1316
|
+
"noPropertyAccessFromIndexSignature",
|
|
1317
|
+
"noUncheckedIndexedAccess",
|
|
1318
|
+
"noUnusedLocals",
|
|
1319
|
+
"noUnusedParameters",
|
|
1320
|
+
"useUnknownInCatchVariables",
|
|
1321
|
+
/* Emit */
|
|
1322
|
+
"declaration",
|
|
1323
|
+
"declarationDir",
|
|
1324
|
+
"declarationMap",
|
|
1325
|
+
"downlevelIteration",
|
|
1326
|
+
"emitBOM",
|
|
1327
|
+
"emitDeclarationOnly",
|
|
1328
|
+
"importHelpers",
|
|
1329
|
+
"importsNotUsedAsValues",
|
|
1330
|
+
"inlineSourceMap",
|
|
1331
|
+
"inlineSources",
|
|
1332
|
+
"mapRoot",
|
|
1333
|
+
"newLine",
|
|
1334
|
+
"noEmit",
|
|
1335
|
+
"noEmitHelpers",
|
|
1336
|
+
"noEmitOnError",
|
|
1337
|
+
"outDir",
|
|
1338
|
+
"outFile",
|
|
1339
|
+
"preserveConstEnums",
|
|
1340
|
+
"preserveValueImports",
|
|
1341
|
+
"removeComments",
|
|
1342
|
+
"sourceMap",
|
|
1343
|
+
"sourceRoot",
|
|
1344
|
+
"stripInternal",
|
|
1345
|
+
/* Interop Constraints */
|
|
1346
|
+
"allowSyntheticDefaultImports",
|
|
1347
|
+
"esModuleInterop",
|
|
1348
|
+
"forceConsistentCasingInFileNames",
|
|
1349
|
+
"isolatedModules",
|
|
1350
|
+
"preserveSymlinks",
|
|
1351
|
+
"verbatimModuleSyntax",
|
|
1352
|
+
/* Completeness */
|
|
1353
|
+
"skipDefaultLibCheck",
|
|
1354
|
+
"skipLibCheck"
|
|
1355
|
+
],
|
|
1356
|
+
pathPattern: "^compilerOptions$"
|
|
1357
|
+
}
|
|
1358
|
+
]
|
|
1461
1359
|
}
|
|
1462
1360
|
}
|
|
1463
1361
|
];
|
|
@@ -1508,182 +1406,176 @@ async function test(options = {}) {
|
|
|
1508
1406
|
];
|
|
1509
1407
|
}
|
|
1510
1408
|
|
|
1511
|
-
// src/configs/
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
{
|
|
1515
|
-
name: "eslint:perfectionist",
|
|
1516
|
-
plugins: {
|
|
1517
|
-
perfectionist: import_eslint_plugin_perfectionist.default
|
|
1518
|
-
}
|
|
1519
|
-
}
|
|
1520
|
-
];
|
|
1521
|
-
}
|
|
1522
|
-
|
|
1523
|
-
// src/configs/react.ts
|
|
1524
|
-
var import_local_pkg3 = require("local-pkg");
|
|
1525
|
-
var ReactRefreshAllowConstantExportPackages = [
|
|
1526
|
-
"vite"
|
|
1527
|
-
];
|
|
1528
|
-
async function react(options = {}) {
|
|
1409
|
+
// src/configs/typescript.ts
|
|
1410
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
1411
|
+
async function typescript(options = {}) {
|
|
1529
1412
|
const {
|
|
1530
|
-
|
|
1531
|
-
jsx = true,
|
|
1413
|
+
componentExts = [],
|
|
1532
1414
|
overrides = {},
|
|
1533
|
-
|
|
1534
|
-
version = "17.0"
|
|
1415
|
+
parserOptions = {}
|
|
1535
1416
|
} = options;
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1417
|
+
const files = options.files ?? [
|
|
1418
|
+
GLOB_SRC,
|
|
1419
|
+
...componentExts.map((ext) => `**/*.${ext}`)
|
|
1420
|
+
];
|
|
1421
|
+
const typeAwareRules = {
|
|
1422
|
+
"dot-notation": "off",
|
|
1423
|
+
"no-implied-eval": "off",
|
|
1424
|
+
"no-throw-literal": "off",
|
|
1425
|
+
"ts/await-thenable": "error",
|
|
1426
|
+
"ts/dot-notation": ["error", { allowKeywords: true }],
|
|
1427
|
+
"ts/no-floating-promises": "error",
|
|
1428
|
+
"ts/no-for-in-array": "error",
|
|
1429
|
+
"ts/no-implied-eval": "error",
|
|
1430
|
+
"ts/no-misused-promises": "error",
|
|
1431
|
+
"ts/no-throw-literal": "error",
|
|
1432
|
+
"ts/no-unnecessary-type-assertion": "error",
|
|
1433
|
+
"ts/no-unsafe-argument": "error",
|
|
1434
|
+
"ts/no-unsafe-assignment": "error",
|
|
1435
|
+
"ts/no-unsafe-call": "error",
|
|
1436
|
+
"ts/no-unsafe-member-access": "error",
|
|
1437
|
+
"ts/no-unsafe-return": "error",
|
|
1438
|
+
"ts/restrict-plus-operands": "error",
|
|
1439
|
+
"ts/restrict-template-expressions": "error",
|
|
1440
|
+
"ts/unbound-method": "error"
|
|
1441
|
+
};
|
|
1442
|
+
const tsconfigPath = options?.tsconfigPath ? toArray(options.tsconfigPath) : void 0;
|
|
1541
1443
|
const [
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
pluginReactRefresh
|
|
1444
|
+
pluginTs,
|
|
1445
|
+
parserTs
|
|
1545
1446
|
] = await Promise.all([
|
|
1546
|
-
|
|
1547
|
-
interopDefault(import("eslint
|
|
1548
|
-
// @ts-expect-error missing types
|
|
1549
|
-
interopDefault(import("eslint-plugin-react-hooks")),
|
|
1550
|
-
// @ts-expect-error missing types
|
|
1551
|
-
interopDefault(import("eslint-plugin-react-refresh"))
|
|
1447
|
+
interopDefault(import("@typescript-eslint/eslint-plugin")),
|
|
1448
|
+
interopDefault(import("@typescript-eslint/parser"))
|
|
1552
1449
|
]);
|
|
1553
|
-
const isAllowConstantExport = ReactRefreshAllowConstantExportPackages.some(
|
|
1554
|
-
(i) => (0, import_local_pkg3.isPackageExists)(i)
|
|
1555
|
-
);
|
|
1556
1450
|
return [
|
|
1557
1451
|
{
|
|
1558
|
-
|
|
1452
|
+
// Install the plugins without globs, so they can be configured separately.
|
|
1453
|
+
name: "eslint:typescript:setup",
|
|
1559
1454
|
plugins: {
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
"react-refresh": pluginReactRefresh
|
|
1455
|
+
antfu: import_eslint_plugin_antfu.default,
|
|
1456
|
+
ts: pluginTs
|
|
1563
1457
|
}
|
|
1564
1458
|
},
|
|
1565
1459
|
{
|
|
1566
1460
|
files,
|
|
1567
1461
|
languageOptions: {
|
|
1462
|
+
parser: parserTs,
|
|
1568
1463
|
parserOptions: {
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1464
|
+
extraFileExtensions: componentExts.map((ext) => `.${ext}`),
|
|
1465
|
+
sourceType: "module",
|
|
1466
|
+
...tsconfigPath ? {
|
|
1467
|
+
project: tsconfigPath,
|
|
1468
|
+
tsconfigRootDir: import_node_process2.default.cwd()
|
|
1469
|
+
} : {},
|
|
1470
|
+
...parserOptions
|
|
1572
1471
|
}
|
|
1573
1472
|
},
|
|
1574
|
-
name: "eslint:
|
|
1473
|
+
name: "eslint:typescript:rules",
|
|
1575
1474
|
rules: {
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
"
|
|
1587
|
-
"
|
|
1588
|
-
"
|
|
1589
|
-
"
|
|
1590
|
-
"
|
|
1591
|
-
|
|
1592
|
-
"
|
|
1593
|
-
"
|
|
1594
|
-
"
|
|
1595
|
-
"
|
|
1596
|
-
"
|
|
1597
|
-
"
|
|
1598
|
-
|
|
1599
|
-
"
|
|
1600
|
-
"
|
|
1601
|
-
"
|
|
1602
|
-
|
|
1603
|
-
"
|
|
1604
|
-
"
|
|
1605
|
-
"
|
|
1606
|
-
"
|
|
1607
|
-
|
|
1608
|
-
"
|
|
1609
|
-
|
|
1610
|
-
"
|
|
1611
|
-
|
|
1612
|
-
"react/jsx-no-duplicate-props": "error",
|
|
1613
|
-
"react/jsx-no-leaked-render": "error",
|
|
1614
|
-
"react/jsx-no-literals": "off",
|
|
1615
|
-
// 禁止在 JSX 中使用字符串文字
|
|
1616
|
-
"react/jsx-no-script-url": "error",
|
|
1617
|
-
"react/jsx-no-target-blank": "error",
|
|
1618
|
-
"react/jsx-no-undef": "error",
|
|
1619
|
-
"react/jsx-no-useless-fragment": "error",
|
|
1620
|
-
"react/jsx-pascal-case": "error",
|
|
1621
|
-
"react/jsx-props-no-spreading": "off",
|
|
1622
|
-
// 强制任何 JSX 属性都不会传播
|
|
1623
|
-
"react/jsx-uses-react": "error",
|
|
1624
|
-
"react/jsx-uses-vars": "error",
|
|
1625
|
-
"react/no-access-state-in-setstate": "error",
|
|
1626
|
-
"react/no-adjacent-inline-elements": "error",
|
|
1627
|
-
"react/no-array-index-key": "error",
|
|
1628
|
-
"react/no-arrow-function-lifecycle": "error",
|
|
1629
|
-
"react/no-children-prop": "error",
|
|
1630
|
-
"react/no-danger": "off",
|
|
1631
|
-
// 禁止使用 dangerouslySetInnerHTML
|
|
1632
|
-
"react/no-danger-with-children": "error",
|
|
1633
|
-
"react/no-deprecated": "error",
|
|
1634
|
-
"react/no-did-mount-set-state": "error",
|
|
1635
|
-
"react/no-did-update-set-state": "error",
|
|
1636
|
-
"react/no-direct-mutation-state": "error",
|
|
1637
|
-
"react/no-find-dom-node": "error",
|
|
1638
|
-
"react/no-invalid-html-attribute": "error",
|
|
1639
|
-
"react/no-is-mounted": "error",
|
|
1640
|
-
"react/no-multi-comp": "error",
|
|
1641
|
-
"react/no-namespace": "error",
|
|
1642
|
-
"react/no-object-type-as-default-prop": "error",
|
|
1643
|
-
"react/no-redundant-should-component-update": "error",
|
|
1644
|
-
"react/no-render-return-value": "error",
|
|
1645
|
-
"react/no-set-state": "error",
|
|
1646
|
-
"react/no-string-refs": "error",
|
|
1647
|
-
"react/no-this-in-sfc": "error",
|
|
1648
|
-
"react/no-typos": "error",
|
|
1649
|
-
"react/no-unescaped-entities": "error",
|
|
1650
|
-
"react/no-unknown-property": "error",
|
|
1651
|
-
"react/no-unsafe": "off",
|
|
1652
|
-
// 禁止使用不安全的生命周期方法
|
|
1653
|
-
"react/no-unstable-nested-components": "error",
|
|
1654
|
-
"react/no-unused-class-component-methods": "error",
|
|
1655
|
-
"react/no-unused-prop-types": "error",
|
|
1656
|
-
"react/no-unused-state": "error",
|
|
1657
|
-
"react/no-will-update-set-state": "error",
|
|
1658
|
-
"react/prefer-es6-class": "error",
|
|
1659
|
-
"react/prefer-exact-props": "error",
|
|
1660
|
-
"react/prefer-read-only-props": "error",
|
|
1661
|
-
"react/prefer-stateless-function": "error",
|
|
1662
|
-
"react/prop-types": "error",
|
|
1663
|
-
"react/react-in-jsx-scope": "off",
|
|
1664
|
-
// 使用 JSX 时需要引入 React
|
|
1665
|
-
"react/require-default-props": "off",
|
|
1666
|
-
// 为每个非必需 prop 强制执行 defaultProps 定义
|
|
1667
|
-
"react/require-optimization": "error",
|
|
1668
|
-
"react/require-render-return": "error",
|
|
1669
|
-
"react/self-closing-comp": "error",
|
|
1670
|
-
"react/sort-comp": "error",
|
|
1671
|
-
"react/sort-default-props": "error",
|
|
1672
|
-
"react/sort-prop-types": "error",
|
|
1673
|
-
"react/state-in-constructor": "error",
|
|
1674
|
-
"react/static-property-placement": "error",
|
|
1675
|
-
"react/style-prop-object": "error",
|
|
1676
|
-
"react/void-dom-elements-no-children": "error",
|
|
1677
|
-
...typescript2 ? {
|
|
1678
|
-
"react/jsx-no-undef": "off",
|
|
1679
|
-
"react/prop-type": "off"
|
|
1680
|
-
} : {},
|
|
1475
|
+
...renameRules(
|
|
1476
|
+
pluginTs.configs["eslint-recommended"].overrides[0].rules,
|
|
1477
|
+
"@typescript-eslint/",
|
|
1478
|
+
"ts/"
|
|
1479
|
+
),
|
|
1480
|
+
...renameRules(
|
|
1481
|
+
pluginTs.configs.strict.rules,
|
|
1482
|
+
"@typescript-eslint/",
|
|
1483
|
+
"ts/"
|
|
1484
|
+
),
|
|
1485
|
+
"no-dupe-class-members": "off",
|
|
1486
|
+
"no-loss-of-precision": "off",
|
|
1487
|
+
"no-redeclare": "off",
|
|
1488
|
+
"no-use-before-define": "off",
|
|
1489
|
+
"no-useless-constructor": "off",
|
|
1490
|
+
"ts/ban-ts-comment": ["error", { "ts-ignore": "allow-with-description" }],
|
|
1491
|
+
"ts/ban-types": ["error", { types: { Function: false } }],
|
|
1492
|
+
"ts/consistent-type-definitions": ["error", "interface"],
|
|
1493
|
+
"ts/consistent-type-imports": ["error", { disallowTypeAnnotations: false, prefer: "type-imports" }],
|
|
1494
|
+
"ts/no-dupe-class-members": "error",
|
|
1495
|
+
"ts/no-dynamic-delete": "off",
|
|
1496
|
+
"ts/no-explicit-any": "off",
|
|
1497
|
+
"ts/no-extraneous-class": "off",
|
|
1498
|
+
"ts/no-import-type-side-effects": "error",
|
|
1499
|
+
"ts/no-invalid-void-type": "off",
|
|
1500
|
+
"ts/no-loss-of-precision": "error",
|
|
1501
|
+
"ts/no-non-null-assertion": "off",
|
|
1502
|
+
"ts/no-redeclare": "error",
|
|
1503
|
+
"ts/no-require-imports": "error",
|
|
1504
|
+
"ts/no-unused-vars": "off",
|
|
1505
|
+
"ts/no-use-before-define": ["error", { classes: false, functions: false, variables: true }],
|
|
1506
|
+
"ts/no-useless-constructor": "off",
|
|
1507
|
+
"ts/prefer-ts-expect-error": "error",
|
|
1508
|
+
"ts/triple-slash-reference": "off",
|
|
1509
|
+
"ts/unified-signatures": "off",
|
|
1510
|
+
...tsconfigPath ? typeAwareRules : {},
|
|
1681
1511
|
...overrides
|
|
1512
|
+
}
|
|
1513
|
+
},
|
|
1514
|
+
{
|
|
1515
|
+
files: ["**/*.d.ts"],
|
|
1516
|
+
name: "eslint:typescript:dts-overrides",
|
|
1517
|
+
rules: {
|
|
1518
|
+
"eslint-comments/no-unlimited-disable": "off",
|
|
1519
|
+
"import/no-duplicates": "off",
|
|
1520
|
+
"no-restricted-syntax": "off",
|
|
1521
|
+
"unused-imports/no-unused-vars": "off"
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
{
|
|
1525
|
+
files: ["**/*.{test,spec}.ts?(x)"],
|
|
1526
|
+
name: "eslint:typescript:tests-overrides",
|
|
1527
|
+
rules: {
|
|
1528
|
+
"no-unused-expressions": "off"
|
|
1529
|
+
}
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
files: ["**/*.js", "**/*.cjs"],
|
|
1533
|
+
name: "eslint:typescript:javascript-overrides",
|
|
1534
|
+
rules: {
|
|
1535
|
+
"ts/no-require-imports": "off",
|
|
1536
|
+
"ts/no-var-requires": "off"
|
|
1537
|
+
}
|
|
1538
|
+
}
|
|
1539
|
+
];
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// src/configs/unicorn.ts
|
|
1543
|
+
async function unicorn() {
|
|
1544
|
+
return [
|
|
1545
|
+
{
|
|
1546
|
+
name: "eslint:unicorn",
|
|
1547
|
+
plugins: {
|
|
1548
|
+
unicorn: import_eslint_plugin_unicorn.default
|
|
1682
1549
|
},
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1550
|
+
rules: {
|
|
1551
|
+
// Pass error message when throwing errors
|
|
1552
|
+
"unicorn/error-message": "error",
|
|
1553
|
+
// Uppercase regex escapes
|
|
1554
|
+
"unicorn/escape-case": "error",
|
|
1555
|
+
// Array.isArray instead of instanceof
|
|
1556
|
+
"unicorn/no-instanceof-array": "error",
|
|
1557
|
+
// Ban `new Array` as `Array` constructor's params are ambiguous
|
|
1558
|
+
"unicorn/no-new-array": "error",
|
|
1559
|
+
// Prevent deprecated `new Buffer()`
|
|
1560
|
+
"unicorn/no-new-buffer": "error",
|
|
1561
|
+
// Keep regex literals safe!
|
|
1562
|
+
"unicorn/no-unsafe-regex": "error",
|
|
1563
|
+
// Lowercase number formatting for octal, hex, binary (0x1'error' instead of 0X1'error')
|
|
1564
|
+
"unicorn/number-literal-case": "error",
|
|
1565
|
+
// textContent instead of innerText
|
|
1566
|
+
"unicorn/prefer-dom-node-text-content": "error",
|
|
1567
|
+
// includes over indexOf when checking for existence
|
|
1568
|
+
"unicorn/prefer-includes": "error",
|
|
1569
|
+
// Prefer using the node: protocol
|
|
1570
|
+
"unicorn/prefer-node-protocol": "error",
|
|
1571
|
+
// Prefer using number properties like `Number.isNaN` rather than `isNaN`
|
|
1572
|
+
"unicorn/prefer-number-properties": "error",
|
|
1573
|
+
// String methods startsWith/endsWith instead of more complicated stuff
|
|
1574
|
+
"unicorn/prefer-string-starts-ends-with": "error",
|
|
1575
|
+
// Enforce throwing type error when throwing error while checking typeof
|
|
1576
|
+
"unicorn/prefer-type-error": "error",
|
|
1577
|
+
// Use new when throwing error
|
|
1578
|
+
"unicorn/throw-new-error": "error"
|
|
1687
1579
|
}
|
|
1688
1580
|
}
|
|
1689
1581
|
];
|
|
@@ -1722,6 +1614,208 @@ async function unocss(options = {}) {
|
|
|
1722
1614
|
];
|
|
1723
1615
|
}
|
|
1724
1616
|
|
|
1617
|
+
// src/configs/vue.ts
|
|
1618
|
+
var import_local_pkg3 = require("local-pkg");
|
|
1619
|
+
var pkg = (0, import_local_pkg3.getPackageInfoSync)("vue");
|
|
1620
|
+
var vueVersion = pkg && pkg.version;
|
|
1621
|
+
vueVersion = vueVersion && vueVersion[0];
|
|
1622
|
+
vueVersion = Number.isNaN(vueVersion) ? "3" : vueVersion;
|
|
1623
|
+
async function vue(options = {}) {
|
|
1624
|
+
const {
|
|
1625
|
+
files = [GLOB_VUE],
|
|
1626
|
+
overrides = {},
|
|
1627
|
+
stylistic: stylistic2 = true
|
|
1628
|
+
} = options;
|
|
1629
|
+
const {
|
|
1630
|
+
indent = 4
|
|
1631
|
+
} = typeof stylistic2 === "boolean" ? {} : stylistic2;
|
|
1632
|
+
const [
|
|
1633
|
+
pluginVue,
|
|
1634
|
+
parserVue
|
|
1635
|
+
] = await Promise.all([
|
|
1636
|
+
// @ts-expect-error missing types
|
|
1637
|
+
interopDefault(import("eslint-plugin-vue")),
|
|
1638
|
+
interopDefault(import("vue-eslint-parser"))
|
|
1639
|
+
]);
|
|
1640
|
+
return [
|
|
1641
|
+
{
|
|
1642
|
+
name: "eslint:vue:setup",
|
|
1643
|
+
plugins: {
|
|
1644
|
+
vue: pluginVue
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
{
|
|
1648
|
+
files,
|
|
1649
|
+
languageOptions: {
|
|
1650
|
+
parser: parserVue,
|
|
1651
|
+
parserOptions: {
|
|
1652
|
+
ecmaFeatures: {
|
|
1653
|
+
jsx: true
|
|
1654
|
+
},
|
|
1655
|
+
extraFileExtensions: [".vue"],
|
|
1656
|
+
parser: options.typescript ? await interopDefault(import("@typescript-eslint/parser")) : null,
|
|
1657
|
+
sourceType: "module"
|
|
1658
|
+
}
|
|
1659
|
+
},
|
|
1660
|
+
name: "eslint:vue:rules",
|
|
1661
|
+
processor: pluginVue.processors[".vue"],
|
|
1662
|
+
rules: {
|
|
1663
|
+
...pluginVue.configs.base.rules,
|
|
1664
|
+
...vueVersion === "3" ? {
|
|
1665
|
+
...pluginVue.configs["vue3-essential"].rules,
|
|
1666
|
+
...pluginVue.configs["vue3-strongly-recommended"].rules,
|
|
1667
|
+
...pluginVue.configs["vue3-recommended"].rules
|
|
1668
|
+
} : {
|
|
1669
|
+
...pluginVue.configs.essential.rules,
|
|
1670
|
+
...pluginVue.configs["strongly-recommended"].rules,
|
|
1671
|
+
...pluginVue.configs.recommended.rules
|
|
1672
|
+
},
|
|
1673
|
+
"node/prefer-global/process": "off",
|
|
1674
|
+
"vue/block-order": ["error", {
|
|
1675
|
+
order: ["template", "script", "style"]
|
|
1676
|
+
}],
|
|
1677
|
+
"vue/component-name-in-template-casing": ["error", "PascalCase"],
|
|
1678
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1679
|
+
"vue/custom-event-name-casing": vueVersion === "3" ? ["error", "camelCase"] : ["error", "kebab-case"],
|
|
1680
|
+
...vueVersion === "2" ? {
|
|
1681
|
+
"vue/require-explicit-emits": "off"
|
|
1682
|
+
} : null,
|
|
1683
|
+
"vue/define-macros-order": ["error", {
|
|
1684
|
+
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"]
|
|
1685
|
+
}],
|
|
1686
|
+
"vue/dot-location": ["error", "property"],
|
|
1687
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1688
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1689
|
+
"vue/html-indent": ["error", indent, {
|
|
1690
|
+
alignAttributesVertically: true,
|
|
1691
|
+
attribute: 1,
|
|
1692
|
+
baseIndent: 1,
|
|
1693
|
+
closeBracket: 0,
|
|
1694
|
+
ignores: []
|
|
1695
|
+
}],
|
|
1696
|
+
"vue/html-self-closing": ["error", {
|
|
1697
|
+
html: {
|
|
1698
|
+
component: "any",
|
|
1699
|
+
normal: "any",
|
|
1700
|
+
void: "never"
|
|
1701
|
+
},
|
|
1702
|
+
math: "always",
|
|
1703
|
+
svg: "always"
|
|
1704
|
+
}],
|
|
1705
|
+
"vue/max-attributes-per-line": "off",
|
|
1706
|
+
"vue/multi-word-component-names": "off",
|
|
1707
|
+
"vue/no-constant-condition": "warn",
|
|
1708
|
+
"vue/no-dupe-keys": "off",
|
|
1709
|
+
"vue/no-empty-pattern": "error",
|
|
1710
|
+
"vue/no-extra-parens": ["error", "functions"],
|
|
1711
|
+
"vue/no-irregular-whitespace": "error",
|
|
1712
|
+
"vue/no-loss-of-precision": "error",
|
|
1713
|
+
"vue/no-restricted-syntax": [
|
|
1714
|
+
"error",
|
|
1715
|
+
"DebuggerStatement",
|
|
1716
|
+
"LabeledStatement",
|
|
1717
|
+
"WithStatement"
|
|
1718
|
+
],
|
|
1719
|
+
"vue/no-restricted-v-bind": ["error", "/^v-/"],
|
|
1720
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
1721
|
+
"vue/no-sparse-arrays": "error",
|
|
1722
|
+
"vue/no-unused-refs": "error",
|
|
1723
|
+
"vue/no-useless-v-bind": "error",
|
|
1724
|
+
"vue/no-v-html": "off",
|
|
1725
|
+
"vue/no-v-text-v-html-on-component": "off",
|
|
1726
|
+
"vue/object-shorthand": ["error", "always", {
|
|
1727
|
+
avoidQuotes: true,
|
|
1728
|
+
ignoreConstructors: false
|
|
1729
|
+
}],
|
|
1730
|
+
"vue/prefer-separate-static-class": "error",
|
|
1731
|
+
"vue/prefer-template": "error",
|
|
1732
|
+
"vue/require-default-prop": "off",
|
|
1733
|
+
"vue/require-prop-types": "off",
|
|
1734
|
+
"vue/singleline-html-element-content-newline": "off",
|
|
1735
|
+
"vue/space-infix-ops": "error",
|
|
1736
|
+
"vue/space-unary-ops": ["error", { nonwords: false, words: true }],
|
|
1737
|
+
...stylistic2 ? {
|
|
1738
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1739
|
+
"vue/arrow-spacing": ["error", { after: true, before: true }],
|
|
1740
|
+
"vue/block-spacing": ["error", "always"],
|
|
1741
|
+
"vue/block-tag-newline": ["error", { multiline: "always", singleline: "always" }],
|
|
1742
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1743
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1744
|
+
"vue/comma-spacing": ["error", { after: true, before: false }],
|
|
1745
|
+
"vue/comma-style": ["error", "last"],
|
|
1746
|
+
"vue/html-comment-content-spacing": ["error", "always", { exceptions: ["-"] }],
|
|
1747
|
+
"vue/key-spacing": ["error", { afterColon: true, beforeColon: false }],
|
|
1748
|
+
"vue/keyword-spacing": ["error", { after: true, before: true }],
|
|
1749
|
+
"vue/object-curly-newline": "off",
|
|
1750
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1751
|
+
"vue/object-property-newline": ["error", { allowMultiplePropertiesPerLine: true }],
|
|
1752
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1753
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
1754
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1755
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1756
|
+
"vue/template-curly-spacing": "error"
|
|
1757
|
+
} : {},
|
|
1758
|
+
...overrides
|
|
1759
|
+
}
|
|
1760
|
+
}
|
|
1761
|
+
];
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
// src/configs/yaml.ts
|
|
1765
|
+
async function yaml(options = {}) {
|
|
1766
|
+
const {
|
|
1767
|
+
files = [GLOB_YAML],
|
|
1768
|
+
overrides = {},
|
|
1769
|
+
stylistic: stylistic2 = true
|
|
1770
|
+
} = options;
|
|
1771
|
+
const [
|
|
1772
|
+
pluginYaml,
|
|
1773
|
+
parserYaml
|
|
1774
|
+
] = await Promise.all([
|
|
1775
|
+
interopDefault(import("eslint-plugin-yml")),
|
|
1776
|
+
interopDefault(import("yaml-eslint-parser"))
|
|
1777
|
+
]);
|
|
1778
|
+
return [
|
|
1779
|
+
{
|
|
1780
|
+
name: "eslint:yaml:setup",
|
|
1781
|
+
plugins: {
|
|
1782
|
+
yaml: pluginYaml
|
|
1783
|
+
}
|
|
1784
|
+
},
|
|
1785
|
+
{
|
|
1786
|
+
files,
|
|
1787
|
+
languageOptions: {
|
|
1788
|
+
parser: parserYaml
|
|
1789
|
+
},
|
|
1790
|
+
name: "eslint:yaml:rules",
|
|
1791
|
+
rules: {
|
|
1792
|
+
"style/spaced-comment": "off",
|
|
1793
|
+
"yaml/block-mapping": "error",
|
|
1794
|
+
"yaml/block-sequence": "error",
|
|
1795
|
+
"yaml/no-empty-key": "error",
|
|
1796
|
+
"yaml/no-empty-sequence-entry": "error",
|
|
1797
|
+
"yaml/no-irregular-whitespace": "error",
|
|
1798
|
+
"yaml/plain-scalar": "error",
|
|
1799
|
+
"yaml/vue-custom-block/no-parsing-error": "error",
|
|
1800
|
+
...stylistic2 ? {
|
|
1801
|
+
"yaml/block-mapping-question-indicator-newline": "error",
|
|
1802
|
+
"yaml/block-sequence-hyphen-indicator-newline": "error",
|
|
1803
|
+
"yaml/flow-mapping-curly-newline": "error",
|
|
1804
|
+
"yaml/flow-mapping-curly-spacing": "error",
|
|
1805
|
+
"yaml/flow-sequence-bracket-newline": "error",
|
|
1806
|
+
"yaml/flow-sequence-bracket-spacing": "error",
|
|
1807
|
+
"yaml/indent": ["error", 2],
|
|
1808
|
+
"yaml/key-spacing": "error",
|
|
1809
|
+
"yaml/no-tab-indent": "error",
|
|
1810
|
+
"yaml/quotes": ["error", { avoidEscape: false, prefer: "single" }],
|
|
1811
|
+
"yaml/spaced-comment": "error"
|
|
1812
|
+
} : {},
|
|
1813
|
+
...overrides
|
|
1814
|
+
}
|
|
1815
|
+
}
|
|
1816
|
+
];
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1725
1819
|
// src/factory.ts
|
|
1726
1820
|
var flatConfigProps = [
|
|
1727
1821
|
"files",
|
|
@@ -1849,11 +1943,20 @@ async function lincy(options = {}, ...userConfigs) {
|
|
|
1849
1943
|
}));
|
|
1850
1944
|
}
|
|
1851
1945
|
if (options.markdown ?? true) {
|
|
1852
|
-
configs.push(markdown(
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
|
|
1946
|
+
configs.push(markdown(
|
|
1947
|
+
{
|
|
1948
|
+
...typeof options.markdown !== "boolean" ? options.markdown : {},
|
|
1949
|
+
componentExts,
|
|
1950
|
+
overrides: overrides.markdown
|
|
1951
|
+
},
|
|
1952
|
+
options.formatters === true || !!(options.formatters || {})?.markdown
|
|
1953
|
+
));
|
|
1954
|
+
}
|
|
1955
|
+
if (options.formatters) {
|
|
1956
|
+
configs.push(formatters(
|
|
1957
|
+
options.formatters,
|
|
1958
|
+
typeof stylisticOptions === "boolean" ? {} : stylisticOptions
|
|
1959
|
+
));
|
|
1857
1960
|
}
|
|
1858
1961
|
const fusedConfig = flatConfigProps.reduce((acc, key) => {
|
|
1859
1962
|
if (key in options)
|
|
@@ -1885,6 +1988,8 @@ var src_default = lincy;
|
|
|
1885
1988
|
GLOB_LESS,
|
|
1886
1989
|
GLOB_MARKDOWN,
|
|
1887
1990
|
GLOB_MARKDOWN_CODE,
|
|
1991
|
+
GLOB_MARKDOWN_IN_MARKDOWN,
|
|
1992
|
+
GLOB_POSTCSS,
|
|
1888
1993
|
GLOB_SCSS,
|
|
1889
1994
|
GLOB_SRC,
|
|
1890
1995
|
GLOB_SRC_EXT,
|
|
@@ -1894,9 +1999,11 @@ var src_default = lincy;
|
|
|
1894
1999
|
GLOB_TSX,
|
|
1895
2000
|
GLOB_VUE,
|
|
1896
2001
|
GLOB_YAML,
|
|
2002
|
+
StylisticConfigDefaults,
|
|
1897
2003
|
combine,
|
|
1898
2004
|
comments,
|
|
1899
2005
|
ensurePackages,
|
|
2006
|
+
formatters,
|
|
1900
2007
|
ignores,
|
|
1901
2008
|
imports,
|
|
1902
2009
|
interopDefault,
|