@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.
- package/README.md +112 -53
- package/format.js +40 -0
- package/html.js +32 -0
- package/index.js +18 -0
- package/lib/configs/eslint-es5.js +24 -0
- package/lib/configs/eslint.js +23 -0
- package/lib/configs/format-html.js +22 -0
- package/lib/configs/format-js.js +134 -0
- package/{eslint/prettier.js → lib/configs/format-prettier.js} +109 -45
- package/lib/configs/format-vue.js +278 -0
- package/lib/configs/html.js +20 -0
- package/lib/configs/import-bugfix.js +36 -0
- package/lib/configs/import.js +44 -0
- package/lib/configs/vue2.js +28 -0
- package/lib/configs/vue3.js +28 -0
- package/{eslint/rules → lib/rules/eslint}/best-practices.js +19 -19
- package/{eslint/rules → lib/rules/eslint}/es6.js +8 -9
- package/{eslint/rules → lib/rules/eslint}/node.js +0 -0
- package/{eslint/rules → lib/rules/eslint}/possible-errors.js +16 -11
- package/{eslint/rules → lib/rules/eslint}/strict-mode.js +0 -0
- package/{eslint/rules → lib/rules/eslint}/stylistic-issues.js +60 -59
- package/{eslint/rules → lib/rules/eslint}/variables.js +13 -11
- package/lib/rules/html/accessibility.js +44 -0
- package/lib/rules/html/best-practice.js +64 -0
- package/lib/rules/html/seo.js +24 -0
- package/lib/rules/html/style.js +32 -0
- package/lib/rules/import/helpful-warnings.js +68 -0
- package/lib/rules/import/module-systems.js +34 -0
- package/lib/rules/import/static-analysis.js +69 -0
- package/lib/rules/import/style-guide.js +97 -0
- package/lib/rules/vue/common-base.js +29 -0
- package/lib/rules/vue/common-eslint.js +220 -0
- package/lib/rules/vue/common-essential.js +267 -0
- package/lib/rules/vue/common-extra.js +282 -0
- package/lib/rules/vue/common-recommended.js +96 -0
- package/lib/rules/vue/common-strongly-recommended.js +138 -0
- package/lib/rules/vue/vue2-essential.js +41 -0
- package/lib/rules/vue/vue2-recommended.js +17 -0
- package/lib/rules/vue/vue2-strongly-recommended.js +16 -0
- package/lib/rules/vue/vue3-essential.js +129 -0
- package/lib/rules/vue/vue3-recommended.js +17 -0
- package/lib/rules/vue/vue3-strongly-recommended.js +24 -0
- package/lib/rules/vuejs-accessibility/index.js +92 -0
- package/package.json +37 -28
- package/vue2.js +30 -0
- package/vue3.js +28 -0
- package/eslint/eslint-fix.js +0 -29
- package/eslint/file-bof-eof.js +0 -22
- package/eslint/index.js +0 -18
- package/eslint/legacy.js +0 -34
- package/eslint/rules/imports.js +0 -279
- package/eslint/rules/vue.js +0 -23
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// 极其重要的规则(plugin:vue/vue3-essential)
|
|
4
|
+
// 严格程度:低
|
|
5
|
+
// - plugin:vue/base
|
|
6
|
+
// - common-essential
|
|
7
|
+
// ==========================================================
|
|
8
|
+
|
|
9
|
+
module.exports = {
|
|
10
|
+
extends: [
|
|
11
|
+
require.resolve("./common-base.js"),
|
|
12
|
+
require.resolve("./common-essential.js"),
|
|
13
|
+
],
|
|
14
|
+
rules: {
|
|
15
|
+
// Vue3 专用 essential 规则
|
|
16
|
+
|
|
17
|
+
// 禁止 data 使用废弃的对象定义方式
|
|
18
|
+
// https://eslint.vuejs.org/rules/no-deprecated-data-object-declaration.html
|
|
19
|
+
"vue/no-deprecated-data-object-declaration": "error",
|
|
20
|
+
|
|
21
|
+
// 禁止使用废弃的销毁生命周期(destroyed、beforeDestroy)
|
|
22
|
+
// https://eslint.vuejs.org/rules/no-deprecated-destroyed-lifecycle.html
|
|
23
|
+
"vue/no-deprecated-destroyed-lifecycle": "error",
|
|
24
|
+
|
|
25
|
+
// 禁止使用废弃的 $listeners
|
|
26
|
+
// https://eslint.vuejs.org/rules/no-deprecated-dollar-listeners-api.html
|
|
27
|
+
"vue/no-deprecated-dollar-listeners-api": "error",
|
|
28
|
+
|
|
29
|
+
// 禁止使用废弃的 $scopedSlots
|
|
30
|
+
// https://eslint.vuejs.org/rules/no-deprecated-dollar-scopedslots-api.html
|
|
31
|
+
"vue/no-deprecated-dollar-scopedslots-api": "error",
|
|
32
|
+
|
|
33
|
+
// 禁止使用废弃的事件api($on 等)
|
|
34
|
+
// https://eslint.vuejs.org/rules/no-deprecated-events-api.html
|
|
35
|
+
"vue/no-deprecated-events-api": "error",
|
|
36
|
+
|
|
37
|
+
// 禁止使用废弃的过滤器语法
|
|
38
|
+
// https://eslint.vuejs.org/rules/no-deprecated-filter.html
|
|
39
|
+
"vue/no-deprecated-filter": "error",
|
|
40
|
+
|
|
41
|
+
// 禁止使用废弃的 functional 模板(<template functional>)
|
|
42
|
+
// https://eslint.vuejs.org/rules/no-deprecated-functional-template.html
|
|
43
|
+
"vue/no-deprecated-functional-template": "error",
|
|
44
|
+
|
|
45
|
+
// 禁止使用废弃的 html 标签 is 属性
|
|
46
|
+
// https://eslint.vuejs.org/rules/no-deprecated-html-element-is.html
|
|
47
|
+
"vue/no-deprecated-html-element-is": "error",
|
|
48
|
+
|
|
49
|
+
// 禁止使用废弃的 inline-template 属性
|
|
50
|
+
// https://eslint.vuejs.org/rules/no-deprecated-inline-template.html
|
|
51
|
+
"vue/no-deprecated-inline-template": "error",
|
|
52
|
+
|
|
53
|
+
// 禁止使用废弃的 props 默认函数中访问 this
|
|
54
|
+
// https://eslint.vuejs.org/rules/no-deprecated-props-default-this.html
|
|
55
|
+
"vue/no-deprecated-props-default-this": "error",
|
|
56
|
+
|
|
57
|
+
// 禁止使用废弃的 RouterLink tag 属性
|
|
58
|
+
// https://eslint.vuejs.org/rules/no-deprecated-router-link-tag-prop.html
|
|
59
|
+
"vue/no-deprecated-router-link-tag-prop": "error",
|
|
60
|
+
|
|
61
|
+
// 禁止使用废弃的 scope 属性
|
|
62
|
+
// https://eslint.vuejs.org/rules/no-deprecated-scope-attribute.html
|
|
63
|
+
"vue/no-deprecated-scope-attribute": "error",
|
|
64
|
+
|
|
65
|
+
// 禁止使用废弃的 slot 属性
|
|
66
|
+
// https://eslint.vuejs.org/rules/no-deprecated-slot-attribute.html
|
|
67
|
+
"vue/no-deprecated-slot-attribute": "error",
|
|
68
|
+
|
|
69
|
+
// 禁止使用废弃的 slot-scope 属性
|
|
70
|
+
// https://eslint.vuejs.org/rules/no-deprecated-slot-scope-attribute.html
|
|
71
|
+
"vue/no-deprecated-slot-scope-attribute": "error",
|
|
72
|
+
|
|
73
|
+
// 禁止使用废弃的 v-bind 指令的 .sync 修饰符
|
|
74
|
+
// https://eslint.vuejs.org/rules/no-deprecated-v-bind-sync.html
|
|
75
|
+
"vue/no-deprecated-v-bind-sync": "error",
|
|
76
|
+
|
|
77
|
+
// 禁止使用废弃的 v-is 指令
|
|
78
|
+
// https://eslint.vuejs.org/rules/no-deprecated-v-is.html
|
|
79
|
+
"vue/no-deprecated-v-is": "error",
|
|
80
|
+
|
|
81
|
+
// 禁止使用废弃的 .native 修饰符
|
|
82
|
+
// https://eslint.vuejs.org/rules/no-deprecated-v-on-native-modifier.html
|
|
83
|
+
"vue/no-deprecated-v-on-native-modifier": "error",
|
|
84
|
+
|
|
85
|
+
// 禁止使用废弃的数字(键码)修饰符
|
|
86
|
+
// https://eslint.vuejs.org/rules/no-deprecated-v-on-number-modifiers.html
|
|
87
|
+
"vue/no-deprecated-v-on-number-modifiers": "error",
|
|
88
|
+
|
|
89
|
+
// 禁止使用废弃的 Vue.config.keyCodes 配置
|
|
90
|
+
// https://eslint.vuejs.org/rules/no-deprecated-vue-config-keycodes.html
|
|
91
|
+
"vue/no-deprecated-vue-config-keycodes": "error",
|
|
92
|
+
|
|
93
|
+
// 禁止把 expose、defineExpose 放在 await 异步函数之后
|
|
94
|
+
// https://eslint.vuejs.org/rules/no-expose-after-await.html
|
|
95
|
+
"vue/no-expose-after-await": "error",
|
|
96
|
+
|
|
97
|
+
// 禁止把生命周期函数放在 await 异步函数之后
|
|
98
|
+
// https://eslint.vuejs.org/rules/no-lifecycle-after-await.html
|
|
99
|
+
"vue/no-lifecycle-after-await": "error",
|
|
100
|
+
|
|
101
|
+
// 禁止把 watch 放在 await 异步函数之后
|
|
102
|
+
// https://eslint.vuejs.org/rules/no-watch-after-await.html
|
|
103
|
+
"vue/no-watch-after-await": "error",
|
|
104
|
+
|
|
105
|
+
// <template v-for> 的 key 不能放在子元素上(放在自身)
|
|
106
|
+
// https://eslint.vuejs.org/rules/no-v-for-template-key-on-child.html
|
|
107
|
+
"vue/no-v-for-template-key-on-child": "error",
|
|
108
|
+
|
|
109
|
+
// 强制从“vue”导入,而不是从“@vue/*”导入
|
|
110
|
+
// https://eslint.vuejs.org/rules/prefer-import-from-vue.html
|
|
111
|
+
"vue/prefer-import-from-vue": "error",
|
|
112
|
+
|
|
113
|
+
// 强制 $slots 属性必须是一个函数
|
|
114
|
+
// https://eslint.vuejs.org/rules/require-slots-as-functions.html
|
|
115
|
+
"vue/require-slots-as-functions": "error",
|
|
116
|
+
|
|
117
|
+
// <transition> 的内容必须有效
|
|
118
|
+
// https://eslint.vuejs.org/rules/require-toggle-inside-transition.html
|
|
119
|
+
"vue/require-toggle-inside-transition": "error",
|
|
120
|
+
|
|
121
|
+
// 强制使用有效的 v-is
|
|
122
|
+
// https://eslint.vuejs.org/rules/valid-v-is.html
|
|
123
|
+
"vue/valid-v-is": "error",
|
|
124
|
+
|
|
125
|
+
// 强制使用有效的 v-memo
|
|
126
|
+
// https://eslint.vuejs.org/rules/valid-v-memo.html
|
|
127
|
+
"vue/valid-v-memo": "error",
|
|
128
|
+
},
|
|
129
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// 推荐的规则(plugin:vue/vue3-recommended)
|
|
4
|
+
// 严格程度:高
|
|
5
|
+
// - plugin:vue/base
|
|
6
|
+
// - plugin:vue/vue3-essential
|
|
7
|
+
// - plugin:vue/vue3-strongly-recommended
|
|
8
|
+
// - common-recommended
|
|
9
|
+
// ==========================================================
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
extends: [
|
|
13
|
+
require.resolve("./vue3-strongly-recommended.js"),
|
|
14
|
+
require.resolve("./common-recommended.js"),
|
|
15
|
+
],
|
|
16
|
+
rules: {},
|
|
17
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// 强烈推荐的规则(plugin:vue/vue3-strongly-recommended)
|
|
4
|
+
// 严格程度:中
|
|
5
|
+
// - plugin:vue/base
|
|
6
|
+
// - plugin:vue/vue3-essential
|
|
7
|
+
// - common-strongly-recommended
|
|
8
|
+
// ==========================================================
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
extends: [
|
|
12
|
+
require.resolve("./vue3-essential.js"),
|
|
13
|
+
require.resolve("./common-strongly-recommended.js"),
|
|
14
|
+
],
|
|
15
|
+
rules: {
|
|
16
|
+
// $emit() 触发的事件必须在 emits 中声明
|
|
17
|
+
// https://eslint.vuejs.org/rules/require-explicit-emits.html
|
|
18
|
+
"vue/require-explicit-emits": "warn",
|
|
19
|
+
|
|
20
|
+
// 强制 v-on 事件名称的格式
|
|
21
|
+
// https://eslint.vuejs.org/rules/v-on-event-hyphenation.html
|
|
22
|
+
"vue/v-on-event-hyphenation": "warn",
|
|
23
|
+
},
|
|
24
|
+
};
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
|
|
2
|
+
// ==================================================================================
|
|
3
|
+
// Vue 可访问性标准
|
|
4
|
+
// 依赖包:eslint-plugin-vuejs-accessibility
|
|
5
|
+
// 文档:https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/tree/main/docs
|
|
6
|
+
// ==================================================================================
|
|
7
|
+
|
|
8
|
+
module.exports = {
|
|
9
|
+
plugins: ["vuejs-accessibility"],
|
|
10
|
+
rules: {
|
|
11
|
+
// 是否校验 emoji 表情
|
|
12
|
+
"vuejs-accessibility/accessible-emoji": "off",
|
|
13
|
+
|
|
14
|
+
// 标签必须含有 alt 属性
|
|
15
|
+
"vuejs-accessibility/alt-text": "off",
|
|
16
|
+
|
|
17
|
+
// 锚点要有内容
|
|
18
|
+
"vuejs-accessibility/anchor-has-content": [
|
|
19
|
+
"off",
|
|
20
|
+
{
|
|
21
|
+
"components": ["Anchor"],
|
|
22
|
+
"accessibleChildren": ["MyAccessibleText"],
|
|
23
|
+
"accessibleDirectives": ["myAccessibleDirective"],
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
|
|
27
|
+
// aria
|
|
28
|
+
// Accessible Rich Internet Applications(WAI-ARIA,简称 ARIA)
|
|
29
|
+
// 是能够让残障人士更加便利的访问 Web 内容和使用 Web 应用(特别是那些由 JavaScript 开发的)的一套机制。
|
|
30
|
+
// 最值得注意的是,它包含了一组属性,我们可以添加到 HTML 元素中,将更多的语义信息嵌入其中,这些信息可以被辅助技术读取。
|
|
31
|
+
"vuejs-accessibility/aria-props": "off",
|
|
32
|
+
"vuejs-accessibility/aria-role": "off",
|
|
33
|
+
"vuejs-accessibility/aria-unsupported-elements": "off",
|
|
34
|
+
|
|
35
|
+
// 可见的、非交互性的标签绑定 click 后,至少绑定一个键盘事件(keyup、keydown、keypress)
|
|
36
|
+
"vuejs-accessibility/click-events-have-key-events": "off",
|
|
37
|
+
|
|
38
|
+
// 每个表单元素必须关联 label 标签
|
|
39
|
+
"vuejs-accessibility/form-control-has-label": "off",
|
|
40
|
+
|
|
41
|
+
// 强制标题(h1,h2 等等)元素包含可访问的内容
|
|
42
|
+
"vuejs-accessibility/heading-has-content": [
|
|
43
|
+
"off",
|
|
44
|
+
{
|
|
45
|
+
"components": ["MyHeading"],
|
|
46
|
+
"accessibleChildren": ["MyAccessibleText"],
|
|
47
|
+
"accessibleDirectives": ["myAccessibleDirective"],
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
|
|
51
|
+
// iframe 元素必须要有 title 属性
|
|
52
|
+
"vuejs-accessibility/iframe-has-title": "off",
|
|
53
|
+
|
|
54
|
+
// 具有交互角色和交互处理程序(鼠标或按键)的元素必须是可聚焦的
|
|
55
|
+
"vuejs-accessibility/interactive-supports-focus": "off",
|
|
56
|
+
|
|
57
|
+
// 强制标签标记具有关联控件
|
|
58
|
+
"vuejs-accessibility/label-has-for": "off",
|
|
59
|
+
|
|
60
|
+
// 媒体元素标签要有标题
|
|
61
|
+
"vuejs-accessibility/media-has-caption": "off",
|
|
62
|
+
|
|
63
|
+
// 强制 @mouseenter/@mouseover/@mouseout/@mouseleave/@hover 必须伴随着 @focus/@blur
|
|
64
|
+
"vuejs-accessibility/mouse-events-have-key-events": "off",
|
|
65
|
+
|
|
66
|
+
// 强制元素上无 accesskey 快捷键属性
|
|
67
|
+
"vuejs-accessibility/no-access-key": "off",
|
|
68
|
+
|
|
69
|
+
// 强制元素上无自动聚焦属性
|
|
70
|
+
"vuejs-accessibility/no-autofocus": "off",
|
|
71
|
+
|
|
72
|
+
// 强制要求不使用分散注意力的元素(视觉分散的元素可能会导致视障用户的无障碍问题)
|
|
73
|
+
"vuejs-accessibility/no-distracting-elements": [
|
|
74
|
+
"off",
|
|
75
|
+
{
|
|
76
|
+
"elements": ["marquee", "blink"],
|
|
77
|
+
},
|
|
78
|
+
],
|
|
79
|
+
|
|
80
|
+
// 禁用 onchange 事件
|
|
81
|
+
"vuejs-accessibility/no-onchange": "off",
|
|
82
|
+
|
|
83
|
+
// 禁止多余的 role 属性
|
|
84
|
+
"vuejs-accessibility/no-redundant-roles": "off",
|
|
85
|
+
|
|
86
|
+
// 具有ARIA角色的元素必须具有该角色所需的所有属性
|
|
87
|
+
"vuejs-accessibility/role-has-required-aria-props": "off",
|
|
88
|
+
|
|
89
|
+
// 避免使用正tabindex属性值,以使页面流与键盘选项卡顺序同步
|
|
90
|
+
"vuejs-accessibility/tabindex-no-positive": "off",
|
|
91
|
+
},
|
|
92
|
+
};
|
package/package.json
CHANGED
|
@@ -1,28 +1,37 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@houheaven/eslint-config-helper",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Eslint 规则助手",
|
|
5
|
-
"author": "立树",
|
|
6
|
-
"main": "
|
|
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
|
-
"
|
|
26
|
-
"eslint": "^
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@houheaven/eslint-config-helper",
|
|
3
|
+
"version": "1.2.0",
|
|
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
|
+
}
|
package/vue2.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
// ===============================================================================
|
|
3
|
+
// @houheaven/eslint-config-helper/vue2
|
|
4
|
+
// -------------------------------------------------------------------------------
|
|
5
|
+
// - ./lib/configs/eslint.js : eslint 定制规则
|
|
6
|
+
// - ./lib/configs/import.js : eslint-plugin-import 定制规则
|
|
7
|
+
// - ./lib/configs/vue2.js : eslint-plugin-vue 定制规则
|
|
8
|
+
// - ./lib/rules/vuejs-accessibility : eslint-plugin-vuejs-accessibility 定制规则
|
|
9
|
+
// ===============================================================================
|
|
10
|
+
|
|
11
|
+
module.exports = {
|
|
12
|
+
extends: [
|
|
13
|
+
"./lib/configs/eslint.js",
|
|
14
|
+
"./lib/configs/import.js",
|
|
15
|
+
],
|
|
16
|
+
parserOptions: {
|
|
17
|
+
ecmaVersion: "latest",
|
|
18
|
+
sourceType: "module",
|
|
19
|
+
},
|
|
20
|
+
rules: {},
|
|
21
|
+
overrides: [
|
|
22
|
+
{
|
|
23
|
+
files: ["*.vue", "**/*.vue"],
|
|
24
|
+
extends: [
|
|
25
|
+
"./lib/configs/vue2.js",
|
|
26
|
+
"./lib/rules/vuejs-accessibility",
|
|
27
|
+
],
|
|
28
|
+
},
|
|
29
|
+
],
|
|
30
|
+
};
|
package/vue3.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
|
|
2
|
+
// ==========================================================
|
|
3
|
+
// @houheaven/eslint-config-helper/vue3
|
|
4
|
+
// ----------------------------------------------------------
|
|
5
|
+
// - ./lib/configs/eslint.js : eslint 定制规则
|
|
6
|
+
// - ./lib/configs/import.js : eslint-plugin-import 定制规则
|
|
7
|
+
// - ./lib/configs/vue3.js : eslint-plugin-vue 定制规则
|
|
8
|
+
// ==========================================================
|
|
9
|
+
|
|
10
|
+
module.exports = {
|
|
11
|
+
extends: [
|
|
12
|
+
"./lib/configs/eslint.js",
|
|
13
|
+
"./lib/configs/import.js",
|
|
14
|
+
],
|
|
15
|
+
parserOptions: {
|
|
16
|
+
ecmaVersion: "latest",
|
|
17
|
+
sourceType: "module",
|
|
18
|
+
},
|
|
19
|
+
rules: {},
|
|
20
|
+
overrides: [
|
|
21
|
+
{
|
|
22
|
+
files: ["*.vue", "**/*.vue"],
|
|
23
|
+
extends: [
|
|
24
|
+
"./lib/configs/vue3.js",
|
|
25
|
+
],
|
|
26
|
+
},
|
|
27
|
+
],
|
|
28
|
+
};
|
package/eslint/eslint-fix.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports = {
|
|
3
|
-
rules: {
|
|
4
|
-
// 强制使用一致的换行符风格
|
|
5
|
-
// Windows - "CRLF"
|
|
6
|
-
// Unix、Linux - "LF"
|
|
7
|
-
"linebreak-style": ["warn", "unix"],
|
|
8
|
-
// 强制在花括号中使用一致的空格
|
|
9
|
-
"object-curly-spacing": ["warn", "always", {
|
|
10
|
-
"arraysInObjects": false,
|
|
11
|
-
"objectsInObjects": true,
|
|
12
|
-
}],
|
|
13
|
-
// 要求对象字面量属性名称用引号括起来
|
|
14
|
-
"quote-props": ["warn", "consistent"],
|
|
15
|
-
// 要求或禁止使用拖尾逗号(对象、数组、函数参数的最后一项后面是否允许有逗号)
|
|
16
|
-
"comma-dangle": ["warn", {
|
|
17
|
-
arrays: "never",
|
|
18
|
-
objects: "always-multiline",
|
|
19
|
-
imports: "never",
|
|
20
|
-
exports: "never",
|
|
21
|
-
functions: "never",
|
|
22
|
-
}],
|
|
23
|
-
// 强制在对象字面量的键和值之间使用一致的空格
|
|
24
|
-
"key-spacing": ["warn", {
|
|
25
|
-
beforeColon: false,
|
|
26
|
-
afterColon: true,
|
|
27
|
-
}],
|
|
28
|
-
},
|
|
29
|
-
};
|
package/eslint/file-bof-eof.js
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
// 文件首尾空行
|
|
3
|
-
|
|
4
|
-
"use strict";
|
|
5
|
-
|
|
6
|
-
module.exports = {
|
|
7
|
-
rules: {
|
|
8
|
-
// 要求或禁止文件末尾存在空行
|
|
9
|
-
"eol-last": ["warn", "always"],
|
|
10
|
-
// 禁止出现多行空行
|
|
11
|
-
"no-multiple-empty-lines": ["warn", {
|
|
12
|
-
"max": 2,
|
|
13
|
-
"maxBOF": 1,
|
|
14
|
-
"maxEOF": 1,
|
|
15
|
-
}],
|
|
16
|
-
// 禁用行尾空白
|
|
17
|
-
"no-trailing-spaces": ["warn", {
|
|
18
|
-
"skipBlankLines": true,
|
|
19
|
-
"ignoreComments": false,
|
|
20
|
-
}],
|
|
21
|
-
},
|
|
22
|
-
};
|
package/eslint/index.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
module.exports = {
|
|
3
|
-
extends: [
|
|
4
|
-
"./rules/best-practices",
|
|
5
|
-
"./rules/possible-errors",
|
|
6
|
-
"./rules/node",
|
|
7
|
-
"./rules/stylistic-issues",
|
|
8
|
-
"./rules/variables",
|
|
9
|
-
"./rules/es6",
|
|
10
|
-
"./rules/imports",
|
|
11
|
-
"./rules/strict-mode"
|
|
12
|
-
],
|
|
13
|
-
parserOptions: {
|
|
14
|
-
ecmaVersion: 2018,
|
|
15
|
-
sourceType: "module",
|
|
16
|
-
},
|
|
17
|
-
rules: {},
|
|
18
|
-
};
|
package/eslint/legacy.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
extends: [
|
|
3
|
-
"./rules/best-practices",
|
|
4
|
-
"./rules/errors",
|
|
5
|
-
"./rules/node",
|
|
6
|
-
"./rules/style",
|
|
7
|
-
"./rules/variables"
|
|
8
|
-
].map(require.resolve),
|
|
9
|
-
env: {
|
|
10
|
-
browser: true,
|
|
11
|
-
node: true,
|
|
12
|
-
amd: false,
|
|
13
|
-
mocha: false,
|
|
14
|
-
jasmine: false,
|
|
15
|
-
},
|
|
16
|
-
rules: {
|
|
17
|
-
"comma-dangle": ["error", "never"],
|
|
18
|
-
"prefer-numeric-literals": "off",
|
|
19
|
-
"no-restricted-properties": ["error", {
|
|
20
|
-
object: "arguments",
|
|
21
|
-
property: "callee",
|
|
22
|
-
message: "arguments.callee is deprecated",
|
|
23
|
-
}, {
|
|
24
|
-
property: "__defineGetter__",
|
|
25
|
-
message: "Please use Object.defineProperty instead.",
|
|
26
|
-
}, {
|
|
27
|
-
property: "__defineSetter__",
|
|
28
|
-
message: "Please use Object.defineProperty instead.",
|
|
29
|
-
}],
|
|
30
|
-
"no-var": "off",
|
|
31
|
-
"prefer-object-spread": "off",
|
|
32
|
-
"strict": ["error", "safe"],
|
|
33
|
-
},
|
|
34
|
-
};
|