@houheaven/eslint-config-helper 1.0.0 → 1.2.0

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 (52) hide show
  1. package/README.md +112 -53
  2. package/format.js +40 -0
  3. package/html.js +32 -0
  4. package/index.js +18 -0
  5. package/lib/configs/eslint-es5.js +24 -0
  6. package/lib/configs/eslint.js +23 -0
  7. package/lib/configs/format-html.js +22 -0
  8. package/lib/configs/format-js.js +134 -0
  9. package/{eslint/prettier.js → lib/configs/format-prettier.js} +109 -45
  10. package/lib/configs/format-vue.js +278 -0
  11. package/lib/configs/html.js +20 -0
  12. package/lib/configs/import-bugfix.js +36 -0
  13. package/lib/configs/import.js +44 -0
  14. package/lib/configs/vue2.js +28 -0
  15. package/lib/configs/vue3.js +28 -0
  16. package/{eslint/rules → lib/rules/eslint}/best-practices.js +19 -19
  17. package/{eslint/rules → lib/rules/eslint}/es6.js +8 -9
  18. package/{eslint/rules → lib/rules/eslint}/node.js +0 -0
  19. package/{eslint/rules → lib/rules/eslint}/possible-errors.js +16 -11
  20. package/{eslint/rules → lib/rules/eslint}/strict-mode.js +0 -0
  21. package/{eslint/rules → lib/rules/eslint}/stylistic-issues.js +60 -59
  22. package/{eslint/rules → lib/rules/eslint}/variables.js +13 -11
  23. package/lib/rules/html/accessibility.js +44 -0
  24. package/lib/rules/html/best-practice.js +64 -0
  25. package/lib/rules/html/seo.js +24 -0
  26. package/lib/rules/html/style.js +32 -0
  27. package/lib/rules/import/helpful-warnings.js +68 -0
  28. package/lib/rules/import/module-systems.js +34 -0
  29. package/lib/rules/import/static-analysis.js +69 -0
  30. package/lib/rules/import/style-guide.js +97 -0
  31. package/lib/rules/vue/common-base.js +29 -0
  32. package/lib/rules/vue/common-eslint.js +220 -0
  33. package/lib/rules/vue/common-essential.js +267 -0
  34. package/lib/rules/vue/common-extra.js +282 -0
  35. package/lib/rules/vue/common-recommended.js +96 -0
  36. package/lib/rules/vue/common-strongly-recommended.js +138 -0
  37. package/lib/rules/vue/vue2-essential.js +41 -0
  38. package/lib/rules/vue/vue2-recommended.js +17 -0
  39. package/lib/rules/vue/vue2-strongly-recommended.js +16 -0
  40. package/lib/rules/vue/vue3-essential.js +129 -0
  41. package/lib/rules/vue/vue3-recommended.js +17 -0
  42. package/lib/rules/vue/vue3-strongly-recommended.js +24 -0
  43. package/lib/rules/vuejs-accessibility/index.js +92 -0
  44. package/package.json +37 -28
  45. package/vue2.js +30 -0
  46. package/vue3.js +28 -0
  47. package/eslint/eslint-fix.js +0 -29
  48. package/eslint/file-bof-eof.js +0 -22
  49. package/eslint/index.js +0 -18
  50. package/eslint/legacy.js +0 -34
  51. package/eslint/rules/imports.js +0 -279
  52. package/eslint/rules/vue.js +0 -23
@@ -1,21 +1,34 @@
1
1
 
2
- "use strict";
3
-
4
- const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
2
+ // ==========================================================
3
+ // 此文件是 Prettier 与 Eslint 共用时,会产生冲突的规则列表
4
+ // 此处仅仅是做一个记录,目前暂无应用
5
+ // ==========================================================
5
6
 
