@ntnyq/eslint-config 2.8.1 → 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 +1 -0
- package/dist/index.cjs +343 -314
- package/dist/index.d.cts +13 -7
- package/dist/index.d.ts +13 -7
- package/dist/index.js +360 -335
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import process from "node:process";
|
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { isPackageExists } from "local-pkg";
|
|
5
5
|
var hasTypeScript = isPackageExists("typescript");
|
|
6
|
+
var hasVitest = isPackageExists("vitest");
|
|
6
7
|
var hasVue = isPackageExists("vue") || isPackageExists("nuxt") || isPackageExists("vitepress") || isPackageExists("@slidev/cli") || isPackageExists("vue", {
|
|
7
8
|
paths: [resolve(process.cwd(), "playground")]
|
|
8
9
|
});
|
|
@@ -36,6 +37,7 @@ var GLOB_JSX = "**/*.?([cm])jsx";
|
|
|
36
37
|
var GLOB_TS = "**/*.?([cm])ts";
|
|
37
38
|
var GLOB_TSX = "**/*.?([cm])tsx";
|
|
38
39
|
var GLOB_DTS = "**/*.d.?([cm])ts";
|
|
40
|
+
var GLOB_TEST = "**/*.{test,spec}.?([cm])[jt]s?(x)";
|
|
39
41
|
var GLOB_STYLE = "**/*.{c,le,sc}ss";
|
|
40
42
|
var GLOB_CSS = "**/*.css";
|
|
41
43
|
var GLOB_LESS = "**/*.less";
|
|
@@ -131,13 +133,14 @@ import { default as default5 } from "eslint-plugin-toml";
|
|
|
131
133
|
import { default as default6 } from "eslint-plugin-jsonc";
|
|
132
134
|
import { default as default7 } from "eslint-plugin-jsdoc";
|
|
133
135
|
import { default as default8 } from "@unocss/eslint-plugin";
|
|
134
|
-
import { default as default9 } from "eslint-plugin
|
|
135
|
-
import { default as default10 } from "eslint-plugin-
|
|
136
|
-
import { default as default11 } from "eslint-plugin-
|
|
137
|
-
import { default as default12 } from "eslint-plugin-
|
|
138
|
-
import { default as default13 } from "eslint-plugin-
|
|
139
|
-
import { default as default14 } from "
|
|
140
|
-
import { default as default15 } from "
|
|
136
|
+
import { default as default9 } from "@vitest/eslint-plugin";
|
|
137
|
+
import { default as default10 } from "eslint-plugin-unicorn";
|
|
138
|
+
import { default as default11 } from "eslint-plugin-import-x";
|
|
139
|
+
import { default as default12 } from "eslint-plugin-prettier";
|
|
140
|
+
import { default as default13 } from "eslint-plugin-markdown";
|
|
141
|
+
import { default as default14 } from "eslint-plugin-perfectionist";
|
|
142
|
+
import { default as default15 } from "eslint-plugin-unused-imports";
|
|
143
|
+
import { default as default16 } from "@eslint-community/eslint-plugin-eslint-comments";
|
|
141
144
|
import * as parserToml from "toml-eslint-parser";
|
|
142
145
|
import * as parserYaml from "yaml-eslint-parser";
|
|
143
146
|
import * as parserVue from "vue-eslint-parser";
|
|
@@ -197,7 +200,7 @@ var imports = defineConfig([
|
|
|
197
200
|
{
|
|
198
201
|
name: "ntnyq/imports",
|
|
199
202
|
plugins: {
|
|
200
|
-
import:
|
|
203
|
+
import: default11
|
|
201
204
|
},
|
|
202
205
|
settings: {
|
|
203
206
|
"import/resolver": {
|
|
@@ -240,7 +243,7 @@ var unicorn = defineConfig([
|
|
|
240
243
|
{
|
|
241
244
|
name: "ntnyq/unicorn",
|
|
242
245
|
plugins: {
|
|
243
|
-
unicorn:
|
|
246
|
+
unicorn: default10
|
|
244
247
|
},
|
|
245
248
|
rules: {
|
|
246
249
|
// Disabled for now
|
|
@@ -317,11 +320,11 @@ var prettier = defineConfig([
|
|
|
317
320
|
{
|
|
318
321
|
name: "ntnyq/prettier",
|
|
319
322
|
plugins: {
|
|
320
|
-
prettier:
|
|
323
|
+
prettier: default12
|
|
321
324
|
},
|
|
322
325
|
rules: {
|
|
323
326
|
...prettierConfig.rules,
|
|
324
|
-
...
|
|
327
|
+
...default12.configs.recommended.rules,
|
|
325
328
|
"prettier/prettier": "warn"
|
|
326
329
|
}
|
|
327
330
|
},
|
|
@@ -332,7 +335,7 @@ var prettier = defineConfig([
|
|
|
332
335
|
name: "ntnyq/prettier/ignore",
|
|
333
336
|
files: [GLOB_TOML],
|
|
334
337
|
plugins: {
|
|
335
|
-
prettier:
|
|
338
|
+
prettier: default12
|
|
336
339
|
},
|
|
337
340
|
rules: {
|
|
338
341
|
"prettier/prettier": "off"
|
|
@@ -345,10 +348,10 @@ var comments = defineConfig([
|
|
|
345
348
|
{
|
|
346
349
|
name: "ntnyq/eslint-comments",
|
|
347
350
|
plugins: {
|
|
348
|
-
"@eslint-community/eslint-comments":
|
|
351
|
+
"@eslint-community/eslint-comments": default16
|
|
349
352
|
},
|
|
350
353
|
rules: {
|
|
351
|
-
...
|
|
354
|
+
...default16.configs.recommended.rules,
|
|
352
355
|
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
353
356
|
}
|
|
354
357
|
}
|
|
@@ -699,7 +702,7 @@ var unusedImports = defineConfig([
|
|
|
699
702
|
{
|
|
700
703
|
name: "ntnyq/unused-imports",
|
|
701
704
|
plugins: {
|
|
702
|
-
"unused-imports":
|
|
705
|
+
"unused-imports": default15
|
|
703
706
|
},
|
|
704
707
|
rules: {
|
|
705
708
|
"@typescript-eslint/no-unused-vars": "off",
|
|
@@ -722,7 +725,7 @@ var perfectionist = defineConfig([
|
|
|
722
725
|
{
|
|
723
726
|
name: "ntnyq/perfectionist",
|
|
724
727
|
plugins: {
|
|
725
|
-
perfectionist:
|
|
728
|
+
perfectionist: default14
|
|
726
729
|
},
|
|
727
730
|
rules: {
|
|
728
731
|
"perfectionist/sort-imports": [
|
|
@@ -784,6 +787,288 @@ var unocss = defineConfig([
|
|
|
784
787
|
import createCommandPlugin from "eslint-plugin-command/config";
|
|
785
788
|
var command = defineConfig([createCommandPlugin()]);
|
|
786
789
|
|
|
790
|
+
// src/configs/vitest.ts
|
|
791
|
+
var vitest = defineConfig([
|
|
792
|
+
{
|
|
793
|
+
name: "ntnyq/test",
|
|
794
|
+
plugins: {
|
|
795
|
+
vitest: default9
|
|
796
|
+
},
|
|
797
|
+
files: [GLOB_TEST],
|
|
798
|
+
rules: {
|
|
799
|
+
...default9.configs.recommended.rules
|
|
800
|
+
}
|
|
801
|
+
}
|
|
802
|
+
]);
|
|
803
|
+
|
|
804
|
+
// src/configs/vue.ts
|
|
805
|
+
import process2 from "node:process";
|
|
806
|
+
import { getPackageInfoSync } from "local-pkg";
|
|
807
|
+
function getVueVersion() {
|
|
808
|
+
const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
|
|
809
|
+
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
810
|
+
return +pkg.version[0];
|
|
811
|
+
}
|
|
812
|
+
return 3;
|
|
813
|
+
}
|
|
814
|
+
var isVue3 = getVueVersion() === 3;
|
|
815
|
+
var vue2Rules = {
|
|
816
|
+
...default3.configs.base.rules,
|
|
817
|
+
...default3.configs.essential.rules,
|
|
818
|
+
...default3.configs["strongly-recommended"].rules,
|
|
819
|
+
...default3.configs.recommended.rules
|
|
820
|
+
};
|
|
821
|
+
var vue3Rules = {
|
|
822
|
+
...default3.configs.base.rules,
|
|
823
|
+
...default3.configs["vue3-essential"].rules,
|
|
824
|
+
...default3.configs["vue3-strongly-recommended"].rules,
|
|
825
|
+
...default3.configs["vue3-recommended"].rules
|
|
826
|
+
};
|
|
827
|
+
var vue = defineConfig([
|
|
828
|
+
...tseslint.config({
|
|
829
|
+
name: "ntnyq/vue/ts",
|
|
830
|
+
files: [GLOB_VUE],
|
|
831
|
+
// TODO: Remove this when `typescript-eslint` is aligned with `eslint`
|
|
832
|
+
// @ts-expect-error - `typescript-eslint` is not aligned with eslint
|
|
833
|
+
extends: typescriptCore
|
|
834
|
+
}),
|
|
835
|
+
{
|
|
836
|
+
name: "ntnyq/vue/core",
|
|
837
|
+
files: [GLOB_VUE],
|
|
838
|
+
plugins: {
|
|
839
|
+
vue: default3,
|
|
840
|
+
"@typescript-eslint": tseslint.plugin
|
|
841
|
+
},
|
|
842
|
+
languageOptions: {
|
|
843
|
+
parser: parserVue,
|
|
844
|
+
parserOptions: {
|
|
845
|
+
parser: "@typescript-eslint/parser",
|
|
846
|
+
sourceType: "module",
|
|
847
|
+
extraFileExtensions: [".vue"],
|
|
848
|
+
ecmaFeatures: {
|
|
849
|
+
jsx: true
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
},
|
|
853
|
+
processor: default3.processors[".vue"],
|
|
854
|
+
rules: {
|
|
855
|
+
...isVue3 ? vue3Rules : vue2Rules,
|
|
856
|
+
// OFF
|
|
857
|
+
"vue/no-v-html": "off",
|
|
858
|
+
"vue/require-prop-types": "off",
|
|
859
|
+
"vue/require-default-prop": "off",
|
|
860
|
+
"vue/multi-word-component-names": "off",
|
|
861
|
+
"vue/no-setup-props-reactivity-loss": "off",
|
|
862
|
+
"vue/html-self-closing": [
|
|
863
|
+
"error",
|
|
864
|
+
{
|
|
865
|
+
html: {
|
|
866
|
+
void: "always",
|
|
867
|
+
normal: "always",
|
|
868
|
+
component: "always"
|
|
869
|
+
},
|
|
870
|
+
svg: "always",
|
|
871
|
+
math: "always"
|
|
872
|
+
}
|
|
873
|
+
],
|
|
874
|
+
"vue/block-tag-newline": [
|
|
875
|
+
"error",
|
|
876
|
+
{
|
|
877
|
+
singleline: "always",
|
|
878
|
+
multiline: "always"
|
|
879
|
+
}
|
|
880
|
+
],
|
|
881
|
+
"vue/component-name-in-template-casing": [
|
|
882
|
+
"error",
|
|
883
|
+
"PascalCase",
|
|
884
|
+
{
|
|
885
|
+
// Force auto-import components to be PascalCase
|
|
886
|
+
registeredComponentsOnly: false,
|
|
887
|
+
ignores: ["slot", "component"]
|
|
888
|
+
}
|
|
889
|
+
],
|
|
890
|
+
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
891
|
+
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
892
|
+
"vue/define-macros-order": [
|
|
893
|
+
"error",
|
|
894
|
+
{
|
|
895
|
+
order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
|
|
896
|
+
}
|
|
897
|
+
],
|
|
898
|
+
"vue/html-comment-content-spacing": [
|
|
899
|
+
"error",
|
|
900
|
+
"always",
|
|
901
|
+
{
|
|
902
|
+
exceptions: ["-"]
|
|
903
|
+
}
|
|
904
|
+
],
|
|
905
|
+
"vue/array-bracket-spacing": ["error", "never"],
|
|
906
|
+
"vue/arrow-spacing": ["error", { before: true, after: true }],
|
|
907
|
+
"vue/block-spacing": ["error", "always"],
|
|
908
|
+
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
909
|
+
"vue/comma-dangle": ["error", "always-multiline"],
|
|
910
|
+
"vue/comma-spacing": ["error", { before: false, after: true }],
|
|
911
|
+
"vue/comma-style": ["error", "last"],
|
|
912
|
+
"vue/dot-location": ["error", "property"],
|
|
913
|
+
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
914
|
+
"vue/eqeqeq": ["error", "smart"],
|
|
915
|
+
"vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
916
|
+
"vue/keyword-spacing": ["error", { before: true, after: true }],
|
|
917
|
+
"vue/no-empty-pattern": "error",
|
|
918
|
+
"vue/no-loss-of-precision": "error",
|
|
919
|
+
"vue/no-irregular-whitespace": "error",
|
|
920
|
+
"vue/no-use-v-else-with-v-for": "error",
|
|
921
|
+
"vue/require-typed-object-prop": "error",
|
|
922
|
+
"vue/no-extra-parens": ["error", "functions"],
|
|
923
|
+
"vue/no-restricted-syntax": [
|
|
924
|
+
"error",
|
|
925
|
+
"DebuggerStatement",
|
|
926
|
+
"LabeledStatement",
|
|
927
|
+
"WithStatement"
|
|
928
|
+
],
|
|
929
|
+
"vue/no-sparse-arrays": "error",
|
|
930
|
+
"vue/no-deprecated-model-definition": [
|
|
931
|
+
"error",
|
|
932
|
+
{
|
|
933
|
+
allowVue3Compat: true
|
|
934
|
+
}
|
|
935
|
+
],
|
|
936
|
+
"vue/object-curly-newline": [
|
|
937
|
+
"error",
|
|
938
|
+
{
|
|
939
|
+
multiline: true,
|
|
940
|
+
consistent: true
|
|
941
|
+
}
|
|
942
|
+
],
|
|
943
|
+
"vue/no-static-inline-styles": [
|
|
944
|
+
"error",
|
|
945
|
+
{
|
|
946
|
+
allowBinding: true
|
|
947
|
+
}
|
|
948
|
+
],
|
|
949
|
+
"vue/object-curly-spacing": ["error", "always"],
|
|
950
|
+
"vue/object-property-newline": [
|
|
951
|
+
"error",
|
|
952
|
+
{
|
|
953
|
+
allowMultiplePropertiesPerLine: true
|
|
954
|
+
}
|
|
955
|
+
],
|
|
956
|
+
"vue/object-shorthand": [
|
|
957
|
+
"error",
|
|
958
|
+
"always",
|
|
959
|
+
{
|
|
960
|
+
ignoreConstructors: false,
|
|
961
|
+
avoidQuotes: true
|
|
962
|
+
}
|
|
963
|
+
],
|
|
964
|
+
"vue/operator-linebreak": ["error", "before"],
|
|
965
|
+
"vue/prefer-template": "error",
|
|
966
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
967
|
+
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
968
|
+
"vue/space-in-parens": ["error", "never"],
|
|
969
|
+
"vue/space-infix-ops": "error",
|
|
970
|
+
"vue/space-unary-ops": [
|
|
971
|
+
"error",
|
|
972
|
+
{
|
|
973
|
+
words: true,
|
|
974
|
+
nonwords: false
|
|
975
|
+
}
|
|
976
|
+
],
|
|
977
|
+
"vue/template-curly-spacing": "error",
|
|
978
|
+
"vue/block-order": [
|
|
979
|
+
"error",
|
|
980
|
+
{
|
|
981
|
+
order: ["script", "template", "style"]
|
|
982
|
+
}
|
|
983
|
+
],
|
|
984
|
+
"vue/attributes-order": [
|
|
985
|
+
"error",
|
|
986
|
+
{
|
|
987
|
+
order: [
|
|
988
|
+
"EVENTS",
|
|
989
|
+
// `@click="functionCall"`, `v-on="event"`
|
|
990
|
+
"TWO_WAY_BINDING",
|
|
991
|
+
// `v-model`
|
|
992
|
+
"OTHER_DIRECTIVES",
|
|
993
|
+
// `v-custom-directive`
|
|
994
|
+
"LIST_RENDERING",
|
|
995
|
+
// `v-for item in items`
|
|
996
|
+
"CONDITIONALS",
|
|
997
|
+
// `v-if`, `v-show`, `v-cloak`
|
|
998
|
+
"CONTENT",
|
|
999
|
+
// `v-text`, `v-html`
|
|
1000
|
+
"SLOT",
|
|
1001
|
+
// `v-slot`, `slot`
|
|
1002
|
+
"UNIQUE",
|
|
1003
|
+
// `ref`, `key`
|
|
1004
|
+
"DEFINITION",
|
|
1005
|
+
// `is`, `v-is`
|
|
1006
|
+
"ATTR_DYNAMIC",
|
|
1007
|
+
// `v-bind:prop="foo"`, `:prop="foo"`
|
|
1008
|
+
// `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
|
|
1009
|
+
"RENDER_MODIFIERS",
|
|
1010
|
+
// `v-once`, `v-pre`
|
|
1011
|
+
"GLOBAL",
|
|
1012
|
+
// `id`
|
|
1013
|
+
"ATTR_STATIC",
|
|
1014
|
+
// `prop="foo", `static attributes
|
|
1015
|
+
"ATTR_SHORTHAND_BOOL"
|
|
1016
|
+
// `disabled`, prop shorthand
|
|
1017
|
+
],
|
|
1018
|
+
alphabetical: false
|
|
1019
|
+
}
|
|
1020
|
+
],
|
|
1021
|
+
"vue/order-in-components": [
|
|
1022
|
+
"error",
|
|
1023
|
+
{
|
|
1024
|
+
order: [
|
|
1025
|
+
"el",
|
|
1026
|
+
"name",
|
|
1027
|
+
"key",
|
|
1028
|
+
"parent",
|
|
1029
|
+
"functional",
|
|
1030
|
+
["provide", "inject"],
|
|
1031
|
+
["delimiters", "comments"],
|
|
1032
|
+
["components", "directives", "filters"],
|
|
1033
|
+
"extends",
|
|
1034
|
+
"mixins",
|
|
1035
|
+
"layout",
|
|
1036
|
+
"middleware",
|
|
1037
|
+
"validate",
|
|
1038
|
+
"scrollToTop",
|
|
1039
|
+
"transition",
|
|
1040
|
+
"loading",
|
|
1041
|
+
"inheritAttrs",
|
|
1042
|
+
"model",
|
|
1043
|
+
["props", "propsData"],
|
|
1044
|
+
"emits",
|
|
1045
|
+
"setup",
|
|
1046
|
+
"asyncData",
|
|
1047
|
+
"computed",
|
|
1048
|
+
"data",
|
|
1049
|
+
"fetch",
|
|
1050
|
+
"head",
|
|
1051
|
+
"methods",
|
|
1052
|
+
["template", "render"],
|
|
1053
|
+
"watch",
|
|
1054
|
+
"watchQuery",
|
|
1055
|
+
"LIFECYCLE_HOOKS",
|
|
1056
|
+
"renderError",
|
|
1057
|
+
"ROUTER_GUARDS"
|
|
1058
|
+
]
|
|
1059
|
+
}
|
|
1060
|
+
],
|
|
1061
|
+
"vue/max-attributes-per-line": [
|
|
1062
|
+
"error",
|
|
1063
|
+
{
|
|
1064
|
+
singleline: 1,
|
|
1065
|
+
multiline: 1
|
|
1066
|
+
}
|
|
1067
|
+
]
|
|
1068
|
+
}
|
|
1069
|
+
}
|
|
1070
|
+
]);
|
|
1071
|
+
|
|
787
1072
|
// src/configs/yml.ts
|
|
788
1073
|
var yml = defineConfig([
|
|
789
1074
|
{
|
|
@@ -1059,346 +1344,79 @@ var sortTsConfig = defineConfig([
|
|
|
1059
1344
|
// src/configs/jsonc.ts
|
|
1060
1345
|
var jsonc = defineConfig([
|
|
1061
1346
|
{
|
|
1062
|
-
name: "ntnyq/jsonc",
|
|
1063
|
-
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1064
|
-
plugins: {
|
|
1065
|
-
jsonc: default6
|
|
1066
|
-
},
|
|
1067
|
-
languageOptions: {
|
|
1068
|
-
parser: parserJsonc
|
|
1069
|
-
},
|
|
1070
|
-
rules: {
|
|
1071
|
-
...default6.configs["recommended-with-jsonc"].rules,
|
|
1072
|
-
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1073
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1074
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1075
|
-
"jsonc/indent": ["error", 2],
|
|
1076
|
-
"jsonc/key-spacing": [
|
|
1077
|
-
"error",
|
|
1078
|
-
{
|
|
1079
|
-
beforeColon: false,
|
|
1080
|
-
afterColon: true
|
|
1081
|
-
}
|
|
1082
|
-
],
|
|
1083
|
-
"jsonc/no-octal-escape": "error",
|
|
1084
|
-
"jsonc/object-curly-newline": [
|
|
1085
|
-
"error",
|
|
1086
|
-
{
|
|
1087
|
-
multiline: true,
|
|
1088
|
-
consistent: true
|
|
1089
|
-
}
|
|
1090
|
-
],
|
|
1091
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1092
|
-
"jsonc/object-property-newline": [
|
|
1093
|
-
"error",
|
|
1094
|
-
{
|
|
1095
|
-
allowMultiplePropertiesPerLine: true
|
|
1096
|
-
}
|
|
1097
|
-
]
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
]);
|
|
1101
|
-
|
|
1102
|
-
// src/configs/markdown.ts
|
|
1103
|
-
var markdown = defineConfig([
|
|
1104
|
-
...default12.configs.recommended,
|
|
1105
|
-
{
|
|
1106
|
-
name: "ntnyq/markdown/extensions",
|
|
1107
|
-
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1108
|
-
rules: {
|
|
1109
|
-
"no-undef": "off",
|
|
1110
|
-
"no-alert": "off",
|
|
1111
|
-
"no-console": "off",
|
|
1112
|
-
"no-unused-vars": "off",
|
|
1113
|
-
"no-unused-expressions": "off",
|
|
1114
|
-
"no-restricted-imports": "off",
|
|
1115
|
-
"node/prefer-global/buffer": "off",
|
|
1116
|
-
"node/prefer-global/process": "off",
|
|
1117
|
-
"import/no-unresolved": "off",
|
|
1118
|
-
"unused-imports/no-unused-imports": "off",
|
|
1119
|
-
"unused-imports/no-unused-vars": "off",
|
|
1120
|
-
"@typescript-eslint/comma-dangle": "off",
|
|
1121
|
-
"@typescript-eslint/no-redeclare": "off",
|
|
1122
|
-
"@typescript-eslint/no-namespace": "off",
|
|
1123
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
1124
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
1125
|
-
"@typescript-eslint/no-use-before-define": "off"
|
|
1126
|
-
}
|
|
1127
|
-
}
|
|
1128
|
-
]);
|
|
1129
|
-
|
|
1130
|
-
// src/configs/vue.ts
|
|
1131
|
-
import process2 from "node:process";
|
|
1132
|
-
import { getPackageInfoSync } from "local-pkg";
|
|
1133
|
-
function getVueVersion() {
|
|
1134
|
-
const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
|
|
1135
|
-
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1136
|
-
return +pkg.version[0];
|
|
1137
|
-
}
|
|
1138
|
-
return 3;
|
|
1139
|
-
}
|
|
1140
|
-
var isVue3 = getVueVersion() === 3;
|
|
1141
|
-
var vue2Rules = {
|
|
1142
|
-
...default3.configs.base.rules,
|
|
1143
|
-
...default3.configs.essential.rules,
|
|
1144
|
-
...default3.configs["strongly-recommended"].rules,
|
|
1145
|
-
...default3.configs.recommended.rules
|
|
1146
|
-
};
|
|
1147
|
-
var vue3Rules = {
|
|
1148
|
-
...default3.configs.base.rules,
|
|
1149
|
-
...default3.configs["vue3-essential"].rules,
|
|
1150
|
-
...default3.configs["vue3-strongly-recommended"].rules,
|
|
1151
|
-
...default3.configs["vue3-recommended"].rules
|
|
1152
|
-
};
|
|
1153
|
-
var vue = defineConfig([
|
|
1154
|
-
...tseslint.config({
|
|
1155
|
-
name: "ntnyq/vue/ts",
|
|
1156
|
-
files: [GLOB_VUE],
|
|
1157
|
-
// TODO: Remove this when `typescript-eslint` is aligned with `eslint`
|
|
1158
|
-
// @ts-expect-error - `typescript-eslint` is not aligned with eslint
|
|
1159
|
-
extends: typescriptCore
|
|
1160
|
-
}),
|
|
1161
|
-
{
|
|
1162
|
-
name: "ntnyq/vue/core",
|
|
1163
|
-
files: [GLOB_VUE],
|
|
1347
|
+
name: "ntnyq/jsonc",
|
|
1348
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1164
1349
|
plugins: {
|
|
1165
|
-
|
|
1166
|
-
"@typescript-eslint": tseslint.plugin
|
|
1350
|
+
jsonc: default6
|
|
1167
1351
|
},
|
|
1168
1352
|
languageOptions: {
|
|
1169
|
-
parser:
|
|
1170
|
-
parserOptions: {
|
|
1171
|
-
parser: "@typescript-eslint/parser",
|
|
1172
|
-
sourceType: "module",
|
|
1173
|
-
extraFileExtensions: [".vue"],
|
|
1174
|
-
ecmaFeatures: {
|
|
1175
|
-
jsx: true
|
|
1176
|
-
}
|
|
1177
|
-
}
|
|
1353
|
+
parser: parserJsonc
|
|
1178
1354
|
},
|
|
1179
|
-
processor: default3.processors[".vue"],
|
|
1180
1355
|
rules: {
|
|
1181
|
-
...
|
|
1182
|
-
|
|
1183
|
-
"
|
|
1184
|
-
"
|
|
1185
|
-
"
|
|
1186
|
-
"
|
|
1187
|
-
"vue/no-setup-props-reactivity-loss": "off",
|
|
1188
|
-
"vue/html-self-closing": [
|
|
1189
|
-
"error",
|
|
1190
|
-
{
|
|
1191
|
-
html: {
|
|
1192
|
-
void: "always",
|
|
1193
|
-
normal: "always",
|
|
1194
|
-
component: "always"
|
|
1195
|
-
},
|
|
1196
|
-
svg: "always",
|
|
1197
|
-
math: "always"
|
|
1198
|
-
}
|
|
1199
|
-
],
|
|
1200
|
-
"vue/block-tag-newline": [
|
|
1201
|
-
"error",
|
|
1202
|
-
{
|
|
1203
|
-
singleline: "always",
|
|
1204
|
-
multiline: "always"
|
|
1205
|
-
}
|
|
1206
|
-
],
|
|
1207
|
-
"vue/component-name-in-template-casing": [
|
|
1208
|
-
"error",
|
|
1209
|
-
"PascalCase",
|
|
1210
|
-
{
|
|
1211
|
-
// Force auto-import components to be PascalCase
|
|
1212
|
-
registeredComponentsOnly: false,
|
|
1213
|
-
ignores: ["slot", "component"]
|
|
1214
|
-
}
|
|
1215
|
-
],
|
|
1216
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1217
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1218
|
-
"vue/define-macros-order": [
|
|
1219
|
-
"error",
|
|
1220
|
-
{
|
|
1221
|
-
order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
|
|
1222
|
-
}
|
|
1223
|
-
],
|
|
1224
|
-
"vue/html-comment-content-spacing": [
|
|
1225
|
-
"error",
|
|
1226
|
-
"always",
|
|
1227
|
-
{
|
|
1228
|
-
exceptions: ["-"]
|
|
1229
|
-
}
|
|
1230
|
-
],
|
|
1231
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1232
|
-
"vue/arrow-spacing": ["error", { before: true, after: true }],
|
|
1233
|
-
"vue/block-spacing": ["error", "always"],
|
|
1234
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1235
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1236
|
-
"vue/comma-spacing": ["error", { before: false, after: true }],
|
|
1237
|
-
"vue/comma-style": ["error", "last"],
|
|
1238
|
-
"vue/dot-location": ["error", "property"],
|
|
1239
|
-
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1240
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
1241
|
-
"vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
1242
|
-
"vue/keyword-spacing": ["error", { before: true, after: true }],
|
|
1243
|
-
"vue/no-empty-pattern": "error",
|
|
1244
|
-
"vue/no-loss-of-precision": "error",
|
|
1245
|
-
"vue/no-irregular-whitespace": "error",
|
|
1246
|
-
"vue/no-use-v-else-with-v-for": "error",
|
|
1247
|
-
"vue/require-typed-object-prop": "error",
|
|
1248
|
-
"vue/no-extra-parens": ["error", "functions"],
|
|
1249
|
-
"vue/no-restricted-syntax": [
|
|
1250
|
-
"error",
|
|
1251
|
-
"DebuggerStatement",
|
|
1252
|
-
"LabeledStatement",
|
|
1253
|
-
"WithStatement"
|
|
1254
|
-
],
|
|
1255
|
-
"vue/no-sparse-arrays": "error",
|
|
1256
|
-
"vue/no-deprecated-model-definition": [
|
|
1356
|
+
...default6.configs["recommended-with-jsonc"].rules,
|
|
1357
|
+
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1358
|
+
"jsonc/comma-dangle": ["error", "never"],
|
|
1359
|
+
"jsonc/comma-style": ["error", "last"],
|
|
1360
|
+
"jsonc/indent": ["error", 2],
|
|
1361
|
+
"jsonc/key-spacing": [
|
|
1257
1362
|
"error",
|
|
1258
1363
|
{
|
|
1259
|
-
|
|
1364
|
+
beforeColon: false,
|
|
1365
|
+
afterColon: true
|
|
1260
1366
|
}
|
|
1261
1367
|
],
|
|
1262
|
-
"
|
|
1368
|
+
"jsonc/no-octal-escape": "error",
|
|
1369
|
+
"jsonc/object-curly-newline": [
|
|
1263
1370
|
"error",
|
|
1264
1371
|
{
|
|
1265
1372
|
multiline: true,
|
|
1266
1373
|
consistent: true
|
|
1267
1374
|
}
|
|
1268
1375
|
],
|
|
1269
|
-
"
|
|
1270
|
-
|
|
1271
|
-
{
|
|
1272
|
-
allowBinding: true
|
|
1273
|
-
}
|
|
1274
|
-
],
|
|
1275
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1276
|
-
"vue/object-property-newline": [
|
|
1376
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1377
|
+
"jsonc/object-property-newline": [
|
|
1277
1378
|
"error",
|
|
1278
1379
|
{
|
|
1279
1380
|
allowMultiplePropertiesPerLine: true
|
|
1280
1381
|
}
|
|
1281
|
-
],
|
|
1282
|
-
"vue/object-shorthand": [
|
|
1283
|
-
"error",
|
|
1284
|
-
"always",
|
|
1285
|
-
{
|
|
1286
|
-
ignoreConstructors: false,
|
|
1287
|
-
avoidQuotes: true
|
|
1288
|
-
}
|
|
1289
|
-
],
|
|
1290
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1291
|
-
"vue/prefer-template": "error",
|
|
1292
|
-
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1293
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1294
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1295
|
-
"vue/space-infix-ops": "error",
|
|
1296
|
-
"vue/space-unary-ops": [
|
|
1297
|
-
"error",
|
|
1298
|
-
{
|
|
1299
|
-
words: true,
|
|
1300
|
-
nonwords: false
|
|
1301
|
-
}
|
|
1302
|
-
],
|
|
1303
|
-
"vue/template-curly-spacing": "error",
|
|
1304
|
-
"vue/block-order": [
|
|
1305
|
-
"error",
|
|
1306
|
-
{
|
|
1307
|
-
order: ["script", "template", "style"]
|
|
1308
|
-
}
|
|
1309
|
-
],
|
|
1310
|
-
"vue/attributes-order": [
|
|
1311
|
-
"error",
|
|
1312
|
-
{
|
|
1313
|
-
order: [
|
|
1314
|
-
"EVENTS",
|
|
1315
|
-
// `@click="functionCall"`, `v-on="event"`
|
|
1316
|
-
"TWO_WAY_BINDING",
|
|
1317
|
-
// `v-model`
|
|
1318
|
-
"OTHER_DIRECTIVES",
|
|
1319
|
-
// `v-custom-directive`
|
|
1320
|
-
"LIST_RENDERING",
|
|
1321
|
-
// `v-for item in items`
|
|
1322
|
-
"CONDITIONALS",
|
|
1323
|
-
// `v-if`, `v-show`, `v-cloak`
|
|
1324
|
-
"CONTENT",
|
|
1325
|
-
// `v-text`, `v-html`
|
|
1326
|
-
"SLOT",
|
|
1327
|
-
// `v-slot`, `slot`
|
|
1328
|
-
"UNIQUE",
|
|
1329
|
-
// `ref`, `key`
|
|
1330
|
-
"DEFINITION",
|
|
1331
|
-
// `is`, `v-is`
|
|
1332
|
-
"ATTR_DYNAMIC",
|
|
1333
|
-
// `v-bind:prop="foo"`, `:prop="foo"`
|
|
1334
|
-
// `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
|
|
1335
|
-
"RENDER_MODIFIERS",
|
|
1336
|
-
// `v-once`, `v-pre`
|
|
1337
|
-
"GLOBAL",
|
|
1338
|
-
// `id`
|
|
1339
|
-
"ATTR_STATIC",
|
|
1340
|
-
// `prop="foo", `static attributes
|
|
1341
|
-
"ATTR_SHORTHAND_BOOL"
|
|
1342
|
-
// `disabled`, prop shorthand
|
|
1343
|
-
],
|
|
1344
|
-
alphabetical: false
|
|
1345
|
-
}
|
|
1346
|
-
],
|
|
1347
|
-
"vue/order-in-components": [
|
|
1348
|
-
"error",
|
|
1349
|
-
{
|
|
1350
|
-
order: [
|
|
1351
|
-
"el",
|
|
1352
|
-
"name",
|
|
1353
|
-
"key",
|
|
1354
|
-
"parent",
|
|
1355
|
-
"functional",
|
|
1356
|
-
["provide", "inject"],
|
|
1357
|
-
["delimiters", "comments"],
|
|
1358
|
-
["components", "directives", "filters"],
|
|
1359
|
-
"extends",
|
|
1360
|
-
"mixins",
|
|
1361
|
-
"layout",
|
|
1362
|
-
"middleware",
|
|
1363
|
-
"validate",
|
|
1364
|
-
"scrollToTop",
|
|
1365
|
-
"transition",
|
|
1366
|
-
"loading",
|
|
1367
|
-
"inheritAttrs",
|
|
1368
|
-
"model",
|
|
1369
|
-
["props", "propsData"],
|
|
1370
|
-
"emits",
|
|
1371
|
-
"setup",
|
|
1372
|
-
"asyncData",
|
|
1373
|
-
"computed",
|
|
1374
|
-
"data",
|
|
1375
|
-
"fetch",
|
|
1376
|
-
"head",
|
|
1377
|
-
"methods",
|
|
1378
|
-
["template", "render"],
|
|
1379
|
-
"watch",
|
|
1380
|
-
"watchQuery",
|
|
1381
|
-
"LIFECYCLE_HOOKS",
|
|
1382
|
-
"renderError",
|
|
1383
|
-
"ROUTER_GUARDS"
|
|
1384
|
-
]
|
|
1385
|
-
}
|
|
1386
|
-
],
|
|
1387
|
-
"vue/max-attributes-per-line": [
|
|
1388
|
-
"error",
|
|
1389
|
-
{
|
|
1390
|
-
singleline: 1,
|
|
1391
|
-
multiline: 1
|
|
1392
|
-
}
|
|
1393
1382
|
]
|
|
1394
1383
|
}
|
|
1395
1384
|
}
|
|
1396
1385
|
]);
|
|
1397
1386
|
|
|
1387
|
+
// src/configs/markdown.ts
|
|
1388
|
+
var markdown = defineConfig([
|
|
1389
|
+
...default13.configs.recommended,
|
|
1390
|
+
{
|
|
1391
|
+
name: "ntnyq/markdown/extensions",
|
|
1392
|
+
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1393
|
+
rules: {
|
|
1394
|
+
"no-undef": "off",
|
|
1395
|
+
"no-alert": "off",
|
|
1396
|
+
"no-console": "off",
|
|
1397
|
+
"no-unused-vars": "off",
|
|
1398
|
+
"no-unused-expressions": "off",
|
|
1399
|
+
"no-restricted-imports": "off",
|
|
1400
|
+
"node/prefer-global/buffer": "off",
|
|
1401
|
+
"node/prefer-global/process": "off",
|
|
1402
|
+
"import/no-unresolved": "off",
|
|
1403
|
+
"unused-imports/no-unused-imports": "off",
|
|
1404
|
+
"unused-imports/no-unused-vars": "off",
|
|
1405
|
+
"@typescript-eslint/comma-dangle": "off",
|
|
1406
|
+
"@typescript-eslint/no-redeclare": "off",
|
|
1407
|
+
"@typescript-eslint/no-namespace": "off",
|
|
1408
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
1409
|
+
"@typescript-eslint/no-extraneous-class": "off",
|
|
1410
|
+
"@typescript-eslint/no-use-before-define": "off"
|
|
1411
|
+
}
|
|
1412
|
+
}
|
|
1413
|
+
]);
|
|
1414
|
+
|
|
1398
1415
|
// src/core.ts
|
|
1399
1416
|
function ntnyq(config = [], {
|
|
1400
1417
|
vue: enableVue = hasVue,
|
|
1401
1418
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
1419
|
+
vitest: enableVitest = hasVitest,
|
|
1402
1420
|
prettier: enablePrettier = true,
|
|
1403
1421
|
markdown: enableMarkdown = true,
|
|
1404
1422
|
command: enableCommand = true
|
|
@@ -1429,6 +1447,9 @@ function ntnyq(config = [], {
|
|
|
1429
1447
|
if (enableVue) {
|
|
1430
1448
|
configs.push(...vue);
|
|
1431
1449
|
}
|
|
1450
|
+
if (enableVitest) {
|
|
1451
|
+
configs.push(...vitest);
|
|
1452
|
+
}
|
|
1432
1453
|
if (enableUnoCSS) {
|
|
1433
1454
|
configs.push(...unocss);
|
|
1434
1455
|
}
|
|
@@ -1466,6 +1487,7 @@ export {
|
|
|
1466
1487
|
GLOB_SRC,
|
|
1467
1488
|
GLOB_SRC_EXT,
|
|
1468
1489
|
GLOB_STYLE,
|
|
1490
|
+
GLOB_TEST,
|
|
1469
1491
|
GLOB_TOML,
|
|
1470
1492
|
GLOB_TS,
|
|
1471
1493
|
GLOB_TSX,
|
|
@@ -1477,6 +1499,7 @@ export {
|
|
|
1477
1499
|
getVueVersion,
|
|
1478
1500
|
hasTypeScript,
|
|
1479
1501
|
hasUnoCSS,
|
|
1502
|
+
hasVitest,
|
|
1480
1503
|
hasVue,
|
|
1481
1504
|
ignores,
|
|
1482
1505
|
imports,
|
|
@@ -1494,19 +1517,20 @@ export {
|
|
|
1494
1517
|
parserVue,
|
|
1495
1518
|
parserYaml,
|
|
1496
1519
|
perfectionist,
|
|
1497
|
-
|
|
1498
|
-
|
|
1520
|
+
default16 as pluginComments,
|
|
1521
|
+
default11 as pluginImport,
|
|
1499
1522
|
default7 as pluginJsdoc,
|
|
1500
1523
|
default6 as pluginJsonc,
|
|
1501
|
-
|
|
1524
|
+
default13 as pluginMarkdown,
|
|
1502
1525
|
default2 as pluginNode,
|
|
1503
|
-
|
|
1504
|
-
|
|
1526
|
+
default14 as pluginPerfectionist,
|
|
1527
|
+
default12 as pluginPrettier,
|
|
1505
1528
|
pluginRegexp,
|
|
1506
1529
|
default5 as pluginToml,
|
|
1507
|
-
|
|
1530
|
+
default10 as pluginUnicorn,
|
|
1508
1531
|
default8 as pluginUnoCSS,
|
|
1509
|
-
|
|
1532
|
+
default15 as pluginUnusedImports,
|
|
1533
|
+
default9 as pluginVitest,
|
|
1510
1534
|
default3 as pluginVue,
|
|
1511
1535
|
default4 as pluginYaml,
|
|
1512
1536
|
prettier,
|
|
@@ -1520,6 +1544,7 @@ export {
|
|
|
1520
1544
|
unicorn,
|
|
1521
1545
|
unocss,
|
|
1522
1546
|
unusedImports,
|
|
1547
|
+
vitest,
|
|
1523
1548
|
vue,
|
|
1524
1549
|
yml
|
|
1525
1550
|
};
|