@eset-gdd/code-styleguide-eslint-vue3 1.1.5 → 1.1.7
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 +24 -6
- package/index.js +44 -7
- package/package.json +5 -11
- package/typescript.js +0 -47
package/configs/rules.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const rules = {
|
|
2
2
|
// general
|
|
3
|
-
"vue/
|
|
3
|
+
"vue/block-order": [
|
|
4
4
|
"error",
|
|
5
5
|
{
|
|
6
6
|
order: ["template", "script", "style"],
|
|
@@ -22,7 +22,6 @@ export const rules = {
|
|
|
22
22
|
],
|
|
23
23
|
|
|
24
24
|
// template
|
|
25
|
-
"vue/no-multiple-template-root": "warn",
|
|
26
25
|
"vue/attributes-order": [
|
|
27
26
|
"error",
|
|
28
27
|
{
|
|
@@ -124,9 +123,9 @@ export const rules = {
|
|
|
124
123
|
ignore: [],
|
|
125
124
|
},
|
|
126
125
|
],
|
|
127
|
-
"vue/v-on-
|
|
126
|
+
"vue/v-on-handler-style": [
|
|
128
127
|
"error",
|
|
129
|
-
"
|
|
128
|
+
["method", "inline-function"],
|
|
130
129
|
{
|
|
131
130
|
ignoreIncludesComment: false,
|
|
132
131
|
},
|
|
@@ -140,13 +139,32 @@ export const rules = {
|
|
|
140
139
|
"vue/prefer-separate-static-class": "error",
|
|
141
140
|
"vue/prefer-template": "error",
|
|
142
141
|
"vue/prop-name-casing": ["error", "camelCase"],
|
|
143
|
-
|
|
142
|
+
"vue/attribute-hyphenation": [
|
|
143
|
+
"error",
|
|
144
|
+
"always",
|
|
145
|
+
{
|
|
146
|
+
ignore: [],
|
|
147
|
+
ignoreTags: [],
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
"vue/max-attributes-per-line": [
|
|
151
|
+
"error",
|
|
152
|
+
{
|
|
153
|
+
singleline: {
|
|
154
|
+
max: 3,
|
|
155
|
+
},
|
|
156
|
+
multiline: {
|
|
157
|
+
max: 1,
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
],
|
|
144
161
|
"no-restricted-syntax": [
|
|
145
162
|
"error",
|
|
146
163
|
{
|
|
147
164
|
selector:
|
|
148
165
|
"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:
|
|
166
|
+
message:
|
|
167
|
+
"Boolean ref variables must start with is/are/was/were/has/did/can/should",
|
|
150
168
|
},
|
|
151
169
|
],
|
|
152
170
|
};
|
package/index.js
CHANGED
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
/* eslint-disable import-x/extensions */
|
|
2
2
|
import pluginVue from "eslint-plugin-vue";
|
|
3
3
|
import globals from "globals";
|
|
4
|
+
import tseslint from "typescript-eslint";
|
|
4
5
|
import { rules as vueRules } from "./configs/rules.js";
|
|
6
|
+
import { getRules as getTsRules } from "@eset-gdd/code-styleguide-eslint-base-typescript";
|
|
5
7
|
|
|
6
|
-
|
|
8
|
+
const getRules = ({ strict, typescript }) => {
|
|
9
|
+
if (typescript) {
|
|
10
|
+
return { ...vueRules, ...getTsRules({ strict }) };
|
|
11
|
+
}
|
|
7
12
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
13
|
+
return { ...vueRules };
|
|
14
|
+
};
|
|
15
|
+
const createConfig = (options = {}) => {
|
|
16
|
+
const { strict = false, typescript = true } = options;
|
|
17
|
+
const rules = getRules(options);
|
|
18
|
+
const vueConfig = {
|
|
11
19
|
files: ["**/*.vue"],
|
|
12
20
|
languageOptions: {
|
|
13
21
|
globals: {
|
|
@@ -29,7 +37,36 @@ export default [
|
|
|
29
37
|
},
|
|
30
38
|
},
|
|
31
39
|
rules: {
|
|
32
|
-
...
|
|
40
|
+
...rules,
|
|
33
41
|
},
|
|
34
|
-
}
|
|
35
|
-
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
if (typescript) {
|
|
45
|
+
vueConfig.languageOptions.parserOptions = {
|
|
46
|
+
parser: tseslint.parser,
|
|
47
|
+
projectService: strict,
|
|
48
|
+
extraFileExtensions: [".vue"],
|
|
49
|
+
sourceType: "module",
|
|
50
|
+
};
|
|
51
|
+
vueConfig.plugins = {
|
|
52
|
+
"@typescript-eslint": tseslint.plugin,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
return [...pluginVue.configs["flat/recommended"], vueConfig];
|
|
57
|
+
};
|
|
58
|
+
const vueConfig = (options) => {
|
|
59
|
+
return createConfig(options);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
vueConfig[Symbol.iterator] = function* () {
|
|
63
|
+
const config = createConfig({ strict: false, typescript: true });
|
|
64
|
+
|
|
65
|
+
for (const c of config) {
|
|
66
|
+
yield c;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const rules = getRules({ strict: false, typescript: true });
|
|
71
|
+
|
|
72
|
+
export default vueConfig;
|
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.7",
|
|
5
5
|
"description": "Vue 3 ESLint configuration for ESET's Frontend Coding Styleguide",
|
|
6
6
|
"author": "ESET GWD Team",
|
|
7
7
|
"license": "ISC",
|
|
@@ -21,26 +21,20 @@
|
|
|
21
21
|
"vue3",
|
|
22
22
|
"code-style"
|
|
23
23
|
],
|
|
24
|
-
"exports": {
|
|
25
|
-
".": "./index.js",
|
|
26
|
-
"./index.js": "./index.js",
|
|
27
|
-
"./typescript": "./typescript.js"
|
|
28
|
-
},
|
|
29
24
|
"main": "index.js",
|
|
30
25
|
"files": [
|
|
31
26
|
"README.md",
|
|
32
27
|
"configs",
|
|
33
|
-
"index.js"
|
|
34
|
-
"typescript.js"
|
|
28
|
+
"index.js"
|
|
35
29
|
],
|
|
36
30
|
"peerDependencies": {
|
|
37
31
|
"eslint": "^9.37.0",
|
|
38
32
|
"vue": ">=3.0.0"
|
|
39
33
|
},
|
|
40
34
|
"dependencies": {
|
|
41
|
-
"@eset-gdd/code-styleguide-eslint-base-typescript": "^1.1.
|
|
42
|
-
"eslint-plugin-vue": "^
|
|
35
|
+
"@eset-gdd/code-styleguide-eslint-base-typescript": "^1.1.7",
|
|
36
|
+
"eslint-plugin-vue": "^10.6.0",
|
|
43
37
|
"globals": "^16.4.0",
|
|
44
|
-
"typescript-eslint": "^8.
|
|
38
|
+
"typescript-eslint": "^8.47.0"
|
|
45
39
|
}
|
|
46
40
|
}
|
package/typescript.js
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
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 { rules as vueRules } from "./configs/rules.js";
|
|
6
|
-
import { rules 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
|
-
},
|
|
21
|
-
globals: {
|
|
22
|
-
...globals.browser,
|
|
23
|
-
computed: "readonly",
|
|
24
|
-
defineEmits: "readonly",
|
|
25
|
-
defineExpose: "readonly",
|
|
26
|
-
defineProps: "readonly",
|
|
27
|
-
onMounted: "readonly",
|
|
28
|
-
onUnmounted: "readonly",
|
|
29
|
-
reactive: "readonly",
|
|
30
|
-
ref: "readonly",
|
|
31
|
-
shallowReactive: "readonly",
|
|
32
|
-
shallowRef: "readonly",
|
|
33
|
-
toRef: "readonly",
|
|
34
|
-
toRefs: "readonly",
|
|
35
|
-
watch: "readonly",
|
|
36
|
-
watchEffect: "readonly",
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
plugins: {
|
|
40
|
-
"@typescript-eslint": tseslint.plugin,
|
|
41
|
-
},
|
|
42
|
-
rules: {
|
|
43
|
-
...vueRules,
|
|
44
|
-
...tsFlatConfig,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
];
|