@houheaven/eslint-config-helper 1.2.0 → 1.2.2
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,36 +1,36 @@
|
|
|
1
|
-
|
|
2
|
-
// ===============================================================================
|
|
3
|
-
// 修复 Vue 中设置的别名(比如 @)无法被 import/no-unresolved 规则解析的问题
|
|
4
|
-
// -------------------------------------------------------------------------------
|
|
5
|
-
// Vue2
|
|
6
|
-
// 方案:设置解析器("import/resolver"),用来解析 Vue - webpack 中设置的别名
|
|
7
|
-
// 依赖:eslint-import-resolver-node、eslint-import-resolver-webpack
|
|
8
|
-
// -------------------------------------------------------------------------------
|
|
9
|
-
// Vue3
|
|
10
|
-
// 方案:设置解析器("import/resolver"),用来解析 Vue - vite 中设置的别名
|
|
11
|
-
// 依赖:eslint-import-resolver-alias
|
|
12
|
-
// ===============================================================================
|
|
13
|
-
|
|
14
|
-
const importResolver = {
|
|
15
|
-
[require.resolve("eslint-import-resolver-node")]: {},
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
try {
|
|
19
|
-
const vueCliConfig = require.resolve("@vue/cli-service/webpack.config.js");
|
|
20
|
-
importResolver[require.resolve("eslint-import-resolver-webpack")] = {
|
|
21
|
-
config: vueCliConfig,
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
catch(e) {
|
|
25
|
-
// ignore
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// Vue3 Vite alias
|
|
29
|
-
const path = require("path");
|
|
30
|
-
importResolver
|
|
31
|
-
map: [
|
|
32
|
-
["@", path.resolve(process.cwd(), "src")],
|
|
33
|
-
],
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
module.exports = importResolver;
|
|
1
|
+
|
|
2
|
+
// ===============================================================================
|
|
3
|
+
// 修复 Vue 中设置的别名(比如 @)无法被 import/no-unresolved 规则解析的问题
|
|
4
|
+
// -------------------------------------------------------------------------------
|
|
5
|
+
// Vue2
|
|
6
|
+
// 方案:设置解析器("import/resolver"),用来解析 Vue - webpack 中设置的别名
|
|
7
|
+
// 依赖:eslint-import-resolver-node、eslint-import-resolver-webpack
|
|
8
|
+
// -------------------------------------------------------------------------------
|
|
9
|
+
// Vue3
|
|
10
|
+
// 方案:设置解析器("import/resolver"),用来解析 Vue - vite 中设置的别名
|
|
11
|
+
// 依赖:eslint-import-resolver-alias
|
|
12
|
+
// ===============================================================================
|
|
13
|
+
|
|
14
|
+
const importResolver = {
|
|
15
|
+
[require.resolve("eslint-import-resolver-node")]: {},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
try {
|
|
19
|
+
const vueCliConfig = require.resolve("@vue/cli-service/webpack.config.js");
|
|
20
|
+
importResolver[require.resolve("eslint-import-resolver-webpack")] = {
|
|
21
|
+
config: vueCliConfig,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
catch(e) {
|
|
25
|
+
// ignore
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Vue3 Vite alias
|
|
29
|
+
const path = require("path");
|
|
30
|
+
importResolver.alias = {
|
|
31
|
+
map: [
|
|
32
|
+
["@", path.resolve(process.cwd(), "src")],
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
module.exports = importResolver;
|
|
@@ -282,13 +282,14 @@ module.exports = {
|
|
|
282
282
|
|
|
283
283
|
// 要求或禁止在三元操作数中间换行
|
|
284
284
|
// https://eslint.org/docs/rules/multiline-ternary
|
|
285
|
-
// TODO: enable?
|
|
286
285
|
"multiline-ternary": ["off", "never"],
|
|
287
286
|
|
|
288
|
-
//
|
|
289
|
-
|
|
287
|
+
// 要求构造器函数首字母大写
|
|
288
|
+
// https://eslint.org/docs/latest/rules/new-cap
|
|
289
|
+
"new-cap": ["warn", {
|
|
290
290
|
newIsCap: true,
|
|
291
291
|
newIsCapExceptions: [],
|
|
292
|
+
newIsCapExceptionPattern: "^hh[A-Z]",
|
|
292
293
|
capIsNew: false,
|
|
293
294
|
capIsNewExceptions: ["Immutable.Map", "Immutable.Set", "Immutable.List"],
|
|
294
295
|
}],
|
|
@@ -22,7 +22,7 @@ module.exports = {
|
|
|
22
22
|
|
|
23
23
|
// 禁用 Node.js 内置模块
|
|
24
24
|
// https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-nodejs-modules.md
|
|
25
|
-
"import/no-nodejs-modules": "
|
|
25
|
+
"import/no-nodejs-modules": "off",
|
|
26
26
|
|
|
27
27
|
// 除了主模块以外,在使用 CommonJS 导出的任何文件中都不能使用 import 声明
|
|
28
28
|
// https://github.com/benmosher/eslint-plugin-import/blob/1012eb951767279ce3b540a4ec4f29236104bb5b/docs/rules/no-import-module-exports.md
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@houheaven/eslint-config-helper",
|
|
3
|
-
"version": "1.2.
|
|
4
|
-
"description": "Eslint 规则助手",
|
|
5
|
-
"author": "立树",
|
|
6
|
-
"main": "index.js",
|
|
7
|
-
"license": "MIT",
|
|
8
|
-
"private": false,
|
|
9
|
-
"keywords": [
|
|
10
|
-
"houheaven",
|
|
11
|
-
"eslint"
|
|
12
|
-
],
|
|
13
|
-
"repository": {
|
|
14
|
-
"type": "git",
|
|
15
|
-
"url": "https://gitee.com/houheaven/eslint-config-helper.git"
|
|
16
|
-
},
|
|
17
|
-
"bugs": {
|
|
18
|
-
"url": "https://gitee.com/houheaven/eslint-config-helper/issues"
|
|
19
|
-
},
|
|
20
|
-
"homepage": "https://gitee.com/houheaven/eslint-config-helper",
|
|
21
|
-
"scripts": {
|
|
22
|
-
"lint": "eslint . --fix",
|
|
23
|
-
"lint-check": "eslint ."
|
|
24
|
-
},
|
|
25
|
-
"dependencies": {
|
|
26
|
-
"@html-eslint/eslint-plugin": "^0.14.1",
|
|
27
|
-
"@html-eslint/parser": "^0.14.0",
|
|
28
|
-
"eslint": "^8.23.1",
|
|
29
|
-
"eslint-import-resolver-alias": "^1.1.2",
|
|
30
|
-
"eslint-import-resolver-node": "^0.3.6",
|
|
31
|
-
"eslint-import-resolver-webpack": "^0.13.2",
|
|
32
|
-
"eslint-plugin-html": "^7.1.0",
|
|
33
|
-
"eslint-plugin-import": "^2.26.0",
|
|
34
|
-
"eslint-plugin-vue": "^9.4.0",
|
|
35
|
-
"eslint-plugin-vuejs-accessibility": "^1.2.0"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@houheaven/eslint-config-helper",
|
|
3
|
+
"version": "1.2.2",
|
|
4
|
+
"description": "Eslint 规则助手",
|
|
5
|
+
"author": "立树",
|
|
6
|
+
"main": "index.js",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"private": false,
|
|
9
|
+
"keywords": [
|
|
10
|
+
"houheaven",
|
|
11
|
+
"eslint"
|
|
12
|
+
],
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://gitee.com/houheaven/eslint-config-helper.git"
|
|
16
|
+
},
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://gitee.com/houheaven/eslint-config-helper/issues"
|
|
19
|
+
},
|
|
20
|
+
"homepage": "https://gitee.com/houheaven/eslint-config-helper",
|
|
21
|
+
"scripts": {
|
|
22
|
+
"lint": "eslint . --fix",
|
|
23
|
+
"lint-check": "eslint ."
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@html-eslint/eslint-plugin": "^0.14.1",
|
|
27
|
+
"@html-eslint/parser": "^0.14.0",
|
|
28
|
+
"eslint": "^8.23.1",
|
|
29
|
+
"eslint-import-resolver-alias": "^1.1.2",
|
|
30
|
+
"eslint-import-resolver-node": "^0.3.6",
|
|
31
|
+
"eslint-import-resolver-webpack": "^0.13.2",
|
|
32
|
+
"eslint-plugin-html": "^7.1.0",
|
|
33
|
+
"eslint-plugin-import": "^2.26.0",
|
|
34
|
+
"eslint-plugin-vue": "^9.4.0",
|
|
35
|
+
"eslint-plugin-vuejs-accessibility": "^1.2.0"
|
|
36
|
+
}
|
|
37
|
+
}
|