@houheaven/eslint-config-helper 1.1.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.
Files changed (43) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +112 -54
  3. package/format.js +40 -0
  4. package/html.js +32 -0
  5. package/index.js +18 -0
  6. package/lib/configs/eslint-es5.js +24 -0
  7. package/lib/configs/eslint.js +10 -11
  8. package/lib/configs/format-html.js +22 -0
  9. package/lib/configs/format-js.js +134 -0
  10. package/lib/configs/{prettier.js → format-prettier.js} +19 -18
  11. package/lib/configs/{vue-format.js → format-vue.js} +184 -221
  12. package/lib/configs/html.js +20 -0
  13. package/lib/configs/import-bugfix.js +36 -0
  14. package/lib/configs/import.js +44 -0
  15. package/lib/configs/vue2.js +7 -0
  16. package/lib/configs/vue3.js +7 -0
  17. package/lib/rules/eslint/best-practices.js +10 -10
  18. package/lib/rules/eslint/es6.js +1 -2
  19. package/lib/rules/eslint/possible-errors.js +8 -3
  20. package/lib/rules/eslint/stylistic-issues.js +14 -17
  21. package/lib/rules/eslint/variables.js +12 -10
  22. package/lib/rules/html/accessibility.js +44 -0
  23. package/lib/rules/html/best-practice.js +64 -0
  24. package/lib/rules/html/seo.js +24 -0
  25. package/lib/rules/html/style.js +32 -0
  26. package/lib/rules/import/helpful-warnings.js +68 -0
  27. package/lib/rules/import/module-systems.js +34 -0
  28. package/lib/rules/import/static-analysis.js +69 -0
  29. package/lib/rules/import/style-guide.js +97 -0
  30. package/lib/rules/vue/common-eslint.js +17 -6
  31. package/lib/rules/vue/common-extra.js +5 -4
  32. package/lib/rules/vue/common-recommended.js +1 -1
  33. package/lib/rules/vue/common-strongly-recommended.js +2 -2
  34. package/lib/rules/vuejs-accessibility/index.js +92 -0
  35. package/package.json +37 -29
  36. package/vue2.js +30 -0
  37. package/vue3.js +28 -0
  38. package/lib/configs/file-bof-eof.js +0 -20
  39. package/lib/configs/legacy.js +0 -34
  40. package/lib/configs/vuejs-accessibility.js +0 -20
  41. package/lib/eslint-fix.js +0 -29
  42. package/lib/index.js +0 -14
  43. package/lib/rules/imports.js +0 -279
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
@@ -1,54 +1,112 @@
1
-
2
- # @houheaven/eslint-config-helper
3
-
4
- > Eslint 规则助手
5
-
6
-
7
- ## 安装
8
-
9
- ```sh
10
- npm install --dev @houheaven/eslint-config-helper
11
- ```
12
-
13
- 请确保你已经安装了 `eslint`
14
-
15
- ## 用法
16
-
17
- 在 Eslint 配置文件中的 `"extends"` 数组里添加 `"@houheaven/eslint-config-helper"`
18
-
19
- ```js
20
- // .eslintrc.js
21
-
22
- module.exports = {
23
- extends: [
24
- // ... 其他配置
25
- "@houheaven/eslint-config-helper"
26
- ]
27
- }
28
- ```
29
-
30
- ## 修改 Eslint 规则
31
-
32
- Eslint 官网:http://eslint.org/
33
-
34
- 在 Eslint 配置文件中的 `"rules"` 里添加规则配置。
35
-
36
- ```js
37
- // .eslintrc.js
38
-
39
- module.exports = {
40
- rules: {
41
- "quotes": ["warn", "double"],
42
- "no-multiple-empty-lines": ["warn", {
43
- "max": 2,
44
- "maxBOF": 1,
45
- "maxEOF": 1
46
- }]
47
- }
48
- };
49
- ```
50
-
51
- ## 更多
52
-
53
- 功能依赖:
54
- - [`eslint`](https://www.npmjs.com/package/eslint)
1
+
2
+ # @houheaven/eslint-config-helper
3
+
4
+ > Eslint 规则助手
5
+ > 主要功能是处理 html、JavaScript、Vue 中的语法校验、代码格式化
6
+
7
+
8
+ ## 特点
9
+ - 内置了 `Eslint`,并对其规则进行了优化
10
+ - 内置了 `eslint-plugin-import`,并对其规则进行了优化
11
+ - 内置了 `eslint-plugin-vue`,并对其规则进行了优化
12
+ - 内置了 `eslint-plugin-vuejs-accessibility`,并对其规则进行了优化
13
+ - 内置了 `@html-eslint/eslint-plugin`,并对其规则进行了优化
14
+ - 支持 html、JavaScript、Vue2、Vue3
15
+
16
+
17
+ ## 安装
18
+
19
+ ```sh
20
+ npm install --dev @houheaven/eslint-config-helper
21
+ ```
22
+
23
+ ## 用法
24
+
25
+ 在 Eslint 配置文件中的 `"extends"` 数组里添加 `"@houheaven/eslint-config-helper"`
26
+
27
+ ```js
28
+ // .eslintrc.js
29
+
30
+ module.exports = {
31
+ extends: [
32
+ // ... 其他配置
33
+ "@houheaven/eslint-config-helper"
34
+ ]
35
+ };
36
+ ```
37
+
38
+ 我们提供了多种模式,分别用来处理不同的场景
39
+ | 模式名称 | 功能说明 | 适用场景 |
40
+ | ------ | ------ | ------ |
41
+ | @houheaven/eslint-config-helper | `语法校验` `代码格式化` | `js` |
42
+ | @houheaven/eslint-config-helper/vue2 | `语法校验` `代码格式化` | `js` `vue2` |
43
+ | @houheaven/eslint-config-helper/vue3 | `语法校验` `代码格式化` | `js` `vue3` |
44
+ | @houheaven/eslint-config-helper/html | `语法校验` `代码格式化` | `js` `html` |
45
+ | @houheaven/eslint-config-helper/format | `代码格式化` | `js` `vue2` `vue3` |
46
+
47
+
48
+ ## 修改 Eslint 规则
49
+
50
+ 在 Eslint 配置文件中的 `"rules"` 里添加规则。
51
+
52
+ ```js
53
+ // .eslintrc.js
54
+
55
+ module.exports = {
56
+ // eslint 其他配置
57
+ // ……
58
+ rules: {
59
+ // js 规则
60
+ "quotes": ["warn", "double"],
61
+ "no-multiple-empty-lines": ["warn", {
62
+ max: 2,
63
+ maxBOF: 1,
64
+ maxEOF: 1
65
+ }],
66
+ // import 规则
67
+ "import/first": "error",
68
+ "import/no-unresolved": ["error", {
69
+ commonjs: true,
70
+ caseSensitive: true,
71
+ }],
72
+ // vue 规则
73
+ "vue/eqeqeq": ["error", "always", { null: "ignore" }],
74
+ "vue/custom-event-name-casing": ["warn", "kebab-case"],
75
+ // vuejs-accessibility 规则
76
+ "vuejs-accessibility/alt-text": "off",
77
+ "vuejs-accessibility/no-onchange": "off",
78
+ // html 规则
79
+ "@html-eslint/require-title": "error",
80
+ "@html-eslint/no-duplicate-id": "error",
81
+ }
82
+ };
83
+ ```
84
+
85
+ - 查看 [`Eslint 规则文档`](https://www.npmjs.com/package/eslint)
86
+ - 查看 [`eslint-plugin-import 规则文档`](https://www.npmjs.com/package/eslint-plugin-import)
87
+ - 查看 [`eslint-plugin-vue 规则文档`](https://eslint.vuejs.org/rules/)
88
+ - 查看 [`eslint-plugin-vuejs-accessibility 规则文档`](https://github.com/vue-a11y/eslint-plugin-vuejs-accessibility/tree/main/docs)
89
+ - 查看 [`@html-eslint 规则文档`](https://yeonjuan.github.io/html-eslint/docs/getting-started.html)
90
+
91
+ <!--
92
+ ## 常见问题
93
+
94
+ ### Vue3 中会产生 import/no-unresolved 错误
95
+
96
+ 解决方案:https://stackoverflow.com/questions/67835072/vue-3-on-vite-js-with-eslint-unable-to-resolve-path-to-module-eslintimport-no
97
+ 依赖包:[`eslint-import-resolver-alias`](https://www.npmjs.com/package/eslint-import-resolver-alias)
98
+ -->
99
+
100
+ ## 更多
101
+
102
+ 功能依赖:
103
+ - [`eslint`](https://www.npmjs.com/package/eslint)
104
+ - [`eslint-plugin-import`](https://www.npmjs.com/package/eslint-plugin-import)
105
+ - [`eslint-plugin-vue`](https://www.npmjs.com/package/eslint-plugin-vue)
106
+ - [`eslint-plugin-vuejs-accessibility`](https://www.npmjs.com/package/eslint-plugin-vuejs-accessibility)
107
+ - [`eslint-plugin-html`](https://www.npmjs.com/package/eslint-plugin-html)
108
+ - [`eslint-import-resolver-alias`](https://www.npmjs.com/package/eslint-import-resolver-alias)
109
+ - [`eslint-import-resolver-node`](https://www.npmjs.com/package/eslint-import-resolver-node)
110
+ - [`eslint-import-resolver-webpack`](https://www.npmjs.com/package/eslint-import-resolver-webpack)
111
+ - [`@html-eslint/eslint-plugin`](https://www.npmjs.com/package/@html-eslint/eslint-plugin)
112
+ - [`@html-eslint/parser`](https://www.npmjs.com/package/@html-eslint/parser)
package/format.js ADDED
@@ -0,0 +1,40 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper/format
4
+ // ----------------------------------------------------------
5
+ // 说明:代码格式化,功能非常的基础、安全
6
+ // - ./lib/configs/format-js.js : js 定制规则
7
+ // - ./lib/configs/format-vue.js : vue 定制规则
8
+ // - ./lib/configs/format-html.js : html 定制规则
9
+ // ==========================================================
10
+
11
+ module.exports = {
12
+ extends: [
13
+ "./lib/configs/format-js.js",
14
+ ],
15
+ parserOptions: {
16
+ ecmaVersion: "latest",
17
+ sourceType: "module",
18
+ },
19
+ overrides: [
20
+ {
21
+ files: ["*.vue", "**/*.vue"],
22
+ extends: [
23
+ "./lib/rules/vue/common-base.js",
24
+ "./lib/configs/format-vue.js",
25
+ ],
26
+ rules: {
27
+ "indent": "off",
28
+ },
29
+ },
30
+ {
31
+ files: ["*.html", "**/*.html", "*.htm", "**/*.htm"],
32
+ extends: [
33
+ "./lib/configs/format-html.js",
34
+ ],
35
+ rules: {
36
+ "eol-last": ["warn", "never"],
37
+ },
38
+ },
39
+ ],
40
+ };
package/html.js ADDED
@@ -0,0 +1,32 @@
1
+
2
+ // ===============================================================================
3
+ // @houheaven/eslint-config-helper/html
4
+ // -------------------------------------------------------------------------------
5
+ // - ./lib/configs/eslint-es5.j : Eslint ES5 定制规则
6
+ // - ./lib/configs/html.js : @html-eslint/eslint-plugin 定制规则
7
+ // ===============================================================================
8
+
9
+ module.exports = {
10
+ extends: [
11
+ "./lib/configs/eslint-es5.js",
12
+ ],
13
+ overrides: [
14
+ {
15
+ files: ["*.html", "**/*.html", "*.htm", "**/*.htm"],
16
+ extends: ["./lib/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
+ },
31
+ ],
32
+ };
package/index.js ADDED
@@ -0,0 +1,18 @@
1
+
2
+ // ==========================================================
3
+ // @houheaven/eslint-config-helper
4
+ // ----------------------------------------------------------
5
+ // - ./lib/configs/eslint.js : eslint 定制规则
6
+ // - ./lib/configs/import.js : eslint-plugin-import 定制规则
7
+ // ==========================================================
8
+
9
+ module.exports = {
10
+ extends: [
11
+ "./lib/configs/eslint.js",
12
+ "./lib/configs/import.js",
13
+ ],
14
+ parserOptions: {
15
+ ecmaVersion: "latest",
16
+ sourceType: "module",
17
+ },
18
+ };
@@ -0,0 +1,24 @@
1
+
2
+ // ==========================================================
3
+ // Eslint ES5 规则
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ env: {
8
+ browser: true,
9
+ jquery: true,
10
+ },
11
+ parserOptions: {
12
+ ecmaVersion: 5,
13
+ sourceType: "script",
14
+ },
15
+ extends: [
16
+ "../rules/eslint/best-practices.js",
17
+ "../rules/eslint/possible-errors.js",
18
+ "../rules/eslint/stylistic-issues.js",
19
+ "../rules/eslint/strict-mode.js",
20
+ "../rules/eslint/variables.js",
21
+ // "../rules/eslint/node.js",
22
+ // "../rules/eslint/es6.js",
23
+ ].map(require.resolve),
24
+ };
@@ -1,18 +1,9 @@
1
1
 
2
2
  // ==========================================================
3
- // eslint 规则
3
+ // Eslint 规则
4
4
  // ==========================================================
5
5
 
6
6
  module.exports = {
7
- extends: [
8
- "../rules/eslint/best-practices.js",
9
- "../rules/eslint/possible-errors.js",
10
- "../rules/eslint/stylistic-issues.js",
11
- "../rules/eslint/strict-mode.js",
12
- "../rules/eslint/es6.js",
13
- "../rules/eslint/node.js",
14
- "../rules/eslint/variables.js",
15
- ].map(require.resolve),
16
7
  env: {
17
8
  browser: true,
18
9
  node: true,
@@ -20,5 +11,13 @@ module.exports = {
20
11
  mocha: false,
21
12
  jasmine: false,
22
13
  },
23
- rules: {},
14
+ extends: [
15
+ "../rules/eslint/best-practices.js",
16
+ "../rules/eslint/possible-errors.js",
17
+ "../rules/eslint/stylistic-issues.js",
18
+ "../rules/eslint/strict-mode.js",
19
+ "../rules/eslint/variables.js",
20
+ "../rules/eslint/node.js",
21
+ "../rules/eslint/es6.js",
22
+ ].map(require.resolve),
24
23
  };
@@ -0,0 +1,22 @@
1
+
2
+ // ==========================================================
3
+ // html 文件代码格式化
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ parser: "@html-eslint/parser",
8
+ plugins: ["@html-eslint"],
9
+ rules: {
10
+ // 要求设置 <!DOCTYPE html> 文档申明
11
+ "@html-eslint/require-doctype": "warn",
12
+
13
+ // 要求标签闭合
14
+ "@html-eslint/require-closing-tags": ["warn", { selfClosing: "always" }],
15
+
16
+ // 强制使用一致的引号
17
+ "@html-eslint/quotes": ["warn", "double"],
18
+
19
+ // 禁止出现多个空行
20
+ "@html-eslint/no-multiple-empty-lines": ["warn", { max: 2 }],
21
+ },
22
+ };
@@ -0,0 +1,134 @@
1
+
2
+ // ==========================================================
3
+ // JS 文件代码格式化
4
+ // ==========================================================
5
+
6
+ module.exports = {
7
+ rules: {
8
+ // Best Practices - 最佳实践
9
+ // "eqeqeq": ["error", "always", { null: "ignore" }],
10
+
11
+ // ES6
12
+ "arrow-parens": ["warn", "as-needed"],
13
+ "arrow-spacing": ["warn", {
14
+ before: true,
15
+ after: true,
16
+ }],
17
+ "arrow-body-style": ["error", "as-needed", {
18
+ requireReturnForObjectLiteral: false,
19
+ }],
20
+ "prefer-template": "warn",
21
+ "template-curly-spacing": "warn",
22
+
23
+ // Stylistic Issues
24
+ "quotes": ["warn", "double", { "avoidEscape": true }],
25
+ "linebreak-style": ["warn", "unix"],
26
+ "comma-spacing": ["warn", {
27
+ before: false,
28
+ after: true,
29
+ }],
30
+ "comma-dangle": ["warn", {
31
+ arrays: "always-multiline",
32
+ objects: "always-multiline",
33
+ imports: "always-multiline",
34
+ exports: "always-multiline",
35
+ functions: "never",
36
+ }],
37
+ "keyword-spacing": ["warn", {
38
+ "before": true,
39
+ "after": true,
40
+ "overrides": {
41
+ "if": { "after": true },
42
+ "for": { "after": false },
43
+ "while": { "after": false },
44
+ "switch": { "after": false },
45
+ "case": { "after": true },
46
+ "catch": { "after": false },
47
+ "return": { "after": true },
48
+ "throw": { "after": true },
49
+ },
50
+ }],
51
+ "object-curly-spacing": ["warn", "always", {
52
+ arraysInObjects: true,
53
+ objectsInObjects: true,
54
+ }],
55
+ "object-curly-newline": ["warn", {
56
+ ObjectExpression: { minProperties: 40, multiline: true, consistent: true },
57
+ ObjectPattern: "never",
58
+ ImportDeclaration: "never",
59
+ ExportDeclaration: "always",
60
+ }],
61
+ "array-bracket-spacing": ["warn", "never"],
62
+ "space-in-parens": ["warn", "never"],
63
+ "space-infix-ops": "warn",
64
+ "semi-spacing": ["error", { before: false, after: true }],
65
+ "space-before-blocks": ["warn", {
66
+ "functions": "always",
67
+ "keywords": "always",
68
+ "classes": "always",
69
+ }],
70
+ "brace-style": ["warn", "stroustrup", { "allowSingleLine": true }],
71
+
72
+
73
+ // 文件首尾空行
74
+
75
+ // 要求或禁止文件末尾存在空行
76
+ "eol-last": ["warn", "always"],
77
+
78
+ // 禁止出现多行空行
79
+ "no-multiple-empty-lines": ["warn", {
80
+ "max": 2,
81
+ "maxBOF": 1,
82
+ "maxEOF": 1,
83
+ }],
84
+
85
+ // 禁用行尾空白
86
+ "no-trailing-spaces": ["warn", {
87
+ "skipBlankLines": true,
88
+ "ignoreComments": false,
89
+ }],
90
+
91
+ // 强制使用一致的缩进
92
+ "indent": ["error", 2, {
93
+ SwitchCase: 1,
94
+ VariableDeclarator: 1,
95
+ outerIIFEBody: 1,
96
+ // MemberExpression: null,
97
+ FunctionDeclaration: {
98
+ parameters: 1,
99
+ body: 1,
100
+ },
101
+ FunctionExpression: {
102
+ parameters: 1,
103
+ body: 1,
104
+ },
105
+ CallExpression: {
106
+ arguments: 1,
107
+ },
108
+ ArrayExpression: 1,
109
+ ObjectExpression: 1,
110
+ ImportDeclaration: 1,
111
+ flatTernaryExpressions: false,
112
+ // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
113
+ ignoredNodes: [
114
+ "JSXElement",
115
+ "JSXElement > *",
116
+ "JSXAttribute",
117
+ "JSXIdentifier",
118
+ "JSXNamespacedName",
119
+ "JSXMemberExpression",
120
+ "JSXSpreadAttribute",
121
+ "JSXExpressionContainer",
122
+ "JSXOpeningElement",
123
+ "JSXClosingElement",
124
+ "JSXFragment",
125
+ "JSXOpeningFragment",
126
+ "JSXClosingFragment",
127
+ "JSXText",
128
+ "JSXEmptyExpression",
129
+ "JSXSpreadChild",
130
+ ],
131
+ ignoreComments: false,
132
+ }],
133
+ },
134
+ };
@@ -1,7 +1,20 @@
1
1
 
2
- const includeDeprecated = !process.env.ESLINT_CONFIG_PRETTIER_NO_DEPRECATED;
2
+ // ==========================================================
3
+ // 此文件是 Prettier 与 Eslint 共用时,会产生冲突的规则列表
4
+ // 此处仅仅是做一个记录,目前暂无应用
5
+ // ==========================================================
3
6
 
4
7
  module.exports = {
8
+ env: {
9
+ browser: true,
10
+ commonjs: true,
11
+ node: true,
12
+ es2021: true,
13
+ },
14
+ parserOptions: {
15
+ ecmaVersion: 2021,
16
+ sourceType: "module",
17
+ },
5
18
  rules: {
6
19
  // 在某些情况下,可以使用以下规则,阅读 README 获取更多信息
7
20
  // 它们用“0”而不是“off”标记,以便脚本可以区分它们
@@ -32,7 +45,7 @@ module.exports = {
32
45
 
33
46
  // 禁止混合使用不同的操作符
34
47
  "no-mixed-operators": [
35
- "error",
48
+ "off",
36
49
  {
37
50
  "groups": [
38
51
  ["+", "-", "*", "/", "%", "**"],
@@ -46,7 +59,7 @@ module.exports = {
46
59
  ],
47
60
 
48
61
  // 禁用 tab
49
- "no-tabs": "error",
62
+ "no-tabs": "warn",
50
63
 
51
64
  // 禁止出现令人困惑的多行表达式
52
65
  "no-unexpected-multiline": "error",
@@ -276,7 +289,7 @@ module.exports = {
276
289
 
277
290
  // 强制在花括号中使用一致的空格
278
291
  "object-curly-spacing": ["warn", "always", {
279
- arraysInObjects: false,
292
+ arraysInObjects: true,
280
293
  objectsInObjects: true,
281
294
  }],
282
295
 
@@ -317,8 +330,8 @@ module.exports = {
317
330
  }],
318
331
 
319
332
  // 强制在 function 的左括号之前使用一致的空格
320
- "space-before-function-paren": ["error", {
321
- "anonymous": "always",
333
+ "space-before-function-paren": ["warn", {
334
+ "anonymous": "never",
322
335
  "named": "never",
323
336
  "asyncArrow": "always",
324
337
  }],
@@ -461,17 +474,5 @@ module.exports = {
461
474
  "vue/template-curly-spacing": "off",
462
475
  "vue/html-self-closing": 0,
463
476
  "vue/max-len": 0,
464
-
465
- ...(includeDeprecated && {
466
- // Deprecated since version 4.0.0.
467
- // https://github.com/eslint/eslint/pull/8286
468
- "indent-legacy": "off",
469
- // Deprecated since version 3.3.0.
470
- // https://eslint.org/docs/rules/no-spaced-func
471
- "no-spaced-func": "off",
472
- // Deprecated since version 7.0.0.
473
- // https://github.com/yannickcr/eslint-plugin-react/blob/master/CHANGELOG.md#700---2017-05-06
474
- "react/jsx-space-before-closing": "off",
475
- }),
476
477
  },
477
478
  };