@pawover/eslint-rules 0.0.2 → 0.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/dist/core.antfu.js +59 -3
- package/dist/core.imports.js +45 -0
- package/dist/core.javascript.js +980 -0
- package/dist/core.react.js +459 -15
- package/dist/core.reactHooks.js +85 -0
- package/dist/core.stylistic.js +460 -0
- package/dist/core.typescript.js +715 -0
- package/dist/index.js +1 -1
- package/dist/types/core.antfu.d.ts +59 -1
- package/dist/types/core.antfu.d.ts.map +1 -1
- package/dist/types/core.imports.d.ts +45 -0
- package/dist/types/core.imports.d.ts.map +1 -1
- package/dist/types/core.javascript.d.ts +980 -0
- package/dist/types/core.javascript.d.ts.map +1 -1
- package/dist/types/core.react.d.ts +455 -11
- package/dist/types/core.react.d.ts.map +1 -1
- package/dist/types/core.reactHooks.d.ts +85 -0
- package/dist/types/core.reactHooks.d.ts.map +1 -1
- package/dist/types/core.stylistic.d.ts +460 -0
- package/dist/types/core.stylistic.d.ts.map +1 -1
- package/dist/types/core.typescript.d.ts +715 -0
- package/dist/types/core.typescript.d.ts.map +1 -1
- package/dist/types/index.d.ts +3 -3
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +53 -38
package/dist/core.javascript.js
CHANGED
|
@@ -1,200 +1,1180 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
// Possible Problems
|
|
3
|
+
/**
|
|
4
|
+
* @desc 强制数组回调函数中必须包含 return 语句
|
|
5
|
+
* @descEN Enforce return statements in callbacks of array methods
|
|
6
|
+
* @see https://eslint.org/docs/latest/rules/array-callback-return
|
|
7
|
+
*/
|
|
3
8
|
"array-callback-return": 2,
|
|
9
|
+
/**
|
|
10
|
+
* @desc 确保构造函数中调用了 super()
|
|
11
|
+
* @descEN Require `super()` calls in constructors
|
|
12
|
+
* @see https://eslint.org/docs/latest/rules/constructor-super
|
|
13
|
+
*/
|
|
4
14
|
"constructor-super": 2,
|
|
15
|
+
/**
|
|
16
|
+
* @desc 强制 for 循环方向正确
|
|
17
|
+
* @descEN Enforce "for" loop update clause moving the counter in the right direction
|
|
18
|
+
* @see https://eslint.org/docs/latest/rules/for-direction
|
|
19
|
+
*/
|
|
5
20
|
"for-direction": 2,
|
|
21
|
+
/**
|
|
22
|
+
* @desc 强制 getter 函数中必须有 return 语句
|
|
23
|
+
* @descEN Enforce that a getter returns a value
|
|
24
|
+
* @see https://eslint.org/docs/latest/rules/getter-return
|
|
25
|
+
*/
|
|
6
26
|
"getter-return": 2,
|
|
27
|
+
/**
|
|
28
|
+
* @desc 禁止使用异步函数作为 Promise 执行器
|
|
29
|
+
* @descEN Disallow using an async function as a Promise executor
|
|
30
|
+
* @see https://eslint.org/docs/latest/rules/no-async-promise-executor
|
|
31
|
+
*/
|
|
7
32
|
"no-async-promise-executor": 2,
|
|
33
|
+
/**
|
|
34
|
+
* @desc 禁止在循环中使用 await
|
|
35
|
+
* @descEN Disallow `await` inside loops
|
|
36
|
+
* @see https://eslint.org/docs/latest/rules/no-await-in-loop
|
|
37
|
+
*/
|
|
8
38
|
"no-await-in-loop": 0,
|
|
39
|
+
/**
|
|
40
|
+
* @desc 禁止给类赋值
|
|
41
|
+
* @descEN Disallow reassigning class members
|
|
42
|
+
* @see https://eslint.org/docs/latest/rules/no-class-assign
|
|
43
|
+
*/
|
|
9
44
|
"no-class-assign": 2,
|
|
45
|
+
/**
|
|
46
|
+
* @desc 禁止与 -0 进行比较
|
|
47
|
+
* @descEN Disallow comparing against -0
|
|
48
|
+
* @see https://eslint.org/docs/latest/rules/no-compare-neg-zero
|
|
49
|
+
*/
|
|
10
50
|
"no-compare-neg-zero": 2,
|
|
51
|
+
/**
|
|
52
|
+
* @desc 禁止在条件表达式中使用赋值运算符
|
|
53
|
+
* @descEN Disallow assignment operators in conditional expressions
|
|
54
|
+
* @see https://eslint.org/docs/latest/rules/no-cond-assign
|
|
55
|
+
*/
|
|
11
56
|
"no-cond-assign": 2,
|
|
57
|
+
/**
|
|
58
|
+
* @desc 禁止修改 const 声明的变量
|
|
59
|
+
* @descEN Disallow reassigning `const` variables
|
|
60
|
+
* @see https://eslint.org/docs/latest/rules/no-const-assign
|
|
61
|
+
*/
|
|
12
62
|
"no-const-assign": 2,
|
|
63
|
+
/**
|
|
64
|
+
* @desc 禁止在常量条件、比较和表达式中出现逻辑错误
|
|
65
|
+
* @descEN Disallow expressions where the operation doesn't match the type
|
|
66
|
+
* @see https://eslint.org/docs/latest/rules/no-constant-binary-expression
|
|
67
|
+
*/
|
|
13
68
|
"no-constant-binary-expression": 2,
|
|
69
|
+
/**
|
|
70
|
+
* @desc 禁止在条件中使用常量表达式
|
|
71
|
+
* @descEN Disallow constant expressions in conditions
|
|
72
|
+
* @see https://eslint.org/docs/latest/rules/no-constant-condition
|
|
73
|
+
*/
|
|
14
74
|
"no-constant-condition": 2,
|
|
75
|
+
/**
|
|
76
|
+
* @desc 禁止构造函数中显式 return 值
|
|
77
|
+
* @descEN Disallow returning a value from a constructor
|
|
78
|
+
* @see https://eslint.org/docs/latest/rules/no-constructor-return
|
|
79
|
+
*/
|
|
15
80
|
"no-constructor-return": 2,
|
|
81
|
+
/**
|
|
82
|
+
* @desc 禁止在正则表达式中使用控制字符
|
|
83
|
+
* @descEN Disallow control characters in regular expressions
|
|
84
|
+
* @see https://eslint.org/docs/latest/rules/no-control-regex
|
|
85
|
+
*/
|
|
16
86
|
"no-control-regex": 2,
|
|
87
|
+
/**
|
|
88
|
+
* @desc 禁止使用 debugger
|
|
89
|
+
* @descEN Disallow the use of `debugger`
|
|
90
|
+
* @see https://eslint.org/docs/latest/rules/no-debugger
|
|
91
|
+
*/
|
|
17
92
|
"no-debugger": 2,
|
|
93
|
+
/**
|
|
94
|
+
* @desc 禁止函数参数重复
|
|
95
|
+
* @descEN Disallow duplicate arguments in function definitions
|
|
96
|
+
* @see https://eslint.org/docs/latest/rules/no-dupe-args
|
|
97
|
+
*/
|
|
18
98
|
"no-dupe-args": 2,
|
|
99
|
+
/**
|
|
100
|
+
* @desc 禁止类成员重复
|
|
101
|
+
* @descEN Disallow duplicate class members
|
|
102
|
+
* @see https://eslint.org/docs/latest/rules/no-dupe-class-members
|
|
103
|
+
*/
|
|
19
104
|
"no-dupe-class-members": 2,
|
|
105
|
+
/**
|
|
106
|
+
* @desc 禁止 if-else-if 链中出现重复条件
|
|
107
|
+
* @descEN Disallow duplicate conditions in if-else-if chains
|
|
108
|
+
* @see https://eslint.org/docs/latest/rules/no-dupe-else-if
|
|
109
|
+
*/
|
|
20
110
|
"no-dupe-else-if": 2,
|
|
111
|
+
/**
|
|
112
|
+
* @desc 禁止对象字面量中出现重复键
|
|
113
|
+
* @descEN Disallow duplicate keys in object literals
|
|
114
|
+
* @see https://eslint.org/docs/latest/rules/no-dupe-keys
|
|
115
|
+
*/
|
|
21
116
|
"no-dupe-keys": 2,
|
|
117
|
+
/**
|
|
118
|
+
* @desc 禁止 switch 中出现重复 case
|
|
119
|
+
* @descEN Disallow duplicate case labels
|
|
120
|
+
* @see https://eslint.org/docs/latest/rules/no-duplicate-case
|
|
121
|
+
*/
|
|
22
122
|
"no-duplicate-case": 2,
|
|
123
|
+
/**
|
|
124
|
+
* @desc 禁止重复导入
|
|
125
|
+
* @descEN Disallow duplicate imports
|
|
126
|
+
* @see https://eslint.org/docs/latest/rules/no-duplicate-imports
|
|
127
|
+
*/
|
|
23
128
|
"no-duplicate-imports": 2,
|
|
129
|
+
/**
|
|
130
|
+
* @desc 禁止在正则字符类中使用空字符
|
|
131
|
+
* @descEN Disallow empty character classes in regular expressions
|
|
132
|
+
* @see https://eslint.org/docs/latest/rules/no-empty-character-class
|
|
133
|
+
*/
|
|
24
134
|
"no-empty-character-class": 2,
|
|
135
|
+
/**
|
|
136
|
+
* @desc 禁止解构赋值中出现空模式
|
|
137
|
+
* @descEN Disallow empty destructuring patterns
|
|
138
|
+
* @see https://eslint.org/docs/latest/rules/no-empty-pattern
|
|
139
|
+
*/
|
|
25
140
|
"no-empty-pattern": 2,
|
|
141
|
+
/**
|
|
142
|
+
* @desc 禁止对 catch 异常参数赋值
|
|
143
|
+
* @descEN Disallow reassigning exceptions in `catch` clauses
|
|
144
|
+
* @see https://eslint.org/docs/latest/rules/no-ex-assign
|
|
145
|
+
*/
|
|
26
146
|
"no-ex-assign": 2,
|
|
147
|
+
/**
|
|
148
|
+
* @desc 禁止 switch 穿透
|
|
149
|
+
* @descEN Disallow fallthrough of `case` statements
|
|
150
|
+
* @see https://eslint.org/docs/latest/rules/no-fallthrough
|
|
151
|
+
*/
|
|
27
152
|
"no-fallthrough": 0,
|
|
153
|
+
/**
|
|
154
|
+
* @desc 禁止对函数声明重新赋值
|
|
155
|
+
* @descEN Disallow reassigning function declarations
|
|
156
|
+
* @see https://eslint.org/docs/latest/rules/no-func-assign
|
|
157
|
+
*/
|
|
28
158
|
"no-func-assign": 2,
|
|
159
|
+
/**
|
|
160
|
+
* @desc 禁止给导入绑定赋值
|
|
161
|
+
* @descEN Disallow assigning to imported bindings
|
|
162
|
+
* @see https://eslint.org/docs/latest/rules/no-import-assign
|
|
163
|
+
*/
|
|
29
164
|
"no-import-assign": 2,
|
|
165
|
+
/**
|
|
166
|
+
* @desc 禁止在嵌套代码块中声明变量或函数
|
|
167
|
+
* @descEN Disallow variable or function declarations in nested blocks
|
|
168
|
+
* @see https://eslint.org/docs/latest/rules/no-inner-declarations
|
|
169
|
+
*/
|
|
30
170
|
"no-inner-declarations": 2,
|
|
171
|
+
/**
|
|
172
|
+
* @desc 禁止使用无效的正则表达式
|
|
173
|
+
* @descEN Disallow invalid regular expressions in string literals
|
|
174
|
+
* @see https://eslint.org/docs/latest/rules/no-invalid-regexp
|
|
175
|
+
*/
|
|
31
176
|
"no-invalid-regexp": 2,
|
|
177
|
+
/**
|
|
178
|
+
* @desc 禁止不规则的空白字符
|
|
179
|
+
* @descEN Disallow irregular whitespace characters
|
|
180
|
+
* @see https://eslint.org/docs/latest/rules/no-irregular-whitespace
|
|
181
|
+
*/
|
|
32
182
|
"no-irregular-whitespace": [2, { skipStrings: true, skipComments: false, skipRegExps: true, skipTemplates: true, skipJSXText: true }],
|
|
183
|
+
/**
|
|
184
|
+
* @desc 禁止数字精度丢失
|
|
185
|
+
* @descEN Disallow literal numbers that lose precision
|
|
186
|
+
* @see https://eslint.org/docs/latest/rules/no-loss-of-precision
|
|
187
|
+
*/
|
|
33
188
|
"no-loss-of-precision": 2,
|
|
189
|
+
/**
|
|
190
|
+
* @desc 禁止误导性的字符类
|
|
191
|
+
* @descEN Disallow characters which are made with multiple code points in character class syntax
|
|
192
|
+
* @see https://eslint.org/docs/latest/rules/no-misleading-character-class
|
|
193
|
+
*/
|
|
34
194
|
"no-misleading-character-class": 2,
|
|
195
|
+
/**
|
|
196
|
+
* @desc 禁止使用 new 调用非构造函数
|
|
197
|
+
* @descEN Disallow `new` operators with global non-constructor functions
|
|
198
|
+
* @see https://eslint.org/docs/latest/rules/no-new-native-nonconstructor
|
|
199
|
+
*/
|
|
35
200
|
"no-new-native-nonconstructor": 2,
|
|
201
|
+
/**
|
|
202
|
+
* @desc 禁止对内置全局对象调用
|
|
203
|
+
* @descEN Disallow calling global object properties as functions
|
|
204
|
+
* @see https://eslint.org/docs/latest/rules/no-obj-calls
|
|
205
|
+
*/
|
|
36
206
|
"no-obj-calls": 2,
|
|
207
|
+
/**
|
|
208
|
+
* @desc 禁止在 Promise 执行器中返回值
|
|
209
|
+
* @descEN Disallow returning values from Promise executor functions
|
|
210
|
+
* @see https://eslint.org/docs/latest/rules/no-promise-executor-return
|
|
211
|
+
*/
|
|
37
212
|
"no-promise-executor-return": [2, { allowVoid: true }],
|
|
213
|
+
/**
|
|
214
|
+
* @desc 禁止直接调用对象原型上的方法
|
|
215
|
+
* @descEN Disallow calling some `Object.prototype` methods directly on objects
|
|
216
|
+
* @see https://eslint.org/docs/latest/rules/no-prototype-builtins
|
|
217
|
+
*/
|
|
38
218
|
"no-prototype-builtins": 2,
|
|
219
|
+
/**
|
|
220
|
+
* @desc 禁止自身赋值
|
|
221
|
+
* @descEN Disallow self-assignment
|
|
222
|
+
* @see https://eslint.org/docs/latest/rules/no-self-assign
|
|
223
|
+
*/
|
|
39
224
|
"no-self-assign": 2,
|
|
225
|
+
/**
|
|
226
|
+
* @desc 禁止自身比较
|
|
227
|
+
* @descEN Disallow self-comparison
|
|
228
|
+
* @see https://eslint.org/docs/latest/rules/no-self-compare
|
|
229
|
+
*/
|
|
40
230
|
"no-self-compare": 2,
|
|
231
|
+
/**
|
|
232
|
+
* @desc 禁止 setter 返回值
|
|
233
|
+
* @descEN Disallow returning a value from a setter
|
|
234
|
+
* @see https://eslint.org/docs/latest/rules/no-setter-return
|
|
235
|
+
*/
|
|
41
236
|
"no-setter-return": 2,
|
|
237
|
+
/**
|
|
238
|
+
* @desc 禁止稀疏数组
|
|
239
|
+
* @descEN Disallow sparse arrays
|
|
240
|
+
* @see https://eslint.org/docs/latest/rules/no-sparse-arrays
|
|
241
|
+
*/
|
|
42
242
|
"no-sparse-arrays": 2,
|
|
243
|
+
/**
|
|
244
|
+
* @desc 禁止在字符串中使用模板字面量占位符
|
|
245
|
+
* @descEN Disallow template literal placeholder syntax in regular strings
|
|
246
|
+
* @see https://eslint.org/docs/latest/rules/no-template-curly-in-string
|
|
247
|
+
*/
|
|
43
248
|
"no-template-curly-in-string": 2,
|
|
249
|
+
/**
|
|
250
|
+
* @desc 确保在构造函数中调用 super() 之前不能访问 this
|
|
251
|
+
* @descEN Disallow using `this`/`super` before `super()` is called
|
|
252
|
+
* @see https://eslint.org/docs/latest/rules/no-this-before-super
|
|
253
|
+
*/
|
|
44
254
|
"no-this-before-super": 2,
|
|
255
|
+
/**
|
|
256
|
+
* @desc 禁止使用未声明的变量
|
|
257
|
+
* @descEN Disallow undeclared variables
|
|
258
|
+
* @see https://eslint.org/docs/latest/rules/no-undef
|
|
259
|
+
*/
|
|
45
260
|
"no-undef": 0,
|
|
261
|
+
/**
|
|
262
|
+
* @desc 禁止使用可能引起歧义的多行表达式
|
|
263
|
+
* @descEN Disallow confusing multiline expressions
|
|
264
|
+
* @see https://eslint.org/docs/latest/rules/no-unexpected-multiline
|
|
265
|
+
*/
|
|
46
266
|
"no-unexpected-multiline": 2,
|
|
267
|
+
/**
|
|
268
|
+
* @desc 禁止未修改的循环条件
|
|
269
|
+
* @descEN Disallow unmodified loop conditions
|
|
270
|
+
* @see https://eslint.org/docs/latest/rules/no-unmodified-loop-condition
|
|
271
|
+
*/
|
|
47
272
|
"no-unmodified-loop-condition": 2,
|
|
273
|
+
/**
|
|
274
|
+
* @desc 禁止无法到达的代码
|
|
275
|
+
* @descEN Disallow unreachable code after control flow statements
|
|
276
|
+
* @see https://eslint.org/docs/latest/rules/no-unreachable
|
|
277
|
+
*/
|
|
48
278
|
"no-unreachable": 2,
|
|
279
|
+
/**
|
|
280
|
+
* @desc 禁止只有一次迭代的循环
|
|
281
|
+
* @descEN Disallow loops with a body that allows only one iteration
|
|
282
|
+
* @see https://eslint.org/docs/latest/rules/no-unreachable-loop
|
|
283
|
+
*/
|
|
49
284
|
"no-unreachable-loop": 2,
|
|
285
|
+
/**
|
|
286
|
+
* @desc 禁止不安全的 finally 语句
|
|
287
|
+
* @descEN Disallow control flow statements in `finally` blocks
|
|
288
|
+
* @see https://eslint.org/docs/latest/rules/no-unsafe-finally
|
|
289
|
+
*/
|
|
50
290
|
"no-unsafe-finally": 2,
|
|
291
|
+
/**
|
|
292
|
+
* @desc 禁止否定运算符与比较运算符混用
|
|
293
|
+
* @descEN Disallow negating the left operand of relational operators
|
|
294
|
+
* @see https://eslint.org/docs/latest/rules/no-unsafe-negation
|
|
295
|
+
*/
|
|
51
296
|
"no-unsafe-negation": 2,
|
|
297
|
+
/**
|
|
298
|
+
* @desc 禁止对可选链使用不安全的方式
|
|
299
|
+
* @descEN Disallow assignments that can lead to `undefined` in optional chaining
|
|
300
|
+
* @see https://eslint.org/docs/latest/rules/no-unsafe-optional-chaining
|
|
301
|
+
*/
|
|
52
302
|
"no-unsafe-optional-chaining": 2,
|
|
303
|
+
/**
|
|
304
|
+
* @desc 禁止使用未使用的私有类成员
|
|
305
|
+
* @descEN Disallow unused private class members
|
|
306
|
+
* @see https://eslint.org/docs/latest/rules/no-unused-private-class-members
|
|
307
|
+
*/
|
|
53
308
|
"no-unused-private-class-members": 1,
|
|
309
|
+
/**
|
|
310
|
+
* @desc 禁止未使用的变量
|
|
311
|
+
* @descEN Disallow unused variables
|
|
312
|
+
* @see https://eslint.org/docs/latest/rules/no-unused-vars
|
|
313
|
+
*/
|
|
54
314
|
"no-unused-vars": [1, { vars: "local", args: "none", caughtErrors: "none", varsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" }],
|
|
315
|
+
/**
|
|
316
|
+
* @desc 禁止在定义之前使用变量
|
|
317
|
+
* @descEN Disallow the use of variables before they are defined
|
|
318
|
+
* @see https://eslint.org/docs/latest/rules/no-use-before-define
|
|
319
|
+
*/
|
|
55
320
|
"no-use-before-define": [2, { functions: false, classes: false, variables: false, allowNamedExports: false }],
|
|
321
|
+
/**
|
|
322
|
+
* @desc 禁止无用的赋值
|
|
323
|
+
* @descEN Disallow useless assignments
|
|
324
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-assignment
|
|
325
|
+
*/
|
|
56
326
|
"no-useless-assignment": 0,
|
|
327
|
+
/**
|
|
328
|
+
* @desc 禁止正则表达式中无用的反向引用
|
|
329
|
+
* @descEN Disallow useless backreferences in regular expressions
|
|
330
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-backreference
|
|
331
|
+
*/
|
|
57
332
|
"no-useless-backreference": 2,
|
|
333
|
+
/**
|
|
334
|
+
* @desc 要求原子更新
|
|
335
|
+
* @descEN Require calls to `await` in atomic update expressions
|
|
336
|
+
* @see https://eslint.org/docs/latest/rules/require-atomic-updates
|
|
337
|
+
*/
|
|
58
338
|
"require-atomic-updates": [2, { allowProperties: true }],
|
|
339
|
+
/**
|
|
340
|
+
* @desc 强制使用 isNaN() 检查 NaN
|
|
341
|
+
* @descEN Require calls to `isNaN()` when checking for `NaN`
|
|
342
|
+
* @see https://eslint.org/docs/latest/rules/use-isnan
|
|
343
|
+
*/
|
|
59
344
|
"use-isnan": 2,
|
|
345
|
+
/**
|
|
346
|
+
* @desc 强制 typeof 比较值是有效的字符串
|
|
347
|
+
* @descEN Enforce comparing `typeof` expressions against valid strings
|
|
348
|
+
* @see https://eslint.org/docs/latest/rules/valid-typeof
|
|
349
|
+
*/
|
|
60
350
|
"valid-typeof": 2,
|
|
61
351
|
// Suggestions
|
|
352
|
+
/**
|
|
353
|
+
* @desc 强制 getter/setter 成对出现
|
|
354
|
+
* @descEN Enforce getter/setter pairs in objects and classes
|
|
355
|
+
* @see https://eslint.org/docs/latest/rules/accessor-pairs
|
|
356
|
+
*/
|
|
62
357
|
"accessor-pairs": [2, { setWithoutGet: true, getWithoutSet: false }],
|
|
358
|
+
/**
|
|
359
|
+
* @desc 强制箭头函数体风格
|
|
360
|
+
* @descEN Require or disallow braces around arrow function bodies
|
|
361
|
+
* @see https://eslint.org/docs/latest/rules/arrow-body-style
|
|
362
|
+
*/
|
|
63
363
|
"arrow-body-style": 0,
|
|
364
|
+
/**
|
|
365
|
+
* @desc 要求变量声明在块级作用域内
|
|
366
|
+
* @descEN Require variables to be declared in the nearest block scope
|
|
367
|
+
* @see https://eslint.org/docs/latest/rules/block-scoped-var
|
|
368
|
+
*/
|
|
64
369
|
"block-scoped-var": 0,
|
|
370
|
+
/**
|
|
371
|
+
* @desc 强制驼峰命名规范
|
|
372
|
+
* @descEN Enforce camelcase naming convention
|
|
373
|
+
* @see https://eslint.org/docs/latest/rules/camelcase
|
|
374
|
+
*/
|
|
65
375
|
"camelcase": 0,
|
|
376
|
+
/**
|
|
377
|
+
* @desc 强制注释首字母大小写
|
|
378
|
+
* @descEN Enforce capitalization of the first letter of a comment
|
|
379
|
+
* @see https://eslint.org/docs/latest/rules/capitalized-comments
|
|
380
|
+
*/
|
|
66
381
|
"capitalized-comments": 0,
|
|
382
|
+
/**
|
|
383
|
+
* @desc 强制类方法使用 this
|
|
384
|
+
* @descEN Require class methods to use `this`
|
|
385
|
+
* @see https://eslint.org/docs/latest/rules/class-methods-use-this
|
|
386
|
+
*/
|
|
67
387
|
"class-methods-use-this": 0,
|
|
388
|
+
/**
|
|
389
|
+
* @desc 限制代码复杂度
|
|
390
|
+
* @descEN Limit cyclomatic complexity
|
|
391
|
+
* @see https://eslint.org/docs/latest/rules/complexity
|
|
392
|
+
*/
|
|
68
393
|
"complexity": 0,
|
|
394
|
+
/**
|
|
395
|
+
* @desc 要求一致的 return 语句
|
|
396
|
+
* @descEN Require `return` statements to either always or never specify values
|
|
397
|
+
* @see https://eslint.org/docs/latest/rules/consistent-return
|
|
398
|
+
*/
|
|
69
399
|
"consistent-return": 0,
|
|
400
|
+
/**
|
|
401
|
+
* @desc 强制一致的 this 别名
|
|
402
|
+
* @descEN Require or disallow a consistent naming pattern for `this` aliases
|
|
403
|
+
* @see https://eslint.org/docs/latest/rules/consistent-this
|
|
404
|
+
*/
|
|
70
405
|
"consistent-this": 0,
|
|
406
|
+
/**
|
|
407
|
+
* @desc 强制花括号风格
|
|
408
|
+
* @descEN Require or disallow braces around all control statements
|
|
409
|
+
* @see https://eslint.org/docs/latest/rules/curly
|
|
410
|
+
*/
|
|
71
411
|
"curly": 2,
|
|
412
|
+
/**
|
|
413
|
+
* @desc 要求 switch 语句中有 default 分支
|
|
414
|
+
* @descEN Require `default` case in switch statements
|
|
415
|
+
* @see https://eslint.org/docs/latest/rules/default-case
|
|
416
|
+
*/
|
|
72
417
|
"default-case": 2,
|
|
418
|
+
/**
|
|
419
|
+
* @desc 要求 default 分支放在最后
|
|
420
|
+
* @descEN Require `default` case to be the last clause in a switch statement
|
|
421
|
+
* @see https://eslint.org/docs/latest/rules/default-case-last
|
|
422
|
+
*/
|
|
73
423
|
"default-case-last": 0,
|
|
424
|
+
/**
|
|
425
|
+
* @desc 强制默认参数放在最后
|
|
426
|
+
* @descEN Require default parameters to be last
|
|
427
|
+
* @see https://eslint.org/docs/latest/rules/default-param-last
|
|
428
|
+
*/
|
|
74
429
|
"default-param-last": 2,
|
|
430
|
+
/**
|
|
431
|
+
* @desc 强制使用点号表示法
|
|
432
|
+
* @descEN Require dot notation when possible
|
|
433
|
+
* @see https://eslint.org/docs/latest/rules/dot-notation
|
|
434
|
+
*/
|
|
75
435
|
"dot-notation": 0,
|
|
436
|
+
/**
|
|
437
|
+
* @desc 强制使用 === 和 !==
|
|
438
|
+
* @descEN Require the use of `===` and `!==`
|
|
439
|
+
* @see https://eslint.org/docs/latest/rules/eqeqeq
|
|
440
|
+
*/
|
|
76
441
|
"eqeqeq": 2,
|
|
442
|
+
/**
|
|
443
|
+
* @desc 强制函数名与赋值的变量名匹配
|
|
444
|
+
* @descEN Require function names to match the name of the variable to which they are assigned
|
|
445
|
+
* @see https://eslint.org/docs/latest/rules/func-name-matching
|
|
446
|
+
*/
|
|
77
447
|
"func-name-matching": 2,
|
|
448
|
+
/**
|
|
449
|
+
* @desc 强制命名函数表达式
|
|
450
|
+
* @descEN Require or disallow named function expressions
|
|
451
|
+
* @see https://eslint.org/docs/latest/rules/func-names
|
|
452
|
+
*/
|
|
78
453
|
"func-names": 1,
|
|
454
|
+
/**
|
|
455
|
+
* @desc 强制函数声明与函数表达式的风格
|
|
456
|
+
* @descEN Require or disallow the use of function declarations
|
|
457
|
+
* @see https://eslint.org/docs/latest/rules/func-style
|
|
458
|
+
*/
|
|
79
459
|
"func-style": 0,
|
|
460
|
+
/**
|
|
461
|
+
* @desc 强制访问器属性成对出现
|
|
462
|
+
* @descEN Require grouped accessor pairs in object literals and classes
|
|
463
|
+
* @see https://eslint.org/docs/latest/rules/grouped-accessor-pairs
|
|
464
|
+
*/
|
|
80
465
|
"grouped-accessor-pairs": [2, "getBeforeSet"],
|
|
466
|
+
/**
|
|
467
|
+
* @desc 强制 for-in 循环中需要 if 保护
|
|
468
|
+
* @descEN Require `for-in` loops to include an `if` statement
|
|
469
|
+
* @see https://eslint.org/docs/latest/rules/guard-for-in
|
|
470
|
+
*/
|
|
81
471
|
"guard-for-in": 2,
|
|
472
|
+
/**
|
|
473
|
+
* @desc 禁止使用指定标识符名称
|
|
474
|
+
* @descEN Disallow specified identifier names
|
|
475
|
+
* @see https://eslint.org/docs/latest/rules/id-denylist
|
|
476
|
+
*/
|
|
82
477
|
"id-denylist": 0,
|
|
478
|
+
/**
|
|
479
|
+
* @desc 限制标识符长度
|
|
480
|
+
* @descEN Limit minimum and maximum identifier lengths
|
|
481
|
+
* @see https://eslint.org/docs/latest/rules/id-length
|
|
482
|
+
*/
|
|
83
483
|
"id-length": 0,
|
|
484
|
+
/**
|
|
485
|
+
* @desc 强制标识符命名匹配指定模式
|
|
486
|
+
* @descEN Require identifiers to match a specified regular expression
|
|
487
|
+
* @see https://eslint.org/docs/latest/rules/id-match
|
|
488
|
+
*/
|
|
84
489
|
"id-match": 0,
|
|
490
|
+
/**
|
|
491
|
+
* @desc 强制变量初始化
|
|
492
|
+
* @descEN Require or disallow initialization in variable declarations
|
|
493
|
+
* @see https://eslint.org/docs/latest/rules/init-declarations
|
|
494
|
+
*/
|
|
85
495
|
"init-declarations": 0,
|
|
496
|
+
/**
|
|
497
|
+
* @desc 强制使用逻辑赋值运算符
|
|
498
|
+
* @descEN Require or disallow logical assignment operators
|
|
499
|
+
* @see https://eslint.org/docs/latest/rules/logical-assignment-operators
|
|
500
|
+
*/
|
|
86
501
|
"logical-assignment-operators": 0,
|
|
502
|
+
/**
|
|
503
|
+
* @desc 限制单个文件中的类数量
|
|
504
|
+
* @descEN Limit the number of classes per file
|
|
505
|
+
* @see https://eslint.org/docs/latest/rules/max-classes-per-file
|
|
506
|
+
*/
|
|
87
507
|
"max-classes-per-file": 0,
|
|
508
|
+
/**
|
|
509
|
+
* @desc 限制代码块嵌套深度
|
|
510
|
+
* @descEN Enforce a maximum depth that blocks can be nested
|
|
511
|
+
* @see https://eslint.org/docs/latest/rules/max-depth
|
|
512
|
+
*/
|
|
88
513
|
"max-depth": [2, 5],
|
|
514
|
+
/**
|
|
515
|
+
* @desc 限制文件行数
|
|
516
|
+
* @descEN Enforce a maximum number of lines per file
|
|
517
|
+
* @see https://eslint.org/docs/latest/rules/max-lines
|
|
518
|
+
*/
|
|
89
519
|
"max-lines": 0,
|
|
520
|
+
/**
|
|
521
|
+
* @desc 限制函数中的行数
|
|
522
|
+
* @descEN Enforce a maximum number of lines per function
|
|
523
|
+
* @see https://eslint.org/docs/latest/rules/max-lines-per-function
|
|
524
|
+
*/
|
|
90
525
|
"max-lines-per-function": 0,
|
|
526
|
+
/**
|
|
527
|
+
* @desc 限制回调嵌套深度
|
|
528
|
+
* @descEN Enforce a maximum depth that callbacks can be nested
|
|
529
|
+
* @see https://eslint.org/docs/latest/rules/max-nested-callbacks
|
|
530
|
+
*/
|
|
91
531
|
"max-nested-callbacks": 0,
|
|
532
|
+
/**
|
|
533
|
+
* @desc 限制参数数量
|
|
534
|
+
* @descEN Enforce a maximum number of parameters in function definitions
|
|
535
|
+
* @see https://eslint.org/docs/latest/rules/max-params
|
|
536
|
+
*/
|
|
92
537
|
"max-params": 0,
|
|
538
|
+
/**
|
|
539
|
+
* @desc 限制函数中的语句数量
|
|
540
|
+
* @descEN Enforce a maximum number of statements allowed in function blocks
|
|
541
|
+
* @see https://eslint.org/docs/latest/rules/max-statements
|
|
542
|
+
*/
|
|
93
543
|
"max-statements": 0,
|
|
544
|
+
/**
|
|
545
|
+
* @desc 要求构造函数名以大写字母开头
|
|
546
|
+
* @descEN Require constructor names to begin with a capital letter
|
|
547
|
+
* @see https://eslint.org/docs/latest/rules/new-cap
|
|
548
|
+
*/
|
|
94
549
|
"new-cap": [2, { capIsNew: false }],
|
|
550
|
+
/**
|
|
551
|
+
* @desc 禁止使用 alert
|
|
552
|
+
* @descEN Disallow the use of `alert`, `confirm`, and `prompt`
|
|
553
|
+
* @see https://eslint.org/docs/latest/rules/no-alert
|
|
554
|
+
*/
|
|
95
555
|
"no-alert": 0,
|
|
556
|
+
/**
|
|
557
|
+
* @desc 禁止使用 Array 构造函数
|
|
558
|
+
* @descEN Disallow `Array` constructors
|
|
559
|
+
* @see https://eslint.org/docs/latest/rules/no-array-constructor
|
|
560
|
+
*/
|
|
96
561
|
"no-array-constructor": 2,
|
|
562
|
+
/**
|
|
563
|
+
* @desc 禁止使用位运算符
|
|
564
|
+
* @descEN Disallow bitwise operators
|
|
565
|
+
* @see https://eslint.org/docs/latest/rules/no-bitwise
|
|
566
|
+
*/
|
|
97
567
|
"no-bitwise": 0,
|
|
568
|
+
/**
|
|
569
|
+
* @desc 禁止使用 caller 或 callee
|
|
570
|
+
* @descEN Disallow the use of `arguments.caller` or `arguments.callee`
|
|
571
|
+
* @see https://eslint.org/docs/latest/rules/no-caller
|
|
572
|
+
*/
|
|
98
573
|
"no-caller": 2,
|
|
574
|
+
/**
|
|
575
|
+
* @desc 禁止在 case/default 子句中使用词法声明
|
|
576
|
+
* @descEN Disallow lexical declarations in case/default clauses
|
|
577
|
+
* @see https://eslint.org/docs/latest/rules/no-case-declarations
|
|
578
|
+
*/
|
|
99
579
|
"no-case-declarations": 2,
|
|
580
|
+
/**
|
|
581
|
+
* @desc 禁止使用 console
|
|
582
|
+
* @descEN Disallow the use of `console`
|
|
583
|
+
* @see https://eslint.org/docs/latest/rules/no-console
|
|
584
|
+
*/
|
|
100
585
|
"no-console": 0,
|
|
586
|
+
/**
|
|
587
|
+
* @desc 禁止使用 continue
|
|
588
|
+
* @descEN Disallow the use of `continue`
|
|
589
|
+
* @see https://eslint.org/docs/latest/rules/no-continue
|
|
590
|
+
*/
|
|
101
591
|
"no-continue": 0,
|
|
592
|
+
/**
|
|
593
|
+
* @desc 禁止删除变量
|
|
594
|
+
* @descEN Disallow deleting variables
|
|
595
|
+
* @see https://eslint.org/docs/latest/rules/no-delete-var
|
|
596
|
+
*/
|
|
102
597
|
"no-delete-var": 2,
|
|
598
|
+
/**
|
|
599
|
+
* @desc 禁止使用正则除法标记
|
|
600
|
+
* @descEN Disallow division operators which might be confused with regular expressions
|
|
601
|
+
* @see https://eslint.org/docs/latest/rules/no-div-regex
|
|
602
|
+
*/
|
|
103
603
|
"no-div-regex": 2,
|
|
604
|
+
/**
|
|
605
|
+
* @desc 禁止在 else 分支中使用 return
|
|
606
|
+
* @descEN Disallow `else` blocks after `return` statements in `if` blocks
|
|
607
|
+
* @see https://eslint.org/docs/latest/rules/no-else-return
|
|
608
|
+
*/
|
|
104
609
|
"no-else-return": 0,
|
|
610
|
+
/**
|
|
611
|
+
* @desc 禁止空块语句
|
|
612
|
+
* @descEN Disallow empty block statements
|
|
613
|
+
* @see https://eslint.org/docs/latest/rules/no-empty
|
|
614
|
+
*/
|
|
105
615
|
"no-empty": [2, { allowEmptyCatch: true }],
|
|
616
|
+
/**
|
|
617
|
+
* @desc 禁止空函数
|
|
618
|
+
* @descEN Disallow empty functions
|
|
619
|
+
* @see https://eslint.org/docs/latest/rules/no-empty-function
|
|
620
|
+
*/
|
|
106
621
|
"no-empty-function": 0,
|
|
622
|
+
/**
|
|
623
|
+
* @desc 禁止空静态代码块
|
|
624
|
+
* @descEN Disallow empty static blocks
|
|
625
|
+
* @see https://eslint.org/docs/latest/rules/no-empty-static-block
|
|
626
|
+
*/
|
|
107
627
|
"no-empty-static-block": 2,
|
|
628
|
+
/**
|
|
629
|
+
* @desc 禁止使用 == 与 null 比较
|
|
630
|
+
* @descEN Disallow `==` and `!=` comparisons against `null`
|
|
631
|
+
* @see https://eslint.org/docs/latest/rules/no-eq-null
|
|
632
|
+
*/
|
|
108
633
|
"no-eq-null": 2,
|
|
634
|
+
/**
|
|
635
|
+
* @desc 禁止使用 eval
|
|
636
|
+
* @descEN Disallow the use of `eval()`
|
|
637
|
+
* @see https://eslint.org/docs/latest/rules/no-eval
|
|
638
|
+
*/
|
|
109
639
|
"no-eval": 2,
|
|
640
|
+
/**
|
|
641
|
+
* @desc 禁止扩展原生对象
|
|
642
|
+
* @descEN Disallow extending native types
|
|
643
|
+
* @see https://eslint.org/docs/latest/rules/no-extend-native
|
|
644
|
+
*/
|
|
110
645
|
"no-extend-native": 2,
|
|
646
|
+
/**
|
|
647
|
+
* @desc 禁止不必要的函数绑定
|
|
648
|
+
* @descEN Disallow unnecessary calls to `.bind()`
|
|
649
|
+
* @see https://eslint.org/docs/latest/rules/no-extra-bind
|
|
650
|
+
*/
|
|
111
651
|
"no-extra-bind": 2,
|
|
652
|
+
/**
|
|
653
|
+
* @desc 禁止不必要的布尔类型转换
|
|
654
|
+
* @descEN Disallow unnecessary boolean casts
|
|
655
|
+
* @see https://eslint.org/docs/latest/rules/no-extra-boolean-cast
|
|
656
|
+
*/
|
|
112
657
|
"no-extra-boolean-cast": 2,
|
|
658
|
+
/**
|
|
659
|
+
* @desc 禁止不必要的标签
|
|
660
|
+
* @descEN Disallow unnecessary labels
|
|
661
|
+
* @see https://eslint.org/docs/latest/rules/no-extra-label
|
|
662
|
+
*/
|
|
113
663
|
"no-extra-label": 0,
|
|
664
|
+
/**
|
|
665
|
+
* @desc 禁止对全局对象赋值
|
|
666
|
+
* @descEN Disallow assignments to native objects or read-only global variables
|
|
667
|
+
* @see https://eslint.org/docs/latest/rules/no-global-assign
|
|
668
|
+
*/
|
|
114
669
|
"no-global-assign": 2,
|
|
670
|
+
/**
|
|
671
|
+
* @desc 禁止隐式类型转换
|
|
672
|
+
* @descEN Disallow shorthand type conversions
|
|
673
|
+
* @see https://eslint.org/docs/latest/rules/no-implicit-coercion
|
|
674
|
+
*/
|
|
115
675
|
"no-implicit-coercion": [2, { allow: ["!!"] }],
|
|
676
|
+
/**
|
|
677
|
+
* @desc 禁止隐式全局变量
|
|
678
|
+
* @descEN Disallow declarations in the global scope
|
|
679
|
+
* @see https://eslint.org/docs/latest/rules/no-implicit-globals
|
|
680
|
+
*/
|
|
116
681
|
"no-implicit-globals": 0,
|
|
682
|
+
/**
|
|
683
|
+
* @desc 禁止隐式 eval
|
|
684
|
+
* @descEN Disallow the use of `eval()`-like methods
|
|
685
|
+
* @see https://eslint.org/docs/latest/rules/no-implied-eval
|
|
686
|
+
*/
|
|
117
687
|
"no-implied-eval": 2,
|
|
688
|
+
/**
|
|
689
|
+
* @desc 禁止行内注释
|
|
690
|
+
* @descEN Disallow inline comments after code
|
|
691
|
+
* @see https://eslint.org/docs/latest/rules/no-inline-comments
|
|
692
|
+
*/
|
|
118
693
|
"no-inline-comments": 0,
|
|
694
|
+
/**
|
|
695
|
+
* @desc 禁止无效的 this
|
|
696
|
+
* @descEN Disallow use of `this` in contexts where the value of `this` is `undefined`
|
|
697
|
+
* @see https://eslint.org/docs/latest/rules/no-invalid-this
|
|
698
|
+
*/
|
|
119
699
|
"no-invalid-this": 0,
|
|
700
|
+
/**
|
|
701
|
+
* @desc 禁止使用 __iterator__
|
|
702
|
+
* @descEN Disallow the use of the `__iterator__` property
|
|
703
|
+
* @see https://eslint.org/docs/latest/rules/no-iterator
|
|
704
|
+
*/
|
|
120
705
|
"no-iterator": 2,
|
|
706
|
+
/**
|
|
707
|
+
* @desc 禁止 label 与变量同名
|
|
708
|
+
* @descEN Disallow labels that share a name with a variable
|
|
709
|
+
* @see https://eslint.org/docs/latest/rules/no-label-var
|
|
710
|
+
*/
|
|
121
711
|
"no-label-var": 2,
|
|
712
|
+
/**
|
|
713
|
+
* @desc 禁止使用标签语句
|
|
714
|
+
* @descEN Disallow labeled statements
|
|
715
|
+
* @see https://eslint.org/docs/latest/rules/no-labels
|
|
716
|
+
*/
|
|
122
717
|
"no-labels": 2,
|
|
718
|
+
/**
|
|
719
|
+
* @desc 禁止不必要的代码块
|
|
720
|
+
* @descEN Disallow unnecessary nested blocks
|
|
721
|
+
* @see https://eslint.org/docs/latest/rules/no-lone-blocks
|
|
722
|
+
*/
|
|
123
723
|
"no-lone-blocks": 2,
|
|
724
|
+
/**
|
|
725
|
+
* @desc 禁止 if 作为唯一语句的 else 块
|
|
726
|
+
* @descEN Disallow `if` statements as the only statement in `else` blocks
|
|
727
|
+
* @see https://eslint.org/docs/latest/rules/no-lonely-if
|
|
728
|
+
*/
|
|
124
729
|
"no-lonely-if": 0,
|
|
730
|
+
/**
|
|
731
|
+
* @desc 禁止在循环中使用函数声明
|
|
732
|
+
* @descEN Disallow function declarations inside loops
|
|
733
|
+
* @see https://eslint.org/docs/latest/rules/no-loop-func
|
|
734
|
+
*/
|
|
125
735
|
"no-loop-func": 0,
|
|
736
|
+
/**
|
|
737
|
+
* @desc 禁止使用魔术数字
|
|
738
|
+
* @descEN Disallow magic numbers
|
|
739
|
+
* @see https://eslint.org/docs/latest/rules/no-magic-numbers
|
|
740
|
+
*/
|
|
126
741
|
"no-magic-numbers": 0,
|
|
742
|
+
/**
|
|
743
|
+
* @desc 禁止连续赋值
|
|
744
|
+
* @descEN Disallow chained assignments
|
|
745
|
+
* @see https://eslint.org/docs/latest/rules/no-multi-assign
|
|
746
|
+
*/
|
|
127
747
|
"no-multi-assign": 0,
|
|
748
|
+
/**
|
|
749
|
+
* @desc 禁止多行字符串
|
|
750
|
+
* @descEN Disallow multiline strings
|
|
751
|
+
* @see https://eslint.org/docs/latest/rules/no-multi-str
|
|
752
|
+
*/
|
|
128
753
|
"no-multi-str": 2,
|
|
754
|
+
/**
|
|
755
|
+
* @desc 禁止否定条件
|
|
756
|
+
* @descEN Disallow negated conditions
|
|
757
|
+
* @see https://eslint.org/docs/latest/rules/no-negated-condition
|
|
758
|
+
*/
|
|
129
759
|
"no-negated-condition": 0,
|
|
760
|
+
/**
|
|
761
|
+
* @desc 禁止嵌套三元表达式
|
|
762
|
+
* @descEN Disallow nested ternary expressions
|
|
763
|
+
* @see https://eslint.org/docs/latest/rules/no-nested-ternary
|
|
764
|
+
*/
|
|
130
765
|
"no-nested-ternary": 0,
|
|
766
|
+
/**
|
|
767
|
+
* @desc 禁止使用 new 而不赋值
|
|
768
|
+
* @descEN Disallow `new` operators outside of assignments or comparisons
|
|
769
|
+
* @see https://eslint.org/docs/latest/rules/no-new
|
|
770
|
+
*/
|
|
131
771
|
"no-new": 2,
|
|
772
|
+
/**
|
|
773
|
+
* @desc 禁止使用 new Function
|
|
774
|
+
* @descEN Disallow `new Function()` expressions
|
|
775
|
+
* @see https://eslint.org/docs/latest/rules/no-new-func
|
|
776
|
+
*/
|
|
132
777
|
"no-new-func": 2,
|
|
778
|
+
/**
|
|
779
|
+
* @desc 禁止使用原始包装类型
|
|
780
|
+
* @descEN Disallow `new` operators with the `String`, `Number`, and `Boolean` objects
|
|
781
|
+
* @see https://eslint.org/docs/latest/rules/no-new-wrappers
|
|
782
|
+
*/
|
|
133
783
|
"no-new-wrappers": 2,
|
|
784
|
+
/**
|
|
785
|
+
* @desc 禁止八进制转义符中的无意义数字
|
|
786
|
+
* @descEN Disallow `\8` and `\9` escape sequences in string literals
|
|
787
|
+
* @see https://eslint.org/docs/latest/rules/no-nonoctal-decimal-escape
|
|
788
|
+
*/
|
|
134
789
|
"no-nonoctal-decimal-escape": 2,
|
|
790
|
+
/**
|
|
791
|
+
* @desc 禁止使用 Object 构造函数
|
|
792
|
+
* @descEN Disallow `Object` constructors
|
|
793
|
+
* @see https://eslint.org/docs/latest/rules/no-object-constructor
|
|
794
|
+
*/
|
|
135
795
|
"no-object-constructor": 2,
|
|
796
|
+
/**
|
|
797
|
+
* @desc 禁止使用八进制字面量
|
|
798
|
+
* @descEN Disallow octal literals
|
|
799
|
+
* @see https://eslint.org/docs/latest/rules/no-octal
|
|
800
|
+
*/
|
|
136
801
|
"no-octal": 2,
|
|
802
|
+
/**
|
|
803
|
+
* @desc 禁止八进制转义序列
|
|
804
|
+
* @descEN Disallow octal escape sequences in string literals
|
|
805
|
+
* @see https://eslint.org/docs/latest/rules/no-octal-escape
|
|
806
|
+
*/
|
|
137
807
|
"no-octal-escape": 0,
|
|
808
|
+
/**
|
|
809
|
+
* @desc 禁止重新分配函数参数
|
|
810
|
+
* @descEN Disallow reassigning function parameters
|
|
811
|
+
* @see https://eslint.org/docs/latest/rules/no-param-reassign
|
|
812
|
+
*/
|
|
138
813
|
"no-param-reassign": 2,
|
|
814
|
+
/**
|
|
815
|
+
* @desc 禁止使用 ++ 和 --
|
|
816
|
+
* @descEN Disallow the unary operators `++` and `--`
|
|
817
|
+
* @see https://eslint.org/docs/latest/rules/no-plusplus
|
|
818
|
+
*/
|
|
139
819
|
"no-plusplus": 0,
|
|
820
|
+
/**
|
|
821
|
+
* @desc 禁止使用 __proto__
|
|
822
|
+
* @descEN Disallow the use of the `__proto__` property
|
|
823
|
+
* @see https://eslint.org/docs/latest/rules/no-proto
|
|
824
|
+
*/
|
|
140
825
|
"no-proto": 2,
|
|
826
|
+
/**
|
|
827
|
+
* @desc 禁止重复声明变量
|
|
828
|
+
* @descEN Disallow variable redeclaration
|
|
829
|
+
* @see https://eslint.org/docs/latest/rules/no-redeclare
|
|
830
|
+
*/
|
|
141
831
|
"no-redeclare": 2,
|
|
832
|
+
/**
|
|
833
|
+
* @desc 禁止正则表达式中的空格
|
|
834
|
+
* @descEN Disallow multiple spaces in regular expression literals
|
|
835
|
+
* @see https://eslint.org/docs/latest/rules/no-regex-spaces
|
|
836
|
+
*/
|
|
142
837
|
"no-regex-spaces": 2,
|
|
838
|
+
/**
|
|
839
|
+
* @desc 禁止受限的导出名称
|
|
840
|
+
* @descEN Disallow specified names in exports
|
|
841
|
+
* @see https://eslint.org/docs/latest/rules/no-restricted-exports
|
|
842
|
+
*/
|
|
143
843
|
"no-restricted-exports": 0,
|
|
844
|
+
/**
|
|
845
|
+
* @desc 禁止受限的全局变量
|
|
846
|
+
* @descEN Disallow specified global variables
|
|
847
|
+
* @see https://eslint.org/docs/latest/rules/no-restricted-globals
|
|
848
|
+
*/
|
|
144
849
|
"no-restricted-globals": 0,
|
|
850
|
+
/**
|
|
851
|
+
* @desc 禁止受限的导入
|
|
852
|
+
* @descEN Disallow specified modules when loaded by `import`
|
|
853
|
+
* @see https://eslint.org/docs/latest/rules/no-restricted-imports
|
|
854
|
+
*/
|
|
145
855
|
"no-restricted-imports": 0,
|
|
856
|
+
/**
|
|
857
|
+
* @desc 禁止受限的属性
|
|
858
|
+
* @descEN Disallow certain properties on certain objects
|
|
859
|
+
* @see https://eslint.org/docs/latest/rules/no-restricted-properties
|
|
860
|
+
*/
|
|
146
861
|
"no-restricted-properties": 0,
|
|
862
|
+
/**
|
|
863
|
+
* @desc 禁止受限的语法
|
|
864
|
+
* @descEN Disallow specified syntax
|
|
865
|
+
* @see https://eslint.org/docs/latest/rules/no-restricted-syntax
|
|
866
|
+
*/
|
|
147
867
|
"no-restricted-syntax": 0,
|
|
868
|
+
/**
|
|
869
|
+
* @desc 强制 return 赋值
|
|
870
|
+
* @descEN Disallow assignment in `return` statements
|
|
871
|
+
* @see https://eslint.org/docs/latest/rules/no-return-assign
|
|
872
|
+
*/
|
|
148
873
|
"no-return-assign": [2, "always"],
|
|
874
|
+
/**
|
|
875
|
+
* @desc 禁止使用 javascript: URL
|
|
876
|
+
* @descEN Disallow `javascript:` URLs
|
|
877
|
+
* @see https://eslint.org/docs/latest/rules/no-script-url
|
|
878
|
+
*/
|
|
149
879
|
"no-script-url": 0,
|
|
880
|
+
/**
|
|
881
|
+
* @desc 禁止使用逗号表达式
|
|
882
|
+
* @descEN Disallow comma operators
|
|
883
|
+
* @see https://eslint.org/docs/latest/rules/no-sequences
|
|
884
|
+
*/
|
|
150
885
|
"no-sequences": 2,
|
|
886
|
+
/**
|
|
887
|
+
* @desc 禁止变量声明覆盖外层作用域
|
|
888
|
+
* @descEN Disallow variable declarations from shadowing outer scope variables
|
|
889
|
+
* @see https://eslint.org/docs/latest/rules/no-shadow
|
|
890
|
+
*/
|
|
151
891
|
"no-shadow": 0,
|
|
892
|
+
/**
|
|
893
|
+
* @desc 禁止遮蔽受限的标识符
|
|
894
|
+
* @descEN Disallow identifiers from shadowing restricted names
|
|
895
|
+
* @see https://eslint.org/docs/latest/rules/no-shadow-restricted-names
|
|
896
|
+
*/
|
|
152
897
|
"no-shadow-restricted-names": 2,
|
|
898
|
+
/**
|
|
899
|
+
* @desc 禁止使用三元表达式
|
|
900
|
+
* @descEN Disallow ternary operators
|
|
901
|
+
* @see https://eslint.org/docs/latest/rules/no-ternary
|
|
902
|
+
*/
|
|
153
903
|
"no-ternary": 0,
|
|
904
|
+
/**
|
|
905
|
+
* @desc 禁止抛出字面量
|
|
906
|
+
* @descEN Disallow throwing literals as exceptions
|
|
907
|
+
* @see https://eslint.org/docs/latest/rules/no-throw-literal
|
|
908
|
+
*/
|
|
154
909
|
"no-throw-literal": 0,
|
|
910
|
+
/**
|
|
911
|
+
* @desc 禁止将 undefined 赋值给变量
|
|
912
|
+
* @descEN Disallow initializing variables to `undefined`
|
|
913
|
+
* @see https://eslint.org/docs/latest/rules/no-undef-init
|
|
914
|
+
*/
|
|
155
915
|
"no-undef-init": 2,
|
|
916
|
+
/**
|
|
917
|
+
* @desc 禁止使用 undefined
|
|
918
|
+
* @descEN Disallow the use of `undefined` as an identifier
|
|
919
|
+
* @see https://eslint.org/docs/latest/rules/no-undefined
|
|
920
|
+
*/
|
|
156
921
|
"no-undefined": 0,
|
|
922
|
+
/**
|
|
923
|
+
* @desc 禁止标识符有前导或尾随下划线
|
|
924
|
+
* @descEN Disallow dangling underscores in identifiers
|
|
925
|
+
* @see https://eslint.org/docs/latest/rules/no-underscore-dangle
|
|
926
|
+
*/
|
|
157
927
|
"no-underscore-dangle": 0,
|
|
928
|
+
/**
|
|
929
|
+
* @desc 禁止不必要的三元表达式
|
|
930
|
+
* @descEN Disallow ternary operators when simpler alternatives exist
|
|
931
|
+
* @see https://eslint.org/docs/latest/rules/no-unneeded-ternary
|
|
932
|
+
*/
|
|
158
933
|
"no-unneeded-ternary": 2,
|
|
934
|
+
/**
|
|
935
|
+
* @desc 禁止未使用的表达式
|
|
936
|
+
* @descEN Disallow unused expressions
|
|
937
|
+
* @see https://eslint.org/docs/latest/rules/no-unused-expressions
|
|
938
|
+
*/
|
|
159
939
|
"no-unused-expressions": [1, { ignoreDirectives: true, allowShortCircuit: true }],
|
|
940
|
+
/**
|
|
941
|
+
* @desc 禁止未使用的标签
|
|
942
|
+
* @descEN Disallow unused labels
|
|
943
|
+
* @see https://eslint.org/docs/latest/rules/no-unused-labels
|
|
944
|
+
*/
|
|
160
945
|
"no-unused-labels": 1,
|
|
946
|
+
/**
|
|
947
|
+
* @desc 禁止不必要的函数调用
|
|
948
|
+
* @descEN Disallow unnecessary calls to `.call()` and `.apply()`
|
|
949
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-call
|
|
950
|
+
*/
|
|
161
951
|
"no-useless-call": 2,
|
|
952
|
+
/**
|
|
953
|
+
* @desc 禁止不必要的 catch 语句
|
|
954
|
+
* @descEN Disallow unnecessary `catch` clauses
|
|
955
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-catch
|
|
956
|
+
*/
|
|
162
957
|
"no-useless-catch": 2,
|
|
958
|
+
/**
|
|
959
|
+
* @desc 禁止不必要的计算属性键
|
|
960
|
+
* @descEN Disallow unnecessary computed property keys
|
|
961
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-computed-key
|
|
962
|
+
*/
|
|
163
963
|
"no-useless-computed-key": 2,
|
|
964
|
+
/**
|
|
965
|
+
* @desc 禁止无用的字符串拼接
|
|
966
|
+
* @descEN Disallow unnecessary concatenation of literals or template literals
|
|
967
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-concat
|
|
968
|
+
*/
|
|
164
969
|
"no-useless-concat": 0,
|
|
970
|
+
/**
|
|
971
|
+
* @desc 禁止无用的构造函数
|
|
972
|
+
* @descEN Disallow unnecessary constructors
|
|
973
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-constructor
|
|
974
|
+
*/
|
|
165
975
|
"no-useless-constructor": 0,
|
|
976
|
+
/**
|
|
977
|
+
* @desc 禁止不必要的转义
|
|
978
|
+
* @descEN Disallow unnecessary escape characters
|
|
979
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-escape
|
|
980
|
+
*/
|
|
166
981
|
"no-useless-escape": 2,
|
|
982
|
+
/**
|
|
983
|
+
* @desc 禁止不必要的重命名
|
|
984
|
+
* @descEN Disallow renaming import/export/destructured assignments
|
|
985
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-rename
|
|
986
|
+
*/
|
|
167
987
|
"no-useless-rename": 2,
|
|
988
|
+
/**
|
|
989
|
+
* @desc 禁止多余的 return
|
|
990
|
+
* @descEN Disallow redundant return statements
|
|
991
|
+
* @see https://eslint.org/docs/latest/rules/no-useless-return
|
|
992
|
+
*/
|
|
168
993
|
"no-useless-return": 2,
|
|
994
|
+
/**
|
|
995
|
+
* @desc 禁止使用 var
|
|
996
|
+
* @descEN Require `let` or `const` instead of `var`
|
|
997
|
+
* @see https://eslint.org/docs/latest/rules/no-var
|
|
998
|
+
*/
|
|
169
999
|
"no-var": 2,
|
|
1000
|
+
/**
|
|
1001
|
+
* @desc 禁止使用 void
|
|
1002
|
+
* @descEN Disallow the use of `void` operators
|
|
1003
|
+
* @see https://eslint.org/docs/latest/rules/no-void
|
|
1004
|
+
*/
|
|
170
1005
|
"no-void": 0,
|
|
1006
|
+
/**
|
|
1007
|
+
* @desc 禁止警告注释
|
|
1008
|
+
* @descEN Disallow specified warning terms in comments
|
|
1009
|
+
* @see https://eslint.org/docs/latest/rules/no-warning-comments
|
|
1010
|
+
*/
|
|
171
1011
|
"no-warning-comments": 0,
|
|
1012
|
+
/**
|
|
1013
|
+
* @desc 禁止使用 with
|
|
1014
|
+
* @descEN Disallow `with` statements
|
|
1015
|
+
* @see https://eslint.org/docs/latest/rules/no-with
|
|
1016
|
+
*/
|
|
172
1017
|
"no-with": 2,
|
|
1018
|
+
/**
|
|
1019
|
+
* @desc 强制对象字面量简写语法
|
|
1020
|
+
* @descEN Require or disallow object literal shorthand syntax
|
|
1021
|
+
* @see https://eslint.org/docs/latest/rules/object-shorthand
|
|
1022
|
+
*/
|
|
173
1023
|
"object-shorthand": 0,
|
|
1024
|
+
/**
|
|
1025
|
+
* @desc 强制变量声明风格
|
|
1026
|
+
* @descEN Enforce the use of `let` or `const` or `var` per declaration
|
|
1027
|
+
* @see https://eslint.org/docs/latest/rules/one-var
|
|
1028
|
+
*/
|
|
174
1029
|
"one-var": [2, "never"],
|
|
1030
|
+
/**
|
|
1031
|
+
* @desc 强制使用复合赋值运算符
|
|
1032
|
+
* @descEN Require or disallow assignment operator shorthand
|
|
1033
|
+
* @see https://eslint.org/docs/latest/rules/operator-assignment
|
|
1034
|
+
*/
|
|
175
1035
|
"operator-assignment": 0,
|
|
1036
|
+
/**
|
|
1037
|
+
* @desc 强制使用箭头函数作为回调
|
|
1038
|
+
* @descEN Require using arrow functions for callbacks
|
|
1039
|
+
* @see https://eslint.org/docs/latest/rules/prefer-arrow-callback
|
|
1040
|
+
*/
|
|
176
1041
|
"prefer-arrow-callback": 2,
|
|
1042
|
+
/**
|
|
1043
|
+
* @desc 优先使用 const
|
|
1044
|
+
* @descEN Require `const` declarations for variables that are never reassigned
|
|
1045
|
+
* @see https://eslint.org/docs/latest/rules/prefer-const
|
|
1046
|
+
*/
|
|
177
1047
|
"prefer-const": 2,
|
|
1048
|
+
/**
|
|
1049
|
+
* @desc 优先使用解构赋值
|
|
1050
|
+
* @descEN Require destructuring from arrays and/or objects
|
|
1051
|
+
* @see https://eslint.org/docs/latest/rules/prefer-destructuring
|
|
1052
|
+
*/
|
|
178
1053
|
"prefer-destructuring": 0,
|
|
1054
|
+
/**
|
|
1055
|
+
* @desc 优先使用指数运算符
|
|
1056
|
+
* @descEN Disallow the use of `Math.pow()` in favor of `**`
|
|
1057
|
+
* @see https://eslint.org/docs/latest/rules/prefer-exponentiation-operator
|
|
1058
|
+
*/
|
|
179
1059
|
"prefer-exponentiation-operator": 0,
|
|
1060
|
+
/**
|
|
1061
|
+
* @desc 优先使用命名捕获组
|
|
1062
|
+
* @descEN Require named capture groups in regular expressions
|
|
1063
|
+
* @see https://eslint.org/docs/latest/rules/prefer-named-capture-group
|
|
1064
|
+
*/
|
|
180
1065
|
"prefer-named-capture-group": 0,
|
|
1066
|
+
/**
|
|
1067
|
+
* @desc 优先使用数字字面量
|
|
1068
|
+
* @descEN Disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals
|
|
1069
|
+
* @see https://eslint.org/docs/latest/rules/prefer-numeric-literals
|
|
1070
|
+
*/
|
|
181
1071
|
"prefer-numeric-literals": 2,
|
|
1072
|
+
/**
|
|
1073
|
+
* @desc 优先使用 Object.hasOwn
|
|
1074
|
+
* @descEN Disallow `Object.prototype.hasOwnProperty.call()` in favor of `Object.hasOwn()`
|
|
1075
|
+
* @see https://eslint.org/docs/latest/rules/prefer-object-has-own
|
|
1076
|
+
*/
|
|
182
1077
|
"prefer-object-has-own": 0,
|
|
1078
|
+
/**
|
|
1079
|
+
* @desc 优先使用对象展开运算符
|
|
1080
|
+
* @descEN Disallow using `Object.assign()` with an object literal as the first argument
|
|
1081
|
+
* @see https://eslint.org/docs/latest/rules/prefer-object-spread
|
|
1082
|
+
*/
|
|
183
1083
|
"prefer-object-spread": 2,
|
|
1084
|
+
/**
|
|
1085
|
+
* @desc 优先使用 Promise.reject() 抛出错误
|
|
1086
|
+
* @descEN Require using Error objects as Promise rejection reasons
|
|
1087
|
+
* @see https://eslint.org/docs/latest/rules/prefer-promise-reject-errors
|
|
1088
|
+
*/
|
|
184
1089
|
"prefer-promise-reject-errors": 0,
|
|
1090
|
+
/**
|
|
1091
|
+
* @desc 优先使用正则字面量
|
|
1092
|
+
* @descEN Disallow use of the `RegExp` constructor in favor of regular expression literals
|
|
1093
|
+
* @see https://eslint.org/docs/latest/rules/prefer-regex-literals
|
|
1094
|
+
*/
|
|
185
1095
|
"prefer-regex-literals": 0,
|
|
1096
|
+
/**
|
|
1097
|
+
* @desc 优先使用剩余参数
|
|
1098
|
+
* @descEN Require rest parameters instead of `arguments`
|
|
1099
|
+
* @see https://eslint.org/docs/latest/rules/prefer-rest-params
|
|
1100
|
+
*/
|
|
186
1101
|
"prefer-rest-params": 0,
|
|
1102
|
+
/**
|
|
1103
|
+
* @desc 优先使用展开语法
|
|
1104
|
+
* @descEN Require spread operators instead of `.apply()`
|
|
1105
|
+
* @see https://eslint.org/docs/latest/rules/prefer-spread
|
|
1106
|
+
*/
|
|
187
1107
|
"prefer-spread": 0,
|
|
1108
|
+
/**
|
|
1109
|
+
* @desc 优先使用模板字符串
|
|
1110
|
+
* @descEN Require template literals instead of string concatenation
|
|
1111
|
+
* @see https://eslint.org/docs/latest/rules/prefer-template
|
|
1112
|
+
*/
|
|
188
1113
|
"prefer-template": 0,
|
|
1114
|
+
/**
|
|
1115
|
+
* @desc 强制使用 parseInt 时指定基数
|
|
1116
|
+
* @descEN Require the use of the second argument in `parseInt()`
|
|
1117
|
+
* @see https://eslint.org/docs/latest/rules/radix
|
|
1118
|
+
*/
|
|
189
1119
|
"radix": 2,
|
|
1120
|
+
/**
|
|
1121
|
+
* @desc 禁用不必要的 await
|
|
1122
|
+
* @descEN Disallow `await` inside of `async` functions when there is no useful work
|
|
1123
|
+
* @see https://eslint.org/docs/latest/rules/require-await
|
|
1124
|
+
*/
|
|
190
1125
|
"require-await": 0,
|
|
1126
|
+
/**
|
|
1127
|
+
* @desc 强制在正则表达式中使用 u 或 v 标志
|
|
1128
|
+
* @descEN Require the use of the `u` or `v` flag in regular expressions
|
|
1129
|
+
* @see https://eslint.org/docs/latest/rules/require-unicode-regexp
|
|
1130
|
+
*/
|
|
191
1131
|
"require-unicode-regexp": 0,
|
|
1132
|
+
/**
|
|
1133
|
+
* @desc 要求 generator 函数中有 yield
|
|
1134
|
+
* @descEN Require `yield` statements in generator functions
|
|
1135
|
+
* @see https://eslint.org/docs/latest/rules/require-yield
|
|
1136
|
+
*/
|
|
192
1137
|
"require-yield": 2,
|
|
1138
|
+
/**
|
|
1139
|
+
* @desc 强制 import 排序
|
|
1140
|
+
* @descEN Enforce sorted import declarations
|
|
1141
|
+
* @see https://eslint.org/docs/latest/rules/sort-imports
|
|
1142
|
+
*/
|
|
193
1143
|
"sort-imports": 0,
|
|
1144
|
+
/**
|
|
1145
|
+
* @desc 强制对象键排序
|
|
1146
|
+
* @descEN Require object keys to be sorted
|
|
1147
|
+
* @see https://eslint.org/docs/latest/rules/sort-keys
|
|
1148
|
+
*/
|
|
194
1149
|
"sort-keys": 0,
|
|
1150
|
+
/**
|
|
1151
|
+
* @desc 强制变量排序
|
|
1152
|
+
* @descEN Require variables within the same declaration block to be sorted
|
|
1153
|
+
* @see https://eslint.org/docs/latest/rules/sort-vars
|
|
1154
|
+
*/
|
|
195
1155
|
"sort-vars": 0,
|
|
1156
|
+
/**
|
|
1157
|
+
* @desc 强制严格模式
|
|
1158
|
+
* @descEN Require or disallow strict mode directives
|
|
1159
|
+
* @see https://eslint.org/docs/latest/rules/strict
|
|
1160
|
+
*/
|
|
196
1161
|
"strict": 2,
|
|
1162
|
+
/**
|
|
1163
|
+
* @desc 要求 Symbol 描述
|
|
1164
|
+
* @descEN Require symbol descriptions
|
|
1165
|
+
* @see https://eslint.org/docs/latest/rules/symbol-description
|
|
1166
|
+
*/
|
|
197
1167
|
"symbol-description": 2,
|
|
1168
|
+
/**
|
|
1169
|
+
* @desc 要求 var 声明在作用域顶部
|
|
1170
|
+
* @descEN Require `var` declarations to be placed at the top of their containing scope
|
|
1171
|
+
* @see https://eslint.org/docs/latest/rules/vars-on-top
|
|
1172
|
+
*/
|
|
198
1173
|
"vars-on-top": 0,
|
|
1174
|
+
/**
|
|
1175
|
+
* @desc 强制比较运算符风格
|
|
1176
|
+
* @descEN Require or disallow "yoda" conditions
|
|
1177
|
+
* @see https://eslint.org/docs/latest/rules/yoda
|
|
1178
|
+
*/
|
|
199
1179
|
"yoda": [2, "never", { onlyEquality: true }],
|
|
200
1180
|
};
|