eslint-config-fe 2.1.2 → 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.
- package/README.md +58 -3
- package/base.js +4 -2
- package/eslint.config.js +3 -0
- package/flat.js +32 -0
- package/package.json +34 -11
- package/rules/base.js +454 -455
- package/rules/index.js +161 -162
- package/rules/react.js +279 -280
- package/rules/ts.js +29 -24
- package/ts.js +2 -2
package/rules/base.js
CHANGED
|
@@ -1,944 +1,943 @@
|
|
|
1
1
|
module.exports = {
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
rules: {
|
|
3
|
+
/**
|
|
4
4
|
* 限制数组的括号使用一致的换行符
|
|
5
5
|
*
|
|
6
6
|
* https://eslint.org/docs/rules/array-bracket-newline
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
'array-bracket-newline': ['warn', 'consistent'],
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
11
|
* 限制在代码块中开括号后和闭括号前有空格
|
|
12
12
|
*
|
|
13
13
|
* https://eslint.org/docs/rules/block-spacing
|
|
14
14
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
'block-spacing': ['warn', 'always'],
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
18
|
* 避免在 case 或 default 子句中出现声明语句
|
|
19
19
|
*
|
|
20
20
|
* https://eslint.org/docs/rules/no-case-declarations
|
|
21
21
|
*/
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
'no-case-declarations': 'error',
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
25
|
* 避免 case 语句缺失 break
|
|
26
26
|
*
|
|
27
27
|
* https://eslint.org/docs/rules/no-fallthrough
|
|
28
28
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
'no-fallthrough': [
|
|
30
|
+
'error',
|
|
31
|
+
{ commentPattern: 'break[\\s\\w]*omitted' }
|
|
32
|
+
],
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
35
|
* 避免使用空解构模式
|
|
36
36
|
*
|
|
37
37
|
* https://eslint.org/docs/rules/no-empty-pattern
|
|
38
38
|
*/
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
'no-empty-pattern': 'error',
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
42
|
* 避免对原生对象或只读的全局对象进行赋值
|
|
43
43
|
*
|
|
44
44
|
* https://eslint.org/docs/rules/no-global-assign
|
|
45
45
|
*/
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
'no-global-assign': 'error',
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
49
|
* 避免 Symbolnew 操作符和 new 一起使用
|
|
50
50
|
*
|
|
51
51
|
* https://eslint.org/docs/rules/no-new-symbol
|
|
52
52
|
*/
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
'no-new-symbol': 'error',
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
56
|
* 避免正则表达式字面量中出现多个空格
|
|
57
57
|
*
|
|
58
58
|
* https://eslint.org/docs/rules/no-regex-spaces
|
|
59
59
|
*/
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
'no-regex-spaces': 'error',
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
63
|
* 避免不必要的 return await
|
|
64
64
|
*
|
|
65
65
|
* https://eslint.org/docs/rules/no-return-await
|
|
66
66
|
*/
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
'no-return-await': 'error',
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
70
|
* 避免给自身赋值
|
|
71
71
|
*
|
|
72
72
|
* https://eslint.org/docs/rules/no-self-assign
|
|
73
73
|
*/
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
'no-self-assign': 'error',
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
77
|
* 避免使用逗号操作符
|
|
78
78
|
*
|
|
79
79
|
* https://eslint.org/docs/rules/no-sequences
|
|
80
80
|
*/
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
81
|
+
'no-sequences': 'error',
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
84
|
* 避免使用令人困惑的多行表达式
|
|
85
85
|
*
|
|
86
86
|
* https://eslint.org/docs/rules/no-unexpected-multiline
|
|
87
87
|
*/
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
88
|
+
'no-unexpected-multiline': 'error',
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
91
|
* 避免使用一成不变的循环条件
|
|
92
92
|
*
|
|
93
93
|
* https://eslint.org/docs/rules/no-unmodified-loop-condition
|
|
94
94
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
'no-unmodified-loop-condition': 'warn',
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
98
|
* 避免在 finally 语句块中出现控制流语句
|
|
99
99
|
*
|
|
100
100
|
* https://eslint.org/docs/rules/no-unsafe-finally
|
|
101
101
|
*/
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
'no-unsafe-finally': 'error',
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
105
|
* 避免在对象中使用不必要的计算属性
|
|
106
106
|
*
|
|
107
107
|
* https://eslint.org/docs/rules/no-useless-computed-key
|
|
108
108
|
*/
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
109
|
+
'no-useless-computed-key': 'error',
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
112
|
* 警告没有必要的字符拼接
|
|
113
113
|
*
|
|
114
114
|
* https://eslint.org/docs/rules/no-useless-concat
|
|
115
115
|
*/
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
116
|
+
'no-useless-concat': 'warn',
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
119
|
* 避免不必要的转义
|
|
120
120
|
*
|
|
121
121
|
* https://eslint.org/docs/rules/no-useless-escape
|
|
122
122
|
*/
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
123
|
+
'no-useless-escape': 'error',
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
126
|
* 避免属性前有空白
|
|
127
127
|
*
|
|
128
128
|
* https://eslint.org/docs/rules/no-whitespace-before-property
|
|
129
129
|
*/
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
130
|
+
'no-whitespace-before-property': 'error',
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
133
|
* 避免使用不带 await 表达式的 async 函数
|
|
134
134
|
*
|
|
135
135
|
* https://eslint.org/docs/rules/require-await
|
|
136
136
|
*/
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
137
|
+
'require-await': 'warn',
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
140
|
* 避免函数内没有yield的 generator 函数
|
|
141
141
|
*
|
|
142
142
|
* https://eslint.org/docs/rules/require-yield
|
|
143
143
|
*/
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
144
|
+
'require-yield': 'error',
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
147
|
* 限制 case 语句的冒号右边有空格
|
|
148
148
|
*
|
|
149
149
|
* https://eslint.org/docs/rules/switch-colon-spacing
|
|
150
150
|
*/
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
151
|
+
'switch-colon-spacing': ['error', { before: false, after: true }],
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
154
|
* 避免使用异步函数作为 Promise executor
|
|
155
155
|
*
|
|
156
156
|
* https://eslint.org/docs/rules/no-async-promise-executor
|
|
157
157
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
158
|
+
'no-async-promise-executor': 'error',
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
161
|
* 限制在 getter 属性中出现一个 return 语句
|
|
162
162
|
*
|
|
163
163
|
* https://eslint.org/docs/rules/getter-return
|
|
164
164
|
*/
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
'getter-return': 'error',
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
168
|
* 避免在构造函数中返回值
|
|
169
169
|
*
|
|
170
170
|
* https://eslint.org/docs/rules/no-constructor-return
|
|
171
171
|
*/
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
172
|
+
'no-constructor-return': 'error',
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
175
|
* 避免重复的 if-else-if 条件
|
|
176
176
|
*
|
|
177
177
|
* https://eslint.org/docs/rules/no-dupe-else-if
|
|
178
178
|
*/
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
'no-dupe-else-if': 'error',
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
182
|
* 避免对 import 声明重新赋值
|
|
183
183
|
*
|
|
184
184
|
* https://eslint.org/docs/rules/no-import-assign
|
|
185
185
|
*/
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
186
|
+
'no-import-assign': 'error',
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
189
|
* 避免在正则表达式中使用多余的反斜杠
|
|
190
190
|
*
|
|
191
191
|
* https://eslint.org/docs/rules/no-useless-backreference
|
|
192
192
|
*/
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
193
|
+
'no-useless-backreference': 'error',
|
|
194
|
+
|
|
195
|
+
/**
|
|
196
196
|
* 警告在非空文件末尾至少存在一行空行
|
|
197
197
|
*
|
|
198
198
|
* https://eslint.org/docs/rules/eol-last
|
|
199
199
|
*/
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
200
|
+
'eol-last': ['warn', 'always'],
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
203
|
* 避免使用非字符串连接而使用模板字面量
|
|
204
204
|
*
|
|
205
205
|
* https://eslint.org/docs/rules/prefer-template
|
|
206
206
|
*/
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
'prefer-template': 'error',
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
210
|
* 限制2个缩进
|
|
211
211
|
*
|
|
212
212
|
* https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
|
|
213
213
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
214
|
+
indent: [
|
|
215
|
+
'error',
|
|
216
|
+
2,
|
|
217
|
+
{
|
|
218
|
+
SwitchCase: 1
|
|
219
|
+
}
|
|
220
|
+
],
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
223
|
* 限制 generator 函数星号后面有空格
|
|
224
224
|
*
|
|
225
225
|
* https://eslint.org/docs/rules/generator-star-spacing
|
|
226
226
|
*/
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
227
|
+
'generator-star-spacing': [
|
|
228
|
+
'error',
|
|
229
|
+
{
|
|
230
|
+
before: false,
|
|
231
|
+
after: true
|
|
232
|
+
}
|
|
233
|
+
],
|
|
234
|
+
|
|
235
|
+
/**
|
|
236
236
|
* 避免在括号内使用空格
|
|
237
237
|
*
|
|
238
238
|
* https://eslint.org/docs/rules/array-bracket-spacing
|
|
239
239
|
*/
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
240
|
+
'array-bracket-spacing': ['error', 'never'],
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
243
|
* 限制箭头函数的参数被圆括号包围
|
|
244
244
|
*
|
|
245
245
|
* https://eslint.org/docs/rules/arrow-parens
|
|
246
246
|
*/
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
247
|
+
'arrow-parens': ['error', 'always'],
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
250
|
* 限制使用 console.error、console.warn、console.info
|
|
251
251
|
*
|
|
252
252
|
* https://eslint.org/docs/rules/no-console
|
|
253
253
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
254
|
+
'no-console': [
|
|
255
|
+
'warn',
|
|
256
|
+
{
|
|
257
|
+
allow: ['error', 'warn', 'info']
|
|
258
|
+
}
|
|
259
|
+
],
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
262
|
* 警告在条件中使用常量表达式
|
|
263
263
|
*
|
|
264
264
|
* https://eslint.org/docs/rules/no-constant-condition
|
|
265
265
|
*/
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
'no-constant-condition': 'warn',
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
269
|
* 限制尾部没有逗号
|
|
270
270
|
*
|
|
271
271
|
* https://eslint.org/docs/rules/comma-dangle
|
|
272
272
|
*/
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
273
|
+
'comma-dangle': ['error', 'never'],
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
276
|
* 避免使用 debugger
|
|
277
277
|
*
|
|
278
278
|
* https://eslint.org/docs/rules/no-debugger
|
|
279
279
|
*/
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
280
|
+
'no-debugger': 'error',
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
283
|
* 警告在对象字面量中出现重复的键
|
|
284
284
|
*
|
|
285
285
|
* https://eslint.org/docs/rules/no-dupe-keys
|
|
286
286
|
*/
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
287
|
+
'no-dupe-keys': 'warn',
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
290
|
* 避免正则表达式中出现空字符集
|
|
291
291
|
*
|
|
292
292
|
* https://eslint.org/docs/rules/no-empty-character-class
|
|
293
293
|
*/
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
'no-empty-character-class': 'error',
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
297
|
* 避免对 catch 子句中的异常重新赋值
|
|
298
298
|
*
|
|
299
299
|
* https://eslint.org/docs/rules/no-ex-assign
|
|
300
300
|
*/
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
301
|
+
'no-ex-assign': 'error',
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
304
|
* 警告出现不必要的布尔类型转换
|
|
305
305
|
*
|
|
306
306
|
* https://eslint.org/docs/rules/no-extra-boolean-cast
|
|
307
307
|
*/
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
308
|
+
'no-extra-boolean-cast': 'warn',
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
311
|
* 警告对 function 声明重新赋值
|
|
312
312
|
*
|
|
313
313
|
* https://eslint.org/docs/rules/no-func-assign
|
|
314
314
|
*/
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
315
|
+
'no-func-assign': 'warn',
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
318
|
* 警告在嵌套的语句块中出现变量或 function 声明
|
|
319
319
|
*
|
|
320
320
|
* https://eslint.org/docs/rules/no-inner-declarations
|
|
321
321
|
*/
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
322
|
+
'no-inner-declarations': 'warn',
|
|
323
|
+
|
|
324
|
+
/**
|
|
325
325
|
* 避免使用无效的正则表达式在 RegExp 构造函数中
|
|
326
326
|
*
|
|
327
327
|
* https://eslint.org/docs/rules/no-invalid-regexp
|
|
328
328
|
*/
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
329
|
+
'no-invalid-regexp': 'error',
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
332
|
* 避免全局对象被当作函数调用
|
|
333
333
|
*
|
|
334
334
|
* https://eslint.org/docs/rules/no-obj-calls
|
|
335
335
|
*/
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
336
|
+
'no-obj-calls': 'error',
|
|
337
|
+
|
|
338
|
+
/**
|
|
339
339
|
* 避免使用稀疏数组
|
|
340
340
|
*
|
|
341
341
|
* https://eslint.org/docs/rules/no-sparse-arrays
|
|
342
342
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
343
|
+
'no-sparse-arrays': 'error',
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
346
|
* 避免在 return、throw、continue 和 break 语句后出现不被执行的代码
|
|
347
347
|
*
|
|
348
348
|
* https://eslint.org/docs/rules/no-unreachable
|
|
349
349
|
*/
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
350
|
+
'no-unreachable': 'error',
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
353
|
* 避免循环中只有一次迭代
|
|
354
354
|
*
|
|
355
355
|
* https://eslint.org/docs/rules/no-unreachable-loop
|
|
356
356
|
*/
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
357
|
+
'no-unreachable-loop': 'error',
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
360
|
* 限制使用 isNaN()检查 NaN
|
|
361
361
|
*
|
|
362
362
|
* https://eslint.org/docs/rules/use-isnan
|
|
363
363
|
*/
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
'use-isnan': 'error',
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
367
|
* 限制使用 typeof 表达式与有效的字符串进行比较
|
|
368
368
|
*
|
|
369
369
|
* https://eslint.org/docs/rules/valid-typeof
|
|
370
370
|
*/
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
371
|
+
'valid-typeof': 'error',
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
374
|
* 避免省略花括号当一个块只包含一条语句时
|
|
375
375
|
*
|
|
376
376
|
* https://eslint.org/docs/rules/curly
|
|
377
377
|
*/
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
378
|
+
curly: ['error', 'all'],
|
|
379
|
+
|
|
380
|
+
/**
|
|
381
381
|
* 限制使用 === 和 !==
|
|
382
382
|
*
|
|
383
383
|
* https://eslint.org/docs/rules/eqeqeq
|
|
384
384
|
*/
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
385
|
+
eqeqeq: ['error', 'allow-null'],
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
388
|
* 警告 for-in 中没有判断是否是自身属性
|
|
389
389
|
*
|
|
390
390
|
* https://eslint.org/docs/rules/guard-for-in
|
|
391
391
|
*/
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
392
|
+
'guard-for-in': 'warn',
|
|
393
|
+
|
|
394
|
+
/**
|
|
395
395
|
* 警告在 else 前有 return
|
|
396
396
|
*
|
|
397
397
|
* https://eslint.org/docs/rules/no-else-return
|
|
398
398
|
*/
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
'no-else-return': 'warn',
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
402
|
* 警告使用了非循环使用标签
|
|
403
403
|
*
|
|
404
404
|
* https://eslint.org/docs/rules/no-labels
|
|
405
405
|
*/
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
406
|
+
'no-labels': [
|
|
407
|
+
'warn',
|
|
408
|
+
{
|
|
409
|
+
allowLoop: true
|
|
410
|
+
}
|
|
411
|
+
],
|
|
412
|
+
|
|
413
|
+
/**
|
|
414
414
|
* 警告使用了 eval()
|
|
415
415
|
*
|
|
416
416
|
* https://eslint.org/docs/rules/no-eval
|
|
417
417
|
*/
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
418
|
+
'no-eval': 'warn',
|
|
419
|
+
|
|
420
|
+
// /**
|
|
421
|
+
// * 避免扩展原生对象
|
|
422
|
+
// *
|
|
423
|
+
// * https://eslint.org/docs/rules/no-extend-native
|
|
424
|
+
// */
|
|
425
|
+
// 'no-extend-native': 'error',
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
428
|
* 警告使用了不必要的函数绑定
|
|
429
429
|
*
|
|
430
430
|
* https://eslint.org/docs/rules/no-extra-bind
|
|
431
431
|
*/
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
432
|
+
'no-extra-bind': 'warn',
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
435
|
* 警告使用了隐式的 eval()
|
|
436
436
|
*
|
|
437
437
|
* https://eslint.org/docs/rules/no-implied-eval
|
|
438
438
|
*/
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
439
|
+
'no-implied-eval': 'warn',
|
|
440
|
+
|
|
441
|
+
/**
|
|
442
442
|
* 避免使用废弃的迭代器属性 __iterator__
|
|
443
443
|
*
|
|
444
444
|
* https://eslint.org/docs/rules/no-iterator
|
|
445
445
|
*/
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
446
|
+
'no-iterator': 'error',
|
|
447
|
+
|
|
448
|
+
/**
|
|
449
449
|
* 警告使用了不规则的空白
|
|
450
450
|
*
|
|
451
451
|
* https://eslint.org/docs/rules/no-irregular-whitespace
|
|
452
452
|
*/
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
453
|
+
'no-irregular-whitespace': 'warn',
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
456
|
* 警告使用了不必要的嵌套块
|
|
457
457
|
*
|
|
458
458
|
* https://eslint.org/docs/rules/no-lone-blocks
|
|
459
459
|
*/
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
460
|
+
'no-lone-blocks': 'warn',
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
463
|
* 警告循环中存在函数
|
|
464
464
|
*
|
|
465
465
|
* https://eslint.org/docs/rules/no-loop-func
|
|
466
466
|
*/
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
467
|
+
'no-loop-func': 'warn',
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
470
|
* 警告多行字符串 \
|
|
471
471
|
*
|
|
472
472
|
* https://eslint.org/docs/rules/no-multi-str
|
|
473
473
|
*/
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
'no-multi-str': 'warn',
|
|
475
|
+
|
|
476
|
+
/**
|
|
477
477
|
* 避免重新赋值原生对象
|
|
478
478
|
*
|
|
479
479
|
* https://eslint.org/docs/rules/no-native-reassign
|
|
480
480
|
*/
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
481
|
+
'no-native-reassign': 'error',
|
|
482
|
+
|
|
483
|
+
/**
|
|
484
484
|
* 避免使用原始包装实例
|
|
485
485
|
*
|
|
486
486
|
* https://eslint.org/docs/rules/no-new-wrappers
|
|
487
487
|
*/
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
488
|
+
'no-new-wrappers': 'error',
|
|
489
|
+
|
|
490
|
+
/**
|
|
491
491
|
* 警告使用了八进制字面量
|
|
492
492
|
*
|
|
493
493
|
* https://eslint.org/docs/rules/no-octal
|
|
494
494
|
*/
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
495
|
+
'no-octal': 'warn',
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
498
|
* 警告在字符串字面量中使用八进制转义序列
|
|
499
499
|
*
|
|
500
500
|
* https://eslint.org/docs/rules/no-octal-escape
|
|
501
501
|
*/
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
502
|
+
'no-octal-escape': 'warn',
|
|
503
|
+
|
|
504
|
+
/**
|
|
505
505
|
* 避免使用 __proto__
|
|
506
506
|
*
|
|
507
507
|
* https://eslint.org/docs/rules/no-proto
|
|
508
508
|
*/
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
509
|
+
'no-proto': 'error',
|
|
510
|
+
|
|
511
|
+
/**
|
|
512
512
|
* 警告 var 重新声明变量
|
|
513
513
|
*
|
|
514
514
|
* https://eslint.org/docs/rules/no-redeclare
|
|
515
515
|
*/
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
516
|
+
'no-redeclare': 'warn',
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
519
|
* 避免比较自身
|
|
520
520
|
*
|
|
521
521
|
* https://eslint.org/docs/rules/no-self-compare
|
|
522
522
|
*/
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
523
|
+
'no-self-compare': 'error',
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
526
|
* 限制使用更简单结构的三元操作符
|
|
527
527
|
*
|
|
528
528
|
* https://eslint.org/docs/rules/no-unneeded-ternary
|
|
529
529
|
*/
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
530
|
+
'no-unneeded-ternary': 'error',
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
533
|
* 警告使用了 with 语句
|
|
534
534
|
*
|
|
535
535
|
* https://eslint.org/docs/rules/no-with
|
|
536
536
|
*/
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
537
|
+
'no-with': 'warn',
|
|
538
|
+
|
|
539
|
+
/**
|
|
540
540
|
* 限制调用 parseInt() 函数时传入第二个参数
|
|
541
541
|
*
|
|
542
542
|
* https://eslint.org/docs/rules/no-with
|
|
543
543
|
*/
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
544
|
+
radix: 'error',
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
547
|
* 限制把立即执行的函数包裹起来再执行
|
|
548
548
|
*
|
|
549
549
|
* https://eslint.org/docs/rules/wrap-iife
|
|
550
550
|
*/
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
551
|
+
'wrap-iife': ['error', 'any'],
|
|
552
|
+
|
|
553
|
+
/**
|
|
554
554
|
* 避免使用 delete 删除变量
|
|
555
555
|
*
|
|
556
556
|
* https://eslint.org/docs/rules/no-delete-var
|
|
557
557
|
*/
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
558
|
+
'no-delete-var': 'warn',
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
561
|
* 避免 function 定义中出现重复的参数名
|
|
562
562
|
*
|
|
563
563
|
* https://eslint.org/docs/rules/no-dupe-args
|
|
564
564
|
*/
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
565
|
+
'no-dupe-args': 'error',
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
568
|
* 避免出现重复的 case 条件
|
|
569
569
|
*
|
|
570
570
|
* https://eslint.org/docs/rules/no-duplicate-case
|
|
571
571
|
*/
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
572
|
+
'no-duplicate-case': 'error',
|
|
573
|
+
|
|
574
|
+
/**
|
|
575
575
|
* 警告标签与变量同名
|
|
576
576
|
*
|
|
577
577
|
* https://eslint.org/docs/rules/no-label-var
|
|
578
578
|
*/
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
579
|
+
'no-label-var': 'warn',
|
|
580
|
+
|
|
581
|
+
/**
|
|
582
582
|
* 避免变量名或者函数名与全局对象属性、关键字相同
|
|
583
583
|
*
|
|
584
584
|
* https://eslint.org/docs/rules/no-shadow-restricted-names
|
|
585
585
|
*/
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
586
|
+
'no-shadow-restricted-names': 'error',
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
589
|
* 避免使用未声明的变量
|
|
590
590
|
*
|
|
591
591
|
* https://eslint.org/docs/rules/no-undef
|
|
592
592
|
*/
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
593
|
+
'no-undef': 'error',
|
|
594
|
+
|
|
595
|
+
/**
|
|
596
596
|
* 警告定义变量的初始值为 undefined
|
|
597
597
|
*
|
|
598
598
|
* https://eslint.org/docs/rules/no-undef-init
|
|
599
599
|
*/
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
600
|
+
'no-undef-init': 'warn',
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
603
|
* 警告当前作用域中声明的变量未使用,不检查传递的参数是否被使用
|
|
604
604
|
*
|
|
605
605
|
* https://eslint.org/docs/rules/no-unused-vars
|
|
606
606
|
*/
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
607
|
+
'no-unused-vars': [
|
|
608
|
+
'warn',
|
|
609
|
+
{
|
|
610
|
+
vars: 'local',
|
|
611
|
+
args: 'none'
|
|
612
|
+
}
|
|
613
|
+
],
|
|
614
|
+
|
|
615
|
+
/**
|
|
616
616
|
* 避免非函数在定义前使用
|
|
617
617
|
*
|
|
618
618
|
* https://eslint.org/docs/rules/no-use-before-define
|
|
619
619
|
*/
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
620
|
+
'no-use-before-define': ['error', 'nofunc'],
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
623
|
* 限制大括号风格,if-else中的else语句,连同catch 和 finally,都必须在右括号后另起一行
|
|
624
624
|
*
|
|
625
625
|
* https://eslint.org/docs/rules/brace-style
|
|
626
626
|
*/
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
627
|
+
'brace-style': ['warn', 'stroustrup'],
|
|
628
|
+
|
|
629
|
+
/**
|
|
630
630
|
* 限制在逗号后加空格
|
|
631
631
|
* 默认选项 { "before": false, "after": true }
|
|
632
632
|
*
|
|
633
633
|
* https://eslint.org/docs/rules/comma-spacing
|
|
634
634
|
*/
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
635
|
+
'comma-spacing': 'error',
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
638
|
* 限制逗号风格,要求逗号放在数组元素、对象属性或变量声明之后,且在同一行
|
|
639
639
|
*
|
|
640
640
|
* https://eslint.org/docs/rules/comma-style
|
|
641
641
|
*/
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
642
|
+
'comma-style': ['error', 'last'],
|
|
643
|
+
|
|
644
|
+
/**
|
|
645
645
|
* 警告使用了无参构造函数时未带括号
|
|
646
646
|
*
|
|
647
647
|
* https://eslint.org/docs/rules/new-parens
|
|
648
648
|
*/
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
649
|
+
'new-parens': 'warn',
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
652
|
* 避免使用 Array 构造函数
|
|
653
653
|
*
|
|
654
654
|
* https://eslint.org/docs/rules/no-array-constructor
|
|
655
655
|
*/
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
656
|
+
'no-array-constructor': 'error',
|
|
657
|
+
|
|
658
|
+
/**
|
|
659
659
|
* 避免一行出现多个空格,除了对象属性定义、二元表达式、定义变量对齐
|
|
660
660
|
*
|
|
661
661
|
* https://eslint.org/docs/rules/no-multi-spaces
|
|
662
662
|
*/
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
663
|
+
'no-multi-spaces': [
|
|
664
|
+
'error',
|
|
665
|
+
{
|
|
666
|
+
exceptions: {
|
|
667
|
+
Property: true,
|
|
668
|
+
BinaryExpression: true,
|
|
669
|
+
VariableDeclarator: true
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
],
|
|
673
|
+
|
|
674
|
+
/**
|
|
675
675
|
* 避免使用 Object 构造函数
|
|
676
676
|
*
|
|
677
677
|
* https://eslint.org/docs/rules/no-new-object
|
|
678
678
|
*/
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
679
|
+
'no-new-object': 'error',
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
682
|
* 避免函数标识符和其调用之间出现空格
|
|
683
683
|
*
|
|
684
684
|
* https://eslint.org/docs/rules/func-call-spacing
|
|
685
685
|
*/
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
686
|
+
'func-call-spacing': 'error',
|
|
687
|
+
|
|
688
|
+
/**
|
|
689
689
|
* 避免行尾出现空白
|
|
690
690
|
*
|
|
691
691
|
* https://eslint.org/docs/rules/no-trailing-spaces
|
|
692
692
|
*/
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
693
|
+
'no-trailing-spaces': 'error',
|
|
694
|
+
|
|
695
|
+
/**
|
|
696
696
|
* 避免 空格 和 tab 混合缩进
|
|
697
697
|
*
|
|
698
698
|
* https://eslint.org/docs/rules/no-mixed-spaces-and-tabs
|
|
699
699
|
*/
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
700
|
+
'no-mixed-spaces-and-tabs': 'error',
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
703
|
* 限制函数中的变量分开声明
|
|
704
704
|
*
|
|
705
705
|
* https://eslint.org/docs/rules/one-var
|
|
706
706
|
*/
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
707
|
+
'one-var': ['error', 'never'],
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
710
|
* 限制换行符在操作符之前
|
|
711
711
|
*
|
|
712
712
|
* https://eslint.org/docs/rules/operator-linebreak
|
|
713
713
|
*/
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
714
|
+
'operator-linebreak': ['error', 'before'],
|
|
715
|
+
|
|
716
|
+
/**
|
|
717
717
|
* 限制使用单引号除了字符串中包含了一个其它的引号
|
|
718
718
|
*
|
|
719
719
|
* https://eslint.org/docs/rules/quotes
|
|
720
720
|
*/
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
721
|
+
quotes: [
|
|
722
|
+
'error',
|
|
723
|
+
'single',
|
|
724
|
+
{ avoidEscape: true }
|
|
725
|
+
],
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
728
|
* 限制分号后面有空格
|
|
729
729
|
* 默认选项为 {"before": false, "after": true}
|
|
730
730
|
*
|
|
731
731
|
* https://eslint.org/docs/rules/semi-spacing
|
|
732
732
|
*/
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
733
|
+
'semi-spacing': 'error',
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
736
|
* 限制关键字前后出现空格
|
|
737
737
|
*
|
|
738
738
|
* https://eslint.org/docs/rules/keyword-spacing
|
|
739
739
|
*/
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
740
|
+
'keyword-spacing': [
|
|
741
|
+
'error',
|
|
742
|
+
{
|
|
743
|
+
before: true,
|
|
744
|
+
after: true
|
|
745
|
+
}
|
|
746
|
+
],
|
|
747
|
+
|
|
748
|
+
/**
|
|
749
749
|
* 限制对象字面量的键后面无空格,值前面有空格
|
|
750
750
|
* 默认选项 { "beforeColon": false, "afterColon": true, "mode": "strict" }
|
|
751
751
|
*
|
|
752
752
|
* https://eslint.org/docs/rules/keyword-spacing
|
|
753
753
|
*/
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
754
|
+
'key-spacing': 'error',
|
|
755
|
+
|
|
756
|
+
/**
|
|
757
757
|
* 限制函数圆括号之前有一个空格除了具名函数
|
|
758
758
|
*
|
|
759
759
|
* https://eslint.org/docs/rules/space-before-function-paren
|
|
760
760
|
*/
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
761
|
+
'space-before-function-paren': [
|
|
762
|
+
'error',
|
|
763
|
+
{
|
|
764
|
+
anonymous: 'always',
|
|
765
|
+
named: 'never',
|
|
766
|
+
asyncArrow: 'always'
|
|
767
|
+
}
|
|
768
|
+
],
|
|
769
|
+
|
|
770
|
+
/**
|
|
771
771
|
* 限制语句块之前有空格
|
|
772
772
|
*
|
|
773
773
|
* https://eslint.org/docs/rules/space-before-blocks
|
|
774
774
|
*/
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
775
|
+
'space-before-blocks': ['error', 'always'],
|
|
776
|
+
|
|
777
|
+
/**
|
|
778
778
|
* 限制计算属性中无空格
|
|
779
779
|
*
|
|
780
780
|
* https://eslint.org/docs/rules/computed-property-spacing
|
|
781
781
|
*/
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
782
|
+
'computed-property-spacing': ['error', 'never'],
|
|
783
|
+
|
|
784
|
+
/**
|
|
785
785
|
* 限制圆括号内无空格
|
|
786
786
|
*
|
|
787
787
|
* https://eslint.org/docs/rules/space-in-parens
|
|
788
788
|
*/
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
789
|
+
'space-in-parens': ['error', 'never'],
|
|
790
|
+
|
|
791
|
+
/**
|
|
792
792
|
* 限制单词类一元操作符之前或之后有空格,限制一元操作符之前或之后无空格
|
|
793
793
|
* 默认选项 {"words": true, "nonwords": false}
|
|
794
794
|
*
|
|
795
795
|
* https://eslint.org/docs/rules/space-unary-ops
|
|
796
796
|
*/
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
797
|
+
'space-unary-ops': 'warn',
|
|
798
|
+
|
|
799
|
+
/**
|
|
800
800
|
* 限制注释前至少要有一个空格,除了固定的几个字符
|
|
801
801
|
*
|
|
802
802
|
* https://eslint.org/docs/rules/spaced-comment
|
|
803
803
|
*/
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
804
|
+
'spaced-comment': [
|
|
805
|
+
'error',
|
|
806
|
+
'always',
|
|
807
|
+
{
|
|
808
|
+
exceptions: [
|
|
809
|
+
'-',
|
|
810
|
+
'+',
|
|
811
|
+
'\'',
|
|
812
|
+
'#'
|
|
813
|
+
],
|
|
814
|
+
block: {
|
|
815
|
+
balanced: true
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
],
|
|
819
|
+
|
|
820
|
+
/**
|
|
821
821
|
* 限制行的最大长度
|
|
822
822
|
*
|
|
823
823
|
* https://eslint.org/docs/rules/max-len
|
|
824
824
|
*/
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
825
|
+
'max-len': [
|
|
826
|
+
'error',
|
|
827
|
+
{
|
|
828
|
+
code: 120,
|
|
829
|
+
tabWidth: 4,
|
|
830
|
+
ignorePattern: 'data:image\\/',
|
|
831
|
+
ignoreUrls: true,
|
|
832
|
+
ignoreRegExpLiterals: true
|
|
833
|
+
}
|
|
834
|
+
],
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
837
|
* 限制中缀操作符周围有空格
|
|
838
838
|
*
|
|
839
839
|
* https://eslint.org/docs/rules/space-infix-ops
|
|
840
840
|
*/
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
841
|
+
'space-infix-ops': 'error',
|
|
842
|
+
|
|
843
|
+
/**
|
|
844
844
|
* 限制使用点号访问属性,部分关键字除外
|
|
845
845
|
* 默认选项 { "allowKeywords": true }
|
|
846
846
|
*
|
|
847
847
|
* https://eslint.org/docs/rules/dot-notation
|
|
848
848
|
*/
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
849
|
+
'dot-notation': [
|
|
850
|
+
'error',
|
|
851
|
+
{
|
|
852
|
+
allowPattern: '^catch$'
|
|
853
|
+
}
|
|
854
|
+
],
|
|
855
|
+
|
|
856
|
+
/**
|
|
857
857
|
* 限制箭头函数的箭头之前和之后有空格
|
|
858
858
|
* 默认选项 { "before": true, "after": true }
|
|
859
859
|
*
|
|
860
860
|
* https://eslint.org/docs/rules/arrow-spacing
|
|
861
861
|
*/
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
862
|
+
'arrow-spacing': 'error',
|
|
863
|
+
|
|
864
|
+
/**
|
|
865
865
|
* 限制派生类中的构造函数必须调用 super()
|
|
866
866
|
*
|
|
867
867
|
* https://eslint.org/docs/rules/constructor-super
|
|
868
868
|
*/
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
869
|
+
'constructor-super': 'error',
|
|
870
|
+
|
|
871
|
+
/**
|
|
872
872
|
* 避免可能与比较操作符相混淆的地方使用箭头函数
|
|
873
873
|
* 默认选项 { "allowParens": true }
|
|
874
874
|
*
|
|
875
875
|
* https://eslint.org/docs/rules/no-confusing-arrow
|
|
876
876
|
*/
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
877
|
+
'no-confusing-arrow': 'error',
|
|
878
|
+
|
|
879
|
+
/**
|
|
880
880
|
* 警告修改类声明的变量
|
|
881
881
|
*
|
|
882
882
|
* https://eslint.org/docs/rules/no-class-assign
|
|
883
883
|
*/
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
884
|
+
'no-class-assign': 'warn',
|
|
885
|
+
|
|
886
|
+
/**
|
|
887
887
|
* 避免修改 const 声明的变量
|
|
888
888
|
*
|
|
889
889
|
* https://eslint.org/docs/rules/no-const-assign
|
|
890
890
|
*/
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
891
|
+
'no-const-assign': 'error',
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
894
|
* 警告类成员中重复的名称
|
|
895
895
|
*
|
|
896
896
|
* https://eslint.org/docs/rules/no-dupe-class-members
|
|
897
897
|
*/
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
898
|
+
'no-dupe-class-members': 'warn',
|
|
899
|
+
|
|
900
|
+
/**
|
|
901
901
|
* 警告在构造函数中调用super()之前使用this或super
|
|
902
902
|
*
|
|
903
903
|
* https://eslint.org/docs/rules/no-this-before-super
|
|
904
904
|
*/
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
905
|
+
'no-this-before-super': 'warn',
|
|
906
|
+
|
|
907
|
+
/**
|
|
908
908
|
* 警告使用了 let 或 const 非 var
|
|
909
909
|
*
|
|
910
910
|
* https://eslint.org/docs/rules/no-var
|
|
911
911
|
*/
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
912
|
+
'no-var': 'warn',
|
|
913
|
+
|
|
914
|
+
/**
|
|
915
915
|
* 警告重复导入
|
|
916
916
|
*
|
|
917
917
|
* https://eslint.org/docs/rules/no-duplicate-imports
|
|
918
918
|
*/
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
919
|
+
'no-duplicate-imports': 'warn',
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
922
|
* 限制一行只有一条语句
|
|
923
923
|
* 默认选项 { "max": 1 }
|
|
924
924
|
*
|
|
925
925
|
* https://eslint.org/docs/rules/max-statements-per-line
|
|
926
926
|
*/
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
927
|
+
'max-statements-per-line': 'error',
|
|
928
|
+
|
|
929
|
+
/**
|
|
930
930
|
* 警告使用了不必要的构造函数
|
|
931
931
|
*
|
|
932
932
|
* https://eslint.org/docs/rules/no-useless-constructor
|
|
933
933
|
*/
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
934
|
+
'no-useless-constructor': 'warn',
|
|
935
|
+
|
|
936
|
+
/**
|
|
937
937
|
* 限制对象属性在有需要的情况下使用引号
|
|
938
938
|
*
|
|
939
939
|
* https://eslint.org/docs/rules/quote-props
|
|
940
940
|
*/
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
941
|
+
'quote-props': ['error', 'as-needed']
|
|
942
|
+
}
|
|
943
|
+
};
|