6
7
  module.exports = {
8
+ env: {
9
+ browser: true,
10
+ commonjs: true,
11
+ node: true,
12
+ es2021: true,
13
+ },
14
+ parserOptions: {
15
+ ecmaVersion: 2021,
16
+ sourceType: "module",
17
+ },
7
18
  rules: {
8
19
  // 在某些情况下,可以使用以下规则,阅读 README 获取更多信息
9
20
  // 它们用“0”而不是“off”标记,以便脚本可以区分它们
10
21
 
11
22
  // 强制所有控制语句使用一致的括号风格
12
23
  "curly": 0,
24
+
13
25
  // 要求在注释周围有空行
14
26
  "lines-around-comment": 0,
27
+
15
28
  // 强制一行的最大长度
16
29
  "max-len": ["warn", {
17
30
  "code": 200,
18
- "tabWidth": 4,
31
+ "tabWidth": 2,
19
32
  "comments": 200,
20
33
  "ignoreComments": false,
21
34
  "ignoreTrailingComments": true,
@@ -24,67 +37,78 @@ module.exports = {
24
37
  "ignoreTemplateLiterals": true,
25
38
  "ignoreRegExpLiterals": true,
26
39
  }],
40
+
27
41
  // 禁止在可能与比较操作符相混淆的地方使用箭头函数
28
42
  "no-confusing-arrow": ["error", {
29
43
  "allowParens": true,
30
44
  }],
45
+
31
46
  // 禁止混合使用不同的操作符
32
47
  "no-mixed-operators": [
33
- "error",
48
+ "off",
34
49
  {
35
50
  "groups": [
36
51
  ["+", "-", "*", "/", "%", "**"],
37
52
  ["&", "|", "^", "~", "<<", ">>", ">>>"],
38
53
  ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
39
54
  ["&&", "||"],
40
- ["in", "instanceof"]
55
+ ["in", "instanceof"],
41
56
  ],
42
57
  "allowSamePrecedence": true,
43
- }
58
+ },
44
59
  ],
60
+
45
61
  // 禁用 tab
46
- "no-tabs": "error",
62
+ "no-tabs": "warn",
63
+
47
64
  // 禁止出现令人困惑的多行表达式
48
65
  "no-unexpected-multiline": "error",
66
+
49
67
  // 强制使用一致的反勾号、双引号或单引号
50
68
  "quotes": ["warn", "double", { "avoidEscape": true }],
51
- "@typescript-eslint/quotes": 0,
52
- "babel/quotes": 0,
53
- "vue/html-self-closing": 0,
54
- "vue/max-len": 0,
69
+
55
70
 
56
71
  // 以下的规则在使用Prettier时不需要启用
57
72
 
58
73
  // 在数组开括号后和闭括号前强制换行
59
74
  "array-bracket-newline": ["warn", "consistent"],
75
+
60
76
  // 强制数组方括号中使用一致的空格
61
77
  "array-bracket-spacing": ["error", "never"],
78
+
62
79
  // 强制数组元素间出现换行
63
80
  "array-element-newline": ["warn", "consistent"],
81
+
64
82
  // 要求箭头函数的参数使用圆括号
65
83
  "arrow-parens": ["warn", "as-needed"],
84
+
66
85
  // 要求箭头函数的箭头之前或之后有空格
67
86
  "arrow-spacing": ["warn", {
68
87
  "before": true,
69
88
  "after": true,
70
89
  }],
90
+
71
91
  // 禁止或强制在代码块中开括号前和闭括号后有空格
72
92
  "block-spacing": ["warn", "always"],
93
+
73
94
  // 强制在代码块中使用一致的大括号风格
74
95
  "brace-style": ["warn", "stroustrup", { "allowSingleLine": true }],
75
- // 要求或禁止使用拖尾逗号(对象、数组、函数参数的最后一项后面是否允许有逗号)
96
+
97
+ // 要求或禁止使用拖尾逗号(对象、数组、导入、导出、函数参数的最后一项后面是否允许有逗号)
76
98
  "comma-dangle": ["warn", {
77
- arrays: "never",
99
+ arrays: "always-multiline",
78
100
  objects: "always-multiline",
79
- imports: "never",
80
- exports: "never",
101
+ imports: "always-multiline",
102
+ exports: "always-multiline",
81
103
  functions: "never",
82
104
  }],
105
+
83
106
  // 强制在逗号前后使用一致的空格
84
107
  "comma-spacing": ["warn", {
85
108
  "before": false,
86
109
  "after": true,
87
110
  }],
111
+
88
112
  // 强制使用一致的逗号风格
89
113
  "comma-style": ["warn", "last", {
90
114
  exceptions: {
@@ -101,27 +125,37 @@ module.exports = {
101
125
  NewExpression: false,
102
126
  },
103
127
  }],
128
+
104
129
  // 强制在计算的属性的方括号中使用一致的空格
105
130
  "computed-property-spacing": ["warn", "never"],
131
+
106
132
  // 强制在点号之前和之后一致的换行
107
133
  "dot-location": ["warn", "property"],
134
+
108
135
  // 要求或禁止文件末尾存在空行
109
136
  "eol-last": ["warn", "always"],
137
+
110
138
  // 要求或禁止在函数标识符和其调用之间有空格
111
139
  "func-call-spacing": ["warn", "never"],
140
+
112
141
  // 函数调用参数换行符
113
142
  "function-call-argument-newline": ["warn", "consistent"],
143
+
114
144
  // 强制在函数括号内使用一致的换行
115
145
  "function-paren-newline": ["warn", "consistent"],
146
+
116
147
  // generator 函数中 * 号
117
148
  // "generator-star": "error",
149
+
118
150
  // 强制 generator 函数中 * 号周围使用一致的空格
119
151
  "generator-star-spacing": ["warn", {
120
152
  before: false,
121
153
  after: true,
122
154
  }],
155
+
123
156
  // 强制隐式返回的箭头函数体的位置
124
157
  "implicit-arrow-linebreak": ["warn", "beside"],
158
+
125
159
  // 强制使用一致的缩进
126
160
  "indent": ["error", 2, {
127
161
  SwitchCase: 1,
@@ -160,23 +194,26 @@ module.exports = {
160
194
  "JSXClosingFragment",
161
195
  "JSXText",
162
196
  "JSXEmptyExpression",
163
- "JSXSpreadChild"
197
+ "JSXSpreadChild",
164
198
  ],
165
199
  ignoreComments: false,
166
200
  }],
201
+
167
202
  // 强制在 JSX 属性中一致地使用双引号或单引号
168
203
  "jsx-quotes": ["warn", "prefer-double"],
204
+
169
205
  // 强制在对象字面量的键和值之间使用一致的空格
170
206
  "key-spacing": ["warn", {
171
207
  beforeColon: false,
172
208
  afterColon: true,
173
209
  }],
210
+
174
211
  // 强制关键字周围空格的一致性
175
212
  "keyword-spacing": ["warn", {
176
213
  "before": true,
177
214
  "after": true,
178
215
  "overrides": {
179
- "if": { "after": false },
216
+ "if": { "after": true },
180
217
  "for": { "after": false },
181
218
  "while": { "after": false },
182
219
  "switch": { "after": false },
@@ -186,17 +223,22 @@ module.exports = {
186
223
  "throw": { "after": true },
187
224
  },
188
225
  }],
226
+
189
227
  // 强制使用一致的换行符风格
190
228
  // Windows - "CRLF"
191
229
  // Unix、Linux - "LF"
192
230
  "linebreak-style": ["warn", "unix"],
231
+
193
232
  // 要求或禁止在三元操作数中间换行
194
233
  // TODO: enable?
195
234
  "multiline-ternary": ["off", "never"],
235
+
196
236
  // 要求方法链中每个调用都有一个换行符
197
237
  "newline-per-chained-call": ["warn", { ignoreChainWithDepth: 4 }],
238
+
198
239
  // 强制或禁止调用无参构造函数时有圆括号
199
240
  "new-parens": ["error", "always"],
241
+
200
242
  // 禁止冗余的括号
201
243
  "no-extra-parens": ["off", "all", {
202
244
  "conditionalAssign": true,
@@ -205,95 +247,125 @@ module.exports = {
205
247
  "ignoreJSX": "all", // delegate to eslint-plugin-react
206
248
  "enforceForArrowConditionals": false,
207
249
  }],
250
+
208
251
  // 禁止不必要的分号
209
252
  "no-extra-semi": "warn",
253
+
210
254
  // 禁止数字字面量中使用前导和末尾小数点
211
255
  "no-floating-decimal": "error",
256
+
212
257
  // 禁止空格和 tab 的混合缩进
213
258
  "no-mixed-spaces-and-tabs": "warn",
259
+
214
260
  // 禁止使用多个空格
215
261
  "no-multi-spaces": ["warn", { "ignoreEOLComments": true }],
262
+
216
263
  // 禁止出现多行空行
217
264
  "no-multiple-empty-lines": ["warn", {
218
265
  "max": 2,
219
266
  "maxBOF": 1,
220
267
  "maxEOF": 1,
221
268
  }],
269
+
222
270
  // 禁用行尾空格
223
271
  "no-trailing-spaces": ["warn", {
224
272
  "skipBlankLines": true,
225
273
  "ignoreComments": false,
226
274
  }],
275
+
227
276
  // 禁止属性前有空白
228
277
  "no-whitespace-before-property": "error",
278
+
229
279
  // 强制单个语句的位置
230
280
  "nonblock-statement-body-position": "off",
231
- "object-curly-newline": "off",
281
+
232
282
  // 强制大括号内换行符的一致性
233
- "object-curly-newline": ["error", {
234
- "ObjectExpression": { minProperties: 4, multiline: true, consistent: true },
235
- "ObjectPattern": { minProperties: 4, multiline: true, consistent: true },
236
- "ImportDeclaration": { minProperties: 4, multiline: true, consistent: true },
237
- "ExportDeclaration": { minProperties: 4, multiline: true, consistent: true },
283
+ "object-curly-newline": ["warn", {
284
+ ObjectExpression: { minProperties: 40, multiline: true, consistent: true },
285
+ ObjectPattern: "never",
286
+ ImportDeclaration: "never",
287
+ ExportDeclaration: "always",
238
288
  }],
289
+
239
290
  // 强制在花括号中使用一致的空格
240
291
  "object-curly-spacing": ["warn", "always", {
241
- "arraysInObjects": false,
242
- "objectsInObjects": true,
292
+ arraysInObjects: true,
293
+ objectsInObjects: true,
243
294
  }],
295
+
244
296
  // 强制将对象的属性放在不同的行上
245
297
  "object-property-newline": ["off", {
246
- "allowAllPropertiesOnSameLine": true,
298
+ allowAllPropertiesOnSameLine: true,
247
299
  }],
300
+
248
301
  // 要求或禁止在变量声明周围换行
249
302
  "one-var-declaration-per-line": "off",
303
+
250
304
  // 强制操作符使用一致的换行符
251
305
  "operator-linebreak": ["off", "before", { overrides: { "=": "none" } }],
306
+
252
307
  // 要求或禁止块内填充
253
308
  "padded-blocks": "off",
309
+
254
310
  // 要求对象字面量属性名称用引号括起来
255
311
  "quote-props": ["warn", "consistent"],
312
+
256
313
  // 强制剩余和扩展运算符及其表达式之间有空格
257
314
  "rest-spread-spacing": ["error", "never"],
315
+
258
316
  // 要求或禁止使用分号代替 ASI
259
317
  "semi": ["error", "always"],
318
+
260
319
  // 强制分号之前和之后使用一致的空格
261
320
  "semi-spacing": ["error", { before: false, after: true }],
321
+
262
322
  // 强制分号的位置
263
323
  "semi-style": ["error", "last"],
324
+
264
325
  // 要求或禁止语句块之前的空格(代码块大括号前面是否需要空格)
265
326
  "space-before-blocks": ["warn", {
266
327
  "functions": "always",
267
328
  "keywords": "always",
268
329
  "classes": "always",
269
330
  }],
331
+
270
332
  // 强制在 function 的左括号之前使用一致的空格
271
- "space-before-function-paren": ["error", {
272
- "anonymous": "always",
333
+ "space-before-function-paren": ["warn", {
334
+ "anonymous": "never",
273
335
  "named": "never",
274
336
  "asyncArrow": "always",
275
337
  }],
338
+
276
339
  // 强制在圆括号内使用一致的空格
277
- "space-in-parens": ["error", "never"],
340
+ "space-in-parens": ["warn", "never"],
341
+
278
342
  // 要求中缀操作符周围有空格(+-*/?| etc.)
279
- "space-infix-ops": "error",
343
+ "space-infix-ops": "warn",
344
+
280
345
  // 强制在一元操作符前后使用一致的空格
281
- "space-unary-ops": ["error", {
346
+ "space-unary-ops": ["warn", {
282
347
  "words": true,
283
348
  "nonwords": false,
284
349
  }],
350
+
285
351
  // 强制在 switch 的冒号左右有空格
286
352
  "switch-colon-spacing": ["error", { after: true, before: false }],
353
+
287
354
  // 要求或禁止模板字符串中的嵌入表达式周围空格的使用
288
- "template-curly-spacing": "error",
355
+ "template-curly-spacing": "warn",
356
+
289
357
  // 要求或禁止在模板标记和它们的字面量之间有空格
290
358
  "template-tag-spacing": ["error", "never"],
359
+
291
360
  // 要求或禁止 Unicode 字节顺序标记 (BOM)
292
361
  "unicode-bom": ["off", "never"],
362
+
293
363
  // 要求 IIFE 使用括号括起来
294
364
  "wrap-iife": ["error", "outside", { functionPrototypeMethods: true }],
365
+
295
366
  // 要求正则表达式被括号括起来
296
367
  "wrap-regex": "off",
368
+
297
369
  // 强制在 yield* 表达式中 * 周围使用空格
298
370
  "yield-star-spacing": ["error", "both"],
299
371
 
@@ -312,6 +384,8 @@ module.exports = {
312
384
  "space-unary-word-ops": "off",
313
385
 
314
386
 
387
+ "@typescript-eslint/quotes": 0,
388
+ "babel/quotes": 0,
315
389
  "@babel/object-curly-spacing": "off",
316
390
  "@babel/semi": "off",
317
391
  "@typescript-eslint/brace-style": "off",
@@ -398,17 +472,7 @@ module.exports = {
398
472
  "vue/space-infix-ops": "off",
399
473
  "vue/space-unary-ops": "off",
400
474
  "vue/template-curly-spacing": "off",
401
-
402
- ...(includeDeprecated && {
403
- // Deprecated since version 4.0.0.
404
- // https://github.com/eslint/eslint/pull/8286
405
- "indent-legacy": "off",
406
- // Deprecated since version 3.3.0.
407
- // https://eslint.org/docs/rules/no-spaced-func
408
- "no-spaced-func": "off",
409
- // Deprecated since version 7.0.0.
410
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
411
- "react/jsx-space-before-closing": "off",
412
- }),
475
+ "vue/html-self-closing": 0,
476
+ "vue/max-len": 0,
413
477
  },
414
478
  };
@@ -0,0 +1,278 @@
1
+
2
+ // ==========================================================
3
+ // Vue 文件代码格式化
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ extends: [
8
+ "../rules/vue/common-base",
9
+ ],
10
+ rules: {
11
+ // template、script、style 多行显示
12
+ "vue/block-tag-newline": ["warn", {
13
+ "singleline": "always",
14
+ "multiline": "always",
15
+ "maxEmptyLines": 0,
16
+ }],
17
+
18
+ // 在 <template> 中,强制统一缩进
19
+ "vue/html-indent": ["warn", 2, {
20
+ "attribute": 1,
21
+ "baseIndent": 1,
22
+ "closeBracket": 0,
23
+ "alignAttributesVertically": true,
24
+ "ignores": [],
25
+ }],
26
+
27
+ // 在 <script> 中,强制统一缩进
28
+ "vue/script-indent": ["warn", 2, {
29
+ "baseIndent": 1,
30
+ "switchCase": 1,
31
+ "ignores": [],
32
+ }],
33
+
34
+ // 在 html 属性中,强制统一引号
35
+ "vue/html-quotes": ["warn", "double", { "avoidEscape": true }],
36
+
37
+ // 强制标签自闭合
38
+ "vue/html-self-closing": ["warn", {
39
+ "html": {
40
+ "void": "always",
41
+ "normal": "never",
42
+ "component": "always",
43
+ },
44
+ "svg": "always",
45
+ "math": "always",
46
+ }],
47
+
48
+ // 规定标签的右尖括号(>)是否有空格
49
+ "vue/html-closing-bracket-spacing": ["warn", {
50
+ "startTag": "never",
51
+ "endTag": "never",
52
+ "selfClosingTag": "always",
53
+ }],
54
+
55
+ // 要求箭头函数的箭头之前或之后有空格
56
+ "vue/arrow-spacing": ["warn", {
57
+ before: true,
58
+ after: true,
59
+ }],
60
+
61
+ // 标签内不能出现多个空格
62
+ "vue/no-multi-spaces": ["warn", {
63
+ "ignoreProperties": false,
64
+ }],
65
+
66
+ // 要求或禁止使用拖尾逗号(对象、数组、导入、导出、函数参数的最后一项后面是否允许有逗号)
67
+ "vue/comma-dangle": ["warn", {
68
+ arrays: "always-multiline",
69
+ objects: "always-multiline",
70
+ imports: "always-multiline",
71
+ exports: "always-multiline",
72
+ functions: "never",
73
+ }],
74
+
75
+ // 强制在逗号前后使用一致的空格
76
+ "vue/comma-spacing": ["warn", {
77
+ "before": false,
78
+ "after": true,
79
+ }],
80
+
81
+ // 强制在对象字面量的键和值之间使用一致的空格
82
+ "vue/key-spacing": ["warn", {
83
+ beforeColon: false,
84
+ afterColon: true,
85
+ }],
86
+
87
+ // 在 html 注释中,强制统一缩进
88
+ "vue/html-comment-indent": ["warn", 2],
89
+
90
+ // 在 mustache 胡须插值中强制统一间距
91
+ "vue/mustache-interpolation-spacing": ["warn", "always"],
92
+
93
+ // 要求使用 === 和 !==
94
+ // "vue/eqeqeq": ["error", "always", { null: "ignore" }],
95
+
96
+ // 要求使用模板文字进行字符串连接
97
+ "vue/prefer-template": "warn",
98
+
99
+ // 强制关键字周围空格的一致性
100
+ "vue/keyword-spacing": ["warn", {
101
+ "before": true,
102
+ "after": true,
103
+ "overrides": {
104
+ "if": { "after": true },
105
+ "for": { "after": false },
106
+ "while": { "after": false },
107
+ "switch": { "after": false },
108
+ "case": { "after": true },
109
+ "catch": { "after": false },
110
+ "return": { "after": true },
111
+ "throw": { "after": true },
112
+ },
113
+ }],
114
+
115
+ // 强制在花括号中使用一致的空格
116
+ "vue/object-curly-spacing": ["warn", "always", {
117
+ arraysInObjects: true,
118
+ objectsInObjects: true,
119
+ }],
120
+
121
+ // 强制大括号内换行符的一致性
122
+ "vue/object-curly-newline": ["warn", {
123
+ ObjectExpression: "never",
124
+ ObjectPattern: "never",
125
+ ImportDeclaration: "never",
126
+ ExportDeclaration: "never",
127
+ }],
128
+
129
+ // 强制数组方括号中使用一致的空格
130
+ "vue/array-bracket-spacing": ["warn", "never"],
131
+
132
+ // 为模板中的组件命名样式强制执行特定的大小写
133
+ "vue/component-name-in-template-casing": ["warn", "kebab-case", {
134
+ "registeredComponentsOnly": false,
135
+ // "ignores": ["/^hh-/"],
136
+ }],
137
+
138
+ // =================================================================================
139
+
140
+ // // 在数组开括号后和闭括号前强制换行
141
+ // "vue/array-bracket-newline": ["warn", "consistent"],
142
+
143
+ // // 禁止或强制在代码块中开括号前和闭括号后有空格
144
+ // "vue/block-spacing": ["warn", "always"],
145
+
146
+ // 强制在代码块中使用一致的大括号风格
147
+ "vue/brace-style": ["warn", "stroustrup", { "allowSingleLine": true }],
148
+
149
+ // // 强制在点号之前和之后一致的换行
150
+ // "vue/dot-location": ["warn", "property"],
151
+
152
+ // // 强制第一个属性的显示位置
153
+ // "vue/first-attribute-linebreak": ["warn", {
154
+ // "singleline": "ignore",
155
+ // "multiline": "below",
156
+ // }],
157
+
158
+ // // 强制每行属性的数量
159
+ // "vue/max-attributes-per-line": ["warn", {
160
+ // "singleline": { "max": 4 },
161
+ // "multiline": { "max": 1 },
162
+ // }],
163
+
164
+ // 属性名称使用连字符("-")进行连接
165
+ "vue/attribute-hyphenation": "warn",
166
+
167
+ // 强制自定义事件名称的大小写
168
+ "vue/custom-event-name-casing": ["warn", "kebab-case", {
169
+ // "ignores": [],
170
+ }],
171
+
172
+ // // button 按钮的 type 属性是否可以省略
173
+ // "vue/html-button-has-type": ["off", {
174
+ // "button": true,
175
+ // "submit": true,
176
+ // "reset": true,
177
+ // }],
178
+
179
+ // // 规定标签的右尖括号(>)是否要换行
180
+ // "vue/html-closing-bracket-newline": ["warn", {
181
+ // "singleline": "never",
182
+ // "multiline": "always",
183
+ // }],
184
+
185
+ // // 在 html 注释中,强制统一换行
186
+ // "vue/html-comment-content-newline": [
187
+ // "warn",
188
+ // {
189
+ // "singleline": "never",
190
+ // "multiline": "always",
191
+ // },
192
+ // {
193
+ // "exceptions": [],
194
+ // },
195
+ // ],
196
+
197
+ // 在 html 注释中,强制统一间距
198
+ "vue/html-comment-content-spacing": ["warn", "always", {
199
+ "exceptions": [],
200
+ }],
201
+
202
+ // // 禁止不必要的胡须插值(mustaches)
203
+ // "vue/no-useless-mustaches": ["warn", {
204
+ // "ignoreIncludesComment": false,
205
+ // "ignoreStringEscape": false,
206
+ // }],
207
+
208
+ // // 禁止不必要的 v-bind 指令
209
+ // "vue/no-useless-v-bind": ["warn", {
210
+ // "ignoreIncludesComment": false,
211
+ // "ignoreStringEscape": false,
212
+ // }],
213
+
214
+ // // 要求或禁止块之间的填充线
215
+ // "vue/padding-line-between-blocks": ["warn", "always"],
216
+
217
+ // // 要求 <template> 中的静态类名位于单独的 class 属性中
218
+ // "vue/prefer-separate-static-class": "warn",
219
+
220
+ // // 强制 v-for 指令的分隔符样式(使用 v-for="i in list",而不是 v-for="i of list")
221
+ // "vue/v-for-delimiter-style": ["warn", "in"],
222
+
223
+ // 在 v-on 指令绑定的回调事件中,如果没有参数,需要省略回调事件的括号
224
+ "vue/v-on-function-call": ["warn", "never"],
225
+
226
+ // // 在单行元素的内容之前和之后需要换行符
227
+ // "vue/singleline-html-element-content-newline": ["off", {
228
+ // "ignoreWhenEmpty": true,
229
+ // "ignoreWhenNoAttributes": true,
230
+ // // "ignores": ["pre", "textarea", ...INLINE_ELEMENTS]
231
+ // }],
232
+
233
+ // 在多行元素的内容之前和之后需要换行符
234
+ "vue/multiline-html-element-content-newline": ["warn", {
235
+ "ignoreWhenEmpty": true,
236
+ "allowEmptyLines": false,
237
+ // "ignores": ["pre", "textarea", ...INLINE_ELEMENTS],
238
+ }],
239
+
240
+ // 属性中的等号周围不允许有空格
241
+ "vue/no-spaces-around-equal-signs-in-attribute": "warn",
242
+
243
+ // 强制在圆括号内使用一致的空格
244
+ "vue/space-in-parens": ["warn", "never"],
245
+
246
+ // 要求中缀操作符周围有空格(+-*/?| etc.)
247
+ "vue/space-infix-ops": "warn",
248
+
249
+ // // 强制在一元操作符前后使用一致的空格
250
+ // "vue/space-unary-ops": ["warn", {
251
+ // words: true,
252
+ // nonwords: false,
253
+ // }],
254
+
255
+ // 要求或禁止模板字符串中的嵌入表达式周围空格的使用
256
+ "vue/template-curly-spacing": "warn",
257
+
258
+ // // 强制操作符使用一致的换行符
259
+ // "vue/operator-linebreak": ["off", "before", { overrides: { "=": "none" } }],
260
+
261
+ // // 要求或禁止在函数标识符和其调用之间有空格
262
+ // "vue/func-call-spacing": ["warn", "never"],
263
+
264
+ // // 禁止冗余的括号
265
+ // "vue/no-extra-parens": ["off", "all", {
266
+ // conditionalAssign: true,
267
+ // nestedBinaryExpressions: false,
268
+ // returnAssign: false,
269
+ // ignoreJSX: "all", // delegate to eslint-plugin-react
270
+ // enforceForArrowConditionals: false,
271
+ // }],
272
+
273
+ // // 强制 defineEmits、defineProps 编译器宏的顺序
274
+ // "vue/define-macros-order": ["warn", {
275
+ // "order": ["defineProps", "defineEmits"],
276
+ // }],
277
+ },
278
+ };
@@ -0,0 +1,20 @@
1
+
2
+ // ==========================================================
3
+ // @html-eslint
4
+ // ----------------------------------------------------------
5
+ // - seo.js
6
+ // - style.js
7
+ // - accessibility.js
8
+ // - best-practice.js
9
+ // ==========================================================
10
+
11
+ module.exports = {
12
+ parser: "@html-eslint/parser",
13
+ plugins: ["@html-eslint"],
14
+ extends: [
15
+ "../rules/html/seo.js",
16
+ "../rules/html/style.js",
17
+ "../rules/html/accessibility.js",
18
+ "../rules/html/best-practice.js",
19
+ ],
20
+ };