@houheaven/eslint-config-helper 2.0.0 → 3.0.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 (75) hide show
  1. package/README.md +155 -149
  2. package/exports.js +26 -0
  3. package/lib/html.js +88 -10
  4. package/lib/javascript-es5.js +44 -9
  5. package/lib/javascript-es6.js +52 -9
  6. package/lib/supports/support-es5.js +25 -0
  7. package/lib/supports/support-es6.js +35 -0
  8. package/lib/supports/support-html.js +41 -0
  9. package/lib/{support/import-support.js → supports/support-import.js} +16 -11
  10. package/lib/supports/support-typescript.js +34 -0
  11. package/lib/supports/support-vue2.js +46 -0
  12. package/lib/supports/support-vue3-ts.js +65 -0
  13. package/lib/supports/support-vue3.js +46 -0
  14. package/lib/typescript.js +54 -21
  15. package/lib/vue2.js +52 -11
  16. package/lib/vue3.js +95 -11
  17. package/node_modules/@houheaven/eslint-config-helper-core/package.json +7 -0
  18. package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/eslint/layout-formatting.js +0 -15
  19. package/node_modules/@houheaven/eslint-config-helper-core/rules/eslint/stylistic.js +24 -0
  20. package/node_modules/@houheaven/eslint-config-helper-core/summary.js +57 -0
  21. package/{lib → node_modules/@houheaven/eslint-config-helper-core}/utils/utils.js +1 -0
  22. package/package.json +29 -37
  23. package/lib/configs/format-prettier.js +0 -478
  24. package/lib/format-es5.js +0 -23
  25. package/lib/format-es6.js +0 -25
  26. package/lib/format-html.js +0 -23
  27. package/lib/format-import.js +0 -23
  28. package/lib/format-typescript.js +0 -28
  29. package/lib/format-vue2.js +0 -23
  30. package/lib/format-vue3.js +0 -23
  31. package/lib/import.js +0 -23
  32. package/lib/support/es5-support.js +0 -29
  33. package/lib/support/es6-support.js +0 -39
  34. package/lib/support/html-support.js +0 -38
  35. package/lib/support/import-bugfix.js +0 -65
  36. package/lib/support/typescript-support.js +0 -27
  37. package/lib/support/vue2-support.js +0 -43
  38. package/lib/support/vue3-support.js +0 -43
  39. package/lib/support/vue3-ts-support.js +0 -51
  40. package/lib/vue3-ts.js +0 -31
  41. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/eslint/_deprecated.js +0 -0
  42. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/eslint/_removed.js +0 -0
  43. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/eslint/es6.js +0 -0
  44. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/eslint/possible-errors.js +0 -0
  45. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/eslint/suggestions.js +0 -0
  46. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/html/accessibility.js +0 -0
  47. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/html/best-practice.js +0 -0
  48. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/html/seo.js +0 -0
  49. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/html/style.js +0 -0
  50. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/import/helpful-warnings.js +0 -0
  51. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/import/module-systems.js +0 -0
  52. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/import/static-analysis.js +0 -0
  53. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/import/style-guide.js +0 -0
  54. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/_deprecated.js +0 -0
  55. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/conflict.js +0 -0
  56. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/deprecated.js +0 -0
  57. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/extension.js +0 -0
  58. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/fixable.js +0 -0
  59. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/other.js +0 -0
  60. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/stylistic.js +0 -0
  61. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/suggestion.js +0 -0
  62. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/typescript/type-checked.js +0 -0
  63. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/_deprecated.js +0 -0
  64. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-base.js +0 -0
  65. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-essential.js +0 -0
  66. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-extension.js +0 -0
  67. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-recommended.js +0 -0
  68. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-strongly-recommended.js +0 -0
  69. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/common-uncategorized.js +0 -0
  70. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue2-essential.js +0 -0
  71. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue2-uncategorized.js +0 -0
  72. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue3-essential.js +0 -0
  73. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue3-strongly-recommended.js +0 -0
  74. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vue/vue3-uncategorized.js +0 -0
  75. /package/{lib → node_modules/@houheaven/eslint-config-helper-core}/rules/vuejs-accessibility/index.js +0 -0
