@houheaven/eslint-config-helper 2.1.0 → 2.1.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.
- package/README.md +11 -9
- package/lib/javascript-es5.js +1 -0
- package/lib/support/es5-support.js +3 -0
- package/lib/support/es6-support.js +3 -0
- package/lib/support/html-support.js +8 -0
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/layout-formatting.js +0 -15
- package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/stylistic.js +24 -0
- package/node_modules/@houheaven/eslint-config-helper-core/utils/utils.js +1 -0
- package/package.json +10 -15
package/README.md
CHANGED
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
|
|
2
2
|
# @houheaven/eslint-config-helper
|
|
3
3
|
|
|
4
|
-
> Eslint
|
|
5
|
-
> 主要功能是处理
|
|
4
|
+
> Eslint 规则助手,基于 Eslint Legacy Config 的规则集。
|
|
5
|
+
> 主要功能是处理 Javascript、Typescript、Vue、HTML 中的语法校验、代码格式化。
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
##
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
- 内置
|
|
12
|
-
- 内置 `@
|
|
13
|
-
- 内置
|
|
14
|
-
-
|
|
8
|
+
## 功能
|
|
9
|
+
|
|
10
|
+
- 项目依赖于 `Eslint v8`,提供 JS 代码的校验规则
|
|
11
|
+
- 内置 `@stylistic/eslint-plugin`,提供 JS、TS 代码格式化的校验规则
|
|
12
|
+
- 内置 `@typescript-eslint/eslint-plugin`,提供 TS 代码的校验规则
|
|
13
|
+
- 内置 `eslint-plugin-import`,提供 import 的校验规则
|
|
14
|
+
- 内置 `eslint-plugin-vue`,提供 Vue 代码的校验规则
|
|
15
|
+
- 内置 `@html-eslint/eslint-plugin`,提供 html 文件的解析和校验规则
|
|
16
|
+
- 内置 `eslint-plugin-html`,提供 html 文件中 <script> 的 JS 解析能力
|
|
15
17
|
|
|
16
18
|
|
|
17
19
|
## 安装
|
package/lib/javascript-es5.js
CHANGED
|
@@ -14,6 +14,8 @@ module.exports = {
|
|
|
14
14
|
// 检查和修复 html 文件中的 JS 代码,即 <script> 中的代码
|
|
15
15
|
// 仅仅提供技术支持,不包含任何规则,具体规则由 eslint.js 提供
|
|
16
16
|
"eslint-plugin-html",
|
|
17
|
+
// Eslint 样式规则
|
|
18
|
+
"@stylistic/eslint-plugin",
|
|
17
19
|
],
|
|
18
20
|
// eslint-plugin-html 配置
|
|
19
21
|
// 注意:为了使 eslint-plugin-html 插件正常工作,parser 必须是 "@html-eslint/parser",不能是 require.resolve("@html-eslint/parser")
|
|
@@ -26,6 +28,12 @@ module.exports = {
|
|
|
26
28
|
"html/report-bad-indent": "warn",
|
|
27
29
|
"html/indent": "+2",
|
|
28
30
|
},
|
|
31
|
+
env: {
|
|
32
|
+
browser: true, // 浏览器环境,启用浏览器环境的全局变量(window、document、navigator、alert 等)
|
|
33
|
+
node: true, // Node.js 环境,启用 Node.js 环境的全局变量和作用域规则(__dirname、__filename、process、global 等)
|
|
34
|
+
commonjs: true, // Node.js 环境,启用 CommonJS 的全局变量和作用域规则(require()、module、exports 等)
|
|
35
|
+
amd: false, // AMD 环境,启用 AMD 环境的全局变量和作用域规则(define()、require() 等)
|
|
36
|
+
},
|
|
29
37
|
// 规则
|
|
30
38
|
rules: {
|
|
31
39
|
// 此处不可删除,解决 html 中 <script> 换行问题
|
|
@@ -264,26 +264,11 @@ module.exports = {
|
|
|
264
264
|
exceptions: {},
|
|
265
265
|
}],
|
|
266
266
|
|
|
267
|
-
// 禁止出现多行空行
|
|
268
|
-
// https://zh-hans.eslint.org/docs/latest/rules/no-multiple-empty-lines
|
|
269
|
-
"no-multiple-empty-lines": ["warn", {
|
|
270
|
-
max: 2,
|
|
271
|
-
maxBOF: 1,
|
|
272
|
-
maxEOF: 1,
|
|
273
|
-
}],
|
|
274
|
-
|
|
275
267
|
// 禁用 tab
|
|
276
268
|
"no-tabs": ["error", {
|
|
277
269
|
allowIndentationTabs: false, // 允许缩进使用 tab
|
|
278
270
|
}],
|
|
279
271
|
|
|
280
|
-
// 禁用行尾空白
|
|
281
|
-
// 这条规则不允许在行末有尾随空格(空格、制表符和其他 Unicode 空白字符)
|
|
282
|
-
"no-trailing-spaces": ["warn", {
|
|
283
|
-
skipBlankLines: true,
|
|
284
|
-
ignoreComments: false,
|
|
285
|
-
}],
|
|
286
|
-
|
|
287
272
|
// 禁止属性前有空白
|
|
288
273
|
// https://zh-hans.eslint.org/docs/latest/rules/no-whitespace-before-property
|
|
289
274
|
"no-whitespace-before-property": "warn",
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// - @stylistic/eslint-plugin 定制规则
|
|
4
|
+
// ==========================================================
|
|
5
|
+
|
|
6
|
+
module.exports = {
|
|
7
|
+
rules: {
|
|
8
|
+
// 禁用行尾空白
|
|
9
|
+
// 这条规则不允许在行末有尾随空格(空格、制表符和其他 Unicode 空白字符)
|
|
10
|
+
// https://eslint.style/rules/no-trailing-spaces
|
|
11
|
+
"@stylistic/no-trailing-spaces": ["warn", {
|
|
12
|
+
skipBlankLines: true,
|
|
13
|
+
ignoreComments: false,
|
|
14
|
+
}],
|
|
15
|
+
|
|
16
|
+
// 禁止出现多行空行
|
|
17
|
+
// https://eslint.style/rules/no-multiple-empty-lines
|
|
18
|
+
"@stylistic/no-multiple-empty-lines": ["warn", {
|
|
19
|
+
max: 2,
|
|
20
|
+
maxBOF: 1,
|
|
21
|
+
maxEOF: 1,
|
|
22
|
+
}],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -9,6 +9,7 @@ const EslintRules = {
|
|
|
9
9
|
...require("../rules/eslint/layout-formatting.js").rules,
|
|
10
10
|
...require("../rules/eslint/possible-errors.js").rules,
|
|
11
11
|
...require("../rules/eslint/suggestions.js").rules,
|
|
12
|
+
...require("../rules/eslint/stylistic.js").rules,
|
|
12
13
|
},
|
|
13
14
|
es6: {
|
|
14
15
|
...require("../rules/eslint/es6.js").rules,
|
package/package.json
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@houheaven/eslint-config-helper",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Eslint 规则助手",
|
|
5
5
|
"author": "立树",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"private": false,
|
|
8
|
-
"publishConfig": {
|
|
9
|
-
"access": "public",
|
|
10
|
-
"tag": "legacy"
|
|
11
|
-
},
|
|
12
8
|
"keywords": [
|
|
13
9
|
"houheaven",
|
|
14
10
|
"eslint",
|
|
@@ -50,20 +46,23 @@
|
|
|
50
46
|
"url": "https://gitee.com/houheaven/eslint-config-helper/issues"
|
|
51
47
|
},
|
|
52
48
|
"homepage": "https://gitee.com/houheaven/eslint-config-helper",
|
|
49
|
+
"scripts": {
|
|
50
|
+
"lint": "eslint ."
|
|
51
|
+
},
|
|
53
52
|
"dependencies": {
|
|
53
|
+
"@houheaven/eslint-config-helper-core": "workspace:*",
|
|
54
54
|
"@html-eslint/eslint-plugin": "0.43.0",
|
|
55
55
|
"@html-eslint/parser": "0.43.0",
|
|
56
56
|
"@rushstack/eslint-patch": "1.16.1",
|
|
57
57
|
"@stylistic/eslint-plugin": "3.1.0",
|
|
58
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
59
|
-
"@typescript-eslint/parser": "8.
|
|
58
|
+
"@typescript-eslint/eslint-plugin": "8.56.1",
|
|
59
|
+
"@typescript-eslint/parser": "8.56.1",
|
|
60
60
|
"eslint-import-resolver-alias": "1.1.2",
|
|
61
61
|
"eslint-import-resolver-node": "0.3.6",
|
|
62
62
|
"eslint-import-resolver-webpack": "0.13.2",
|
|
63
|
-
"eslint-plugin-html": "8.1.
|
|
63
|
+
"eslint-plugin-html": "8.1.4",
|
|
64
64
|
"eslint-plugin-import": "2.32.0",
|
|
65
|
-
"eslint-plugin-vue": "9.33.0"
|
|
66
|
-
"@houheaven/eslint-config-helper-core": "1.0.0"
|
|
65
|
+
"eslint-plugin-vue": "9.33.0"
|
|
67
66
|
},
|
|
68
67
|
"devDependencies": {
|
|
69
68
|
"eslint": "8.57.1",
|
|
@@ -74,9 +73,5 @@
|
|
|
74
73
|
},
|
|
75
74
|
"bundledDependencies": [
|
|
76
75
|
"@houheaven/eslint-config-helper-core"
|
|
77
|
-
]
|
|
78
|
-
"scripts": {
|
|
79
|
-
"lint": "eslint .",
|
|
80
|
-
"lint-fix": "eslint . --fix"
|
|
81
|
-
}
|
|
76
|
+
]
|
|
82
77
|
}
|