@houheaven/eslint-config-helper 1.4.0 → 2.0.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 (91) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +149 -28
  3. package/lib/format-es5.js +23 -0
  4. package/lib/format-es6.js +25 -0
  5. package/lib/format-html.js +23 -0
  6. package/lib/format-import.js +23 -0
  7. package/lib/format-typescript.js +28 -0
  8. package/lib/format-vue2.js +23 -0
  9. package/lib/format-vue3.js +23 -0
  10. package/lib/html.js +13 -22
  11. package/lib/import.js +23 -0
  12. package/lib/javascript-es5.js +23 -0
  13. package/lib/javascript-es6.js +25 -0
  14. package/lib/rules/eslint/_deprecated.js +132 -0
  15. package/lib/rules/eslint/_removed.js +25 -0
  16. package/lib/rules/eslint/es6.js +279 -110
  17. package/lib/rules/eslint/layout-formatting.js +441 -0
  18. package/lib/rules/eslint/possible-errors.js +140 -131
  19. package/lib/rules/eslint/suggestions.js +666 -0
  20. package/lib/rules/html/accessibility.js +47 -23
  21. package/lib/rules/html/best-practice.js +122 -36
  22. package/lib/rules/html/seo.js +16 -11
  23. package/lib/rules/html/style.js +53 -15
  24. package/lib/rules/import/helpful-warnings.js +23 -18
  25. package/lib/rules/import/module-systems.js +16 -17
  26. package/lib/rules/import/static-analysis.js +54 -38
  27. package/lib/rules/import/style-guide.js +89 -61
  28. package/lib/rules/typescript/_deprecated.js +57 -0
  29. package/lib/rules/typescript/conflict.js +16 -0
  30. package/lib/rules/typescript/deprecated.js +41 -0
  31. package/lib/rules/typescript/extension.js +207 -0
  32. package/lib/rules/typescript/fixable.js +215 -0
  33. package/lib/rules/typescript/other.js +125 -0
  34. package/lib/rules/typescript/stylistic.js +34 -0
  35. package/lib/rules/typescript/suggestion.js +53 -0
  36. package/lib/rules/typescript/type-checked.js +263 -0
  37. package/lib/rules/vue/_deprecated.js +37 -0
  38. package/lib/rules/vue/common-base.js +1 -11
  39. package/lib/rules/vue/common-essential.js +25 -38
  40. package/lib/rules/vue/common-extension.js +321 -0
  41. package/lib/rules/vue/common-recommended.js +64 -31
  42. package/lib/rules/vue/common-strongly-recommended.js +37 -20
  43. package/lib/rules/vue/{common-extra.js → common-uncategorized.js} +141 -52
  44. package/lib/rules/vue/vue2-essential.js +16 -14
  45. package/lib/rules/vue/vue2-uncategorized.js +15 -0
  46. package/lib/rules/vue/vue3-essential.js +54 -24
  47. package/lib/rules/vue/vue3-strongly-recommended.js +8 -10
  48. package/lib/rules/vue/vue3-uncategorized.js +115 -0
  49. package/lib/support/es5-support.js +29 -0
  50. package/lib/support/es6-support.js +39 -0
  51. package/lib/support/html-support.js +38 -0
  52. package/lib/support/import-bugfix.js +65 -0
  53. package/lib/support/import-support.js +25 -0
  54. package/lib/support/typescript-support.js +27 -0
  55. package/lib/support/vue2-support.js +43 -0
  56. package/lib/support/vue3-support.js +43 -0
  57. package/lib/support/vue3-ts-support.js +51 -0
  58. package/lib/typescript.js +24 -32
  59. package/lib/utils/utils.js +160 -0
  60. package/lib/vue2.js +16 -22
  61. package/lib/vue3-ts.js +31 -0
  62. package/lib/vue3.js +13 -17
  63. package/package.json +38 -22
  64. package/lib/configs/eslint-es5.js +0 -24
  65. package/lib/configs/eslint.js +0 -23
  66. package/lib/configs/format-html.js +0 -22
  67. package/lib/configs/format-js.js +0 -134
  68. package/lib/configs/format-vue.js +0 -278
  69. package/lib/configs/html.js +0 -20
  70. package/lib/configs/import-bugfix.js +0 -36
  71. package/lib/configs/import.js +0 -44
  72. package/lib/configs/typescript.js +0 -10
  73. package/lib/configs/vue2.js +0 -28
  74. package/lib/configs/vue3.js +0 -28
  75. package/lib/eslint.js +0 -18
  76. package/lib/format.js +0 -40
  77. package/lib/rules/eslint/best-practices.js +0 -422
  78. package/lib/rules/eslint/node.js +0 -48
  79. package/lib/rules/eslint/strict-mode.js +0 -12
  80. package/lib/rules/eslint/stylistic-issues.js +0 -578
  81. package/lib/rules/eslint/variables.js +0 -73
  82. package/lib/rules/typescript/all.js +0 -193
  83. package/lib/rules/typescript/base.js +0 -10
  84. package/lib/rules/typescript/eslint-recommended.js +0 -36
  85. package/lib/rules/typescript/recommended-requiring-type-checking.js +0 -26
  86. package/lib/rules/typescript/recommended.js +0 -36
  87. package/lib/rules/typescript/strict.js +0 -47
  88. package/lib/rules/vue/common-eslint.js +0 -220
  89. package/lib/rules/vue/vue2-recommended.js +0 -17
  90. package/lib/rules/vue/vue2-strongly-recommended.js +0 -16
  91. package/lib/rules/vue/vue3-recommended.js +0 -17
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2022 立树
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2022 立树
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -6,12 +6,11 @@
6
6
 