@@ -0,0 +1,57 @@
1
+
2
+ // 统计数据
3
+ // 使用方式:node summary.js
4
+
5
+ const allRules = require("./rules/html/accessibility.js").rules;
6
+
7
+ // 统计函数
8
+ function countRulesByLevel(rulesObj) {
9
+ const summary = {
10
+ off: {
11
+ num: 0,
12
+ rules: {},
13
+ },
14
+ warn: {
15
+ num: 0,
16
+ rules: {},
17
+ },
18
+ error: {
19
+ num: 0,
20
+ rules: {},
21
+ },
22
+ };
23
+
24
+ for(const [ruleName, ruleConfig] of Object.entries(rulesObj)) {
25
+ let level;
26
+
27
+ if (typeof ruleConfig === "string") {
28
+ level = ruleConfig;
29
+ }
30
+ else if (Array.isArray(ruleConfig) && ruleConfig.length > 0) {
31
+ level = ruleConfig[0];
32
+ }
33
+
34
+ if (level && summary[level]) {
35
+ summary[level].num++;
36
+ summary[level].rules[ruleName] = ruleConfig;
37
+ }
38
+ }
39
+
40
+ return summary;
41
+ }
42
+
43
+ // 执行统计
44
+ const summary = countRulesByLevel(allRules);
45
+
46
+ // 输出统计结果
47
+ console.log("规则统计结果:");
48
+ console.log(`off 级别: ${summary.off.num} 条规则`);
49
+ console.log(`warn 级别: ${summary.warn.num} 条规则`);
50
+ console.log(`error 级别: ${summary.error.num} 条规则`);
51
+
52
+ // 详细规则列表
53
+ console.log("\n详细规则列表:");
54
+ for(const level of ["off", "warn", "error"]) {
55
+ console.log(`\n${level.toUpperCase()} 级别规则 (${summary[level].num}):`);
56
+ console.log(Object.keys(summary[level].rules));
57
+ }
@@ -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,33 +1,23 @@
1
1
  {
2
2
  "name": "@houheaven/eslint-config-helper",
3
- "version": "2.0.0",
4
- "description": "Eslint 规则助手",
3
+ "version": "3.0.0",
4
+ "description": "Eslint 规则助手 (Flat Config)",
5
5
  "author": "立树",
6
6
  "license": "MIT",
7
7
  "private": false,
8
+ "type": "module",
9
+ "publishConfig": {
10
+ "access": "public",
11
+ "tag": "next"
12
+ },
8
13
  "keywords": [
9
14
  "houheaven",
10
- "eslint"
15
+ "eslint",
16
+ "eslint-config-helper"
11
17
  ],
12
- "main": "lib/javascript-es6.js",
18
+ "main": "./exports.js",
13
19
  "exports": {
14
- ".": "./lib/javascript-es6.js",
15
- "./es6": "./lib/javascript-es6.js",
16
- "./es5": "./lib/javascript-es5.js",
17
- "./typescript": "./lib/typescript.js",
18
- "./import": "./lib/import.js",
19
- "./vue2": "./lib/vue2.js",
20
- "./vue3": "./lib/vue3.js",
21
- "./vue3-ts": "./lib/vue3-ts.js",
22
- "./html": "./lib/html.js",
23
- "./format-es5": "./lib/format-es5.js",
24
- "./format-es6": "./lib/format-es6.js",
25
- "./format-typescript": "./lib/format-typescript.js",
26
- "./format-import": "./lib/format-import.js",
27
- "./format-vue2": "./lib/format-vue2.js",
28
- "./format-vue3": "./lib/format-vue3.js",
29
- "./format-html": "./lib/format-html.js",
30
- "./utils": "./lib/utils/utils.js"
20
+ ".": "./exports.js"
31
21
  },
32
22
  "repository": {
33
23
  "type": "git",
@@ -37,28 +27,30 @@
37
27
  "url": "https://gitee.com/houheaven/eslint-config-helper/issues"
38
28
  },
39
29
  "homepage": "https://gitee.com/houheaven/eslint-config-helper",
40
- "scripts": {
41
- "lint": "eslint .",
42
- "lint-fix": "eslint . --fix"
43
- },
44
30
  "dependencies": {
45
- "@html-eslint/eslint-plugin": "0.43.0",
46
- "@html-eslint/parser": "0.43.0",
47
- "@stylistic/eslint-plugin": "3.1.0",
48
- "@typescript-eslint/eslint-plugin": "8.50.1",
49
- "@typescript-eslint/parser": "8.50.1",
50
- "eslint-import-resolver-alias": "1.1.2",
51
- "eslint-import-resolver-node": "0.3.6",
52
- "eslint-import-resolver-webpack": "0.13.2",
53
- "eslint-plugin-html": "8.1.3",
31
+ "@html-eslint/eslint-plugin": "0.58.1",
32
+ "@html-eslint/parser": "0.58.1",
33
+ "@stylistic/eslint-plugin": "5.10.0",
34
+ "@typescript-eslint/eslint-plugin": "8.57.0",
35
+ "@typescript-eslint/parser": "8.57.0",
36
+ "eslint-plugin-html": "8.1.4",
54
37
  "eslint-plugin-import": "2.32.0",
55
- "eslint-plugin-vue": "9.33.0"
38
+ "eslint-plugin-vue": "9.33.0",
39
+ "globals": "17.4.0",
40
+ "vue-eslint-parser": "^9.4.0",
41
+ "@houheaven/eslint-config-helper-core": "1.0.0"
56
42
  },
57
43
  "devDependencies": {
58
- "eslint": "8.57.1",
44
+ "eslint": "9.39.4",
59
45
  "typescript": "5.9.3"
60
46
  },
61
47
  "peerDependencies": {
62
- "eslint": ">=8.57.1"
48
+ "eslint": "^9.0.0 || ^10.0.0"
49
+ },
50
+ "bundledDependencies": [
51
+ "@houheaven/eslint-config-helper-core"
52
+ ],
53
+ "scripts": {
54
+ "lint": "eslint ."
63
55
  }
64
56
  }
