@ntnyq/eslint-config 2.8.0 → 2.8.2
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 +10 -1
- package/dist/index.cjs +385 -314
- package/dist/index.d.cts +328 -9
- package/dist/index.d.ts +328 -9
- package/dist/index.js +397 -332
- package/package.json +15 -13
package/dist/index.cjs
CHANGED
|
@@ -49,6 +49,7 @@ __export(src_exports, {
|
|
|
49
49
|
GLOB_SRC: () => GLOB_SRC,
|
|
50
50
|
GLOB_SRC_EXT: () => GLOB_SRC_EXT,
|
|
51
51
|
GLOB_STYLE: () => GLOB_STYLE,
|
|
52
|
+
GLOB_TEST: () => GLOB_TEST,
|
|
52
53
|
GLOB_TOML: () => GLOB_TOML,
|
|
53
54
|
GLOB_TS: () => GLOB_TS,
|
|
54
55
|
GLOB_TSX: () => GLOB_TSX,
|
|
@@ -60,6 +61,7 @@ __export(src_exports, {
|
|
|
60
61
|
getVueVersion: () => getVueVersion,
|
|
61
62
|
hasTypeScript: () => hasTypeScript,
|
|
62
63
|
hasUnoCSS: () => hasUnoCSS,
|
|
64
|
+
hasVitest: () => hasVitest,
|
|
63
65
|
hasVue: () => hasVue,
|
|
64
66
|
ignores: () => ignores,
|
|
65
67
|
imports: () => imports,
|
|
@@ -76,18 +78,21 @@ __export(src_exports, {
|
|
|
76
78
|
parserToml: () => parserToml,
|
|
77
79
|
parserVue: () => parserVue,
|
|
78
80
|
parserYaml: () => parserYaml,
|
|
81
|
+
perfectionist: () => perfectionist,
|
|
79
82
|
pluginComments: () => import_eslint_plugin_eslint_comments.default,
|
|
80
83
|
pluginImport: () => import_eslint_plugin_import_x.default,
|
|
81
84
|
pluginJsdoc: () => import_eslint_plugin_jsdoc.default,
|
|
82
85
|
pluginJsonc: () => import_eslint_plugin_jsonc.default,
|
|
83
86
|
pluginMarkdown: () => import_eslint_plugin_markdown.default,
|
|
84
87
|
pluginNode: () => import_eslint_plugin_n.default,
|
|
88
|
+
pluginPerfectionist: () => import_eslint_plugin_perfectionist.default,
|
|
85
89
|
pluginPrettier: () => import_eslint_plugin_prettier.default,
|
|
86
90
|
pluginRegexp: () => pluginRegexp,
|
|
87
91
|
pluginToml: () => import_eslint_plugin_toml.default,
|
|
88
92
|
pluginUnicorn: () => import_eslint_plugin_unicorn.default,
|
|
89
93
|
pluginUnoCSS: () => import_eslint_plugin.default,
|
|
90
94
|
pluginUnusedImports: () => import_eslint_plugin_unused_imports.default,
|
|
95
|
+
pluginVitest: () => import_eslint_plugin2.default,
|
|
91
96
|
pluginVue: () => import_eslint_plugin_vue.default,
|
|
92
97
|
pluginYaml: () => import_eslint_plugin_yml.default,
|
|
93
98
|
prettier: () => prettier,
|
|
@@ -101,6 +106,7 @@ __export(src_exports, {
|
|
|
101
106
|
unicorn: () => unicorn,
|
|
102
107
|
unocss: () => unocss,
|
|
103
108
|
unusedImports: () => unusedImports,
|
|
109
|
+
vitest: () => vitest,
|
|
104
110
|
vue: () => vue,
|
|
105
111
|
yml: () => yml
|
|
106
112
|
});
|
|
@@ -111,6 +117,7 @@ var import_node_process = __toESM(require("process"), 1);
|
|
|
111
117
|
var import_node_path = require("path");
|
|
112
118
|
var import_local_pkg = require("local-pkg");
|
|
113
119
|
var hasTypeScript = (0, import_local_pkg.isPackageExists)("typescript");
|
|
120
|
+
var hasVitest = (0, import_local_pkg.isPackageExists)("vitest");
|
|
114
121
|
var hasVue = (0, import_local_pkg.isPackageExists)("vue") || (0, import_local_pkg.isPackageExists)("nuxt") || (0, import_local_pkg.isPackageExists)("vitepress") || (0, import_local_pkg.isPackageExists)("@slidev/cli") || (0, import_local_pkg.isPackageExists)("vue", {
|
|
115
122
|
paths: [(0, import_node_path.resolve)(import_node_process.default.cwd(), "playground")]
|
|
116
123
|
});
|
|
@@ -144,6 +151,7 @@ var GLOB_JSX = "**/*.?([cm])jsx";
|
|
|
144
151
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
145
152
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
146
153
|
var GLOB_DTS = "**/*.d.?([cm])ts";
|
|
154
|
+
var GLOB_TEST = "**/*.{test,spec}.?([cm])[jt]s?(x)";
|
|
147
155
|
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
148
156
|
var GLOB_CSS = "**/*.css";
|
|
149
157
|
var GLOB_LESS = "**/*.less";
|
|
@@ -239,11 +247,13 @@ var import_eslint_plugin_toml = __toESM(require("eslint-plugin-toml"), 1);
|
|
|
239
247
|
var import_eslint_plugin_jsonc = __toESM(require("eslint-plugin-jsonc"), 1);
|
|
240
248
|
var import_eslint_plugin_jsdoc = __toESM(require("eslint-plugin-jsdoc"), 1);
|
|
241
249
|
var import_eslint_plugin = __toESM(require("@unocss/eslint-plugin"), 1);
|
|
250
|
+
var import_eslint_plugin2 = __toESM(require("@vitest/eslint-plugin"), 1);
|
|
242
251
|
var import_eslint_plugin_unicorn = __toESM(require("eslint-plugin-unicorn"), 1);
|
|
243
252
|
var import_eslint_plugin_import_x = __toESM(require("eslint-plugin-import-x"), 1);
|
|
244
253
|
var import_eslint_plugin_prettier = __toESM(require("eslint-plugin-prettier"), 1);
|
|
245
254
|
var import_eslint_plugin_markdown = __toESM(require("eslint-plugin-markdown"), 1);
|
|
246
|
-
var
|
|
255
|
+
var import_eslint_plugin_perfectionist = __toESM(require("eslint-plugin-perfectionist"), 1);
|
|
256
|
+
var import_eslint_plugin_unused_imports = __toESM(require("eslint-plugin-unused-imports"), 1);
|
|
247
257
|
var import_eslint_plugin_eslint_comments = __toESM(require("@eslint-community/eslint-plugin-eslint-comments"), 1);
|
|
248
258
|
var parserToml = __toESM(require("toml-eslint-parser"), 1);
|
|
249
259
|
var parserYaml = __toESM(require("yaml-eslint-parser"), 1);
|
|
@@ -824,6 +834,43 @@ var unusedImports = defineConfig([
|
|
|
824
834
|
}
|
|
825
835
|
]);
|
|
826
836
|
|
|
837
|
+
// src/configs/perfectionist.ts
|
|
838
|
+
var perfectionist = defineConfig([
|
|
839
|
+
{
|
|
840
|
+
name: "ntnyq/perfectionist",
|
|
841
|
+
plugins: {
|
|
842
|
+
perfectionist: import_eslint_plugin_perfectionist.default
|
|
843
|
+
},
|
|
844
|
+
rules: {
|
|
845
|
+
"perfectionist/sort-imports": [
|
|
846
|
+
"error",
|
|
847
|
+
{
|
|
848
|
+
groups: [
|
|
849
|
+
"builtin",
|
|
850
|
+
"external",
|
|
851
|
+
"internal",
|
|
852
|
+
"internal-type",
|
|
853
|
+
"parent",
|
|
854
|
+
"parent-type",
|
|
855
|
+
"sibling",
|
|
856
|
+
"sibling-type",
|
|
857
|
+
"index",
|
|
858
|
+
"index-type",
|
|
859
|
+
"object",
|
|
860
|
+
"type",
|
|
861
|
+
"side-effect",
|
|
862
|
+
"side-effect-style"
|
|
863
|
+
],
|
|
864
|
+
internalPattern: ["~/**", "@/**", "#**"],
|
|
865
|
+
newlinesBetween: "ignore"
|
|
866
|
+
}
|
|
867
|
+
],
|
|
868
|
+
"perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
|
|
869
|
+
"perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
|
|
870
|
+
}
|
|
871
|
+
}
|
|
872
|
+
]);
|
|
873
|
+
|
|
827
874
|
// src/configs/regexp.ts
|
|
828
875
|
var regexp = defineConfig([
|
|
829
876
|
/**
|
|
@@ -854,6 +901,288 @@ var unocss = defineConfig([
|
|
|
854
901
|
var import_config = __toESM(require("eslint-plugin-command/config"), 1);
|
|
855
902
|
var command = defineConfig([(0, import_config.default)()]);
|
|
856
903
|
|
|
904
|
+
// src/configs/vitest.ts
|
|
905
|
+
var vitest = defineConfig([
|
|
906
|
+
{
|
|
907
|
+
name: "ntnyq/test",
|
|
908
|
+
plugins: {
|
|
909
|
+
vitest: import_eslint_plugin2.default
|
|
910
|
+
},
|
|
911
|
+
files: [GLOB_TEST],
|
|
912
|
+
rules: {
|
|
913
|
+
...import_eslint_plugin2.default.configs.recommended.rules
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
]);
|
|
917
|
+
|
|
918
|
+
// src/configs/vue.ts
|
|
919
|
+
var import_node_process2 = __toESM(require("process"), 1);
|
|
920
|
+
var import_local_pkg2 = require("local-pkg");
|
|
921
|
+
function getVueVersion() {
|
|
922
|
+
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
|
|
923
|
+
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
924
|
+
return +pkg.version[0];
|
|
925
|
+
}
|
|
926
|
+
return 3;
|
|
927
|
+
}
|
|
928
|
+
var isVue3 = getVueVersion() === 3;
|
|
929
|
+
var vue2Rules = {
|
|
930
|
+
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
931
|
+
...import_eslint_plugin_vue.default.configs.essential.rules,
|
|
932
|
+
...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
|
|
933
|
+
...import_eslint_plugin_vue.default.configs.recommended.rules
|
|
934
|
+
};
|
|
935
|
+
var vue3Rules = {
|
|
936
|
+
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
937
|
+
...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
|
|
938
|
+
...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
|
|
939
|
+
...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
|
|
940
|
+
};
|
|
941
|
+
var vue = defineConfig([
|
|
942
|
+
...import_typescript_eslint.default.config({
|
|
943
|
+
name: "ntnyq/vue/ts",
|
|
944
|
+
files: [GLOB_VUE],
|
|
945
|
+
// TODO: Remove this when `typescript-eslint` is aligned with `eslint`
|
|
946
|
+
// @ts-expect-error - `typescript-eslint` is not aligned with eslint
|
|
947
|
+
extends: typescriptCore
|
|
948
|
+
}),
|
|
949
|
+
{
|
|
950
|
+
name: "ntnyq/vue/core",
|
|
951
|
+
files: [GLOB_VUE],
|
|
952
|
+
plugins: {
|
|
953
|
+
vue: import_eslint_plugin_vue.default,
|
|
954
|
+
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
955
|
+
},
|
|
956
|
+
languageOptions: {
|
|
957
|
+
parser: parserVue,
|
|
958
|
+
parserOptions: {
|
|
959
|
+
parser: "@typescript-eslint/parser",
|
|
960
|
+
sourceType: "module",
|
|
961
|
+
extraFileExtensions: [".vue"],
|
|
962
|
+
ecmaFeatures: {
|
|
963
|
+
jsx: true
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
},
|
|
967
|
+
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
968
|
+
rules: {
|
|
969
|
+
...isVue3 ? vue3Rules : vue2Rules,
|
|
970
|
+
// OFF
|
|
971
|
+
"vue/no-v-html": "off",
|
|
972
|
+
"vue/require-prop-types": "off",
|
|
973
|
+
"vue/require-default-prop": "off",
|
|
974
|
+
"vue/multi-word-component-names": "off",
|
|
975
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
976
|
+
"vue/html-self-closing": [
|
|
977
|
+
"error",
|
|
978
|
+
{
|
|
979
|
+
html: {
|
|
980
|
+
void: "always",
|
|
981
|
+
normal: "always",
|
|
982
|
+
component: "always"
|
|
983
|
+
},
|
|
984
|
+
svg: "always",
|
|
985
|
+
math: "always"
|
|
986
|
+
}
|
|
987
|
+
],
|
|
988
|
+
"vue/block-tag-newline": [
|
|
989
|
+
"error",
|
|
990
|
+
{
|
|
991
|
+
singleline: "always",
|
|
992
|
+
multiline: "always"
|
|
993
|
+
}
|
|
994
|
+
],
|
|
995
|
+
"vue/component-name-in-template-casing": [
|
|
996
|
+
"error",
|
|
997
|
+
"PascalCase",
|
|
998
|
+
{
|
|
999
|
+
// Force auto-import components to be PascalCase
|
|
1000
|
+
registeredComponentsOnly: false,
|
|
1001
|
+
ignores: ["slot", "component"]
|
|
1002
|
+
}
|
|
1003
|
+
],
|
|
1004
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1005
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1006
|
+
"vue/define-macros-order": [
|
|
1007
|
+
"error",
|
|
1008
|
+
{
|
|
1009
|
+
order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
|
|
1010
|
+
}
|
|
1011
|
+
],
|
|
1012
|
+
"vue/html-comment-content-spacing": [
|
|
1013
|
+
"error",
|
|
1014
|
+
"always",
|
|
1015
|
+
{
|
|
1016
|
+
exceptions: ["-"]
|
|
1017
|
+
}
|
|
1018
|
+
],
|
|
1019
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
1020
|
+
"vue/arrow-spacing": ["error", { before: true, after: true }],
|
|
1021
|
+
"vue/block-spacing": ["error", "always"],
|
|
1022
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1023
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1024
|
+
"vue/comma-spacing": ["error", { before: false, after: true }],
|
|
1025
|
+
"vue/comma-style": ["error", "last"],
|
|
1026
|
+
"vue/dot-location": ["error", "property"],
|
|
1027
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1028
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
1029
|
+
"vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
1030
|
+
"vue/keyword-spacing": ["error", { before: true, after: true }],
|
|
1031
|
+
"vue/no-empty-pattern": "error",
|
|
1032
|
+
"vue/no-loss-of-precision": "error",
|
|
1033
|
+
"vue/no-irregular-whitespace": "error",
|
|
1034
|
+
"vue/no-use-v-else-with-v-for": "error",
|
|
1035
|
+
"vue/require-typed-object-prop": "error",
|
|
1036
|
+
"vue/no-extra-parens": ["error", "functions"],
|
|
1037
|
+
"vue/no-restricted-syntax": [
|
|
1038
|
+
"error",
|
|
1039
|
+
"DebuggerStatement",
|
|
1040
|
+
"LabeledStatement",
|
|
1041
|
+
"WithStatement"
|
|
1042
|
+
],
|
|
1043
|
+
"vue/no-sparse-arrays": "error",
|
|
1044
|
+
"vue/no-deprecated-model-definition": [
|
|
1045
|
+
"error",
|
|
1046
|
+
{
|
|
1047
|
+
allowVue3Compat: true
|
|
1048
|
+
}
|
|
1049
|
+
],
|
|
1050
|
+
"vue/object-curly-newline": [
|
|
1051
|
+
"error",
|
|
1052
|
+
{
|
|
1053
|
+
multiline: true,
|
|
1054
|
+
consistent: true
|
|
1055
|
+
}
|
|
1056
|
+
],
|
|
1057
|
+
"vue/no-static-inline-styles": [
|
|
1058
|
+
"error",
|
|
1059
|
+
{
|
|
1060
|
+
allowBinding: true
|
|
1061
|
+
}
|
|
1062
|
+
],
|
|
1063
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
1064
|
+
"vue/object-property-newline": [
|
|
1065
|
+
"error",
|
|
1066
|
+
{
|
|
1067
|
+
allowMultiplePropertiesPerLine: true
|
|
1068
|
+
}
|
|
1069
|
+
],
|
|
1070
|
+
"vue/object-shorthand": [
|
|
1071
|
+
"error",
|
|
1072
|
+
"always",
|
|
1073
|
+
{
|
|
1074
|
+
ignoreConstructors: false,
|
|
1075
|
+
avoidQuotes: true
|
|
1076
|
+
}
|
|
1077
|
+
],
|
|
1078
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
1079
|
+
"vue/prefer-template": "error",
|
|
1080
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1081
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1082
|
+
"vue/space-in-parens": ["error", "never"],
|
|
1083
|
+
"vue/space-infix-ops": "error",
|
|
1084
|
+
"vue/space-unary-ops": [
|
|
1085
|
+
"error",
|
|
1086
|
+
{
|
|
1087
|
+
words: true,
|
|
1088
|
+
nonwords: false
|
|
1089
|
+
}
|
|
1090
|
+
],
|
|
1091
|
+
"vue/template-curly-spacing": "error",
|
|
1092
|
+
"vue/block-order": [
|
|
1093
|
+
"error",
|
|
1094
|
+
{
|
|
1095
|
+
order: ["script", "template", "style"]
|
|
1096
|
+
}
|
|
1097
|
+
],
|
|
1098
|
+
"vue/attributes-order": [
|
|
1099
|
+
"error",
|
|
1100
|
+
{
|
|
1101
|
+
order: [
|
|
1102
|
+
"EVENTS",
|
|
1103
|
+
// `@click="functionCall"`, `v-on="event"`
|
|
1104
|
+
"TWO_WAY_BINDING",
|
|
1105
|
+
// `v-model`
|
|
1106
|
+
"OTHER_DIRECTIVES",
|
|
1107
|
+
// `v-custom-directive`
|
|
1108
|
+
"LIST_RENDERING",
|
|
1109
|
+
// `v-for item in items`
|
|
1110
|
+
"CONDITIONALS",
|
|
1111
|
+
// `v-if`, `v-show`, `v-cloak`
|
|
1112
|
+
"CONTENT",
|
|
1113
|
+
// `v-text`, `v-html`
|
|
1114
|
+
"SLOT",
|
|
1115
|
+
// `v-slot`, `slot`
|
|
1116
|
+
"UNIQUE",
|
|
1117
|
+
// `ref`, `key`
|
|
1118
|
+
"DEFINITION",
|
|
1119
|
+
// `is`, `v-is`
|
|
1120
|
+
"ATTR_DYNAMIC",
|
|
1121
|
+
// `v-bind:prop="foo"`, `:prop="foo"`
|
|
1122
|
+
// `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
|
|
1123
|
+
"RENDER_MODIFIERS",
|
|
1124
|
+
// `v-once`, `v-pre`
|
|
1125
|
+
"GLOBAL",
|
|
1126
|
+
// `id`
|
|
1127
|
+
"ATTR_STATIC",
|
|
1128
|
+
// `prop="foo", `static attributes
|
|
1129
|
+
"ATTR_SHORTHAND_BOOL"
|
|
1130
|
+
// `disabled`, prop shorthand
|
|
1131
|
+
],
|
|
1132
|
+
alphabetical: false
|
|
1133
|
+
}
|
|
1134
|
+
],
|
|
1135
|
+
"vue/order-in-components": [
|
|
1136
|
+
"error",
|
|
1137
|
+
{
|
|
1138
|
+
order: [
|
|
1139
|
+
"el",
|
|
1140
|
+
"name",
|
|
1141
|
+
"key",
|
|
1142
|
+
"parent",
|
|
1143
|
+
"functional",
|
|
1144
|
+
["provide", "inject"],
|
|
1145
|
+
["delimiters", "comments"],
|
|
1146
|
+
["components", "directives", "filters"],
|
|
1147
|
+
"extends",
|
|
1148
|
+
"mixins",
|
|
1149
|
+
"layout",
|
|
1150
|
+
"middleware",
|
|
1151
|
+
"validate",
|
|
1152
|
+
"scrollToTop",
|
|
1153
|
+
"transition",
|
|
1154
|
+
"loading",
|
|
1155
|
+
"inheritAttrs",
|
|
1156
|
+
"model",
|
|
1157
|
+
["props", "propsData"],
|
|
1158
|
+
"emits",
|
|
1159
|
+
"setup",
|
|
1160
|
+
"asyncData",
|
|
1161
|
+
"computed",
|
|
1162
|
+
"data",
|
|
1163
|
+
"fetch",
|
|
1164
|
+
"head",
|
|
1165
|
+
"methods",
|
|
1166
|
+
["template", "render"],
|
|
1167
|
+
"watch",
|
|
1168
|
+
"watchQuery",
|
|
1169
|
+
"LIFECYCLE_HOOKS",
|
|
1170
|
+
"renderError",
|
|
1171
|
+
"ROUTER_GUARDS"
|
|
1172
|
+
]
|
|
1173
|
+
}
|
|
1174
|
+
],
|
|
1175
|
+
"vue/max-attributes-per-line": [
|
|
1176
|
+
"error",
|
|
1177
|
+
{
|
|
1178
|
+
singleline: 1,
|
|
1179
|
+
multiline: 1
|
|
1180
|
+
}
|
|
1181
|
+
]
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
]);
|
|
1185
|
+
|
|
857
1186
|
// src/configs/yml.ts
|
|
858
1187
|
var yml = defineConfig([
|
|
859
1188
|
{
|
|
@@ -1128,347 +1457,80 @@ var sortTsConfig = defineConfig([
|
|
|
1128
1457
|
|
|
1129
1458
|
// src/configs/jsonc.ts
|
|
1130
1459
|
var jsonc = defineConfig([
|
|
1131
|
-
{
|
|
1132
|
-
name: "ntnyq/jsonc",
|
|
1133
|
-
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1134
|
-
plugins: {
|
|
1135
|
-
jsonc: import_eslint_plugin_jsonc.default
|
|
1136
|
-
},
|
|
1137
|
-
languageOptions: {
|
|
1138
|
-
parser: parserJsonc
|
|
1139
|
-
},
|
|
1140
|
-
rules: {
|
|
1141
|
-
...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
|
|
1142
|
-
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1143
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1144
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1145
|
-
"jsonc/indent": ["error", 2],
|
|
1146
|
-
"jsonc/key-spacing": [
|
|
1147
|
-
"error",
|
|
1148
|
-
{
|
|
1149
|
-
beforeColon: false,
|
|
1150
|
-
afterColon: true
|
|
1151
|
-
}
|
|
1152
|
-
],
|
|
1153
|
-
"jsonc/no-octal-escape": "error",
|
|
1154
|
-
"jsonc/object-curly-newline": [
|
|
1155
|
-
"error",
|
|
1156
|
-
{
|
|
1157
|
-
multiline: true,
|
|
1158
|
-
consistent: true
|
|
1159
|
-
}
|
|
1160
|
-
],
|
|
1161
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1162
|
-
"jsonc/object-property-newline": [
|
|
1163
|
-
"error",
|
|
1164
|
-
{
|
|
1165
|
-
allowMultiplePropertiesPerLine: true
|
|
1166
|
-
}
|
|
1167
|
-
]
|
|
1168
|
-
}
|
|
1169
|
-
}
|
|
1170
|
-
]);
|
|
1171
|
-
|
|
1172
|
-
// src/configs/markdown.ts
|
|
1173
|
-
var markdown = defineConfig([
|
|
1174
|
-
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1175
|
-
{
|
|
1176
|
-
name: "ntnyq/markdown/extensions",
|
|
1177
|
-
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1178
|
-
rules: {
|
|
1179
|
-
"no-undef": "off",
|
|
1180
|
-
"no-alert": "off",
|
|
1181
|
-
"no-console": "off",
|
|
1182
|
-
"no-unused-vars": "off",
|
|
1183
|
-
"no-unused-expressions": "off",
|
|
1184
|
-
"no-restricted-imports": "off",
|
|
1185
|
-
"node/prefer-global/buffer": "off",
|
|
1186
|
-
"node/prefer-global/process": "off",
|
|
1187
|
-
"import/no-unresolved": "off",
|
|
1188
|
-
"unused-imports/no-unused-imports": "off",
|
|
1189
|
-
"unused-imports/no-unused-vars": "off",
|
|
1190
|
-
"@typescript-eslint/comma-dangle": "off",
|
|
1191
|
-
"@typescript-eslint/no-redeclare": "off",
|
|
1192
|
-
"@typescript-eslint/no-namespace": "off",
|
|
1193
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
1194
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
1195
|
-
"@typescript-eslint/no-use-before-define": "off"
|
|
1196
|
-
}
|
|
1197
|
-
}
|
|
1198
|
-
]);
|
|
1199
|
-
|
|
1200
|
-
// src/configs/vue.ts
|
|
1201
|
-
var import_node_process2 = __toESM(require("process"), 1);
|
|
1202
|
-
var import_local_pkg2 = require("local-pkg");
|
|
1203
|
-
function getVueVersion() {
|
|
1204
|
-
const pkg = (0, import_local_pkg2.getPackageInfoSync)("vue", { paths: [import_node_process2.default.cwd()] });
|
|
1205
|
-
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1206
|
-
return +pkg.version[0];
|
|
1207
|
-
}
|
|
1208
|
-
return 3;
|
|
1209
|
-
}
|
|
1210
|
-
var isVue3 = getVueVersion() === 3;
|
|
1211
|
-
var vue2Rules = {
|
|
1212
|
-
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
1213
|
-
...import_eslint_plugin_vue.default.configs.essential.rules,
|
|
1214
|
-
...import_eslint_plugin_vue.default.configs["strongly-recommended"].rules,
|
|
1215
|
-
...import_eslint_plugin_vue.default.configs.recommended.rules
|
|
1216
|
-
};
|
|
1217
|
-
var vue3Rules = {
|
|
1218
|
-
...import_eslint_plugin_vue.default.configs.base.rules,
|
|
1219
|
-
...import_eslint_plugin_vue.default.configs["vue3-essential"].rules,
|
|
1220
|
-
...import_eslint_plugin_vue.default.configs["vue3-strongly-recommended"].rules,
|
|
1221
|
-
...import_eslint_plugin_vue.default.configs["vue3-recommended"].rules
|
|
1222
|
-
};
|
|
1223
|
-
var vue = defineConfig([
|
|
1224
|
-
...import_typescript_eslint.default.config({
|
|
1225
|
-
name: "ntnyq/vue/ts",
|
|
1226
|
-
files: [GLOB_VUE],
|
|
1227
|
-
// TODO: Remove this when `typescript-eslint` is aligned with `eslint`
|
|
1228
|
-
// @ts-expect-error - `typescript-eslint` is not aligned with eslint
|
|
1229
|
-
extends: typescriptCore
|
|
1230
|
-
}),
|
|
1231
|
-
{
|
|
1232
|
-
name: "ntnyq/vue/core",
|
|
1233
|
-
files: [GLOB_VUE],
|
|
1460
|
+
{
|
|
1461
|
+
name: "ntnyq/jsonc",
|
|
1462
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1234
1463
|
plugins: {
|
|
1235
|
-
|
|
1236
|
-
"@typescript-eslint": import_typescript_eslint.default.plugin
|
|
1464
|
+
jsonc: import_eslint_plugin_jsonc.default
|
|
1237
1465
|
},
|
|
1238
1466
|
languageOptions: {
|
|
1239
|
-
parser:
|
|
1240
|
-
parserOptions: {
|
|
1241
|
-
parser: "@typescript-eslint/parser",
|
|
1242
|
-
sourceType: "module",
|
|
1243
|
-
extraFileExtensions: [".vue"],
|
|
1244
|
-
ecmaFeatures: {
|
|
1245
|
-
jsx: true
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1467
|
+
parser: parserJsonc
|
|
1248
1468
|
},
|
|
1249
|
-
processor: import_eslint_plugin_vue.default.processors[".vue"],
|
|
1250
1469
|
rules: {
|
|
1251
|
-
...
|
|
1252
|
-
|
|
1253
|
-
"
|
|
1254
|
-
"
|
|
1255
|
-
"
|
|
1256
|
-
"
|
|
1257
|
-
"vue/no-setup-props-reactivity-loss": "off",
|
|
1258
|
-
"vue/html-self-closing": [
|
|
1259
|
-
"error",
|
|
1260
|
-
{
|
|
1261
|
-
html: {
|
|
1262
|
-
void: "always",
|
|
1263
|
-
normal: "always",
|
|
1264
|
-
component: "always"
|
|
1265
|
-
},
|
|
1266
|
-
svg: "always",
|
|
1267
|
-
math: "always"
|
|
1268
|
-
}
|
|
1269
|
-
],
|
|
1270
|
-
"vue/block-tag-newline": [
|
|
1271
|
-
"error",
|
|
1272
|
-
{
|
|
1273
|
-
singleline: "always",
|
|
1274
|
-
multiline: "always"
|
|
1275
|
-
}
|
|
1276
|
-
],
|
|
1277
|
-
"vue/component-name-in-template-casing": [
|
|
1278
|
-
"error",
|
|
1279
|
-
"PascalCase",
|
|
1280
|
-
{
|
|
1281
|
-
// Force auto-import components to be PascalCase
|
|
1282
|
-
registeredComponentsOnly: false,
|
|
1283
|
-
ignores: ["slot", "component"]
|
|
1284
|
-
}
|
|
1285
|
-
],
|
|
1286
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1287
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1288
|
-
"vue/define-macros-order": [
|
|
1289
|
-
"error",
|
|
1290
|
-
{
|
|
1291
|
-
order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
|
|
1292
|
-
}
|
|
1293
|
-
],
|
|
1294
|
-
"vue/html-comment-content-spacing": [
|
|
1295
|
-
"error",
|
|
1296
|
-
"always",
|
|
1297
|
-
{
|
|
1298
|
-
exceptions: ["-"]
|
|
1299
|
-
}
|
|
1300
|
-
],
|
|
1301
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1302
|
-
"vue/arrow-spacing": ["error", { before: true, after: true }],
|
|
1303
|
-
"vue/block-spacing": ["error", "always"],
|
|
1304
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1305
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1306
|
-
"vue/comma-spacing": ["error", { before: false, after: true }],
|
|
1307
|
-
"vue/comma-style": ["error", "last"],
|
|
1308
|
-
"vue/dot-location": ["error", "property"],
|
|
1309
|
-
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1310
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
1311
|
-
"vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
1312
|
-
"vue/keyword-spacing": ["error", { before: true, after: true }],
|
|
1313
|
-
"vue/no-empty-pattern": "error",
|
|
1314
|
-
"vue/no-loss-of-precision": "error",
|
|
1315
|
-
"vue/no-irregular-whitespace": "error",
|
|
1316
|
-
"vue/no-use-v-else-with-v-for": "error",
|
|
1317
|
-
"vue/require-typed-object-prop": "error",
|
|
1318
|
-
"vue/no-extra-parens": ["error", "functions"],
|
|
1319
|
-
"vue/no-restricted-syntax": [
|
|
1320
|
-
"error",
|
|
1321
|
-
"DebuggerStatement",
|
|
1322
|
-
"LabeledStatement",
|
|
1323
|
-
"WithStatement"
|
|
1324
|
-
],
|
|
1325
|
-
"vue/no-sparse-arrays": "error",
|
|
1326
|
-
"vue/no-deprecated-model-definition": [
|
|
1470
|
+
...import_eslint_plugin_jsonc.default.configs["recommended-with-jsonc"].rules,
|
|
1471
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1472
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
1473
|
+
"jsonc/comma-style": ["error", "last"],
|
|
1474
|
+
"jsonc/indent": ["error", 2],
|
|
1475
|
+
"jsonc/key-spacing": [
|
|
1327
1476
|
"error",
|
|
1328
1477
|
{
|
|
1329
|
-
|
|
1478
|
+
beforeColon: false,
|
|
1479
|
+
afterColon: true
|
|
1330
1480
|
}
|
|
1331
1481
|
],
|
|
1332
|
-
"
|
|
1482
|
+
"jsonc/no-octal-escape": "error",
|
|
1483
|
+
"jsonc/object-curly-newline": [
|
|
1333
1484
|
"error",
|
|
1334
1485
|
{
|
|
1335
1486
|
multiline: true,
|
|
1336
1487
|
consistent: true
|
|
1337
1488
|
}
|
|
1338
1489
|
],
|
|
1339
|
-
"
|
|
1340
|
-
|
|
1341
|
-
{
|
|
1342
|
-
allowBinding: true
|
|
1343
|
-
}
|
|
1344
|
-
],
|
|
1345
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1346
|
-
"vue/object-property-newline": [
|
|
1490
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1491
|
+
"jsonc/object-property-newline": [
|
|
1347
1492
|
"error",
|
|
1348
1493
|
{
|
|
1349
1494
|
allowMultiplePropertiesPerLine: true
|
|
1350
1495
|
}
|
|
1351
|
-
],
|
|
1352
|
-
"vue/object-shorthand": [
|
|
1353
|
-
"error",
|
|
1354
|
-
"always",
|
|
1355
|
-
{
|
|
1356
|
-
ignoreConstructors: false,
|
|
1357
|
-
avoidQuotes: true
|
|
1358
|
-
}
|
|
1359
|
-
],
|
|
1360
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1361
|
-
"vue/prefer-template": "error",
|
|
1362
|
-
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1363
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1364
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1365
|
-
"vue/space-infix-ops": "error",
|
|
1366
|
-
"vue/space-unary-ops": [
|
|
1367
|
-
"error",
|
|
1368
|
-
{
|
|
1369
|
-
words: true,
|
|
1370
|
-
nonwords: false
|
|
1371
|
-
}
|
|
1372
|
-
],
|
|
1373
|
-
"vue/template-curly-spacing": "error",
|
|
1374
|
-
"vue/block-order": [
|
|
1375
|
-
"error",
|
|
1376
|
-
{
|
|
1377
|
-
order: ["script", "template", "style"]
|
|
1378
|
-
}
|
|
1379
|
-
],
|
|
1380
|
-
"vue/attributes-order": [
|
|
1381
|
-
"error",
|
|
1382
|
-
{
|
|
1383
|
-
order: [
|
|
1384
|
-
"EVENTS",
|
|
1385
|
-
// `@click="functionCall"`, `v-on="event"`
|
|
1386
|
-
"TWO_WAY_BINDING",
|
|
1387
|
-
// `v-model`
|
|
1388
|
-
"OTHER_DIRECTIVES",
|
|
1389
|
-
// `v-custom-directive`
|
|
1390
|
-
"LIST_RENDERING",
|
|
1391
|
-
// `v-for item in items`
|
|
1392
|
-
"CONDITIONALS",
|
|
1393
|
-
// `v-if`, `v-show`, `v-cloak`
|
|
1394
|
-
"CONTENT",
|
|
1395
|
-
// `v-text`, `v-html`
|
|
1396
|
-
"SLOT",
|
|
1397
|
-
// `v-slot`, `slot`
|
|
1398
|
-
"UNIQUE",
|
|
1399
|
-
// `ref`, `key`
|
|
1400
|
-
"DEFINITION",
|
|
1401
|
-
// `is`, `v-is`
|
|
1402
|
-
"ATTR_DYNAMIC",
|
|
1403
|
-
// `v-bind:prop="foo"`, `:prop="foo"`
|
|
1404
|
-
// `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
|
|
1405
|
-
"RENDER_MODIFIERS",
|
|
1406
|
-
// `v-once`, `v-pre`
|
|
1407
|
-
"GLOBAL",
|
|
1408
|
-
// `id`
|
|
1409
|
-
"ATTR_STATIC",
|
|
1410
|
-
// `prop="foo", `static attributes
|
|
1411
|
-
"ATTR_SHORTHAND_BOOL"
|
|
1412
|
-
// `disabled`, prop shorthand
|
|
1413
|
-
],
|
|
1414
|
-
alphabetical: false
|
|
1415
|
-
}
|
|
1416
|
-
],
|
|
1417
|
-
"vue/order-in-components": [
|
|
1418
|
-
"error",
|
|
1419
|
-
{
|
|
1420
|
-
order: [
|
|
1421
|
-
"el",
|
|
1422
|
-
"name",
|
|
1423
|
-
"key",
|
|
1424
|
-
"parent",
|
|
1425
|
-
"functional",
|
|
1426
|
-
["provide", "inject"],
|
|
1427
|
-
["delimiters", "comments"],
|
|
1428
|
-
["components", "directives", "filters"],
|
|
1429
|
-
"extends",
|
|
1430
|
-
"mixins",
|
|
1431
|
-
"layout",
|
|
1432
|
-
"middleware",
|
|
1433
|
-
"validate",
|
|
1434
|
-
"scrollToTop",
|
|
1435
|
-
"transition",
|
|
1436
|
-
"loading",
|
|
1437
|
-
"inheritAttrs",
|
|
1438
|
-
"model",
|
|
1439
|
-
["props", "propsData"],
|
|
1440
|
-
"emits",
|
|
1441
|
-
"setup",
|
|
1442
|
-
"asyncData",
|
|
1443
|
-
"computed",
|
|
1444
|
-
"data",
|
|
1445
|
-
"fetch",
|
|
1446
|
-
"head",
|
|
1447
|
-
"methods",
|
|
1448
|
-
["template", "render"],
|
|
1449
|
-
"watch",
|
|
1450
|
-
"watchQuery",
|
|
1451
|
-
"LIFECYCLE_HOOKS",
|
|
1452
|
-
"renderError",
|
|
1453
|
-
"ROUTER_GUARDS"
|
|
1454
|
-
]
|
|
1455
|
-
}
|
|
1456
|
-
],
|
|
1457
|
-
"vue/max-attributes-per-line": [
|
|
1458
|
-
"error",
|
|
1459
|
-
{
|
|
1460
|
-
singleline: 1,
|
|
1461
|
-
multiline: 1
|
|
1462
|
-
}
|
|
1463
1496
|
]
|
|
1464
1497
|
}
|
|
1465
1498
|
}
|
|
1466
1499
|
]);
|
|
1467
1500
|
|
|
1501
|
+
// src/configs/markdown.ts
|
|
1502
|
+
var markdown = defineConfig([
|
|
1503
|
+
...import_eslint_plugin_markdown.default.configs.recommended,
|
|
1504
|
+
{
|
|
1505
|
+
name: "ntnyq/markdown/extensions",
|
|
1506
|
+
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1507
|
+
rules: {
|
|
1508
|
+
"no-undef": "off",
|
|
1509
|
+
"no-alert": "off",
|
|
1510
|
+
"no-console": "off",
|
|
1511
|
+
"no-unused-vars": "off",
|
|
1512
|
+
"no-unused-expressions": "off",
|
|
1513
|
+
"no-restricted-imports": "off",
|
|
1514
|
+
"node/prefer-global/buffer": "off",
|
|
1515
|
+
"node/prefer-global/process": "off",
|
|
1516
|
+
"import/no-unresolved": "off",
|
|
1517
|
+
"unused-imports/no-unused-imports": "off",
|
|
1518
|
+
"unused-imports/no-unused-vars": "off",
|
|
1519
|
+
"@typescript-eslint/comma-dangle": "off",
|
|
1520
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
1521
|
+
"@typescript-eslint/no-namespace": "off",
|
|
1522
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
1523
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
1524
|
+
"@typescript-eslint/no-use-before-define": "off"
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
]);
|
|
1528
|
+
|
|
1468
1529
|
// src/core.ts
|
|
1469
1530
|
function ntnyq(config = [], {
|
|
1470
1531
|
vue: enableVue = hasVue,
|
|
1471
1532
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
1533
|
+
vitest: enableVitest = hasVitest,
|
|
1472
1534
|
prettier: enablePrettier = true,
|
|
1473
1535
|
markdown: enableMarkdown = true,
|
|
1474
1536
|
command: enableCommand = true
|
|
@@ -1499,6 +1561,9 @@ function ntnyq(config = [], {
|
|
|
1499
1561
|
if (enableVue) {
|
|
1500
1562
|
configs.push(...vue);
|
|
1501
1563
|
}
|
|
1564
|
+
if (enableVitest) {
|
|
1565
|
+
configs.push(...vitest);
|
|
1566
|
+
}
|
|
1502
1567
|
if (enableUnoCSS) {
|
|
1503
1568
|
configs.push(...unocss);
|
|
1504
1569
|
}
|
|
@@ -1537,6 +1602,7 @@ function ntnyq(config = [], {
|
|
|
1537
1602
|
GLOB_SRC,
|
|
1538
1603
|
GLOB_SRC_EXT,
|
|
1539
1604
|
GLOB_STYLE,
|
|
1605
|
+
GLOB_TEST,
|
|
1540
1606
|
GLOB_TOML,
|
|
1541
1607
|
GLOB_TS,
|
|
1542
1608
|
GLOB_TSX,
|
|
@@ -1548,6 +1614,7 @@ function ntnyq(config = [], {
|
|
|
1548
1614
|
getVueVersion,
|
|
1549
1615
|
hasTypeScript,
|
|
1550
1616
|
hasUnoCSS,
|
|
1617
|
+
hasVitest,
|
|
1551
1618
|
hasVue,
|
|
1552
1619
|
ignores,
|
|
1553
1620
|
imports,
|
|
@@ -1564,18 +1631,21 @@ function ntnyq(config = [], {
|
|
|
1564
1631
|
parserToml,
|
|
1565
1632
|
parserVue,
|
|
1566
1633
|
parserYaml,
|
|
1634
|
+
perfectionist,
|
|
1567
1635
|
pluginComments,
|
|
1568
1636
|
pluginImport,
|
|
1569
1637
|
pluginJsdoc,
|
|
1570
1638
|
pluginJsonc,
|
|
1571
1639
|
pluginMarkdown,
|
|
1572
1640
|
pluginNode,
|
|
1641
|
+
pluginPerfectionist,
|
|
1573
1642
|
pluginPrettier,
|
|
1574
1643
|
pluginRegexp,
|
|
1575
1644
|
pluginToml,
|
|
1576
1645
|
pluginUnicorn,
|
|
1577
1646
|
pluginUnoCSS,
|
|
1578
1647
|
pluginUnusedImports,
|
|
1648
|
+
pluginVitest,
|
|
1579
1649
|
pluginVue,
|
|
1580
1650
|
pluginYaml,
|
|
1581
1651
|
prettier,
|
|
@@ -1589,6 +1659,7 @@ function ntnyq(config = [], {
|
|
|
1589
1659
|
unicorn,
|
|
1590
1660
|
unocss,
|
|
1591
1661
|
unusedImports,
|
|
1662
|
+
vitest,
|
|
1592
1663
|
vue,
|
|
1593
1664
|
yml
|
|
1594
1665
|
});
|