@blueking/eslint-config-bk 2.1.0 → 3.0.0-beta.1

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.
@@ -1,29 +1,37 @@
1
1
  /*
2
- * Tencent is pleased to support the open source community by making
3
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
- *
5
- * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
- *
7
- * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
- *
9
- * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
- *
11
- * ---------------------------------------------------
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
- * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
- * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
- * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
- *
17
- * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
- * the Software.
19
- *
20
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
- * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
- * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
- * IN THE SOFTWARE.
25
- */
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+
27
+ /**
28
+ * Vue共用ESLint规则
29
+ * 这个文件包含Vue2和Vue3共用的ESLint规则
30
+ */
26
31
  module.exports = {
32
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/multi-word-component-names.md
33
+ 'vue/multi-word-component-names': 'off',
34
+
27
35
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/array-bracket-spacing.md
28
36
  'vue/array-bracket-spacing': ['error', 'never'],
29
37
 
@@ -45,7 +53,10 @@ module.exports = {
45
53
 
46
54
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/camelcase.md
47
55
  // 后端数据字段经常不是驼峰,所以不限制 properties,也不限制解构
48
- 'vue/camelcase': ['error', { properties: 'never', ignoreDestructuring: true }],
56
+ 'vue/camelcase': [
57
+ 'error',
58
+ { properties: 'never', ignoreDestructuring: true },
59
+ ],
49
60
 
50
61
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/comment-directive.md
51
62
  // vue 文件 template 中允许 eslint-disable eslint-enable eslint-disable-line eslint-disable-next-line
@@ -57,8 +68,7 @@ module.exports = {
57
68
  'vue/component-name-in-template-casing': 'off',
58
69
 
59
70
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/dot-location.md
60
- // 等待 https://github.com/vuejs/eslint-plugin-vue/pull/794 合入
61
- // 'vue/dot-location': ['error', 'property'],
71
+ 'vue/dot-location': ['error', 'property'],
62
72
 
63
73
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/eqeqeq.md
64
74
  'vue/eqeqeq': ['error', 'always', { null: 'ignore' }],
@@ -68,23 +78,30 @@ module.exports = {
68
78
  'vue/html-closing-bracket-newline': 'off',
69
79
 
70
80
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-closing-bracket-spacing.md
71
- 'vue/html-closing-bracket-spacing': ['error', {
72
- startTag: 'never',
73
- endTag: 'never',
74
- selfClosingTag: 'always',
75
- }],
81
+ 'vue/html-closing-bracket-spacing': [
82
+ 'error',
83
+ {
84
+ startTag: 'never',
85
+ endTag: 'never',
86
+ selfClosingTag: 'always',
87
+ },
88
+ ],
76
89
 
77
90
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-end-tags.md
78
91
  'vue/html-end-tags': 'error',
79
92
 
80
93
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-indent.md
81
- 'vue/html-indent': ['error', 2, {
82
- attribute: 1,
83
- baseIndent: 1,
84
- closeBracket: 0,
85
- alignAttributesVertically: true,
86
- ignores: [],
87
- }],
94
+ 'vue/html-indent': [
95
+ 'error',
96
+ 2,
97
+ {
98
+ attribute: 1,
99
+ baseIndent: 1,
100
+ closeBracket: 0,
101
+ alignAttributesVertically: true,
102
+ ignores: [],
103
+ },
104
+ ],
88
105
 
89
106
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/html-quotes.md
90
107
  'vue/html-quotes': ['error', 'double'],
@@ -102,8 +119,7 @@ module.exports = {
102
119
 
103
120
  // 关键字周围空格一致性,在关键字前后保留空格,如 if () else {}
104
121
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/keyword-spacing.md
105
- // 等待 https://github.com/vuejs/eslint-plugin-vue/pull/795 合入
106
- // 'vue/keyword-spacing': ['error', {'before': true, 'after': true}],
122
+ 'vue/keyword-spacing': ['error', { before: true, after: true }],
107
123
 
108
124
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/match-component-file-name.md
109
125
  // 组件名称属性与其文件名匹配,不限制
@@ -124,48 +140,21 @@ module.exports = {
124
140
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/name-property-casing.md
125
141
  'vue/name-property-casing': 'off',
126
142
 
127
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-async-in-computed-properties.md
128
- 'vue/no-async-in-computed-properties': 'error',
129
-
130
143
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-boolean-default.md
131
144
  'vue/no-boolean-default': 'off',
132
145
 
133
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-use-v-if-with-v-for.md
134
- 'vue/no-use-v-if-with-v-for': 'error',
135
-
136
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-dupe-keys.md
137
- // 二级属性名禁止重复
138
- 'vue/no-dupe-keys': 'error',
139
-
140
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-duplicate-attributes.md
141
- // 禁止 html 元素中出现重复的属性
142
- 'vue/no-duplicate-attributes': 'error',
143
-
144
146
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-empty-pattern.md
145
- // 等待 https://github.com/vuejs/eslint-plugin-vue/pull/798 合入
146
147
  // 禁止解构中出现空 {} 或 []
147
- // 'vue/no-empty-pattern': 'error',
148
+ 'vue/no-empty-pattern': 'error',
148
149
 
149
150
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-multi-spaces.md
150
151
  // 删除 html 标签中连续多个不用于缩进的空格
151
152
  'vue/no-multi-spaces': 'error',
152
153
 
153
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-parsing-error.md
154
- // 禁止语法错误
155
- 'vue/no-parsing-error': 'error',
156
-
157
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-reserved-keys.md
158
- // 禁止使用保留字
159
- 'vue/no-reserved-keys': 'error',
160
-
161
154
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-restricted-syntax.md
162
155
  // 禁止使用特定的语法
163
156
  'vue/no-restricted-syntax': 'off',
164
157
 
165
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-shared-component-data.md
166
- // data 属性必须是函数
167
- 'vue/no-shared-component-data': 'error',
168
-
169
158
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-side-effects-in-computed-properties.md
170
159
  // 禁止在计算属性对属性进行修改,不限制
171
160
  'vue/no-side-effects-in-computed-properties': 'off',
@@ -180,20 +169,6 @@ module.exports = {
180
169
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-template-shadow.md
181
170
  'vue/no-template-shadow': 'error',
182
171
 
183
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-textarea-mustache.md
184
- 'vue/no-textarea-mustache': 'error',
185
-
186
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-unused-components.md
187
- // 禁止 components 中声明的组件在 template 中没有使用
188
- 'vue/no-unused-components': 'error',
189
-
190
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-unused-vars.md
191
- 'vue/no-unused-vars': 'error',
192
-
193
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-use-v-if-with-v-for.md
194
- // 禁止 v-for 和 v-if 在同一元素上使用,不限制
195
- 'vue/no-use-v-if-with-v-for': 'off',
196
-
197
172
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/no-v-html.md
198
173
  // 禁止使用 v-html,防止 xss
199
174
  'vue/no-v-html': 'error',
@@ -202,39 +177,10 @@ module.exports = {
202
177
  // 对象写在一行时,大括号里需要空格
203
178
  'vue/object-curly-spacing': ['error', 'always'],
204
179
 
205
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/order-in-components.md
206
- // 官方推荐顺序
207
- 'vue/order-in-components': ['error', {
208
- order: [
209
- 'el',
210
- 'name',
211
- 'parent',
212
- 'functional',
213
- ['delimiters', 'comments'],
214
- ['components', 'directives', 'filters'],
215
- 'extends',
216
- 'mixins',
217
- 'inheritAttrs',
218
- 'model',
219
- ['props', 'propsData'],
220
- 'data',
221
- 'computed',
222
- 'watch',
223
- 'LIFECYCLE_HOOKS',
224
- 'methods',
225
- ['template', 'render'],
226
- 'renderError',
227
- ],
228
- }],
229
-
230
180
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/prop-name-casing.md
231
181
  // 组件 props 属性名驼峰命名
232
182
  'vue/prop-name-casing': ['error', 'camelCase'],
233
183
 
234
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-component-is.md
235
- // <component> 元素必须要有 :is 属性
236
- 'vue/require-component-is': 'error',
237
-
238
184
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-default-prop.md
239
185
  // props 必须要有默认值,不限制
240
186
  'vue/require-default-prop': 'off',
@@ -243,30 +189,14 @@ module.exports = {
243
189
  // 组件必须要直接被 export。不限制
244
190
  'vue/require-direct-export': 'off',
245
191
 
246
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-prop-type-constructor.md
247
- // props 的 type 必须为构造函数,不能为字符串。
248
- 'vue/require-prop-type-constructor': 'error',
249
-
250
192
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-prop-types.md
251
193
  // props 必须要有 type。
252
194
  'vue/require-prop-types': 'error',
253
195
 
254
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-render-return.md
255
- // render 函数必须要有返回值
256
- 'vue/require-render-return': 'error',
257
-
258
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-v-for-key.md
259
- // v-for 指令必须要有 key 属性
260
- 'vue/require-v-for-key': 'error',
261
-
262
196
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/require-valid-default-prop.md
263
197
  // props 默认值必须有效。不限制
264
198
  'vue/require-valid-default-prop': 'off',
265
199
 
266
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/return-in-computed-property.md
267
- // 计算属性必须要有返回值
268
- 'vue/return-in-computed-property': 'error',
269
-
270
200
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/singleline-html-element-content-newline.md
271
201
  // 单行 html 元素后面必须换行。不限制
272
202
  'vue/singleline-html-element-content-newline': 'off',
@@ -298,65 +228,4 @@ module.exports = {
298
228
  // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/v-on-style.md
299
229
  // v-on 指令的写法。限制简写
300
230
  'vue/v-on-style': ['error', 'shorthand'],
301
-
302
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-template-root.md
303
- // 根节点必须合法
304
- 'vue/valid-template-root': 'error',
305
-
306
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-bind.md
307
- // v-bind 指令必须合法
308
- 'vue/valid-v-bind': 'error',
309
-
310
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-cloak.md
311
- // v-cloak 指令必须合法
312
- 'vue/valid-v-cloak': 'error',
313
-
314
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-else-if.md
315
- // v-else-if 指令必须合法
316
- 'vue/valid-v-else-if': 'error',
317
-
318
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-else.md
319
- // v-else 指令必须合法
320
- 'vue/valid-v-else': 'error',
321
-
322
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-for.md
323
- // valid-v-for 指令必须合法
324
- 'vue/valid-v-for': 'error',
325
-
326
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-html.md
327
- // v-html 指令必须合法
328
- 'vue/valid-v-html': 'error',
329
-
330
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-if.md
331
- // v-if 指令必须合法
332
- 'vue/valid-v-if': 'error',
333
-
334
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-model.md
335
- // v-model 指令必须合法
336
- 'vue/valid-v-model': 'error',
337
-
338
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-on.md
339
- // v-on 指令必须合法
340
- 'vue/valid-v-on': 'error',
341
-
342
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-once.md
343
- // v-once 指令必须合法
344
- 'vue/valid-v-once': 'error',
345
-
346
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-pre.md
347
- // v-pre 指令必须合法
348
- 'vue/valid-v-pre': 'error',
349
-
350
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-show.md
351
- // v-show 指令必须合法
352
- 'vue/valid-v-show': 'error',
353
-
354
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/valid-v-text.md
355
- // v-text 指令必须合法
356
- 'vue/valid-v-text': 'error',
357
- // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/component-tags-order.md
358
- 'vue/component-tags-order': ['error', {
359
- order: ['template', 'script', 'style'],
360
- }],
361
231
  };
362
-
package/tencent/vue.js ADDED
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const parserVue = require('vue-eslint-parser');
27
+ const parserTypeScript = require('@typescript-eslint/parser');
28
+ const pluginVue = require('eslint-plugin-vue');
29
+ const vueRules = require('./vue.rule');
30
+
31
+ module.exports = [
32
+ {
33
+ files: ['**/*.vue'],
34
+ languageOptions: {
35
+ parser: parserVue,
36
+ parserOptions: {
37
+ ecmaFeatures: {
38
+ jsx: true,
39
+ },
40
+ extraFileExtensions: ['.vue'],
41
+ parser: parserTypeScript,
42
+ sourceType: 'module',
43
+ },
44
+ },
45
+ plugins: {
46
+ vue: pluginVue,
47
+ },
48
+ extends: [pluginVue.configs['flat/vue2-recommended']],
49
+ rules: {
50
+ ...vueRules,
51
+ },
52
+ },
53
+ ];
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const commonVueRules = require('./vue.common.rule');
27
+
28
+ module.exports = {
29
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/v-on-event-hyphenation.md
30
+ 'vue/v-on-event-hyphenation': [
31
+ 'warn',
32
+ 'always',
33
+ {
34
+ autofix: true,
35
+ },
36
+ ],
37
+
38
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/component-tags-order.md
39
+ 'vue/block-order': [
40
+ 'error',
41
+ {
42
+ order: ['template', 'script', 'style'],
43
+ },
44
+ ],
45
+
46
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/order-in-components.md
47
+ 'vue/order-in-components': [
48
+ 'error',
49
+ {
50
+ order: [
51
+ 'el',
52
+ 'name',
53
+ 'parent',
54
+ 'functional',
55
+ ['delimiters', 'comments'],
56
+ ['components', 'directives', 'filters'],
57
+ 'extends',
58
+ 'mixins',
59
+ 'inheritAttrs',
60
+ 'model',
61
+ ['props', 'propsData'],
62
+ 'data',
63
+ 'computed',
64
+ 'watch',
65
+ 'LIFECYCLE_HOOKS',
66
+ 'methods',
67
+ ['template', 'render'],
68
+ 'renderError',
69
+ ],
70
+ },
71
+ ],
72
+
73
+ // 引入公共规则
74
+ ...commonVueRules,
75
+ };
@@ -0,0 +1,53 @@
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const parserVue = require('vue-eslint-parser');
27
+ const parserTypeScript = require('@typescript-eslint/parser');
28
+ const pluginVue = require('eslint-plugin-vue');
29
+ const vue3Rules = require('./vue3.rule');
30
+
31
+ module.exports = [
32
+ {
33
+ files: ['**/*.vue'],
34
+ languageOptions: {
35
+ parser: parserVue,
36
+ parserOptions: {
37
+ ecmaFeatures: {
38
+ jsx: true,
39
+ },
40
+ extraFileExtensions: ['.vue'],
41
+ parser: parserTypeScript,
42
+ sourceType: 'module',
43
+ },
44
+ },
45
+ plugins: {
46
+ vue: pluginVue,
47
+ },
48
+ extends: [pluginVue.configs['flat/recommended']],
49
+ rules: {
50
+ ...vue3Rules,
51
+ },
52
+ },
53
+ ];
@@ -0,0 +1,96 @@
1
+ /*
2
+ * Tencent is pleased to support the open source community by making
3
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) available.
4
+ *
5
+ * Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
6
+ *
7
+ * 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition) is licensed under the MIT License.
8
+ *
9
+ * License for 蓝鲸智云PaaS平台社区版 (BlueKing PaaS Community Edition):
10
+ *
11
+ * ---------------------------------------------------
12
+ * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
13
+ * documentation files (the "Software"), to deal in the Software without restriction, including without limitation
14
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
15
+ * to permit persons to whom the Software is furnished to do so, subject to the following conditions:
16
+ *
17
+ * The above copyright notice and this permission notice shall be included in all copies or substantial portions of
18
+ * the Software.
19
+ *
20
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
21
+ * THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
23
+ * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24
+ * IN THE SOFTWARE.
25
+ */
26
+ const commonVueRules = require('./vue.common.rule');
27
+
28
+ module.exports = {
29
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/define-macros-order.md
30
+ 'vue/define-macros-order': [
31
+ 'error',
32
+ {
33
+ order: [
34
+ 'defineOptions',
35
+ 'defineModel',
36
+ 'defineProps',
37
+ 'defineEmits',
38
+ 'defineSlots',
39
+ ],
40
+ defineExposeLast: true,
41
+ },
42
+ ],
43
+
44
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/component-tags-order.md
45
+ 'vue/block-order': [
46
+ 'error',
47
+ {
48
+ order: [['script', 'template'], 'style'],
49
+ },
50
+ ],
51
+
52
+ // https://github.com/vuejs/eslint-plugin-vue/blob/master/docs/rules/order-in-components.md
53
+ 'vue/order-in-components': [
54
+ 'error',
55
+ {
56
+ order: [
57
+ 'el',
58
+ 'name',
59
+ 'key',
60
+ 'parent',
61
+ 'functional',
62
+ ['delimiters', 'comments'],
63
+ ['components', 'directives', 'filters'],
64
+ 'extends',
65
+ 'mixins',
66
+ ['provide', 'inject'],
67
+ 'ROUTER_GUARDS',
68
+ 'layout',
69
+ 'middleware',
70
+ 'validate',
71
+ 'scrollToTop',
72
+ 'transition',
73
+ 'loading',
74
+ 'inheritAttrs',
75
+ 'model',
76
+ ['props', 'propsData'],
77
+ 'emits',
78
+ 'setup',
79
+ 'asyncData',
80
+ 'data',
81
+ 'fetch',
82
+ 'head',
83
+ 'computed',
84
+ 'watch',
85
+ 'watchQuery',
86
+ 'LIFECYCLE_HOOKS',
87
+ 'methods',
88
+ ['template', 'render'],
89
+ 'renderError',
90
+ ],
91
+ },
92
+ ],
93
+
94
+ // 引入公共规则
95
+ ...commonVueRules,
96
+ };