7
7
 
8
8
  ## 特点
9
- - 内置了 `Eslint`,并对其规则进行了优化
10
- - 内置了 `eslint-plugin-import`,并对其规则进行了优化
11
- - 内置了 `eslint-plugin-vue`,并对其规则进行了优化
12
- - 内置了 `eslint-plugin-vuejs-accessibility`,并对其规则进行了优化
13
- - 内置了 `@html-eslint/eslint-plugin`,并对其规则进行了优化
14
- - 内置了 `@typescript-eslint/eslint-plugin`,并对其规则进行了优化
9
+ - 内置 `Eslint v8.x`,并对其规则进行了优化
10
+ - 内置 `eslint-plugin-import`,并对其规则进行了优化
11
+ - 内置 `eslint-plugin-vue`,并对其规则进行了优化
12
+ - 内置 `@html-eslint/eslint-plugin`,并对其规则进行了优化
13
+ - 内置 `@typescript-eslint/eslint-plugin`,并对其规则进行了优化
15
14
  - 支持 html、Javascript、Typescript、Vue2、Vue3
16
15
 
17
16
 
@@ -23,28 +22,131 @@ npm install --dev @houheaven/eslint-config-helper
23
22
 
24
23
  ## 用法
25
24
 
26
- 在 Eslint 配置文件中的 `"extends"` 数组里添加 `"@houheaven/eslint-config-helper"`
25
+ 我们提供了多种规则集,每个规则集只能处理单一场景,为了处理复杂场景,可以将多个规则集组合使用。
26
+
27
+ | 规则集名称 | 功能说明 | 适用场景 |
28
+ | ------ | ------ | ------ |
29
+ | @houheaven/eslint-config-helper | `语法校验` `代码格式化` | `js/es6` `mjs` `cjs` |
30
+ | @houheaven/eslint-config-helper/es6 | `语法校验` `代码格式化` | `js/es6` `mjs` `cjs` |
31
+ | @houheaven/eslint-config-helper/es5 | `语法校验` `代码格式化` | `js/es5` `mjs` `cjs` |
32
+ | @houheaven/eslint-config-helper/typescript | `语法校验` `代码格式化` | `ts` |
33
+ | @houheaven/eslint-config-helper/import | `语法校验` `代码格式化` | `js/es6` `ts` `vue2` `vue3` |
34
+ | @houheaven/eslint-config-helper/vue2 | `语法校验` `代码格式化` | `vue2` |
35
+ | @houheaven/eslint-config-helper/vue3 | `语法校验` `代码格式化` | `vue3` |
36
+ | @houheaven/eslint-config-helper/vue3-ts | `语法校验` `代码格式化` | `vue3` `ts` |
37
+ | @houheaven/eslint-config-helper/html | `语法校验` `代码格式化` | `html` |
38
+ | @houheaven/eslint-config-helper/format-es6 | `代码格式化` | `js/es6` `mjs` `cjs` |
39
+ | @houheaven/eslint-config-helper/format-es5 | `代码格式化` | `js/es5` `mjs` `cjs` |
40
+ | @houheaven/eslint-config-helper/format-typescript | `代码格式化` | `ts` |
41
+ | @houheaven/eslint-config-helper/format-import | `代码格式化` | `js/es6` `ts` `vue2` `vue3` |
42
+ | @houheaven/eslint-config-helper/format-vue2 | `代码格式化` | `vue2` |
43
+ | @houheaven/eslint-config-helper/format-vue3 | `代码格式化` | `vue3` |
44
+ | @houheaven/eslint-config-helper/format-html | `代码格式化` | `html` |
45
+
46
+ 在 Eslint 配置文件 `.eslintrc.js` 中 `"extends"` 规则集继承数组中添加以上规则集,即可使其生效。
47
+
48
+ ### Javascript(ES5)
27
49
 
