@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.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,12 +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 "
|
|
139
|
-
import { default as default14 } 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";
|
|
140
144
|
import * as parserToml from "toml-eslint-parser";
|
|
141
145
|
import * as parserYaml from "yaml-eslint-parser";
|
|
142
146
|
import * as parserVue from "vue-eslint-parser";
|
|
@@ -196,7 +200,7 @@ var imports = defineConfig([
|
|
|
196
200
|
{
|
|
197
201
|
name: "ntnyq/imports",
|
|
198
202
|
plugins: {
|
|
199
|
-
import:
|
|
203
|
+
import: default11
|
|
200
204
|
},
|
|
201
205
|
settings: {
|
|
202
206
|
"import/resolver": {
|
|
@@ -239,7 +243,7 @@ var unicorn = defineConfig([
|
|
|
239
243
|
{
|
|
240
244
|
name: "ntnyq/unicorn",
|
|
241
245
|
plugins: {
|
|
242
|
-
unicorn:
|
|
246
|
+
unicorn: default10
|
|
243
247
|
},
|
|
244
248
|
rules: {
|
|
245
249
|
// Disabled for now
|
|
@@ -316,11 +320,11 @@ var prettier = defineConfig([
|
|
|
316
320
|
{
|
|
317
321
|
name: "ntnyq/prettier",
|
|
318
322
|
plugins: {
|
|
319
|
-
prettier:
|
|
323
|
+
prettier: default12
|
|
320
324
|
},
|
|
321
325
|
rules: {
|
|
322
326
|
...prettierConfig.rules,
|
|
323
|
-
...
|
|
327
|
+
...default12.configs.recommended.rules,
|
|
324
328
|
"prettier/prettier": "warn"
|
|
325
329
|
}
|
|
326
330
|
},
|
|
@@ -331,7 +335,7 @@ var prettier = defineConfig([
|
|
|
331
335
|
name: "ntnyq/prettier/ignore",
|
|
332
336
|
files: [GLOB_TOML],
|
|
333
337
|
plugins: {
|
|
334
|
-
prettier:
|
|
338
|
+
prettier: default12
|
|
335
339
|
},
|
|
336
340
|
rules: {
|
|
337
341
|
"prettier/prettier": "off"
|
|
@@ -344,10 +348,10 @@ var comments = defineConfig([
|
|
|
344
348
|
{
|
|
345
349
|
name: "ntnyq/eslint-comments",
|
|
346
350
|
plugins: {
|
|
347
|
-
"@eslint-community/eslint-comments":
|
|
351
|
+
"@eslint-community/eslint-comments": default16
|
|
348
352
|
},
|
|
349
353
|
rules: {
|
|
350
|
-
...
|
|
354
|
+
...default16.configs.recommended.rules,
|
|
351
355
|
"@eslint-community/eslint-comments/disable-enable-pair": ["error", { allowWholeFile: true }]
|
|
352
356
|
}
|
|
353
357
|
}
|
|
@@ -698,7 +702,7 @@ var unusedImports = defineConfig([
|
|
|
698
702
|
{
|
|
699
703
|
name: "ntnyq/unused-imports",
|
|
700
704
|
plugins: {
|
|
701
|
-
"unused-imports":
|
|
705
|
+
"unused-imports": default15
|
|
702
706
|
},
|
|
703
707
|
rules: {
|
|
704
708
|
"@typescript-eslint/no-unused-vars": "off",
|
|
@@ -716,6 +720,43 @@ var unusedImports = defineConfig([
|
|
|
716
720
|
}
|
|
717
721
|
]);
|
|
718
722
|
|
|
723
|
+
// src/configs/perfectionist.ts
|
|
724
|
+
var perfectionist = defineConfig([
|
|
725
|
+
{
|
|
726
|
+
name: "ntnyq/perfectionist",
|
|
727
|
+
plugins: {
|
|
728
|
+
perfectionist: default14
|
|
729
|
+
},
|
|
730
|
+
rules: {
|
|
731
|
+
"perfectionist/sort-imports": [
|
|
732
|
+
"error",
|
|
733
|
+
{
|
|
734
|
+
groups: [
|
|
735
|
+
"builtin",
|
|
736
|
+
"external",
|
|
737
|
+
"internal",
|
|
738
|
+
"internal-type",
|
|
739
|
+
"parent",
|
|
740
|
+
"parent-type",
|
|
741
|
+
"sibling",
|
|
742
|
+
"sibling-type",
|
|
743
|
+
"index",
|
|
744
|
+
"index-type",
|
|
745
|
+
"object",
|
|
746
|
+
"type",
|
|
747
|
+
"side-effect",
|
|
748
|
+
"side-effect-style"
|
|
749
|
+
],
|
|
750
|
+
internalPattern: ["~/**", "@/**", "#**"],
|
|
751
|
+
newlinesBetween: "ignore"
|
|
752
|
+
}
|
|
753
|
+
],
|
|
754
|
+
"perfectionist/sort-named-exports": ["warn", { groupKind: "values-first" }],
|
|
755
|
+
"perfectionist/sort-named-imports": ["warn", { groupKind: "values-first" }]
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
]);
|
|
759
|
+
|
|
719
760
|
// src/configs/regexp.ts
|
|
720
761
|
var regexp = defineConfig([
|
|
721
762
|
/**
|
|
@@ -746,6 +787,288 @@ var unocss = defineConfig([
|
|
|
746
787
|
import createCommandPlugin from "eslint-plugin-command/config";
|
|
747
788
|
var command = defineConfig([createCommandPlugin()]);
|
|
748
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
|
+
|
|
749
1072
|
// src/configs/yml.ts
|
|
750
1073
|
var yml = defineConfig([
|
|
751
1074
|
{
|
|
@@ -1021,346 +1344,79 @@ var sortTsConfig = defineConfig([
|
|
|
1021
1344
|
// src/configs/jsonc.ts
|
|
1022
1345
|
var jsonc = defineConfig([
|
|
1023
1346
|
{
|
|
1024
|
-
name: "ntnyq/jsonc",
|
|
1025
|
-
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1026
|
-
plugins: {
|
|
1027
|
-
jsonc: default6
|
|
1028
|
-
},
|
|
1029
|
-
languageOptions: {
|
|
1030
|
-
parser: parserJsonc
|
|
1031
|
-
},
|
|
1032
|
-
rules: {
|
|
1033
|
-
...default6.configs["recommended-with-jsonc"].rules,
|
|
1034
|
-
"jsonc/array-bracket-spacing": ["error", "never"],
|
|
1035
|
-
"jsonc/comma-dangle": ["error", "never"],
|
|
1036
|
-
"jsonc/comma-style": ["error", "last"],
|
|
1037
|
-
"jsonc/indent": ["error", 2],
|
|
1038
|
-
"jsonc/key-spacing": [
|
|
1039
|
-
"error",
|
|
1040
|
-
{
|
|
1041
|
-
beforeColon: false,
|
|
1042
|
-
afterColon: true
|
|
1043
|
-
}
|
|
1044
|
-
],
|
|
1045
|
-
"jsonc/no-octal-escape": "error",
|
|
1046
|
-
"jsonc/object-curly-newline": [
|
|
1047
|
-
"error",
|
|
1048
|
-
{
|
|
1049
|
-
multiline: true,
|
|
1050
|
-
consistent: true
|
|
1051
|
-
}
|
|
1052
|
-
],
|
|
1053
|
-
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1054
|
-
"jsonc/object-property-newline": [
|
|
1055
|
-
"error",
|
|
1056
|
-
{
|
|
1057
|
-
allowMultiplePropertiesPerLine: true
|
|
1058
|
-
}
|
|
1059
|
-
]
|
|
1060
|
-
}
|
|
1061
|
-
}
|
|
1062
|
-
]);
|
|
1063
|
-
|
|
1064
|
-
// src/configs/markdown.ts
|
|
1065
|
-
var markdown = defineConfig([
|
|
1066
|
-
...default12.configs.recommended,
|
|
1067
|
-
{
|
|
1068
|
-
name: "ntnyq/markdown/extensions",
|
|
1069
|
-
files: [`${GLOB_MARKDOWN}/${GLOB_SRC}`, `${GLOB_MARKDOWN}/${GLOB_VUE}`],
|
|
1070
|
-
rules: {
|
|
1071
|
-
"no-undef": "off",
|
|
1072
|
-
"no-alert": "off",
|
|
1073
|
-
"no-console": "off",
|
|
1074
|
-
"no-unused-vars": "off",
|
|
1075
|
-
"no-unused-expressions": "off",
|
|
1076
|
-
"no-restricted-imports": "off",
|
|
1077
|
-
"node/prefer-global/buffer": "off",
|
|
1078
|
-
"node/prefer-global/process": "off",
|
|
1079
|
-
"import/no-unresolved": "off",
|
|
1080
|
-
"unused-imports/no-unused-imports": "off",
|
|
1081
|
-
"unused-imports/no-unused-vars": "off",
|
|
1082
|
-
"@typescript-eslint/comma-dangle": "off",
|
|
1083
|
-
"@typescript-eslint/no-redeclare": "off",
|
|
1084
|
-
"@typescript-eslint/no-namespace": "off",
|
|
1085
|
-
"@typescript-eslint/no-unused-vars": "off",
|
|
1086
|
-
"@typescript-eslint/no-extraneous-class": "off",
|
|
1087
|
-
"@typescript-eslint/no-use-before-define": "off"
|
|
1088
|
-
}
|
|
1089
|
-
}
|
|
1090
|
-
]);
|
|
1091
|
-
|
|
1092
|
-
// src/configs/vue.ts
|
|
1093
|
-
import process2 from "node:process";
|
|
1094
|
-
import { getPackageInfoSync } from "local-pkg";
|
|
1095
|
-
function getVueVersion() {
|
|
1096
|
-
const pkg = getPackageInfoSync("vue", { paths: [process2.cwd()] });
|
|
1097
|
-
if (pkg && typeof pkg.version === "string" && !Number.isNaN(+pkg.version[0])) {
|
|
1098
|
-
return +pkg.version[0];
|
|
1099
|
-
}
|
|
1100
|
-
return 3;
|
|
1101
|
-
}
|
|
1102
|
-
var isVue3 = getVueVersion() === 3;
|
|
1103
|
-
var vue2Rules = {
|
|
1104
|
-
...default3.configs.base.rules,
|
|
1105
|
-
...default3.configs.essential.rules,
|
|
1106
|
-
...default3.configs["strongly-recommended"].rules,
|
|
1107
|
-
...default3.configs.recommended.rules
|
|
1108
|
-
};
|
|
1109
|
-
var vue3Rules = {
|
|
1110
|
-
...default3.configs.base.rules,
|
|
1111
|
-
...default3.configs["vue3-essential"].rules,
|
|
1112
|
-
...default3.configs["vue3-strongly-recommended"].rules,
|
|
1113
|
-
...default3.configs["vue3-recommended"].rules
|
|
1114
|
-
};
|
|
1115
|
-
var vue = defineConfig([
|
|
1116
|
-
...tseslint.config({
|
|
1117
|
-
name: "ntnyq/vue/ts",
|
|
1118
|
-
files: [GLOB_VUE],
|
|
1119
|
-
// TODO: Remove this when `typescript-eslint` is aligned with `eslint`
|
|
1120
|
-
// @ts-expect-error - `typescript-eslint` is not aligned with eslint
|
|
1121
|
-
extends: typescriptCore
|
|
1122
|
-
}),
|
|
1123
|
-
{
|
|
1124
|
-
name: "ntnyq/vue/core",
|
|
1125
|
-
files: [GLOB_VUE],
|
|
1347
|
+
name: "ntnyq/jsonc",
|
|
1348
|
+
files: [GLOB_JSON, GLOB_JSON5, GLOB_JSONC],
|
|
1126
1349
|
plugins: {
|
|
1127
|
-
|
|
1128
|
-
"@typescript-eslint": tseslint.plugin
|
|
1350
|
+
jsonc: default6
|
|
1129
1351
|
},
|
|
1130
1352
|
languageOptions: {
|
|
1131
|
-
parser:
|
|
1132
|
-
parserOptions: {
|
|
1133
|
-
parser: "@typescript-eslint/parser",
|
|
1134
|
-
sourceType: "module",
|
|
1135
|
-
extraFileExtensions: [".vue"],
|
|
1136
|
-
ecmaFeatures: {
|
|
1137
|
-
jsx: true
|
|
1138
|
-
}
|
|
1139
|
-
}
|
|
1353
|
+
parser: parserJsonc
|
|
1140
1354
|
},
|
|
1141
|
-
processor: default3.processors[".vue"],
|
|
1142
1355
|
rules: {
|
|
1143
|
-
...
|
|
1144
|
-
|
|
1145
|
-
"
|
|
1146
|
-
"
|
|
1147
|
-
"
|
|
1148
|
-
"
|
|
1149
|
-
"vue/no-setup-props-reactivity-loss": "off",
|
|
1150
|
-
"vue/html-self-closing": [
|
|
1151
|
-
"error",
|
|
1152
|
-
{
|
|
1153
|
-
html: {
|
|
1154
|
-
void: "always",
|
|
1155
|
-
normal: "always",
|
|
1156
|
-
component: "always"
|
|
1157
|
-
},
|
|
1158
|
-
svg: "always",
|
|
1159
|
-
math: "always"
|
|
1160
|
-
}
|
|
1161
|
-
],
|
|
1162
|
-
"vue/block-tag-newline": [
|
|
1163
|
-
"error",
|
|
1164
|
-
{
|
|
1165
|
-
singleline: "always",
|
|
1166
|
-
multiline: "always"
|
|
1167
|
-
}
|
|
1168
|
-
],
|
|
1169
|
-
"vue/component-name-in-template-casing": [
|
|
1170
|
-
"error",
|
|
1171
|
-
"PascalCase",
|
|
1172
|
-
{
|
|
1173
|
-
// Force auto-import components to be PascalCase
|
|
1174
|
-
registeredComponentsOnly: false,
|
|
1175
|
-
ignores: ["slot", "component"]
|
|
1176
|
-
}
|
|
1177
|
-
],
|
|
1178
|
-
"vue/component-options-name-casing": ["error", "PascalCase"],
|
|
1179
|
-
"vue/custom-event-name-casing": ["error", "camelCase"],
|
|
1180
|
-
"vue/define-macros-order": [
|
|
1181
|
-
"error",
|
|
1182
|
-
{
|
|
1183
|
-
order: ["defineProps", "defineEmits", "defineOptions", "defineSlots"]
|
|
1184
|
-
}
|
|
1185
|
-
],
|
|
1186
|
-
"vue/html-comment-content-spacing": [
|
|
1187
|
-
"error",
|
|
1188
|
-
"always",
|
|
1189
|
-
{
|
|
1190
|
-
exceptions: ["-"]
|
|
1191
|
-
}
|
|
1192
|
-
],
|
|
1193
|
-
"vue/array-bracket-spacing": ["error", "never"],
|
|
1194
|
-
"vue/arrow-spacing": ["error", { before: true, after: true }],
|
|
1195
|
-
"vue/block-spacing": ["error", "always"],
|
|
1196
|
-
"vue/brace-style": ["error", "stroustrup", { allowSingleLine: true }],
|
|
1197
|
-
"vue/comma-dangle": ["error", "always-multiline"],
|
|
1198
|
-
"vue/comma-spacing": ["error", { before: false, after: true }],
|
|
1199
|
-
"vue/comma-style": ["error", "last"],
|
|
1200
|
-
"vue/dot-location": ["error", "property"],
|
|
1201
|
-
"vue/dot-notation": ["error", { allowKeywords: true }],
|
|
1202
|
-
"vue/eqeqeq": ["error", "smart"],
|
|
1203
|
-
"vue/key-spacing": ["error", { beforeColon: false, afterColon: true }],
|
|
1204
|
-
"vue/keyword-spacing": ["error", { before: true, after: true }],
|
|
1205
|
-
"vue/no-empty-pattern": "error",
|
|
1206
|
-
"vue/no-loss-of-precision": "error",
|
|
1207
|
-
"vue/no-irregular-whitespace": "error",
|
|
1208
|
-
"vue/no-use-v-else-with-v-for": "error",
|
|
1209
|
-
"vue/require-typed-object-prop": "error",
|
|
1210
|
-
"vue/no-extra-parens": ["error", "functions"],
|
|
1211
|
-
"vue/no-restricted-syntax": [
|
|
1212
|
-
"error",
|
|
1213
|
-
"DebuggerStatement",
|
|
1214
|
-
"LabeledStatement",
|
|
1215
|
-
"WithStatement"
|
|
1216
|
-
],
|
|
1217
|
-
"vue/no-sparse-arrays": "error",
|
|
1218
|
-
"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": [
|
|
1219
1362
|
"error",
|
|
1220
1363
|
{
|
|
1221
|
-
|
|
1364
|
+
beforeColon: false,
|
|
1365
|
+
afterColon: true
|
|
1222
1366
|
}
|
|
1223
1367
|
],
|
|
1224
|
-
"
|
|
1368
|
+
"jsonc/no-octal-escape": "error",
|
|
1369
|
+
"jsonc/object-curly-newline": [
|
|
1225
1370
|
"error",
|
|
1226
1371
|
{
|
|
1227
1372
|
multiline: true,
|
|
1228
1373
|
consistent: true
|
|
1229
1374
|
}
|
|
1230
1375
|
],
|
|
1231
|
-
"
|
|
1232
|
-
|
|
1233
|
-
{
|
|
1234
|
-
allowBinding: true
|
|
1235
|
-
}
|
|
1236
|
-
],
|
|
1237
|
-
"vue/object-curly-spacing": ["error", "always"],
|
|
1238
|
-
"vue/object-property-newline": [
|
|
1376
|
+
"jsonc/object-curly-spacing": ["error", "always"],
|
|
1377
|
+
"jsonc/object-property-newline": [
|
|
1239
1378
|
"error",
|
|
1240
1379
|
{
|
|
1241
1380
|
allowMultiplePropertiesPerLine: true
|
|
1242
1381
|
}
|
|
1243
|
-
],
|
|
1244
|
-
"vue/object-shorthand": [
|
|
1245
|
-
"error",
|
|
1246
|
-
"always",
|
|
1247
|
-
{
|
|
1248
|
-
ignoreConstructors: false,
|
|
1249
|
-
avoidQuotes: true
|
|
1250
|
-
}
|
|
1251
|
-
],
|
|
1252
|
-
"vue/operator-linebreak": ["error", "before"],
|
|
1253
|
-
"vue/prefer-template": "error",
|
|
1254
|
-
"vue/prop-name-casing": ["error", "camelCase"],
|
|
1255
|
-
"vue/quote-props": ["error", "consistent-as-needed"],
|
|
1256
|
-
"vue/space-in-parens": ["error", "never"],
|
|
1257
|
-
"vue/space-infix-ops": "error",
|
|
1258
|
-
"vue/space-unary-ops": [
|
|
1259
|
-
"error",
|
|
1260
|
-
{
|
|
1261
|
-
words: true,
|
|
1262
|
-
nonwords: false
|
|
1263
|
-
}
|
|
1264
|
-
],
|
|
1265
|
-
"vue/template-curly-spacing": "error",
|
|
1266
|
-
"vue/block-order": [
|
|
1267
|
-
"error",
|
|
1268
|
-
{
|
|
1269
|
-
order: ["script", "template", "style"]
|
|
1270
|
-
}
|
|
1271
|
-
],
|
|
1272
|
-
"vue/attributes-order": [
|
|
1273
|
-
"error",
|
|
1274
|
-
{
|
|
1275
|
-
order: [
|
|
1276
|
-
"EVENTS",
|
|
1277
|
-
// `@click="functionCall"`, `v-on="event"`
|
|
1278
|
-
"TWO_WAY_BINDING",
|
|
1279
|
-
// `v-model`
|
|
1280
|
-
"OTHER_DIRECTIVES",
|
|
1281
|
-
// `v-custom-directive`
|
|
1282
|
-
"LIST_RENDERING",
|
|
1283
|
-
// `v-for item in items`
|
|
1284
|
-
"CONDITIONALS",
|
|
1285
|
-
// `v-if`, `v-show`, `v-cloak`
|
|
1286
|
-
"CONTENT",
|
|
1287
|
-
// `v-text`, `v-html`
|
|
1288
|
-
"SLOT",
|
|
1289
|
-
// `v-slot`, `slot`
|
|
1290
|
-
"UNIQUE",
|
|
1291
|
-
// `ref`, `key`
|
|
1292
|
-
"DEFINITION",
|
|
1293
|
-
// `is`, `v-is`
|
|
1294
|
-
"ATTR_DYNAMIC",
|
|
1295
|
-
// `v-bind:prop="foo"`, `:prop="foo"`
|
|
1296
|
-
// `OTHER_ATTR`, // `custom-prop="foo"`, `:prop="foo"`, `disabled`
|
|
1297
|
-
"RENDER_MODIFIERS",
|
|
1298
|
-
// `v-once`, `v-pre`
|
|
1299
|
-
"GLOBAL",
|
|
1300
|
-
// `id`
|
|
1301
|
-
"ATTR_STATIC",
|
|
1302
|
-
// `prop="foo", `static attributes
|
|
1303
|
-
"ATTR_SHORTHAND_BOOL"
|
|
1304
|
-
// `disabled`, prop shorthand
|
|
1305
|
-
],
|
|
1306
|
-
alphabetical: false
|
|
1307
|
-
}
|
|
1308
|
-
],
|
|
1309
|
-
"vue/order-in-components": [
|
|
1310
|
-
"error",
|
|
1311
|
-
{
|
|
1312
|
-
order: [
|
|
1313
|
-
"el",
|
|
1314
|
-
"name",
|
|
1315
|
-
"key",
|
|
1316
|
-
"parent",
|
|
1317
|
-
"functional",
|
|
1318
|
-
["provide", "inject"],
|
|
1319
|
-
["delimiters", "comments"],
|
|
1320
|
-
["components", "directives", "filters"],
|
|
1321
|
-
"extends",
|
|
1322
|
-
"mixins",
|
|
1323
|
-
"layout",
|
|
1324
|
-
"middleware",
|
|
1325
|
-
"validate",
|
|
1326
|
-
"scrollToTop",
|
|
1327
|
-
"transition",
|
|
1328
|
-
"loading",
|
|
1329
|
-
"inheritAttrs",
|
|
1330
|
-
"model",
|
|
1331
|
-
["props", "propsData"],
|
|
1332
|
-
"emits",
|
|
1333
|
-
"setup",
|
|
1334
|
-
"asyncData",
|
|
1335
|
-
"computed",
|
|
1336
|
-
"data",
|
|
1337
|
-
"fetch",
|
|
1338
|
-
"head",
|
|
1339
|
-
"methods",
|
|
1340
|
-
["template", "render"],
|
|
1341
|
-
"watch",
|
|
1342
|
-
"watchQuery",
|
|
1343
|
-
"LIFECYCLE_HOOKS",
|
|
1344
|
-
"renderError",
|
|
1345
|
-
"ROUTER_GUARDS"
|
|
1346
|
-
]
|
|
1347
|
-
}
|
|
1348
|
-
],
|
|
1349
|
-
"vue/max-attributes-per-line": [
|
|
1350
|
-
"error",
|
|
1351
|
-
{
|
|
1352
|
-
singleline: 1,
|
|
1353
|
-
multiline: 1
|
|
1354
|
-
}
|
|
1355
1382
|
]
|
|
1356
1383
|
}
|
|
1357
1384
|
}
|
|
1358
1385
|
]);
|
|
1359
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
|
+
|
|
1360
1415
|
// src/core.ts
|
|
1361
1416
|
function ntnyq(config = [], {
|
|
1362
1417
|
vue: enableVue = hasVue,
|
|
1363
1418
|
unocss: enableUnoCSS = hasUnoCSS,
|
|
1419
|
+
vitest: enableVitest = hasVitest,
|
|
1364
1420
|
prettier: enablePrettier = true,
|
|
1365
1421
|
markdown: enableMarkdown = true,
|
|
1366
1422
|
command: enableCommand = true
|
|
@@ -1391,6 +1447,9 @@ function ntnyq(config = [], {
|
|
|
1391
1447
|
if (enableVue) {
|
|
1392
1448
|
configs.push(...vue);
|
|
1393
1449
|
}
|
|
1450
|
+
if (enableVitest) {
|
|
1451
|
+
configs.push(...vitest);
|
|
1452
|
+
}
|
|
1394
1453
|
if (enableUnoCSS) {
|
|
1395
1454
|
configs.push(...unocss);
|
|
1396
1455
|
}
|
|
@@ -1428,6 +1487,7 @@ export {
|
|
|
1428
1487
|
GLOB_SRC,
|
|
1429
1488
|
GLOB_SRC_EXT,
|
|
1430
1489
|
GLOB_STYLE,
|
|
1490
|
+
GLOB_TEST,
|
|
1431
1491
|
GLOB_TOML,
|
|
1432
1492
|
GLOB_TS,
|
|
1433
1493
|
GLOB_TSX,
|
|
@@ -1439,6 +1499,7 @@ export {
|
|
|
1439
1499
|
getVueVersion,
|
|
1440
1500
|
hasTypeScript,
|
|
1441
1501
|
hasUnoCSS,
|
|
1502
|
+
hasVitest,
|
|
1442
1503
|
hasVue,
|
|
1443
1504
|
ignores,
|
|
1444
1505
|
imports,
|
|
@@ -1455,18 +1516,21 @@ export {
|
|
|
1455
1516
|
parserToml,
|
|
1456
1517
|
parserVue,
|
|
1457
1518
|
parserYaml,
|
|
1458
|
-
|
|
1459
|
-
|
|
1519
|
+
perfectionist,
|
|
1520
|
+
default16 as pluginComments,
|
|
1521
|
+
default11 as pluginImport,
|
|
1460
1522
|
default7 as pluginJsdoc,
|
|
1461
1523
|
default6 as pluginJsonc,
|
|
1462
|
-
|
|
1524
|
+
default13 as pluginMarkdown,
|
|
1463
1525
|
default2 as pluginNode,
|
|
1464
|
-
|
|
1526
|
+
default14 as pluginPerfectionist,
|
|
1527
|
+
default12 as pluginPrettier,
|
|
1465
1528
|
pluginRegexp,
|
|
1466
1529
|
default5 as pluginToml,
|
|
1467
|
-
|
|
1530
|
+
default10 as pluginUnicorn,
|
|
1468
1531
|
default8 as pluginUnoCSS,
|
|
1469
|
-
|
|
1532
|
+
default15 as pluginUnusedImports,
|
|
1533
|
+
default9 as pluginVitest,
|
|
1470
1534
|
default3 as pluginVue,
|
|
1471
1535
|
default4 as pluginYaml,
|
|
1472
1536
|
prettier,
|
|
@@ -1480,6 +1544,7 @@ export {
|
|
|
1480
1544
|
unicorn,
|
|
1481
1545
|
unocss,
|
|
1482
1546
|
unusedImports,
|
|
1547
|
+
vitest,
|
|
1483
1548
|
vue,
|
|
1484
1549
|
yml
|
|
1485
1550
|
};
|