@eset-gdd/code-styleguide-eslint-vue3 1.1.1 → 1.1.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.
Files changed (3) hide show
  1. package/index.js +8 -153
  2. package/package.json +12 -4
  3. package/typescript.js +48 -0
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
- rules: {
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.1",
4
+ "version": "1.1.2",
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": "./index.js",
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
- "index.js"
32
+ "index.js",
33
+ "rules.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.2",
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
+ ];