28
50
  ```js
29
- // .eslintrc.js
51
+ module.exports = {
52
+ extends: [
53
+ "@houheaven/eslint-config-helper/es5"
54
+ ]
55
+ };
56
+ ```
57
+
58
+ ### Javascript(ES6)
30
59
 
60
+ ```js
31
61
  module.exports = {
32
62
  extends: [
33
- // ... 其他配置
34
- "@houheaven/eslint-config-helper"
63
+ "@houheaven/eslint-config-helper/es6",
64
+ "@houheaven/eslint-config-helper/import"
35
65
  ]
36
66
  };
37
67
  ```
38
68
 
39
- 我们提供了多种模式,分别用来处理不同的场景
40
- | 模式名称 | 功能说明 | 适用场景 |
41
- | ------ | ------ | ------ |
42
- | @houheaven/eslint-config-helper | `语法校验` `代码格式化` | `js` |
43
- | @houheaven/eslint-config-helper/typescript | `语法校验` `代码格式化` | `ts` |
44
- | @houheaven/eslint-config-helper/vue2 | `语法校验` `代码格式化` | `js` `vue2` |
45
- | @houheaven/eslint-config-helper/vue3 | `语法校验` `代码格式化` | `js` `vue3` |
46
- | @houheaven/eslint-config-helper/html | `语法校验` `代码格式化` | `js` `html` |
47
- | @houheaven/eslint-config-helper/format | `代码格式化` | `js` `vue2` `vue3` |
69
+ ### Typescript
70
+
71
+ ```js
72
+ module.exports = {
73
+ extends: [
74
+ "@houheaven/eslint-config-helper/es6",
75
+ "@houheaven/eslint-config-helper/import",
76
+ "@houheaven/eslint-config-helper/typescript"
77
+ ]
78
+ };
79
+ ```
80
+
81
+ ### Vue2
82
+
83
+ ```js
84
+ module.exports = {
85
+ extends: [
86
+ "@houheaven/eslint-config-helper/es6",
87
+ "@houheaven/eslint-config-helper/import",
88
+ "@houheaven/eslint-config-helper/vue2"
89
+ ]
90
+ };
91
+ ```
92
+
93
+ ### Vue3
94
+
95
+ ```js
96
+ module.exports = {
97
+ extends: [
98
+ "@houheaven/eslint-config-helper/es6",
99
+ "@houheaven/eslint-config-helper/import",
100
+ "@houheaven/eslint-config-helper/vue3"
101
+ ]
102
+ };
103
+ ```
104
+
105
+ ### Vue3 + Typescript
106
+
107
+ ```js
108
+ module.exports = {
109
+ extends: [
110
+ "@houheaven/eslint-config-helper/es6",
111
+ "@houheaven/eslint-config-helper/import",
112
+ "@houheaven/eslint-config-helper/typescript",
113
+ "@houheaven/eslint-config-helper/vue3-ts"
114
+ ]
115
+ };
116
+ ```
117
+
118
+ ### html
119
+
120
+ ```js
121
+ module.exports = {
122
+ extends: [
123
+ "@houheaven/eslint-config-helper/html"
124
+ ]
125
+ };
126
+ ```
127
+
128
+ ### html + ES5
129
+
130
+ ```js
131
+ module.exports = {
132
+ extends: [
133
+ "@houheaven/eslint-config-helper/es5",
134
+ "@houheaven/eslint-config-helper/html"
135
+ ]
136
+ };
137
+ ```
138
+
139
+ ### html + ES6
140
+
141
+ ```js
142
+ module.exports = {
143
+ extends: [
144
+ "@houheaven/eslint-config-helper/es6",
145
+ "@houheaven/eslint-config-helper/import",
146
+ "@houheaven/eslint-config-helper/html"
147
+ ]
148
+ };
149
+ ```
48
150
 
