@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.
@@ -1,146 +1,861 @@
1
1
  import preset from "./preset.js";
2
2
  export default {
3
+ /**
4
+ * @desc 强制类方法使用 this
5
+ * @descEN Enforce that class methods utilize this
6
+ * @see https://typescript-eslint.io/rules/class-methods-use-this
7
+ */
3
8
  "class-methods-use-this": 0,
9
+ /**
10
+ * @desc 强制默认参数在最后
11
+ * @descEN Enforce default parameters to be last
12
+ * @see https://typescript-eslint.io/rules/default-param-last
13
+ */
4
14
  "default-param-last": 0,
15
+ /**
16
+ * @desc 强制尽可能使用点号表示法
17
+ * @descEN Enforce dot notation whenever possible
18
+ * @see https://typescript-eslint.io/rules/dot-notation
19
+ */
5
20
  "dot-notation": 0,
21
+ /**
22
+ * @desc 要求或禁止变量声明中初始化
23
+ * @descEN Require or disallow initialization in variable declarations
24
+ * @see https://typescript-eslint.io/rules/init-declarations
25
+ */
6
26
  "init-declarations": 0,
27
+ /**
28
+ * @desc 强制函数定义中最大参数数量
29
+ * @descEN Enforce a maximum number of parameters in function definitions
30
+ * @see https://typescript-eslint.io/rules/max-params
31
+ */
7
32
  "max-params": 0,
33
+ /**
34
+ * @desc 禁止泛型 Array 构造函数
35
+ * @descEN Disallow generic Array constructors
36
+ * @see https://typescript-eslint.io/rules/no-array-constructor
37
+ */
8
38
  "no-array-constructor": 0,
39
+ /**
40
+ * @desc 禁止重复的类成员
41
+ * @descEN Disallow duplicate class members
42
+ * @see https://typescript-eslint.io/rules/no-dupe-class-members
43
+ */
9
44
  "no-dupe-class-members": 0,
45
+ /**
46
+ * @desc 禁止空函数
47
+ * @descEN Disallow empty functions
48
+ * @see https://typescript-eslint.io/rules/no-empty-function
49
+ */
10
50
  "no-empty-function": 0,
51
+ /**
52
+ * @desc 禁止使用类似 eval 的函数
53
+ * @descEN Disallow the use of eval()-like functions
54
+ * @see https://typescript-eslint.io/rules/no-implied-eval
55
+ */
11
56
  "no-implied-eval": 0,
57
+ /**
58
+ * @desc 禁止在循环语句中包含不安全引用的函数声明
59
+ * @descEN Disallow function declarations that contain unsafe references inside loop statements
60
+ * @see https://typescript-eslint.io/rules/no-loop-func
61
+ */
12
62
  "no-loop-func": 0,
63
+ /**
64
+ * @desc 禁止魔术数字
65
+ * @descEN Disallow magic numbers
66
+ * @see https://typescript-eslint.io/rules/no-magic-numbers
67
+ */
13
68
  "no-magic-numbers": 0,
69
+ /**
70
+ * @desc 禁止变量重复声明
71
+ * @descEN Disallow variable redeclaration
72
+ * @see https://typescript-eslint.io/rules/no-redeclare
73
+ */
14
74
  "no-redeclare": 0,
75
+ /**
76
+ * @desc 禁止导入特定模块
77
+ * @descEN Disallow specified modules when loaded by import
78
+ * @see https://typescript-eslint.io/rules/no-restricted-imports
79
+ */
15
80
  "no-restricted-imports": 0,
81
+ /**
82
+ * @desc 禁止变量声明遮蔽外层作用域变量
83
+ * @descEN Disallow variable declarations from shadowing variables declared in the outer scope
84
+ * @see https://typescript-eslint.io/rules/no-shadow
85
+ */
16
86
  "no-shadow": 0,
87
+ /**
88
+ * @desc 禁止未使用的表达式
89
+ * @descEN Disallow unused expressions
90
+ * @see https://typescript-eslint.io/rules/no-unused-expressions
91
+ */
17
92
  "no-unused-expressions": 0,
93
+ /**
94
+ * @desc 禁止未使用的变量
95
+ * @descEN Disallow unused variables
96
+ * @see https://typescript-eslint.io/rules/no-unused-vars
97
+ */
18
98
  "no-unused-vars": 0,
99
+ /**
100
+ * @desc 禁止在定义之前使用变量
101
+ * @descEN Disallow the use of variables before they are defined
102
+ * @see https://typescript-eslint.io/rules/no-use-before-define
103
+ */
19
104
  "no-use-before-define": 0,
105
+ /**
106
+ * @desc 禁止不必要的构造函数
107
+ * @descEN Disallow unnecessary constructors
108
+ * @see https://typescript-eslint.io/rules/no-useless-constructor
109
+ */
20
110
  "no-useless-constructor": 0,
111
+ /**
112
+ * @desc 要求从数组和/或对象进行解构
113
+ * @descEN Require destructuring from arrays and/or objects
114
+ * @see https://typescript-eslint.io/rules/prefer-destructuring
115
+ */
21
116
  "prefer-destructuring": 0,
117
+ /**
118
+ * @desc 要求使用 Error 对象作为 Promise 拒绝原因
119
+ * @descEN Require using Error objects as Promise rejection reasons
120
+ * @see https://typescript-eslint.io/rules/prefer-promise-reject-errors
121
+ */
22
122
  "prefer-promise-reject-errors": 0,
123
+ /**
124
+ * @desc 禁止没有 await 表达式且不返回 Promise 的异步函数
125
+ * @descEN Disallow async functions which do not have await expression
126
+ * @see https://typescript-eslint.io/rules/require-await
127
+ */
23
128
  "require-await": 0,
129
+ /**
130
+ * @desc 要求函数重载签名连续
131
+ * @descEN Require that function overload signatures be consecutive
132
+ * @see https://typescript-eslint.io/rules/adjacent-overload-signatures
133
+ */
24
134
  "ts/adjacent-overload-signatures": 2,
135
+ /**
136
+ * @desc 要求一致使用 T[] 或 Array<T>
137
+ * @descEN Require consistently using either T[] or Array<T> for arrays
138
+ * @see https://typescript-eslint.io/rules/array-type
139
+ */
25
140
  "ts/array-type": 2,
141
+ /**
142
+ * @desc 禁止 await 非 Thenable 的值
143
+ * @descEN Disallow awaiting a value that is not a Thenable
144
+ * @see https://typescript-eslint.io/rules/await-thenable
145
+ */
26
146
  "ts/await-thenable": 0,
147
+ /**
148
+ * @desc 禁止 @ts-<directive> 注释或要求指令后带说明
149
+ * @descEN Disallow @ts-<directive> comments or require descriptions after directives
150
+ * @see https://typescript-eslint.io/rules/ban-ts-comment
151
+ */
27
152
  "ts/ban-ts-comment": 0,
153
+ /**
154
+ * @desc 禁止 // tslint:<rule-flag> 注释
155
+ * @descEN Disallow // tslint:<rule-flag> comments
156
+ * @see https://typescript-eslint.io/rules/ban-tslint-comment
157
+ */
28
158
  "ts/ban-tslint-comment": 0,
159
+ /**
160
+ * @desc 强制类上的字面量以一致风格暴露
161
+ * @descEN Enforce that literals on classes are exposed in a consistent style
162
+ * @see https://typescript-eslint.io/rules/class-literal-property-style
163
+ */
29
164
  "ts/class-literal-property-style": [2, "fields"],
165
+ /**
166
+ * @desc 强制类方法使用 this
167
+ * @descEN Enforce that class methods utilize this
168
+ * @see https://typescript-eslint.io/rules/class-methods-use-this
169
+ */
30
170
  "ts/class-methods-use-this": 0,
171
+ /**
172
+ * @desc 强制在构造函数调用上指定泛型类型参数的风格
173
+ * @descEN Enforce specifying generic type arguments on type annotation or constructor name of a constructor call
174
+ * @see https://typescript-eslint.io/rules/consistent-generic-constructors
175
+ */
31
176
  "ts/consistent-generic-constructors": 0,
177
+ /**
178
+ * @desc 要求或禁止 Record 类型
179
+ * @descEN Require or disallow the Record type
180
+ * @see https://typescript-eslint.io/rules/consistent-indexed-object-style
181
+ */
32
182
  "ts/consistent-indexed-object-style": 0,
183
+ /**
184
+ * @desc 强制类型断言风格一致
185
+ * @descEN Enforce consistent usage of type assertions
186
+ * @see https://typescript-eslint.io/rules/consistent-type-assertions
187
+ */
33
188
  "ts/consistent-type-assertions": 2,
189
+ /**
190
+ * @desc 强制类型定义一致使用 interface 或 type
191
+ * @descEN Enforce type definitions to consistently use either interface or type
192
+ * @see https://typescript-eslint.io/rules/consistent-type-definitions
193
+ */
34
194
  "ts/consistent-type-definitions": [2, "interface"],
195
+ /**
196
+ * @desc 强制一致使用 type 导出
197
+ * @descEN Enforce consistent usage of type exports
198
+ * @see https://typescript-eslint.io/rules/consistent-type-exports
199
+ */
35
200
  "ts/consistent-type-exports": 2,
201
+ /**
202
+ * @desc 强制一致使用 type 导入
203
+ * @descEN Enforce consistent usage of type imports
204
+ * @see https://typescript-eslint.io/rules/consistent-type-imports
205
+ */
36
206
  "ts/consistent-type-imports": [2, { fixStyle: "inline-type-imports" }],
207
+ /**
208
+ * @desc 强制默认参数在最后
209
+ * @descEN Enforce default parameters to be last
210
+ * @see https://typescript-eslint.io/rules/default-param-last
211
+ */
37
212
  "ts/default-param-last": 2,
213
+ /**
214
+ * @desc 强制尽可能使用点号表示法
215
+ * @descEN Enforce dot notation whenever possible
216
+ * @see https://typescript-eslint.io/rules/dot-notation
217
+ */
38
218
  "ts/dot-notation": 0,
219
+ /**
220
+ * @desc 要求函数和方法有显式返回类型
221
+ * @descEN Require explicit return types on functions and class methods
222
+ * @see https://typescript-eslint.io/rules/explicit-function-return-type
223
+ */
39
224
  "ts/explicit-function-return-type": 0,
225
+ /**
226
+ * @desc 要求类属性和方法有显式可访问性修饰符
227
+ * @descEN Require explicit accessibility modifiers on class properties and methods
228
+ * @see https://typescript-eslint.io/rules/explicit-member-accessibility
229
+ */
40
230
  "ts/explicit-member-accessibility": 0,
231
+ /**
232
+ * @desc 要求导出函数和类的公共方法有显式返回和参数类型
233
+ * @descEN Require explicit return and argument types on exported functions' and classes' public class methods
234
+ * @see https://typescript-eslint.io/rules/explicit-module-boundary-types
235
+ */
41
236
  "ts/explicit-module-boundary-types": 0,
237
+ /**
238
+ * @desc 要求或禁止变量声明中初始化
239
+ * @descEN Require or disallow initialization in variable declarations
240
+ * @see https://typescript-eslint.io/rules/init-declarations
241
+ */
42
242
  "ts/init-declarations": 0,
243
+ /**
244
+ * @desc 强制函数定义中最大参数数量
245
+ * @descEN Enforce a maximum number of parameters in function definitions
246
+ * @see https://typescript-eslint.io/rules/max-params
247
+ */
43
248
  "ts/max-params": 0,
249
+ /**
250
+ * @desc 要求成员声明顺序一致
251
+ * @descEN Require a consistent member declaration order
252
+ * @see https://typescript-eslint.io/rules/member-ordering
253
+ */
44
254
  "ts/member-ordering": [2, { default: preset.tsMemberOrder }],
255
+ /**
256
+ * @desc 强制使用特定的方法签名语法
257
+ * @descEN Enforce using a particular method signature syntax
258
+ * @see https://typescript-eslint.io/rules/method-signature-style
259
+ */
45
260
  "ts/method-signature-style": 2,
261
+ /**
262
+ * @desc 强制整个代码库的命名约定
263
+ * @descEN Enforce naming conventions for everything across a codebase
264
+ * @see https://typescript-eslint.io/rules/naming-convention
265
+ */
46
266
  "ts/naming-convention": 0,
267
+ /**
268
+ * @desc 禁止泛型 Array 构造函数
269
+ * @descEN Disallow generic Array constructors
270
+ * @see https://typescript-eslint.io/rules/no-array-constructor
271
+ */
47
272
  "ts/no-array-constructor": 2,
273
+ /**
274
+ * @desc 禁止对数组值使用 delete 操作符
275
+ * @descEN Disallow using the delete operator on array values
276
+ * @see https://typescript-eslint.io/rules/no-array-delete
277
+ */
48
278
  "ts/no-array-delete": 2,
279
+ /**
280
+ * @desc 要求 toString 和 toLocaleString 仅在提供有用信息的对象上调用
281
+ * @descEN Require .toString() to only be called on objects which provide useful information when stringified
282
+ * @see https://typescript-eslint.io/rules/no-base-to-string
283
+ */
49
284
  "ts/no-base-to-string": 0,
285
+ /**
286
+ * @desc 禁止在可能混淆的位置使用非空断言
287
+ * @descEN Disallow non-null assertion in locations that may be confusing
288
+ * @see https://typescript-eslint.io/rules/no-confusing-non-null-assertion
289
+ */
50
290
  "ts/no-confusing-non-null-assertion": 0,
291
+ /**
292
+ * @desc 要求 void 类型的表达式出现在语句位置
293
+ * @descEN Require expressions of type void to appear in statement position
294
+ * @see https://typescript-eslint.io/rules/no-confusing-void-expression
295
+ */
51
296
  "ts/no-confusing-void-expression": [2, { ignoreArrowShorthand: true, ignoreVoidOperator: false }],
297
+ /**
298
+ * @desc 禁止使用标记为 @deprecated 的代码
299
+ * @descEN Disallow using code marked as @deprecated
300
+ * @see https://typescript-eslint.io/rules/no-deprecated
301
+ */
52
302
  "ts/no-deprecated": 0,
303
+ /**
304
+ * @desc 禁止重复的类成员
305
+ * @descEN Disallow duplicate class members
306
+ * @see https://typescript-eslint.io/rules/no-dupe-class-members
307
+ */
53
308
  "ts/no-dupe-class-members": 2,
309
+ /**
310
+ * @desc 禁止重复的枚举成员值
311
+ * @descEN Disallow duplicate enum member values
312
+ * @see https://typescript-eslint.io/rules/no-duplicate-enum-values
313
+ */
54
314
  "ts/no-duplicate-enum-values": 2,
315
+ /**
316
+ * @desc 禁止联合类型或交叉类型中有重复成分
317
+ * @descEN Disallow duplicate constituents of union or intersection types
318
+ * @see https://typescript-eslint.io/rules/no-duplicate-type-constituents
319
+ */
55
320
  "ts/no-duplicate-type-constituents": 0,
321
+ /**
322
+ * @desc 禁止对计算键表达式使用 delete 操作符
323
+ * @descEN Disallow using the delete operator on computed key expressions
324
+ * @see https://typescript-eslint.io/rules/no-dynamic-delete
325
+ */
56
326
  "ts/no-dynamic-delete": 0,
327
+ /**
328
+ * @desc 禁止空函数
329
+ * @descEN Disallow empty functions
330
+ * @see https://typescript-eslint.io/rules/no-empty-function
331
+ */
57
332
  "ts/no-empty-function": 0,
333
+ /**
334
+ * @desc 禁止意外使用空对象类型
335
+ * @descEN Disallow accidentally using the "empty object" type
336
+ * @see https://typescript-eslint.io/rules/no-empty-object-type
337
+ */
58
338
  "ts/no-empty-object-type": [2, { allowInterfaces: "with-single-extends" }],
339
+ /**
340
+ * @desc 禁止 any 类型
341
+ * @descEN Disallow the any type
342
+ * @see https://typescript-eslint.io/rules/no-explicit-any
343
+ */
59
344
  "ts/no-explicit-any": [2, { fixToUnknown: true, ignoreRestArgs: true }],
345
+ /**
346
+ * @desc 禁止多余的非空断言
347
+ * @descEN Disallow extra non-null assertions
348
+ * @see https://typescript-eslint.io/rules/no-extra-non-null-assertion
349
+ */
60
350
  "ts/no-extra-non-null-assertion": 0,
351
+ /**
352
+ * @desc 禁止用作命名空间的类
353
+ * @descEN Disallow classes used as namespaces
354
+ * @see https://typescript-eslint.io/rules/no-extraneous-class
355
+ */
61
356
  "ts/no-extraneous-class": 0,
357
+ /**
358
+ * @desc 要求 Promise 风格的语句被正确处理
359
+ * @descEN Require Promise-like statements to be handled appropriately
360
+ * @see https://typescript-eslint.io/rules/no-floating-promises
361
+ */
62
362
  "ts/no-floating-promises": 0,
363
+ /**
364
+ * @desc 禁止使用 for-in 循环遍历数组
365
+ * @descEN Disallow iterating over an array with a for-in loop
366
+ * @see https://typescript-eslint.io/rules/no-for-in-array
367
+ */
63
368
  "ts/no-for-in-array": 0,
369
+ /**
370
+ * @desc 禁止使用类似 eval 的函数
371
+ * @descEN Disallow the use of eval()-like functions
372
+ * @see https://typescript-eslint.io/rules/no-implied-eval
373
+ */
64
374
  "ts/no-implied-eval": 2,
375
+ /**
376
+ * @desc 强制当导入只有内联类型限定符时使用顶级 import type 限定符
377
+ * @descEN Enforce the use of top-level import type qualifier when an import only has specifiers with inline type qualifiers
378
+ * @see https://typescript-eslint.io/rules/no-import-type-side-effects
379
+ */
65
380
  "ts/no-import-type-side-effects": 2,
381
+ /**
382
+ * @desc 禁止对初始化为数字、字符串或布尔值的变量或参数使用显式类型声明
383
+ * @descEN Disallow explicit type declarations for variables or parameters initialized to a number, string, or boolean
384
+ * @see https://typescript-eslint.io/rules/no-inferrable-types
385
+ */
66
386
  "ts/no-inferrable-types": [2, { ignoreParameters: true, ignoreProperties: true }],
387
+ /**
388
+ * @desc 禁止在泛型或返回类型之外使用 void 类型
389
+ * @descEN Disallow void type outside of generic or return types
390
+ * @see https://typescript-eslint.io/rules/no-invalid-void-type
391
+ */
67
392
  "ts/no-invalid-void-type": 2,
393
+ /**
394
+ * @desc 禁止在循环语句中包含不安全引用的函数声明
395
+ * @descEN Disallow function declarations that contain unsafe references inside loop statements
396
+ * @see https://typescript-eslint.io/rules/no-loop-func
397
+ */
68
398
  "ts/no-loop-func": 0,
399
+ /**
400
+ * @desc 禁止魔术数字
401
+ * @descEN Disallow magic numbers
402
+ * @see https://typescript-eslint.io/rules/no-magic-numbers
403
+ */
69
404
  "ts/no-magic-numbers": 0,
405
+ /**
406
+ * @desc 禁止除用于丢弃值外的 void 运算符
407
+ * @descEN Disallow the void operator except when used to discard a value
408
+ * @see https://typescript-eslint.io/rules/no-meaningless-void-operator
409
+ */
70
410
  "ts/no-meaningless-void-operator": 0,
411
+ /**
412
+ * @desc 强制 new 和 constructor 的有效定义
413
+ * @descEN Enforce valid definition of new and constructor
414
+ * @see https://typescript-eslint.io/rules/no-misused-new
415
+ */
71
416
  "ts/no-misused-new": 0,
417
+ /**
418
+ * @desc 禁止在不设计处理 Promise 的地方使用 Promise
419
+ * @descEN Disallow Promises in places not designed to handle them
420
+ * @see https://typescript-eslint.io/rules/no-misused-promises
421
+ */
72
422
  "ts/no-misused-promises": [2, { checksVoidReturn: false }],
423
+ /**
424
+ * @desc 禁止展开运算符可能导致意外行为的使用
425
+ * @descEN Disallow using the spread operator when it might cause unexpected behavior
426
+ * @see https://typescript-eslint.io/rules/no-misused-spread
427
+ */
73
428
  "ts/no-misused-spread": 2,
429
+ /**
430
+ * @desc 禁止枚举同时具有数字和字符串成员
431
+ * @descEN Disallow enums from having both number and string members
432
+ * @see https://typescript-eslint.io/rules/no-mixed-enums
433
+ */
74
434
  "ts/no-mixed-enums": 0,
435
+ /**
436
+ * @desc 禁止 TypeScript 命名空间
437
+ * @descEN Disallow TypeScript namespaces
438
+ * @see https://typescript-eslint.io/rules/no-namespace
439
+ */
75
440
  "ts/no-namespace": [2, { allowDeclarations: true, allowDefinitionFiles: true }],
441
+ /**
442
+ * @desc 禁止空值合并运算符左操作数中的非空断言
443
+ * @descEN Disallow non-null assertions in the left operand of a nullish coalescing operator
444
+ * @see https://typescript-eslint.io/rules/no-non-null-asserted-nullish-coalescing
445
+ */
76
446
  "ts/no-non-null-asserted-nullish-coalescing": 2,
447
+ /**
448
+ * @desc 禁止可选链表达式后的非空断言
449
+ * @descEN Disallow non-null assertions after an optional chain expression
450
+ * @see https://typescript-eslint.io/rules/no-non-null-asserted-optional-chain
451
+ */
77
452
  "ts/no-non-null-asserted-optional-chain": 2,
453
+ /**
454
+ * @desc 禁止使用 ! 后缀运算符进行非空断言
455
+ * @descEN Disallow non-null assertions using the ! postfix operator
456
+ * @see https://typescript-eslint.io/rules/no-non-null-assertion
457
+ */
78
458
  "ts/no-non-null-assertion": 0,
459
+ /**
460
+ * @desc 禁止变量重复声明
461
+ * @descEN Disallow variable redeclaration
462
+ * @see https://typescript-eslint.io/rules/no-redeclare
463
+ */
79
464
  "ts/no-redeclare": 2,
465
+ /**
466
+ * @desc 禁止联合类型或交叉类型中不起作用或覆盖类型信息的成员
467
+ * @descEN Disallow members of unions and intersections that do nothing or override type information
468
+ * @see https://typescript-eslint.io/rules/no-redundant-type-constituents
469
+ */
80
470
  "ts/no-redundant-type-constituents": 0,
471
+ /**
472
+ * @desc 禁止调用 require()
473
+ * @descEN Disallow invocation of require()
474
+ * @see https://typescript-eslint.io/rules/no-require-imports
475
+ */
81
476
  "ts/no-require-imports": 2,
477
+ /**
478
+ * @desc 禁止导入特定模块
479
+ * @descEN Disallow specified modules when loaded by import
480
+ * @see https://typescript-eslint.io/rules/no-restricted-imports
481
+ */
82
482
  "ts/no-restricted-imports": 0,
483
+ /**
484
+ * @desc 禁止某些类型
485
+ * @descEN Disallow certain types
486
+ * @see https://typescript-eslint.io/rules/no-restricted-types
487
+ */
83
488
  "ts/no-restricted-types": 0,
489
+ /**
490
+ * @desc 禁止变量声明遮蔽外层作用域变量
491
+ * @descEN Disallow variable declarations from shadowing variables declared in the outer scope
492
+ * @see https://typescript-eslint.io/rules/no-shadow
493
+ */
84
494
  "ts/no-shadow": 0,
495
+ /**
496
+ * @desc 禁止别名 this
497
+ * @descEN Disallow aliasing this
498
+ * @see https://typescript-eslint.io/rules/no-this-alias
499
+ */
85
500
  "ts/no-this-alias": [2, { allowDestructuring: true }],
501
+ /**
502
+ * @desc 禁止与布尔字面量的不必要相等比较
503
+ * @descEN Disallow unnecessary equality comparisons against boolean literals
504
+ * @see https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare
505
+ */
86
506
  "ts/no-unnecessary-boolean-literal-compare": 0,
507
+ /**
508
+ * @desc 禁止条件表达式类型始终为真或始终为假
509
+ * @descEN Disallow conditionals where the type is always truthy or always falsy
510
+ * @see https://typescript-eslint.io/rules/no-unnecessary-condition
511
+ */
87
512
  "ts/no-unnecessary-condition": 0,
513
+ /**
514
+ * @desc 禁止不必要的构造函数属性参数赋值
515
+ * @descEN Disallow unnecessary assignment of constructor property parameter
516
+ * @see https://typescript-eslint.io/rules/no-unnecessary-parameter-property-assignment
517
+ */
88
518
  "ts/no-unnecessary-parameter-property-assignment": 0,
519
+ /**
520
+ * @desc 禁止不必要的命名空间限定符
521
+ * @descEN Disallow unnecessary namespace qualifiers
522
+ * @see https://typescript-eslint.io/rules/no-unnecessary-qualifier
523
+ */
89
524
  "ts/no-unnecessary-qualifier": 2,
525
+ /**
526
+ * @desc 禁止不必要的模板表达式
527
+ * @descEN Disallow unnecessary template expressions
528
+ * @see https://typescript-eslint.io/rules/no-unnecessary-template-expression
529
+ */
90
530
  "ts/no-unnecessary-template-expression": 2,
531
+ /**
532
+ * @desc 禁止等于默认值的类型参数
533
+ * @descEN Disallow type arguments that are equal to the default
534
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-arguments
535
+ */
91
536
  "ts/no-unnecessary-type-arguments": 0,
537
+ /**
538
+ * @desc 禁止不改变表达式类型的类型断言
539
+ * @descEN Disallow type assertions that do not change the type of an expression
540
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-assertion
541
+ */
92
542
  "ts/no-unnecessary-type-assertion": 0,
543
+ /**
544
+ * @desc 禁止对泛型类型的不必要约束
545
+ * @descEN Disallow unnecessary constraints on generic types
546
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-constraint
547
+ */
93
548
  "ts/no-unnecessary-type-constraint": 2,
549
+ /**
550
+ * @desc 禁止未多次使用的类型参数
551
+ * @descEN Disallow type parameters that aren't used multiple times
552
+ * @see https://typescript-eslint.io/rules/no-unnecessary-type-parameters
553
+ */
94
554
  "ts/no-unnecessary-type-parameters": 0,
555
+ /**
556
+ * @desc 禁止使用类型为 any 的值调用函数
557
+ * @descEN Disallow calling a function with a value with type any
558
+ * @see https://typescript-eslint.io/rules/no-unsafe-argument
559
+ */
95
560
  "ts/no-unsafe-argument": 0,
561
+ /**
562
+ * @desc 禁止将类型为 any 的值赋值给变量和属性
563
+ * @descEN Disallow assigning a value with type any to variables and properties
564
+ * @see https://typescript-eslint.io/rules/no-unsafe-assignment
565
+ */
96
566
  "ts/no-unsafe-assignment": 0,
567
+ /**
568
+ * @desc 禁止调用类型为 any 的值
569
+ * @descEN Disallow calling a value with type any
570
+ * @see https://typescript-eslint.io/rules/no-unsafe-call
571
+ */
97
572
  "ts/no-unsafe-call": 0,
573
+ /**
574
+ * @desc 禁止不安全的声明合并
575
+ * @descEN Disallow unsafe declaration merging
576
+ * @see https://typescript-eslint.io/rules/no-unsafe-declaration-merging
577
+ */
98
578
  "ts/no-unsafe-declaration-merging": 0,
579
+ /**
580
+ * @desc 禁止将枚举值与非枚举值比较
581
+ * @descEN Disallow comparing an enum value with a non-enum value
582
+ * @see https://typescript-eslint.io/rules/no-unsafe-enum-comparison
583
+ */
99
584
  "ts/no-unsafe-enum-comparison": 0,
585
+ /**
586
+ * @desc 禁止使用不安全的原生 Function 类型
587
+ * @descEN Disallow using the unsafe built-in Function type
588
+ * @see https://typescript-eslint.io/rules/no-unsafe-function-type
589
+ */
100
590
  "ts/no-unsafe-function-type": 2,
591
+ /**
592
+ * @desc 禁止访问类型为 any 的属性
593
+ * @descEN Disallow member access on a value with type any
594
+ * @see https://typescript-eslint.io/rules/no-unsafe-member-access
595
+ */
101
596
  "ts/no-unsafe-member-access": 0,
597
+ /**
598
+ * @desc 禁止从函数返回类型为 any 的值
599
+ * @descEN Disallow returning a value with type any from a function
600
+ * @see https://typescript-eslint.io/rules/no-unsafe-return
601
+ */
102
602
  "ts/no-unsafe-return": 0,
603
+ /**
604
+ * @desc 禁止缩小范围类型的类型断言
605
+ * @descEN Disallow type assertions that narrow a type
606
+ * @see https://typescript-eslint.io/rules/no-unsafe-type-assertion
607
+ */
103
608
  "ts/no-unsafe-type-assertion": 0,
609
+ /**
610
+ * @desc 要求一元否定运算作用于数字
611
+ * @descEN Require unary negation to take a number
612
+ * @see https://typescript-eslint.io/rules/no-unsafe-unary-minus
613
+ */
104
614
  "ts/no-unsafe-unary-minus": 2,
615
+ /**
616
+ * @desc 禁止未使用的表达式
617
+ * @descEN Disallow unused expressions
618
+ * @see https://typescript-eslint.io/rules/no-unused-expressions
619
+ */
105
620
  "ts/no-unused-expressions": [1, { ignoreDirectives: true, allowShortCircuit: true }],
621
+ /**
622
+ * @desc 禁止未使用的变量
623
+ * @descEN Disallow unused variables
624
+ * @see https://typescript-eslint.io/rules/no-unused-vars
625
+ */
106
626
  "ts/no-unused-vars": [1, { vars: "local", args: "none", caughtErrors: "none", varsIgnorePattern: "^_", destructuredArrayIgnorePattern: "^_" }],
627
+ /**
628
+ * @desc 禁止在定义之前使用变量
629
+ * @descEN Disallow the use of variables before they are defined
630
+ * @see https://typescript-eslint.io/rules/no-use-before-define
631
+ */
107
632
  "ts/no-use-before-define": [2, { functions: false, classes: false, variables: false, allowNamedExports: false }],
633
+ /**
634
+ * @desc 禁止不必要的构造函数
635
+ * @descEN Disallow unnecessary constructors
636
+ * @see https://typescript-eslint.io/rules/no-useless-constructor
637
+ */
108
638
  "ts/no-useless-constructor": 0,
639
+ /**
640
+ * @desc 禁止不改变模块文件内容的空导出
641
+ * @descEN Disallow empty exports that don't change anything in a module file
642
+ * @see https://typescript-eslint.io/rules/no-useless-empty-export
643
+ */
109
644
  "ts/no-useless-empty-export": 0,
645
+ /**
646
+ * @desc 禁止使用令人困惑的内置基本类型包装器
647
+ * @descEN Disallow using confusing built-in primitive class wrappers
648
+ * @see https://typescript-eslint.io/rules/no-wrapper-object-types
649
+ */
110
650
  "ts/no-wrapper-object-types": 2,
651
+ /**
652
+ * @desc 强制使用非空断言而不是显式类型断言
653
+ * @descEN Enforce non-null assertions over explicit type assertions
654
+ * @see https://typescript-eslint.io/rules/non-nullable-type-assertion-style
655
+ */
111
656
  "ts/non-nullable-type-assertion-style": 0,
657
+ /**
658
+ * @desc 禁止抛出非 Error 值作为异常
659
+ * @descEN Disallow throwing non-Error values as exceptions
660
+ * @see https://typescript-eslint.io/rules/only-throw-error
661
+ */
112
662
  "ts/only-throw-error": [2, { allow: [{ from: "package", package: "@tanstack/router-core", name: "Redirect" }] }],
663
+ /**
664
+ * @desc 要求或禁止类构造函数中的参数属性
665
+ * @descEN Require or disallow parameter properties in class constructors
666
+ * @see https://typescript-eslint.io/rules/parameter-properties
667
+ */
113
668
  "ts/parameter-properties": 0,
669
+ /**
670
+ * @desc 强制使用 as const 而非字面量类型
671
+ * @descEN Enforce the use of as const over literal type
672
+ * @see https://typescript-eslint.io/rules/prefer-as-const
673
+ */
114
674
  "ts/prefer-as-const": 0,
675
+ /**
676
+ * @desc 要求从数组和/或对象进行解构
677
+ * @descEN Require destructuring from arrays and/or objects
678
+ * @see https://typescript-eslint.io/rules/prefer-destructuring
679
+ */
115
680
  "ts/prefer-destructuring": 0,
681
+ /**
682
+ * @desc 要求每个枚举成员值都被显式初始化
683
+ * @descEN Require each enum member value to be explicitly initialized
684
+ * @see https://typescript-eslint.io/rules/prefer-enum-initializers
685
+ */
116
686
  "ts/prefer-enum-initializers": 0,
687
+ /**
688
+ * @desc 强制使用 Array.prototype.find 而不是 filter 后跟 [0]
689
+ * @descEN Enforce the use of Array.prototype.find() over Array.prototype.filter() followed by [0]
690
+ * @see https://typescript-eslint.io/rules/prefer-find
691
+ */
117
692
  "ts/prefer-find": 2,
693
+ /**
694
+ * @desc 强制尽可能使用 for-of 循环代替标准 for 循环
695
+ * @descEN Enforce the use of for-of loop over the standard for loop where possible
696
+ * @see https://typescript-eslint.io/rules/prefer-for-of
697
+ */
118
698
  "ts/prefer-for-of": 0,
699
+ /**
700
+ * @desc 强制使用函数类型替代带调用签名的接口
701
+ * @descEN Enforce using function types instead of interfaces with call signatures
702
+ * @see https://typescript-eslint.io/rules/prefer-function-type
703
+ */
119
704
  "ts/prefer-function-type": 2,
705
+ /**
706
+ * @desc 强制使用 includes 方法代替 indexOf 方法
707
+ * @descEN Enforce includes method over indexOf method
708
+ * @see https://typescript-eslint.io/rules/prefer-includes
709
+ */
120
710
  "ts/prefer-includes": 0,
711
+ /**
712
+ * @desc 要求所有枚举成员必须是字面量值
713
+ * @descEN Require all enum members to be literal values
714
+ * @see https://typescript-eslint.io/rules/prefer-literal-enum-member
715
+ */
121
716
  "ts/prefer-literal-enum-member": 0,
717
+ /**
718
+ * @desc 要求使用 namespace 关键字而非 module 关键字
719
+ * @descEN Require using namespace keyword over module keyword
720
+ * @see https://typescript-eslint.io/rules/prefer-namespace-keyword
721
+ */
122
722
  "ts/prefer-namespace-keyword": 2,
723
+ /**
724
+ * @desc 强制使用空值合并运算符替代逻辑赋值或链式操作
725
+ * @descEN Enforce using the nullish coalescing operator instead of logical assignments or chaining
726
+ * @see https://typescript-eslint.io/rules/prefer-nullish-coalescing
727
+ */
123
728
  "ts/prefer-nullish-coalescing": 0,
729
+ /**
730
+ * @desc 强制使用简洁的可选链表达式替代逻辑与链
731
+ * @descEN Enforce using concise optional chain expressions instead of chained logical ands
732
+ * @see https://typescript-eslint.io/rules/prefer-optional-chain
733
+ */
124
734
  "ts/prefer-optional-chain": 0,
735
+ /**
736
+ * @desc 要求使用 Error 对象作为 Promise 拒绝原因
737
+ * @descEN Require using Error objects as Promise rejection reasons
738
+ * @see https://typescript-eslint.io/rules/prefer-promise-reject-errors
739
+ */
125
740
  "ts/prefer-promise-reject-errors": 0,
741
+ /**
742
+ * @desc 要求如果私有成员不在构造函数外修改,则标记为 readonly
743
+ * @descEN Require private members to be marked as readonly if they're never modified outside of the constructor
744
+ * @see https://typescript-eslint.io/rules/prefer-readonly
745
+ */
126
746
  "ts/prefer-readonly": 0,
747
+ /**
748
+ * @desc 要求函数参数类型为 readonly 以防止意外修改输入
749
+ * @descEN Require function parameters to be typed as readonly to prevent accidental mutation of inputs
750
+ * @see https://typescript-eslint.io/rules/prefer-readonly-parameter-types
751
+ */
127
752
  "ts/prefer-readonly-parameter-types": 0,
753
+ /**
754
+ * @desc 强制在调用 Array#reduce 时使用类型参数代替类型断言
755
+ * @descEN Enforce using type parameter when calling Array#reduce instead of using a type assertion
756
+ * @see https://typescript-eslint.io/rules/prefer-reduce-type-parameter
757
+ */
128
758
  "ts/prefer-reduce-type-parameter": 0,
759
+ /**
760
+ * @desc 强制在没有全局标志时使用 RegExp#exec 而非 String#match
761
+ * @descEN Enforce RegExp#exec over String#match if no global flag is provided
762
+ * @see https://typescript-eslint.io/rules/prefer-regexp-exec
763
+ */
129
764
  "ts/prefer-regexp-exec": 0,
765
+ /**
766
+ * @desc 强制当仅返回 this 类型时使用 this
767
+ * @descEN Enforce that this is used when only this type is returned
768
+ * @see https://typescript-eslint.io/rules/prefer-return-this-type
769
+ */
130
770
  "ts/prefer-return-this-type": 0,
771
+ /**
772
+ * @desc 强制使用 String#startsWith 和 String#endsWith 替代其他等效方法
773
+ * @descEN Enforce using String#startsWith and String#endsWith over other equivalent methods of checking substrings
774
+ * @see https://typescript-eslint.io/rules/prefer-string-starts-ends-with
775
+ */
131
776
  "ts/prefer-string-starts-ends-with": 0,
777
+ /**
778
+ * @desc 要求返回 Promise 的函数或方法标记为 async
779
+ * @descEN Require any function or method that returns a Promise to be marked async
780
+ * @see https://typescript-eslint.io/rules/promise-function-async
781
+ */
132
782
  "ts/promise-function-async": 0,
783
+ /**
784
+ * @desc 强制 get 类型应可赋值给其对应的 set 类型
785
+ * @descEN Enforce that get() types should be assignable to their equivalent set() type
786
+ * @see https://typescript-eslint.io/rules/related-getter-setter-pairs
787
+ */
133
788
  "ts/related-getter-setter-pairs": 2,
789
+ /**
790
+ * @desc 要求 Array#sort 调用始终提供 compareFunction
791
+ * @descEN Require Array#sort calls to always provide a compareFunction
792
+ * @see https://typescript-eslint.io/rules/require-array-sort-compare
793
+ */
134
794
  "ts/require-array-sort-compare": 0,
795
+ /**
796
+ * @desc 禁止没有 await 表达式的异步函数
797
+ * @descEN Disallow async functions which do not have await expression
798
+ * @see https://typescript-eslint.io/rules/require-await
799
+ */
135
800
  "ts/require-await": 0,
801
+ /**
802
+ * @desc 要求加法运算的两个操作数类型相同
803
+ * @descEN Require both operands of addition to be the same type and be bigint, number, or string
804
+ * @see https://typescript-eslint.io/rules/restrict-plus-operands
805
+ */
136
806
  "ts/restrict-plus-operands": 0,
807
+ /**
808
+ * @desc 强制模板字面量表达式为 string 类型
809
+ * @descEN Enforce template literal expressions to be of string type
810
+ * @see https://typescript-eslint.io/rules/restrict-template-expressions
811
+ */
137
812
  "ts/restrict-template-expressions": 0,
813
+ /**
814
+ * @desc 强制一致等待返回的 Promise
815
+ * @descEN Enforce consistent awaiting of returned promises
816
+ * @see https://typescript-eslint.io/rules/return-await
817
+ */
138
818
  "ts/return-await": 0,
819
+ /**
820
+ * @desc 禁止布尔表达式中的某些类型
821
+ * @descEN Disallow certain types in boolean expressions
822
+ * @see https://typescript-eslint.io/rules/strict-boolean-expressions
823
+ */
139
824
  "ts/strict-boolean-expressions": 0,
825
+ /**
826
+ * @desc 要求 switch-case 语句穷尽所有可能
827
+ * @descEN Require switch-case statements to be exhaustive
828
+ * @see https://typescript-eslint.io/rules/switch-exhaustiveness-check
829
+ */
140
830
  "ts/switch-exhaustiveness-check": 0,
831
+ /**
832
+ * @desc 禁止某些三斜线指令,推荐使用 ES6 导入声明
833
+ * @descEN Disallow certain triple slash directives in favor of ES6-style import declarations
834
+ * @see https://typescript-eslint.io/rules/triple-slash-reference
835
+ */
141
836
  "ts/triple-slash-reference": [2, { path: "never", types: "always", lib: "always" }],
837
+ /**
838
+ * @desc 要求在特定地方使用类型注解
839
+ * @descEN Require type annotations in certain places
840
+ * @see https://typescript-eslint.io/rules/typedef
841
+ */
142
842
  "ts/typedef": [2, { arrayDestructuring: false, arrowParameter: false, memberVariableDeclaration: false, objectDestructuring: false, parameter: false, propertyDeclaration: true, variableDeclaration: false }],
843
+ /**
844
+ * @desc 强制未绑定的方法在其预期作用域内调用
845
+ * @descEN Enforce unbound methods are called with their expected scope
846
+ * @see https://typescript-eslint.io/rules/unbound-method
847
+ */
143
848
  "ts/unbound-method": 0,
849
+ /**
850
+ * @desc 禁止可以统一为一个的多个重载
851
+ * @descEN Disallow two overloads that could be unified into one
852
+ * @see https://typescript-eslint.io/rules/unified-signatures
853
+ */
144
854
  "ts/unified-signatures": 0,
855
+ /**
856
+ * @desc 强制 Promise 拒绝回调中的参数类型为 unknown
857
+ * @descEN Enforce typing arguments in Promise rejection callbacks as unknown
858
+ * @see https://typescript-eslint.io/rules/use-unknown-in-catch-callback-variable
859
+ */
145
860
  "ts/use-unknown-in-catch-callback-variable": 0,
146
861
  };