@houheaven/eslint-config-helper 1.4.0 → 2.1.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.
- package/LICENSE +21 -21
- package/README.md +149 -28
- package/lib/format-es5.js +23 -0
- package/lib/format-es6.js +25 -0
- package/lib/format-html.js +23 -0
- package/lib/format-import.js +23 -0
- package/lib/format-typescript.js +28 -0
- package/lib/format-vue2.js +23 -0
- package/lib/format-vue3.js +23 -0
- package/lib/html.js +16 -22
- package/lib/import.js +26 -0
- package/lib/javascript-es5.js +25 -0
- package/lib/javascript-es6.js +28 -0
- package/lib/support/es5-support.js +29 -0
- package/lib/support/es6-support.js +39 -0
- package/lib/support/html-support.js +38 -0
- package/lib/support/import-bugfix.js +65 -0
- package/lib/support/import-support.js +25 -0
- package/lib/support/typescript-support.js +27 -0
- package/lib/support/vue2-support.js +43 -0
- package/lib/support/vue3-support.js +43 -0
- package/lib/support/vue3-ts-support.js +51 -0
- package/lib/typescript.js +27 -32
- package/lib/utils/utils.js +2 -0
- package/lib/vue2.js +19 -22
- package/lib/vue3-ts.js +32 -0
- package/lib/vue3.js +16 -17
- package/node_modules/@houheaven/eslint-config-helper-core/package.json +7 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/_deprecated.js +132 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/_removed.js +25 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/es6.js +365 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/layout-formatting.js +441 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/possible-errors.js +199 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/suggestions.js +666 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/html/accessibility.js +68 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/html/best-practice.js +150 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/html/seo.js +29 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/html/style.js +70 -0
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/import/helpful-warnings.js +23 -18
- package/node_modules/@houheaven/eslint-config-helper-core/rules/import/module-systems.js +33 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/import/static-analysis.js +85 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/import/style-guide.js +125 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/_deprecated.js +57 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/conflict.js +16 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/deprecated.js +41 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/extension.js +207 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/fixable.js +215 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/other.js +125 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/stylistic.js +34 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/suggestion.js +53 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/typescript/type-checked.js +263 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/vue/_deprecated.js +37 -0
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-base.js +1 -11
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-essential.js +25 -38
- package/node_modules/@houheaven/eslint-config-helper-core/rules/vue/common-extension.js +321 -0
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-recommended.js +64 -31
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-strongly-recommended.js +37 -20
- package/{lib/rules/vue/common-extra.js → node_modules/@houheaven/eslint-config-helper-core/rules/vue/common-uncategorized.js} +141 -52
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue2-essential.js +16 -14
- package/node_modules/@houheaven/eslint-config-helper-core/rules/vue/vue2-uncategorized.js +15 -0
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue3-essential.js +54 -24
- package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue3-strongly-recommended.js +8 -10
- package/node_modules/@houheaven/eslint-config-helper-core/rules/vue/vue3-uncategorized.js +115 -0
- package/node_modules/@houheaven/eslint-config-helper-core/summary.js +57 -0
- package/node_modules/@houheaven/eslint-config-helper-core/utils/utils.js +160 -0
- package/package.json +59 -25
- package/lib/configs/eslint-es5.js +0 -24
- package/lib/configs/eslint.js +0 -23
- package/lib/configs/format-html.js +0 -22
- package/lib/configs/format-js.js +0 -134
- package/lib/configs/format-vue.js +0 -278
- package/lib/configs/html.js +0 -20
- package/lib/configs/import-bugfix.js +0 -36
- package/lib/configs/import.js +0 -44
- package/lib/configs/typescript.js +0 -10
- package/lib/configs/vue2.js +0 -28
- package/lib/configs/vue3.js +0 -28
- package/lib/eslint.js +0 -18
- package/lib/format.js +0 -40
- package/lib/rules/eslint/best-practices.js +0 -422
- package/lib/rules/eslint/es6.js +0 -196
- package/lib/rules/eslint/node.js +0 -48
- package/lib/rules/eslint/possible-errors.js +0 -190
- package/lib/rules/eslint/strict-mode.js +0 -12
- package/lib/rules/eslint/stylistic-issues.js +0 -578
- package/lib/rules/eslint/variables.js +0 -73
- package/lib/rules/html/accessibility.js +0 -44
- package/lib/rules/html/best-practice.js +0 -64
- package/lib/rules/html/seo.js +0 -24
- package/lib/rules/html/style.js +0 -32
- package/lib/rules/import/module-systems.js +0 -34
- package/lib/rules/import/static-analysis.js +0 -69
- package/lib/rules/import/style-guide.js +0 -97
- package/lib/rules/typescript/all.js +0 -193
- package/lib/rules/typescript/base.js +0 -10
- package/lib/rules/typescript/eslint-recommended.js +0 -36
- package/lib/rules/typescript/recommended-requiring-type-checking.js +0 -26
- package/lib/rules/typescript/recommended.js +0 -36
- package/lib/rules/typescript/strict.js +0 -47
- package/lib/rules/vue/common-eslint.js +0 -220
- package/lib/rules/vue/vue2-recommended.js +0 -17
- package/lib/rules/vue/vue2-strongly-recommended.js +0 -16
- package/lib/rules/vue/vue3-recommended.js +0 -17
- /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vuejs-accessibility/index.js +0 -0
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
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
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
|
-
//
|
|
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
|
-
|
|
192
|
+
|
|
193
|
+
// Vue2 规则
|
|
75
194
|
"vue/eqeqeq": ["error", "always", { null: "ignore" }],
|
|
76
195
|
"vue/custom-event-name-casing": ["warn", "kebab-case"],
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
- 查看 [
|
|
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
|
-
<!-- - [
|
|
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("@houheaven/eslint-config-helper-core");
|
|
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("@houheaven/eslint-config-helper-core");
|
|
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("@houheaven/eslint-config-helper-core");
|
|
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("@houheaven/eslint-config-helper-core");
|
|
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("@houheaven/eslint-config-helper-core");
|
|
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("@houheaven/eslint-config-helper-core");
|
|
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("@houheaven/eslint-config-helper-core");
|
|
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,25 @@
|
|
|
2
2
|
// ===============================================================================
|
|
3
3
|
// @houheaven/eslint-config-helper/html
|
|
4
4
|
// -------------------------------------------------------------------------------
|
|
5
|
-
// -
|
|
6
|
-
// - ./configs/html.js : @html-eslint/eslint-plugin 定制规则
|
|
5
|
+
// - @html-eslint/eslint-plugin 定制规则
|
|
7
6
|
// ===============================================================================
|
|
8
7
|
|
|
8
|
+
// 这个插件为当前类库提供”开箱即用“的能力,使用者无需手动安装当前库的依赖项
|
|
9
|
+
require("@rushstack/eslint-patch/modern-module-resolution");
|
|
10
|
+
|
|
11
|
+
const utils = require("@houheaven/eslint-config-helper-core");
|
|
12
|
+
|
|
9
13
|
module.exports = {
|
|
14
|
+
// 当 eslint-disable 注释配置未使用时,是否报错
|
|
15
|
+
reportUnusedDisableDirectives: true,
|
|
16
|
+
// 继承配置文件
|
|
10
17
|
extends: [
|
|
11
|
-
|
|
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
|
-
},
|
|
18
|
+
// html 支持
|
|
19
|
+
"./support/html-support.js",
|
|
31
20
|
],
|
|
21
|
+
// 规则
|
|
22
|
+
rules: {
|
|
23
|
+
// html 规则
|
|
24
|
+
...utils.rules.html,
|
|
25
|
+
},
|
|
32
26
|
};
|
package/lib/import.js
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// @houheaven/eslint-config-helper/import
|
|
4
|
+
// ----------------------------------------------------------
|
|
5
|
+
// - eslint-plugin-import 定制规则
|
|
6
|
+
// ==========================================================
|
|
7
|
+
|
|
8
|
+
// 这个插件为当前类库提供”开箱即用“的能力,使用者无需手动安装当前库的依赖项
|
|
9
|
+
require("@rushstack/eslint-patch/modern-module-resolution");
|
|
10
|
+
|
|
11
|
+
const utils = require("@houheaven/eslint-config-helper-core");
|
|
12
|
+
|
|
13
|
+
module.exports = {
|
|
14
|
+
// 当 eslint-disable 注释配置未使用时,是否报错
|
|
15
|
+
reportUnusedDisableDirectives: true,
|
|
16
|
+
// 继承配置文件
|
|
17
|
+
extends: [
|
|
18
|
+
// eslint-plugin-import 支持
|
|
19
|
+
"./support/import-support.js",
|
|
20
|
+
],
|
|
21
|
+
// 规则
|
|
22
|
+
rules: {
|
|
23
|
+
// eslint-plugin-import 规则
|
|
24
|
+
...utils.rules.import,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// @houheaven/eslint-config-helper/es5
|
|
4
|
+
// ----------------------------------------------------------
|
|
5
|
+
// - Eslint ES5 定制规则
|
|
6
|
+
// ==========================================================
|
|
7
|
+
|
|
8
|
+
require("@rushstack/eslint-patch/modern-module-resolution");
|
|
9
|
+
|
|
10
|
+
const utils = require("@houheaven/eslint-config-helper-core");
|
|
11
|
+
|
|
12
|
+
module.exports = {
|
|
13
|
+
// 当 eslint-disable 注释配置未使用时,是否报错
|
|
14
|
+
reportUnusedDisableDirectives: true,
|
|
15
|
+
// 继承配置文件
|
|
16
|
+
extends: [
|
|
17
|
+
// Eslint ES5 支持
|
|
18
|
+
"./support/es5-support.js",
|
|
19
|
+
],
|
|
20
|
+
// 规则
|
|
21
|
+
rules: {
|
|
22
|
+
// Eslint ES5 规则
|
|
23
|
+
...utils.rules.es5,
|
|
24
|
+
},
|
|
25
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// @houheaven/eslint-config-helper/es6
|
|
4
|
+
// ----------------------------------------------------------
|
|
5
|
+
// - Eslint ES5 定制规则
|
|
6
|
+
// - Eslint ES6+ 定制规则
|
|
7
|
+
// ==========================================================
|
|
8
|
+
|
|
9
|
+
// 这个插件为当前类库提供”开箱即用“的能力,使用者无需手动安装当前库的依赖项
|
|
10
|
+
require("@rushstack/eslint-patch/modern-module-resolution");
|
|
11
|
+
|
|
12
|
+
const utils = require("@houheaven/eslint-config-helper-core");
|
|
13
|
+
|
|
14
|
+
module.exports = {
|
|
15
|
+
// 当 eslint-disable 注释配置未使用时,是否报错
|
|
16
|
+
reportUnusedDisableDirectives: true,
|
|
17
|
+
// 继承配置文件
|
|
18
|
+
extends: [
|
|
19
|
+
// Eslint ES6 支持
|
|
20
|
+
"./support/es6-support.js",
|
|
21
|
+
],
|
|
22
|
+
// 规则
|
|
23
|
+
rules: {
|
|
24
|
+
// Eslint ES6 规则
|
|
25
|
+
...utils.rules.es5,
|
|
26
|
+
...utils.rules.es6,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// Eslint ES5 支持
|
|
4
|
+
// ==========================================================
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
overrides: [
|
|
8
|
+
{
|
|
9
|
+
files: [
|
|
10
|
+
// js 文件
|
|
11
|
+
"**/*.js",
|
|
12
|
+
// Nodejs CommonJS 模块文件
|
|
13
|
+
"**/*.cjs",
|
|
14
|
+
// Nodejs ESM 模块文件
|
|
15
|
+
"**/*.mjs",
|
|
16
|
+
],
|
|
17
|
+
// 定义环境变量
|
|
18
|
+
env: {
|
|
19
|
+
browser: true, // 浏览器环境,启用浏览器环境的全局变量(window、document、navigator、alert 等)
|
|
20
|
+
jquery: true, // jQuery 环境,启用 jQuery 环境的全局变量和作用域规则($、jQuery 等)
|
|
21
|
+
},
|
|
22
|
+
// 解析器配置
|
|
23
|
+
parserOptions: {
|
|
24
|
+
sourceType: "script", // 指定代码的来源类型,"script"(默认)表示 ESLint 会在全局作用域的脚本上下文中解析代码
|
|
25
|
+
ecmaVersion: 5, // 指定 ECMAScript 版本,5 表示 ECMAScript 5
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// Eslint ES6+ 支持
|
|
4
|
+
// ==========================================================
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
overrides: [
|
|
8
|
+
{
|
|
9
|
+
files: [
|
|
10
|
+
// js 文件
|
|
11
|
+
"**/*.js",
|
|
12
|
+
// Nodejs CommonJS 模块文件
|
|
13
|
+
"**/*.cjs",
|
|
14
|
+
// Nodejs ESM 模块文件
|
|
15
|
+
"**/*.mjs",
|
|
16
|
+
],
|
|
17
|
+
// 定义环境变量
|
|
18
|
+
env: {
|
|
19
|
+
browser: true, // 浏览器环境,启用浏览器环境的全局变量(window、document、navigator、alert 等)
|
|
20
|
+
node: true, // Node.js 环境,启用 Node.js 环境的全局变量和作用域规则(__dirname、__filename、process、global 等)
|
|
21
|
+
commonjs: true, // Node.js 环境,启用 CommonJS 的全局变量和作用域规则(require()、module、exports 等)
|
|
22
|
+
amd: false, // AMD 环境,启用 AMD 环境的全局变量和作用域规则(define()、require() 等)
|
|
23
|
+
mocha: false, // Mocha 环境,启用 Mocha 环境的全局变量和作用域规则(describe()、it()、before()、after() 等)
|
|
24
|
+
jasmine: false, // Jasmine 环境,启用 Jasmine 环境的全局变量和作用域规则(describe()、it()、beforeEach()、afterEach() 等)
|
|
25
|
+
es6: true, // 启用 ECMAScript 6 全局变量和作用域规则(let、const、class、import、export 等)
|
|
26
|
+
},
|
|
27
|
+
// 解析器配置
|
|
28
|
+
parserOptions: {
|
|
29
|
+
sourceType: "module", // 指定代码的来源类型,"module" 表示 ESLint 会在 ECMAScript 模块的上下文中解析代码(即支持 import 和 export 语法)
|
|
30
|
+
ecmaVersion: "latest", // 指定 ECMAScript 版本,"latest" 表示使用最新的 ECMAScript 版本
|
|
31
|
+
ecmaFeatures: {
|
|
32
|
+
generators: false,
|
|
33
|
+
objectLiteralDuplicateProperties: false,
|
|
34
|
+
jsx: true,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|