49
151
 
50
152
  ## 修改 Eslint 规则
@@ -58,25 +160,45 @@ module.exports = {
58
160
  // eslint 其他配置
59
161
  // ……
60
162
  rules: {
61
- // js 规则
163
+ // ES5 规则
62
164
  "quotes": ["warn", "double"],
63
165
  "no-multiple-empty-lines": ["warn", {
64
166
  max: 2,
65
167
  maxBOF: 1,
66
168
  maxEOF: 1
67
169
  }],
170
+
171
+ // ES6 规则
172
+ "no-var": "warn",
173
+ "arrow-spacing": ["warn", {
174
+ before: true,
175
+ after: true,
176
+ }],
177
+
178
+ // typescript 规则
179
+ "@typescript-eslint/consistent-type-definitions": ["warn", "interface"],
180
+ "@typescript-eslint/triple-slash-reference": ["error", {
181
+ lib: "always",
182
+ path: "never",
183
+ types: "prefer-import",
184
+ }],
185
+
68
186
  // import 规则
69
187
  "import/first": "error",
70
188
  "import/no-unresolved": ["error", {
71
189
  commonjs: true,
72
190
  caseSensitive: true,
73
191
  }],
74
- // vue 规则
192
+
193
+ // Vue2 规则
75
194
  "vue/eqeqeq": ["error", "always", { null: "ignore" }],
76
195
  "vue/custom-event-name-casing": ["warn", "kebab-case"],
77
- // vuejs-accessibility 规则
78
- "vuejs-accessibility/alt-text": "off",
79
- "vuejs-accessibility/no-onchange": "off",
196
+ "vue/no-multiple-template-root": "error",
197
+
198
+ // Vue3 规则
199
+ "vue/define-emits-declaration": ["error", "type-based"],
200
+ "vue/next-tick-style": ["warn", "promise"],
201
+
80
202
  // html 规则
81
203
  "@html-eslint/require-title": "error",
82
204
  "@html-eslint/no-duplicate-id": "error",
@@ -87,8 +209,7 @@ module.exports = {
87
209
  - 查看 [`Eslint 规则文档`](https://www.npmjs.com/package/eslint)
88
210
  - 查看 [`eslint-plugin-import 规则文档`](https://www.npmjs.com/package/eslint-plugin-import)
89
211
  - 查看 [`eslint-plugin-vue 规则文档`](https://eslint.vuejs.org/rules/)
90
- - 查看 [`eslint-plugin-vuejs-accessibility 规则文档`](https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/tree/main/docs)
91
- - 查看 [`@html-eslint 规则文档`](https://yeonjuan.github.io/html-eslint/docs/getting-started/)
212
+ - 查看 [`@html-eslint 规则文档`](https://html-eslint.org/docs/getting-started/)
92
213
  - 查看 [`@typescript-eslint/eslint-plugin 规则文档`](https://typescript-eslint.io/rules/)
93
214
 
94
215
  <!--
@@ -106,7 +227,6 @@ module.exports = {
106
227
  - [`eslint`](https://www.npmjs.com/package/eslint)
107
228
  - [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import)
108
229
  - [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue)
109
- - [`eslint-plugin-vuejs-accessibility`](https://www.npmjs.com/package/eslint-plugin-vuejs-accessibility)
110
230
  - [`eslint-plugin-html`](https://www.npmjs.com/package/eslint-plugin-html)
111
231
  - [`eslint-import-resolver-alias`](https://www.npmjs.com/package/eslint-import-resolver-alias)
112
232
  - [`eslint-import-resolver-node`](https://www.npmjs.com/package/eslint-import-resolver-node)
@@ -116,4 +236,5 @@ module.exports = {
116
236
  - [`typescript`](https://www.npmjs.com/package/typescript)
117
237
  - [`@typescript-eslint/eslint-plugin`](https://www.npmjs.com/package/@typescript-eslint/eslint-plugin)
118
238
  - [`@typescript-eslint/parser`](https://www.npmjs.com/package/@typescript-eslint/parser)
119
- <!-- - [`@babel/eslint-parser`](https://www.npmjs.com/package/@babel/eslint-parser) -->
239
+ <!-- - [`eslint-plugin-vuejs-accessibility`](https://www.npmjs.com/package/eslint-plugin-vuejs-accessibility) -->
240
+ <!-- - [`@babel/eslint-parser`](https://www.npmjs.com/package/@babel/eslint-parser) -->
@@ -0,0 +1,23 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format-es5
4
+ // ----------------------------------------------------------
5
+ // - Eslint ES5 格式化规则(warn)
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: false,
13
+ // 继承配置文件
14
+ extends: [
15
+ // Eslint ES5 支持
16
+ "./support/es5-support.js",
17
+ ],
18
+ // 规则
19
+ rules: {
20
+ // Eslint ES5 规则(warn)
21
+ ...utils.getWarnRules("es5"),
22
+ },
23
+ };
@@ -0,0 +1,25 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format
4
+ // ----------------------------------------------------------
5
+ // - Eslint ES5 格式化规则(warn)
6
+ // - Eslint ES6+ 格式化规则(warn)
7
+ // ==========================================================
8
+
9
+ const utils = require("./utils/utils.js");
10
+
11
+ module.exports = {
12
+ // 当 eslint-disable 注释配置未使用时,是否报错
13
+ reportUnusedDisableDirectives: false,
14
+ // 继承配置文件
15
+ extends: [
16
+ // Eslint ES6 支持
17
+ "./support/es6-support.js",
18
+ ],
19
+ // 规则
20
+ rules: {
21
+ // Eslint ES6 规则(warn)
22
+ ...utils.getWarnRules("es5"),
23
+ ...utils.getWarnRules("es6"),
24
+ },
25
+ };
@@ -0,0 +1,23 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format-html
4
+ // ----------------------------------------------------------
5
+ // - @html-eslint/eslint-plugin 定制规则(warn)
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: false,
13
+ // 继承配置文件
14
+ extends: [
15
+ // html 支持
16
+ "./support/html-support.js",
17
+ ],
18
+ // 规则
19
+ rules: {
20
+ // html 规则(warn)
21
+ ...utils.getWarnRules("html"),
22
+ },
23
+ };
@@ -0,0 +1,23 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format-import
4
+ // ----------------------------------------------------------
5
+ // - eslint-plugin-import 格式化规则(warn)
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: false,
13
+ // 继承配置文件
14
+ extends: [
15
+ // eslint-plugin-import 支持
16
+ "./support/import-support.js",
17
+ ],
18
+ // 规则
19
+ rules: {
20
+ // eslint-plugin-import 规则(warn)
21
+ ...utils.getWarnRules("import"),
22
+ },
23
+ };
@@ -0,0 +1,28 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format-typescript
4
+ // ----------------------------------------------------------
5
+ // - @typescript-eslint/eslint-plugin 定制规则(warn)
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ overrides: [
12
+ {
13
+ files: ["**/*.ts"],
14
+ // 当 eslint-disable 注释配置未使用时,是否报错
15
+ reportUnusedDisableDirectives: false,
16
+ // 继承配置文件
17
+ extends: [
18
+ // Typescript 支持
19
+ "./support/typescript-support.js",
20
+ ],
21
+ // 规则
22
+ rules: {
23
+ // Typescript 规则(warn)
24
+ ...utils.getWarnRules("typescript"),
25
+ },
26
+ },
27
+ ],
28
+ };
@@ -0,0 +1,23 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format-vue2
4
+ // ----------------------------------------------------------
5
+ // - eslint-plugin-vue 定制规则(warn)
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: false,
13
+ // 继承配置文件
14
+ extends: [
15
+ // Vue2 支持
16
+ "./support/vue2-support.js",
17
+ ],
18
+ // 规则
19
+ rules: {
20
+ // Vue2 规则(warn)
21
+ ...utils.getWarnRules("vue2"),
22
+ },
23
+ };
@@ -0,0 +1,23 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format-vue3
4
+ // ----------------------------------------------------------
5
+ // - eslint-plugin-vue 定制规则(warn)
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: false,
13
+ // 继承配置文件
14
+ extends: [
15
+ // Vue3 支持
16
+ "./support/vue3-support.js",
17
+ ],
18
+ // 规则
19
+ rules: {
20
+ // Vue3 规则(warn)
21
+ ...utils.getWarnRules("vue3"),
22
+ },
23
+ };
package/lib/html.js CHANGED
@@ -2,31 +2,22 @@
2
2
  // ===============================================================================
3
3
  // @houheaven/eslint-config-helper/html
4
4
  // -------------------------------------------------------------------------------
5
- // - ./configs/eslint-es5.j : Eslint ES5 定制规则
6
- // - ./configs/html.js : @html-eslint/eslint-plugin 定制规则
5
+ // - @html-eslint/eslint-plugin 定制规则
7
6
  // ===============================================================================
8
7
 
8
+ const utils = require("./utils/utils.js");
9
+
9
10
  module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: true,
13
+ // 继承配置文件
10
14
  extends: [
11
- "./configs/eslint-es5.js",
12
- ],
13
- overrides: [
14
- {
15
- files: ["*.html", "**/*.html", "*.htm", "**/*.htm"],
16
- extends: ["./configs/html.js"],
17
- rules: {
18
- // 此处不可删除,解决 html 中 <script> 换行问题
19
- "eol-last": ["warn", "never"],
20
- },
21
- },
22
- {
23
- files: ["*.html", "**/*.html", "*.htm", "**/*.htm"],
24
- plugins: ["eslint-plugin-html"],
25
- rules: {
26
- // 此处不可删除,解决 html 中 <script> 换行问题
27
- "eol-last": "off",
28
- "space-before-function-paren": "off",
29
- },
30
- },
15
+ // html 支持
16
+ "./support/html-support.js",
31
17
  ],
18
+ // 规则
19
+ rules: {
20
+ // html 规则
21
+ ...utils.rules.html,
22
+ },
32
23
  };
package/lib/import.js ADDED
@@ -0,0 +1,23 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/import
4
+ // ----------------------------------------------------------
5
+ // - eslint-plugin-import 定制规则
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: true,
13
+ // 继承配置文件
14
+ extends: [
15
+ // eslint-plugin-import 支持
16
+ "./support/import-support.js",
17
+ ],
18
+ // 规则
19
+ rules: {
20
+ // eslint-plugin-import 规则
21
+ ...utils.rules.import,
22
+ },
23
+ };
@@ -0,0 +1,23 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/eslint-es5
4
+ // ----------------------------------------------------------
5
+ // - Eslint ES5 定制规则
6
+ // ==========================================================
7
+
8
+ const utils = require("./utils/utils.js");
9
+
10
+ module.exports = {
11
+ // 当 eslint-disable 注释配置未使用时,是否报错
12
+ reportUnusedDisableDirectives: true,
13
+ // 继承配置文件
14
+ extends: [
15
+ // Eslint ES5 支持
16
+ "./support/es5-support.js",
17
+ ],
18
+ // 规则
19
+ rules: {
20
+ // Eslint ES5 规则
21
+ ...utils.rules.es5,
22
+ },
23
+ };
@@ -0,0 +1,25 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/eslint
4
+ // ----------------------------------------------------------
5
+ // - Eslint ES5 定制规则
6
+ // - Eslint ES6+ 定制规则
7
+ // ==========================================================
8
+
9
+ const utils = require("./utils/utils.js");
10
+
11
+ module.exports = {
12
+ // 当 eslint-disable 注释配置未使用时,是否报错
13
+ reportUnusedDisableDirectives: true,
14
+ // 继承配置文件
15
+ extends: [
16
+ // Eslint ES6 支持
17
+ "./support/es6-support.js",
18
+ ],
19
+ // 规则
20
+ rules: {
21
+ // Eslint ES6 规则
22
+ ...utils.rules.es5,
23
+ ...utils.rules.es6,
24
+ },
25
+ };