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