@@ -1,478 +0,0 @@
1
-
2
- // ==========================================================
3
- // 此文件是 Prettier 与 Eslint 共用时,会产生冲突的规则列表
4
- // 此处仅仅是做一个记录,目前暂无应用
5
- // ==========================================================
6
-
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
- },
18
- rules: {
19
- // 在某些情况下,可以使用以下规则,阅读 README 获取更多信息
20
- // 它们用“0”而不是“off”标记,以便脚本可以区分它们
21
-
22
- // 强制所有控制语句使用一致的括号风格
23
- "curly": 0,
24
-
25
- // 要求在注释周围有空行
26
- "lines-around-comment": 0,
27
-
28
- // 强制一行的最大长度
29
- "max-len": ["warn", {
30
- "code": 200,
31
- "tabWidth": 2,
32
- "comments": 200,
33
- "ignoreComments": false,
34
- "ignoreTrailingComments": true,
35
- "ignoreUrls": true,
36
- "ignoreStrings": true,
37
- "ignoreTemplateLiterals": true,
38
- "ignoreRegExpLiterals": true,
39
- }],
40
-
41
- // 禁止在可能与比较操作符相混淆的地方使用箭头函数
42
- "no-confusing-arrow": ["error", {
43
- "allowParens": true,
44
- }],
45
-
46
- // 禁止混合使用不同的操作符
47
- "no-mixed-operators": [
48
- "off",
49
- {
50
- "groups": [
51
- ["+", "-", "*", "/", "%", "**"],
52
- ["&", "|", "^", "~", "<<", ">>", ">>>"],
53
- ["==", "!=", "===", "!==", ">", ">=", "<", "<="],
54
- ["&&", "||"],
55
- ["in", "instanceof"],
56
- ],
57
- "allowSamePrecedence": true,
58
- },
59
- ],
60
-
61
- // 禁用 tab
62
- "no-tabs": "warn",
63
-
64
- // 禁止出现令人困惑的多行表达式
65
- "no-unexpected-multiline": "error",
66
-
67
- // 强制使用一致的反勾号、双引号或单引号
68
- "quotes": ["warn", "double", { "avoidEscape": true }],
69
-
70
-
71
- // 以下的规则在使用Prettier时不需要启用
72
-
73
- // 在数组开括号后和闭括号前强制换行
74
- "array-bracket-newline": ["warn", "consistent"],
75
-
76
- // 强制数组方括号中使用一致的空格
77
- "array-bracket-spacing": ["error", "never"],
78
-
79
- // 强制数组元素间出现换行
80
- "array-element-newline": ["warn", "consistent"],
81
-
82
- // 要求箭头函数的参数使用圆括号
83
- "arrow-parens": ["warn", "as-needed"],
84
-
85
- // 要求箭头函数的箭头之前或之后有空格
86
- "arrow-spacing": ["warn", {
87
- "before": true,
88
- "after": true,
89
- }],
90
-
91
- // 禁止或强制在代码块中开括号前和闭括号后有空格
92
- "block-spacing": ["warn", "always"],
93
-
94
- // 强制在代码块中使用一致的大括号风格
95
- "brace-style": ["warn", "stroustrup", { "allowSingleLine": true }],
96
-
97
- // 要求或禁止使用拖尾逗号(对象、数组、导入、导出、函数参数的最后一项后面是否允许有逗号)
98
- "comma-dangle": ["warn", {
99
- arrays: "always-multiline",
100
- objects: "always-multiline",
101
- imports: "always-multiline",
102
- exports: "always-multiline",
103
- functions: "never",
104
- }],
105
-
106
- // 强制在逗号前后使用一致的空格
107
- "comma-spacing": ["warn", {
108
- "before": false,
109
- "after": true,
110
- }],
111
-
112
- // 强制使用一致的逗号风格
113
- "comma-style": ["warn", "last", {
114
- exceptions: {
115
- ArrayExpression: false,
116
- ArrayPattern: false,
117
- ArrowFunctionExpression: false,
118
- CallExpression: false,
119
- FunctionDeclaration: false,
120
- FunctionExpression: false,
121
- ImportDeclaration: false,
122
- ObjectExpression: false,
123
- ObjectPattern: false,
124
- VariableDeclaration: false,
125
- NewExpression: false,
126
- },
127
- }],
128
-
129
- // 强制在计算的属性的方括号中使用一致的空格
130
- "computed-property-spacing": ["warn", "never"],
131
-
132
- // 强制在点号之前和之后一致的换行
133
- "dot-location": ["warn", "property"],
134
-
135
- // 要求或禁止文件末尾存在空行
136
- "eol-last": ["warn", "always"],
137
-
138
- // 要求或禁止在函数标识符和其调用之间有空格
139
- "func-call-spacing": ["warn", "never"],
140
-
141
- // 函数调用参数换行符
142
- "function-call-argument-newline": ["warn", "consistent"],
143
-
144
- // 强制在函数括号内使用一致的换行
145
- "function-paren-newline": ["warn", "consistent"],
146
-
147
- // generator 函数中 * 号
148
- // "generator-star": "error",
149
-
150
- // 强制 generator 函数中 * 号周围使用一致的空格
151
- "generator-star-spacing": ["warn", {
152
- before: false,
153
- after: true,
154
- }],
155
-
156
- // 强制隐式返回的箭头函数体的位置
157
- "implicit-arrow-linebreak": ["warn", "beside"],
158
-
159
- // 强制使用一致的缩进
160
- "indent": ["error", 2, {
161
- SwitchCase: 1,
162
- VariableDeclarator: 1,
163
- outerIIFEBody: 1,
164
- // MemberExpression: null,
165
- FunctionDeclaration: {
166
- parameters: 1,
167
- body: 1,
168
- },
169
- FunctionExpression: {
170
- parameters: 1,
171
- body: 1,
172
- },
173
- CallExpression: {
174
- arguments: 1,
175
- },
176
- ArrayExpression: 1,
177
- ObjectExpression: 1,
178
- ImportDeclaration: 1,
179
- flatTernaryExpressions: false,
180
- // list derived from https://github.com/benjamn/ast-types/blob/HEAD/def/jsx.js
181
- ignoredNodes: [
182
- "JSXElement",
183
- "JSXElement > *",
184
- "JSXAttribute",
185
- "JSXIdentifier",
186
- "JSXNamespacedName",
187
- "JSXMemberExpression",
188
- "JSXSpreadAttribute",
189
- "JSXExpressionContainer",
190
- "JSXOpeningElement",
191
- "JSXClosingElement",
192
- "JSXFragment",
193
- "JSXOpeningFragment",
194
- "JSXClosingFragment",
195
- "JSXText",
196
- "JSXEmptyExpression",
197
- "JSXSpreadChild",
198
- ],
199
- ignoreComments: false,
200
- }],
201
-
202
- // 强制在 JSX 属性中一致地使用双引号或单引号
203
- "jsx-quotes": ["warn", "prefer-double"],
204
-
205
- // 强制在对象字面量的键和值之间使用一致的空格
206
- "key-spacing": ["warn", {
207
- beforeColon: false,
208
- afterColon: true,
209
- }],
210
-
211
- // 强制关键字周围空格的一致性
212
- "keyword-spacing": ["warn", {
213
- "before": true,
214
- "after": true,
215
- "overrides": {
216
- "if": { "after": true },
217
- "for": { "after": false },
218
- "while": { "after": false },
219
- "switch": { "after": false },
220
- "case": { "after": true },
221
- "catch": { "after": false },
222
- "return": { "after": true },
223
- "throw": { "after": true },
224
- },
225
- }],
226
-
227
- // 强制使用一致的换行符风格
228
- // Windows - "CRLF"
229
- // Unix、Linux - "LF"
230
- "linebreak-style": ["warn", "unix"],
231
-
232
- // 要求或禁止在三元操作数中间换行
233
- // TODO: enable?
234
- "multiline-ternary": ["off", "never"],
235
-
236
- // 要求方法链中每个调用都有一个换行符
237
- "newline-per-chained-call": ["warn", { ignoreChainWithDepth: 4 }],
238
-
239
- // 强制或禁止调用无参构造函数时有圆括号
240
- "new-parens": ["error", "always"],
241
-
242
- // 禁止冗余的括号
243
- "no-extra-parens": ["off", "all", {
244
- "conditionalAssign": true,
245
- "nestedBinaryExpressions": false,
246
- "returnAssign": false,
247
- "ignoreJSX": "all", // delegate to eslint-plugin-react
248
- "enforceForArrowConditionals": false,
249
- }],
250
-
251
- // 禁止不必要的分号
252
- "no-extra-semi": "warn",
253
-
254
- // 禁止数字字面量中使用前导和末尾小数点
255
- "no-floating-decimal": "error",
256
-
257
- // 禁止空格和 tab 的混合缩进
258
- "no-mixed-spaces-and-tabs": "warn",
259
-
260
- // 禁止使用多个空格
261
- "no-multi-spaces": ["warn", { "ignoreEOLComments": true }],
262
-
263
- // 禁止出现多行空行
264
- "no-multiple-empty-lines": ["warn", {
265
- "max": 2,
266
- "maxBOF": 1,
267
- "maxEOF": 1,
268
- }],
269
-
270
- // 禁用行尾空格
271
- "no-trailing-spaces": ["warn", {
272
- "skipBlankLines": true,
273
- "ignoreComments": false,
274
- }],
275
-
276
- // 禁止属性前有空白
277
- "no-whitespace-before-property": "error",
278
-
279
- // 强制单个语句的位置
280
- "nonblock-statement-body-position": "off",
281
-
282
- // 强制大括号内换行符的一致性
283
- "object-curly-newline": ["warn", {
284
- ObjectExpression: { minProperties: 40, multiline: true, consistent: true },
285
- ObjectPattern: "never",
286
- ImportDeclaration: "never",
287
- ExportDeclaration: "always",
288
- }],
289
-
290
- // 强制在花括号中使用一致的空格
291
- "object-curly-spacing": ["warn", "always", {
292
- arraysInObjects: true,
293
- objectsInObjects: true,
294
- }],
295
-
296
- // 强制将对象的属性放在不同的行上
297
- "object-property-newline": ["off", {
298
- allowAllPropertiesOnSameLine: true,
299
- }],
300
-
301
- // 要求或禁止在变量声明周围换行
302
- "one-var-declaration-per-line": "off",
303
-
304
- // 强制操作符使用一致的换行符
305
- "operator-linebreak": ["off", "before", { overrides: { "=": "none" } }],
306
-
307
- // 要求或禁止块内填充
308
- "padded-blocks": "off",
309
-
310
- // 要求对象字面量属性名称用引号括起来
311
- "quote-props": ["warn", "consistent"],
312
-
313
- // 强制剩余和扩展运算符及其表达式之间有空格
314
- "rest-spread-spacing": ["error", "never"],
315
-
316
- // 要求或禁止使用分号代替 ASI
317
- "semi": ["error", "always"],
318
-
319
- // 强制分号之前和之后使用一致的空格
320
- "semi-spacing": ["error", { before: false, after: true }],
321
-
322
- // 强制分号的位置
323
- "semi-style": ["error", "last"],
324
-
325
- // 要求或禁止语句块之前的空格(代码块大括号前面是否需要空格)
326
- "space-before-blocks": ["warn", {
327
- "functions": "always",
328
- "keywords": "always",
329
- "classes": "always",
330
- }],
331
-
332
- // 强制在 function 的左括号之前使用一致的空格
333
- "space-before-function-paren": ["warn", {
334
- "anonymous": "never",
335
- "named": "never",
336
- "asyncArrow": "always",
337
- }],
338
-
339
- // 强制在圆括号内使用一致的空格
340
- "space-in-parens": ["warn", "never"],
341
-
342
- // 要求中缀操作符周围有空格(+-*/?| etc.)
343
- "space-infix-ops": "warn",
344
-
345
- // 强制在一元操作符前后使用一致的空格
346
- "space-unary-ops": ["warn", {
347
- "words": true,
348
- "nonwords": false,
349
- }],
350
-
351
- // 强制在 switch 的冒号左右有空格
352
- "switch-colon-spacing": ["error", { after: true, before: false }],
353
-
354
- // 要求或禁止模板字符串中的嵌入表达式周围空格的使用
355
- "template-curly-spacing": "warn",
356
-
357
- // 要求或禁止在模板标记和它们的字面量之间有空格
358
- "template-tag-spacing": ["error", "never"],
359
-
360
- // 要求或禁止 Unicode 字节顺序标记 (BOM)
361
- "unicode-bom": ["off", "never"],
362
-
363
- // 要求 IIFE 使用括号括起来
364
- "wrap-iife": ["error", "outside", { functionPrototypeMethods: true }],
365
-
366
- // 要求正则表达式被括号括起来
367
- "wrap-regex": "off",
368
-
369
- // 强制在 yield* 表达式中 * 周围使用空格
370
- "yield-star-spacing": ["error", "both"],
371
-
372
- // 已废弃
373
- "no-arrow-condition": "off",
374
- "no-comma-dangle": "off",
375
- "no-reserved-keys": "off",
376
- "no-space-before-semi": "off",
377
- "no-wrap-func": "off",
378
- "space-after-function-name": "off",
379
- "space-after-keywords": "off",
380
- "space-before-function-parentheses": "off",
381
- "space-before-keywords": "off",
382
- "space-in-brackets": "off",
383
- "space-return-throw-case": "off",
384
- "space-unary-word-ops": "off",
385
-
386
-
387
- "@typescript-eslint/quotes": 0,
388
- "babel/quotes": 0,
389
- "@babel/object-curly-spacing": "off",
390
- "@babel/semi": "off",
391
- "@typescript-eslint/brace-style": "off",
392
- "@typescript-eslint/comma-dangle": "off",
393
- "@typescript-eslint/comma-spacing": "off",
394
- "@typescript-eslint/func-call-spacing": "off",
395
- "@typescript-eslint/indent": "off",
396
- "@typescript-eslint/keyword-spacing": "off",
397
- "@typescript-eslint/member-delimiter-style": "off",
398
- "@typescript-eslint/no-extra-parens": "off",
399
- "@typescript-eslint/no-extra-semi": "off",
400
- "@typescript-eslint/object-curly-spacing": "off",
401
- "@typescript-eslint/semi": "off",
402
- "@typescript-eslint/space-before-blocks": "off",
403
- "@typescript-eslint/space-before-function-paren": "off",
404
- "@typescript-eslint/space-infix-ops": "off",
405
- "@typescript-eslint/type-annotation-spacing": "off",
406
- "babel/object-curly-spacing": "off",
407
- "babel/semi": "off",
408
- "flowtype/boolean-style": "off",
409
- "flowtype/delimiter-dangle": "off",
410
- "flowtype/generic-spacing": "off",
411
- "flowtype/object-type-curly-spacing": "off",
412
- "flowtype/object-type-delimiter": "off",
413
- "flowtype/quotes": "off",
414
- "flowtype/semi": "off",
415
- "flowtype/space-after-type-colon": "off",
416
- "flowtype/space-before-generic-bracket": "off",
417
- "flowtype/space-before-type-colon": "off",
418
- "flowtype/union-intersection-spacing": "off",
419
- "react/jsx-child-element-spacing": "off",
420
- "react/jsx-closing-bracket-location": "off",
421
- "react/jsx-closing-tag-location": "off",
422
- "react/jsx-curly-newline": "off",
423
- "react/jsx-curly-spacing": "off",
424
- "react/jsx-equals-spacing": "off",
425
- "react/jsx-first-prop-new-line": "off",
426
- "react/jsx-indent": "off",
427
- "react/jsx-indent-props": "off",
428
- "react/jsx-max-props-per-line": "off",
429
- "react/jsx-newline": "off",
430
- "react/jsx-one-expression-per-line": "off",
431
- "react/jsx-props-no-multi-spaces": "off",
432
- "react/jsx-tag-spacing": "off",
433
- "react/jsx-wrap-multilines": "off",
434
- "standard/array-bracket-even-spacing": "off",
435
- "standard/computed-property-even-spacing": "off",
436
- "standard/object-curly-even-spacing": "off",
437
- "unicorn/empty-brace-spaces": "off",
438
- "unicorn/no-nested-ternary": "off",
439
- "unicorn/number-literal-case": "off",
440
- "vue/array-bracket-newline": "off",
441
- "vue/array-bracket-spacing": "off",
442
- "vue/arrow-spacing": "off",
443
- "vue/block-spacing": "off",
444
- "vue/block-tag-newline": "off",
445
- "vue/brace-style": "off",
446
- "vue/comma-dangle": "off",
447
- "vue/comma-spacing": "off",
448
- "vue/comma-style": "off",
449
- "vue/dot-location": "off",
450
- "vue/func-call-spacing": "off",
451
- "vue/html-closing-bracket-newline": "off",
452
- "vue/html-closing-bracket-spacing": "off",
453
- "vue/html-end-tags": "off",
454
- "vue/html-indent": "off",
455
- "vue/html-quotes": "off",
456
- "vue/key-spacing": "off",
457
- "vue/keyword-spacing": "off",
458
- "vue/max-attributes-per-line": "off",
459
- "vue/multiline-html-element-content-newline": "off",
460
- "vue/mustache-interpolation-spacing": "off",
461
- "vue/no-extra-parens": "off",
462
- "vue/no-multi-spaces": "off",
463
- "vue/no-spaces-around-equal-signs-in-attribute": "off",
464
- "vue/object-curly-newline": "off",
465
- "vue/object-curly-spacing": "off",
466
- "vue/object-property-newline": "off",
467
- "vue/operator-linebreak": "off",
468
- "vue/quote-props": "off",
469
- "vue/script-indent": "off",
470
- "vue/singleline-html-element-content-newline": "off",
471
- "vue/space-in-parens": "off",
472
- "vue/space-infix-ops": "off",
473
- "vue/space-unary-ops": "off",
474
- "vue/template-curly-spacing": "off",
475
- "vue/html-self-closing": 0,
476
- "vue/max-len": 0,
477
- },
478
- };
package/lib/format-es5.js DELETED
@@ -1,23 +0,0 @@
1
-
2
- // ==========================================================
3
- // @houheaven/eslint-config-helper/format-es5
4
- // ----------------------------------------------------------
5
- // - Eslint ES5 格式化规则(warn)
6
- // ==========================================================
7
-
8
- const utils = require("./utils/utils.js");
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
- };
package/lib/format-es6.js DELETED
@@ -1,25 +0,0 @@
1
-
2
- // ==========================================================
3
- // @houheaven/eslint-config-helper/format
4
- // ----------------------------------------------------------
5
- // - Eslint ES5 格式化规则(warn)
6
- // - Eslint ES6+ 格式化规则(warn)
7
- // ==========================================================
8
-
9
- const utils = require("./utils/utils.js");
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
- };