@eset-gdd/code-styleguide-eslint-vue3 1.1.1 → 1.1.3
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/configs/rules.js +152 -0
- package/index.js +8 -153
- package/package.json +12 -4
- package/typescript.js +48 -0
package/configs/rules.js
ADDED
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
export const vueRules = {
|
|
2
|
+
// general
|
|
3
|
+
"vue/component-tags-order": [
|
|
4
|
+
"error",
|
|
5
|
+
{
|
|
6
|
+
order: ["template", "script", "style"],
|
|
7
|
+
},
|
|
8
|
+
],
|
|
9
|
+
"vue/custom-event-name-casing": [
|
|
10
|
+
"warn",
|
|
11
|
+
"kebab-case",
|
|
12
|
+
{
|
|
13
|
+
ignores: [],
|
|
14
|
+
},
|
|
15
|
+
],
|
|
16
|
+
"vue/component-definition-name-casing": ["error", "PascalCase"],
|
|
17
|
+
"vue/no-unused-properties": [
|
|
18
|
+
"warn",
|
|
19
|
+
{
|
|
20
|
+
groups: ["props", "data", "computed", "methods"],
|
|
21
|
+
},
|
|
22
|
+
],
|
|
23
|
+
|
|
24
|
+
// template
|
|
25
|
+
"vue/no-multiple-template-root": "warn",
|
|
26
|
+
"vue/attributes-order": [
|
|
27
|
+
"error",
|
|
28
|
+
{
|
|
29
|
+
order: [
|
|
30
|
+
"DEFINITION",
|
|
31
|
+
"LIST_RENDERING",
|
|
32
|
+
"CONDITIONALS",
|
|
33
|
+
"RENDER_MODIFIERS",
|
|
34
|
+
"GLOBAL",
|
|
35
|
+
["UNIQUE", "SLOT"],
|
|
36
|
+
"TWO_WAY_BINDING",
|
|
37
|
+
"OTHER_DIRECTIVES",
|
|
38
|
+
"OTHER_ATTR",
|
|
39
|
+
"EVENTS",
|
|
40
|
+
"CONTENT",
|
|
41
|
+
],
|
|
42
|
+
alphabetical: false,
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
"vue/html-self-closing": [
|
|
46
|
+
"error",
|
|
47
|
+
{
|
|
48
|
+
html: {
|
|
49
|
+
void: "always",
|
|
50
|
+
normal: "never",
|
|
51
|
+
component: "always",
|
|
52
|
+
},
|
|
53
|
+
svg: "always",
|
|
54
|
+
math: "always",
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
"vue/component-name-in-template-casing": [
|
|
58
|
+
"error",
|
|
59
|
+
"PascalCase",
|
|
60
|
+
{
|
|
61
|
+
registeredComponentsOnly: false,
|
|
62
|
+
},
|
|
63
|
+
],
|
|
64
|
+
"vue/html-button-has-type": [
|
|
65
|
+
"warn",
|
|
66
|
+
{
|
|
67
|
+
button: true,
|
|
68
|
+
submit: true,
|
|
69
|
+
reset: true,
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
"vue/no-multi-spaces": ["error"],
|
|
73
|
+
"vue/no-reserved-component-names": [
|
|
74
|
+
"error",
|
|
75
|
+
{
|
|
76
|
+
disallowVueBuiltInComponents: true,
|
|
77
|
+
disallowVue3BuiltInComponents: true,
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
"vue/no-restricted-component-options": [
|
|
81
|
+
"error",
|
|
82
|
+
"init",
|
|
83
|
+
"beforeCompile",
|
|
84
|
+
"compiled",
|
|
85
|
+
"activate",
|
|
86
|
+
"ready",
|
|
87
|
+
"/^(?:at|de)tached$/",
|
|
88
|
+
],
|
|
89
|
+
"vue/no-undef-components": [
|
|
90
|
+
"error",
|
|
91
|
+
{
|
|
92
|
+
ignorePatterns: [
|
|
93
|
+
"custom(\\-\\w+)+",
|
|
94
|
+
"app(\\-\\w+)+",
|
|
95
|
+
"b(\\-\\w+)+",
|
|
96
|
+
"font(\\-\\w+)+",
|
|
97
|
+
"nuxt",
|
|
98
|
+
"nuxt(\\-\\w+)+",
|
|
99
|
+
"router(\\-\\w+)+",
|
|
100
|
+
"VGuard",
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
"vue/no-useless-mustaches": [
|
|
105
|
+
"error",
|
|
106
|
+
{
|
|
107
|
+
ignoreIncludesComment: false,
|
|
108
|
+
ignoreStringEscape: false,
|
|
109
|
+
},
|
|
110
|
+
],
|
|
111
|
+
"vue/no-useless-v-bind": [
|
|
112
|
+
"error",
|
|
113
|
+
{
|
|
114
|
+
ignoreIncludesComment: false,
|
|
115
|
+
ignoreStringEscape: false,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
"vue/padding-line-between-blocks": ["error", "always"],
|
|
119
|
+
"vue/v-on-event-hyphenation": [
|
|
120
|
+
"error",
|
|
121
|
+
"always",
|
|
122
|
+
{
|
|
123
|
+
autofix: false,
|
|
124
|
+
ignore: [],
|
|
125
|
+
},
|
|
126
|
+
],
|
|
127
|
+
"vue/v-on-function-call": [
|
|
128
|
+
"error",
|
|
129
|
+
"never",
|
|
130
|
+
{
|
|
131
|
+
ignoreIncludesComment: false,
|
|
132
|
+
},
|
|
133
|
+
],
|
|
134
|
+
"vue/define-macros-order": [
|
|
135
|
+
"error",
|
|
136
|
+
{
|
|
137
|
+
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"],
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
"vue/prefer-separate-static-class": "error",
|
|
141
|
+
"vue/prefer-template": "error",
|
|
142
|
+
"vue/prop-name-casing": ["error", "camelCase"],
|
|
143
|
+
// "vue/custom-event-name-casing": ["error", "camelCase"],
|
|
144
|
+
"no-restricted-syntax": [
|
|
145
|
+
"error",
|
|
146
|
+
{
|
|
147
|
+
selector:
|
|
148
|
+
"VariableDeclarator[init.type='CallExpression'][init.callee.name='ref'][init.arguments.0.raw=/^(true|false)$/][id.name=/^(?!is|are|was|were|has|did|can|should)[a-z]/]",
|
|
149
|
+
message: "Boolean ref variables must start with is/are/was/were/has/did/can/should",
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
};
|
package/index.js
CHANGED
|
@@ -1,163 +1,15 @@
|
|
|
1
|
+
/* eslint-disable import-x/extensions */
|
|
1
2
|
import pluginVue from "eslint-plugin-vue";
|
|
2
3
|
import globals from "globals";
|
|
4
|
+
import { vueRules } from "./configs/rules.js";
|
|
5
|
+
|
|
6
|
+
export const rules = [...vueRules];
|
|
3
7
|
|
|
4
8
|
export default [
|
|
5
9
|
...pluginVue.configs["flat/recommended"],
|
|
6
10
|
{
|
|
7
|
-
|
|
8
|
-
// general
|
|
9
|
-
"vue/component-tags-order": [
|
|
10
|
-
"error",
|
|
11
|
-
{
|
|
12
|
-
order: ["template", "script", "style"],
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
"vue/custom-event-name-casing": [
|
|
16
|
-
"warn",
|
|
17
|
-
"kebab-case",
|
|
18
|
-
{
|
|
19
|
-
ignores: [],
|
|
20
|
-
},
|
|
21
|
-
],
|
|
22
|
-
"vue/component-definition-name-casing": ["error", "PascalCase"],
|
|
23
|
-
"vue/no-unused-properties": [
|
|
24
|
-
"warn",
|
|
25
|
-
{
|
|
26
|
-
groups: ["props", "data", "computed", "methods"],
|
|
27
|
-
},
|
|
28
|
-
],
|
|
29
|
-
|
|
30
|
-
// template
|
|
31
|
-
"vue/no-multiple-template-root": "warn",
|
|
32
|
-
"vue/attributes-order": [
|
|
33
|
-
"error",
|
|
34
|
-
{
|
|
35
|
-
order: [
|
|
36
|
-
"DEFINITION",
|
|
37
|
-
"LIST_RENDERING",
|
|
38
|
-
"CONDITIONALS",
|
|
39
|
-
"RENDER_MODIFIERS",
|
|
40
|
-
"GLOBAL",
|
|
41
|
-
["UNIQUE", "SLOT"],
|
|
42
|
-
"TWO_WAY_BINDING",
|
|
43
|
-
"OTHER_DIRECTIVES",
|
|
44
|
-
"OTHER_ATTR",
|
|
45
|
-
"EVENTS",
|
|
46
|
-
"CONTENT",
|
|
47
|
-
],
|
|
48
|
-
alphabetical: false,
|
|
49
|
-
},
|
|
50
|
-
],
|
|
51
|
-
"vue/html-self-closing": [
|
|
52
|
-
"error",
|
|
53
|
-
{
|
|
54
|
-
html: {
|
|
55
|
-
void: "always",
|
|
56
|
-
normal: "never",
|
|
57
|
-
component: "always",
|
|
58
|
-
},
|
|
59
|
-
svg: "always",
|
|
60
|
-
math: "always",
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
"vue/component-name-in-template-casing": [
|
|
64
|
-
"error",
|
|
65
|
-
"PascalCase",
|
|
66
|
-
{
|
|
67
|
-
registeredComponentsOnly: false,
|
|
68
|
-
},
|
|
69
|
-
],
|
|
70
|
-
"vue/html-button-has-type": [
|
|
71
|
-
"warn",
|
|
72
|
-
{
|
|
73
|
-
button: true,
|
|
74
|
-
submit: true,
|
|
75
|
-
reset: true,
|
|
76
|
-
},
|
|
77
|
-
],
|
|
78
|
-
"vue/no-multi-spaces": ["error"],
|
|
79
|
-
"vue/no-reserved-component-names": [
|
|
80
|
-
"error",
|
|
81
|
-
{
|
|
82
|
-
disallowVueBuiltInComponents: true,
|
|
83
|
-
disallowVue3BuiltInComponents: true,
|
|
84
|
-
},
|
|
85
|
-
],
|
|
86
|
-
"vue/no-restricted-component-options": [
|
|
87
|
-
"error",
|
|
88
|
-
"init",
|
|
89
|
-
"beforeCompile",
|
|
90
|
-
"compiled",
|
|
91
|
-
"activate",
|
|
92
|
-
"ready",
|
|
93
|
-
"/^(?:at|de)tached$/",
|
|
94
|
-
],
|
|
95
|
-
"vue/no-undef-components": [
|
|
96
|
-
"error",
|
|
97
|
-
{
|
|
98
|
-
ignorePatterns: [
|
|
99
|
-
"custom(\\-\\w+)+",
|
|
100
|
-
"app(\\-\\w+)+",
|
|
101
|
-
"b(\\-\\w+)+",
|
|
102
|
-
"font(\\-\\w+)+",
|
|
103
|
-
"nuxt",
|
|
104
|
-
"nuxt(\\-\\w+)+",
|
|
105
|
-
"router(\\-\\w+)+",
|
|
106
|
-
"VGuard",
|
|
107
|
-
],
|
|
108
|
-
},
|
|
109
|
-
],
|
|
110
|
-
"vue/no-useless-mustaches": [
|
|
111
|
-
"error",
|
|
112
|
-
{
|
|
113
|
-
ignoreIncludesComment: false,
|
|
114
|
-
ignoreStringEscape: false,
|
|
115
|
-
},
|
|
116
|
-
],
|
|
117
|
-
"vue/no-useless-v-bind": [
|
|
118
|
-
"error",
|
|
119
|
-
{
|
|
120
|
-
ignoreIncludesComment: false,
|
|
121
|
-
ignoreStringEscape: false,
|
|
122
|
-
},
|
|
123
|
-
],
|
|
124
|
-
"vue/padding-line-between-blocks": ["error", "always"],
|
|
125
|
-
"vue/v-on-event-hyphenation": [
|
|
126
|
-
"error",
|
|
127
|
-
"always",
|
|
128
|
-
{
|
|
129
|
-
autofix: false,
|
|
130
|
-
ignore: [],
|
|
131
|
-
},
|
|
132
|
-
],
|
|
133
|
-
"vue/v-on-function-call": [
|
|
134
|
-
"error",
|
|
135
|
-
"never",
|
|
136
|
-
{
|
|
137
|
-
ignoreIncludesComment: false,
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
"vue/define-macros-order": [
|
|
141
|
-
"error",
|
|
142
|
-
{
|
|
143
|
-
order: ["defineOptions", "defineProps", "defineEmits", "defineSlots"],
|
|
144
|
-
},
|
|
145
|
-
],
|
|
146
|
-
"vue/prefer-separate-static-class": "error",
|
|
147
|
-
"vue/prefer-template": "error",
|
|
148
|
-
"vue/prop-name-casing": ["error", "camelCase"],
|
|
149
|
-
// "vue/custom-event-name-casing": ["error", "camelCase"],
|
|
150
|
-
"no-restricted-syntax": [
|
|
151
|
-
"error",
|
|
152
|
-
{
|
|
153
|
-
selector:
|
|
154
|
-
"VariableDeclarator[init.type='CallExpression'][init.callee.name='ref'][init.arguments.0.raw=/^(true|false)$/][id.name=/^(?!is|are|was|were|has|did|can|should)[a-z]/]",
|
|
155
|
-
message: "Boolean ref variables must start with is/are/was/were/has/did/can/should",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
},
|
|
11
|
+
files: ["**/*.vue"],
|
|
159
12
|
languageOptions: {
|
|
160
|
-
sourceType: "module",
|
|
161
13
|
globals: {
|
|
162
14
|
...globals.browser,
|
|
163
15
|
computed: "readonly",
|
|
@@ -176,5 +28,8 @@ export default [
|
|
|
176
28
|
watchEffect: "readonly",
|
|
177
29
|
},
|
|
178
30
|
},
|
|
31
|
+
rules: {
|
|
32
|
+
...vueRules,
|
|
33
|
+
},
|
|
179
34
|
},
|
|
180
35
|
];
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eset-gdd/code-styleguide-eslint-vue3",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"description": "Vue 3 ESLint configuration for ESET's Frontend Coding Styleguide",
|
|
6
6
|
"author": "ESET GWD Team",
|
|
7
7
|
"license": "ISC",
|
|
@@ -21,18 +21,26 @@
|
|
|
21
21
|
"vue3",
|
|
22
22
|
"code-style"
|
|
23
23
|
],
|
|
24
|
-
"exports":
|
|
24
|
+
"exports": {
|
|
25
|
+
".": "./index.js",
|
|
26
|
+
"./index.js": "./index.js",
|
|
27
|
+
"./typescript": "./typescript.js"
|
|
28
|
+
},
|
|
25
29
|
"main": "index.js",
|
|
26
30
|
"files": [
|
|
27
31
|
"README.md",
|
|
28
|
-
"
|
|
32
|
+
"configs",
|
|
33
|
+
"index.js",
|
|
34
|
+
"typescript.js"
|
|
29
35
|
],
|
|
30
36
|
"peerDependencies": {
|
|
31
37
|
"eslint": "^9.37.0",
|
|
32
38
|
"vue": ">=3.0.0"
|
|
33
39
|
},
|
|
34
40
|
"dependencies": {
|
|
41
|
+
"@eset-gdd/code-styleguide-eslint-base-typescript": "^1.1.3",
|
|
35
42
|
"eslint-plugin-vue": "^9.31.0",
|
|
36
|
-
"globals": "^16.4.0"
|
|
43
|
+
"globals": "^16.4.0",
|
|
44
|
+
"typescript-eslint": "^8.18.2"
|
|
37
45
|
}
|
|
38
46
|
}
|
package/typescript.js
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/* eslint-disable import-x/extensions */
|
|
2
|
+
import pluginVue from "eslint-plugin-vue";
|
|
3
|
+
import globals from "globals";
|
|
4
|
+
import tseslint from "typescript-eslint";
|
|
5
|
+
import { vueRules } from "./configs/rules.js";
|
|
6
|
+
import { flatConfigRules as tsFlatConfig } from "@eset-gdd/code-styleguide-eslint-base-typescript";
|
|
7
|
+
|
|
8
|
+
export const rules = [...vueRules, ...tsFlatConfig];
|
|
9
|
+
|
|
10
|
+
export default [
|
|
11
|
+
...pluginVue.configs["flat/recommended"],
|
|
12
|
+
{
|
|
13
|
+
files: ["**/*.vue"],
|
|
14
|
+
languageOptions: {
|
|
15
|
+
parserOptions: {
|
|
16
|
+
parser: tseslint.parser,
|
|
17
|
+
projectService: true,
|
|
18
|
+
extraFileExtensions: [".vue"],
|
|
19
|
+
sourceType: "module",
|
|
20
|
+
ecmaFeatures: { jsx: true },
|
|
21
|
+
},
|
|
22
|
+
globals: {
|
|
23
|
+
...globals.browser,
|
|
24
|
+
computed: "readonly",
|
|
25
|
+
defineEmits: "readonly",
|
|
26
|
+
defineExpose: "readonly",
|
|
27
|
+
defineProps: "readonly",
|
|
28
|
+
onMounted: "readonly",
|
|
29
|
+
onUnmounted: "readonly",
|
|
30
|
+
reactive: "readonly",
|
|
31
|
+
ref: "readonly",
|
|
32
|
+
shallowReactive: "readonly",
|
|
33
|
+
shallowRef: "readonly",
|
|
34
|
+
toRef: "readonly",
|
|
35
|
+
toRefs: "readonly",
|
|
36
|
+
watch: "readonly",
|
|
37
|
+
watchEffect: "readonly",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
plugins: {
|
|
41
|
+
"@typescript-eslint": tseslint.plugin,
|
|
42
|
+
},
|
|
43
|
+
rules: {
|
|
44
|
+
...vueRules,
|
|
45
|
+
...tsFlatConfig,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
];
|