-
Notifications
You must be signed in to change notification settings - Fork 1
/
bugs.js
420 lines (373 loc) · 12.4 KB
/
bugs.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
"use strict";
/**
* Rules that prevent accidental bugs and runtime errors
*/
module.exports = {
rules: {
/**
* Warns for an awaited value that is not a Promise.
*
* @see https://palantir.github.io/tslint/rules/await-promise/
*/
"await-promise": true,
/**
* Bans “// @ts-ignore” comments from being used.
*
* @see https://palantir.github.io/tslint/rules/ban-ts-ignore/
*
* This rule is disabled because whenever a @ts-ignore comment is needed, it should include
* an explanation of why. I wish there was a TSLint rule to enforce that.
*/
"ban-ts-ignore": false,
/**
* Requires a `for ... in` statement to be filtered with an `if` statement.
*
* @see https://palantir.github.io/tslint/rules/forin/
*/
forin: true,
/**
* Functions marked as `async` must contain an `await` or `return` statement.
*
* @see https://palantir.github.io/tslint/rules/no-async-without-await/
*/
"no-async-without-await": true,
/**
* Disallows bitwise operators.
*
* @see https://palantir.github.io/tslint/rules/no-bitwise/
*/
"no-bitwise": true,
/**
* Disallows any type of assignment in conditionals.
*
* @see https://palantir.github.io/tslint/rules/no-conditional-assignment/
*/
"no-conditional-assignment": true,
/**
* Disallows access to the constructors of `String`, `Number`, and `Boolean`.
*
* @see https://palantir.github.io/tslint/rules/no-construct/
*/
"no-construct": true,
/**
* Disallows `debugger` statements.
*
* @see https://palantir.github.io/tslint/rules/no-debugger/
*/
"no-debugger": true,
/**
* Warns if `super()` appears twice in a constructor.
*
* @see https://palantir.github.io/tslint/rules/no-duplicate-super/
*/
"no-duplicate-super": true,
/**
* Prevents duplicate cases in switch statements.
*
* @see https://palantir.github.io/tslint/rules/no-duplicate-switch-case/
*/
"no-duplicate-switch-case": true,
/**
* Disallows duplicate variable declarations in the same block scope.
*
* @see https://palantir.github.io/tslint/rules/no-duplicate-variable/
*/
"no-duplicate-variable": {
severity: "default",
options: [
"check-parameters"
]
},
/**
* Bans usage of the delete operator with computed key expressions.
*
* @see https://palantir.github.io/tslint/rules/no-dynamic-delete/
*/
"no-dynamic-delete": true,
/**
* Disallows empty blocks.
*
* @see https://palantir.github.io/tslint/rules/no-empty/
*/
"no-empty": {
severity: "warning"
},
/**
* Forbids empty interfaces.
*
* @see https://palantir.github.io/tslint/rules/no-empty-interface/
*/
"no-empty-interface": true,
/**
* Promises returned by functions must be handled appropriately.
*
* @see https://palantir.github.io/tslint/rules/no-floating-promises/
*/
"no-floating-promises": true,
/**
* Disallows iterating with a for-in loop.
*
* @see https://palantir.github.io/tslint/rules/no-for-in/
*/
"no-for-in": true,
/**
* Disallows iterating over an array with a for-in loop.
*
* @see https://palantir.github.io/tslint/rules/no-for-in-array/
*/
"no-for-in-array": true,
/**
* Disallows importing modules that are not listed as dependency in the project`s package.json
*
* @see https://palantir.github.io/tslint/rules/no-implicit-dependencies/
*/
"no-implicit-dependencies": {
severity: "default",
options: [
"dev" // Allow importing type definitions from devDependencies
]
},
/**
* Avoid import statements with side-effect.
*
* @see https://palantir.github.io/tslint/rules/no-import-side-effect/
*/
"no-import-side-effect": {
severity: "default",
options: [{
"ignore-module": "source-map-support/register"
}]
},
/**
* Disallow type inference of {} (empty object type) at function and constructor call sites
*
* @see https://palantir.github.io/tslint/rules/no-inferred-empty-object-type/
*/
"no-inferred-empty-object-type": true,
/**
* Warns on use of `${` in non-template strings.
*
* @see https://palantir.github.io/tslint/rules/no-invalid-template-strings/
*/
"no-invalid-template-strings": true,
/**
* Warns on apparent attempts to define constructors for interfaces or `new` for classes.
*
* @see https://palantir.github.io/tslint/rules/no-misused-new/
*
* This rule is disabled because there are many cases where it is useful or necessary to define
* an interface with a constructor. Many of the built-in TypeScript and Node type definitions
* use this technique.
*/
"no-misused-new": false,
/**
* Disallows non-null assertions using the `!` postfix operator.
*
* @see https://palantir.github.io/tslint/rules/no-non-null-assertion/
*
* This rule is disabled because there are many cases where TypeScript is unable to
* determine that a value is non-null.
*/
"no-non-null-assertion": false,
/**
* Disallows explicitly declared or implicitly returned union types with both `null` and
* `undefined` as members.
*
* @see https://palantir.github.io/tslint/rules/no-null-undefined-union/
*/
"no-null-undefined-union": true,
/**
* Forbids an object literal to appear in a type assertion expression.
* Casting to `any` or to `unknown` is still allowed.
*
* @see https://palantir.github.io/tslint/rules/no-object-literal-type-assertion/
*/
"no-object-literal-type-assertion": true,
/**
* Disallows promises that are used as boolean conditions.
*
* @see https://palantir.github.io/tslint/rules/no-promise-as-boolean/
*/
"no-promise-as-boolean": true,
/**
* Disallows shadowing variable declarations.
*
* @see https://palantir.github.io/tslint/rules/no-shadowed-variable/
*/
"no-shadowed-variable": {
severity: "warning"
},
/**
* Forbids array literals to contain missing elements.
*
* @see https://palantir.github.io/tslint/rules/no-sparse-arrays/
*/
"no-sparse-arrays": true,
/**
* Forbids equality tests that are always true or always false
*
* @see https://palantir.github.io/tslint/rules/no-tautology-expression/
*/
"no-tautology-expression": true,
/**
* Warns when a method is used outside of a method call.
*
* @see https://palantir.github.io/tslint/rules/no-unbound-method/
*
* This rule is currently disabled due to numerous bugs
* @see https://github.com/palantir/tslint/issues?utf8=%E2%9C%93&q=is%3Aissue+no-unbound-method
*/
"no-unbound-method": false,
/**
* Warns when using an expression of type `any` in a dynamic way.
* Uses are only allowed if they would work for `{} | null | undefined`.
* Type casts and tests are allowed.
* Expressions that work on all values (such as `"" + x`) are allowed.
*
* @see https://palantir.github.io/tslint/rules/no-unsafe-any/
*/
"no-unsafe-any": true,
/**
* Disallows control flow statements, such as `return`, `continue`,
* `break` and `throws` in finally blocks.
*
* @see https://palantir.github.io/tslint/rules/no-unsafe-finally/
*/
"no-unsafe-finally": true,
/**
* Disallows usage of variables before their declaration.
*
* @see https://palantir.github.io/tslint/rules/no-use-before-declare/
*
* This rule is disabled because it voilates the Clean Code "newspaper order" principle.
*/
"no-use-before-declare": false,
/**
* Requires expressions of type `void` to appear in statement position.
*
* @see https://palantir.github.io/tslint/rules/no-void-expression/
*/
"no-void-expression": {
severity: "default",
options: [
"ignore-arrow-function-shorthand"
]
},
/**
* Requires any function or method that returns a promise to be marked async.
*
* @see https://palantir.github.io/tslint/rules/promise-function-async/
*/
"promise-function-async": {
severity: "default",
options: [
"check-function-declaration",
"check-method-declaration"
]
},
/**
* Requires the radix parameter to be specified when calling `parseInt`.
*
* @see https://palantir.github.io/tslint/rules/radix/
*/
radix: true,
/**
* When adding two variables, operands must both be of type number or of type string.
*
* @see https://palantir.github.io/tslint/rules/restrict-plus-operands/
*/
"restrict-plus-operands": true,
/**
* Restricts the types allowed in boolean expressions. By default only booleans are allowed.
*
* The following nodes are checked:
*
* - Arguments to the `!`, `&&`, and `||` operators
* - The condition in a conditional expression (`cond ? x : y`)
* - Conditions for `if`, `for`, `while`, and `do-while` statements.
*
* @see https://palantir.github.io/tslint/rules/strict-boolean-expressions/
*
* This rule is disabled because truthy and falsy assertions are a common and well-accepted
* practice in JavaScript.
*/
"strict-boolean-expressions": false,
/**
* Don't allow `>`, `<`, `<=`, or `>=` comparisons between objects.
*
* @see https://palantir.github.io/tslint/rules/strict-comparisons/
*/
"strict-comparisons": {
severity: "default",
options: [{
"allow-object-equal-comparison": true,
"allow-string-order-comparison": true,
}]
},
/**
* Requires explicit `toString()` calls when concatenating non-string values to strings.
*
* @see https://palantir.github.io/tslint/rules/strict-string-expressions/
*
* This rule is disabled because it leads to code that is overly verbose and more difficult to read.
*/
"strict-string-expressions": false,
/**
* Warns for type predicates that are always true or always false.
* Works for `typeof` comparisons to constants (e.g. `typeof foo === "string"`), and equality comparison to `null`/`undefined`.
* (TypeScript won't let you compare `1 === 2`, but it has an exception for `1 === undefined`.)
* Does not yet work for `instanceof`.
* Does not warn for `if (x.y)` where `x.y` is always truthy. For that, see strict-boolean-expressions.
*
* This rule requires `strictNullChecks` to work properly.
*
* @see https://palantir.github.io/tslint/rules/strict-type-predicates/
*
* This rule is disabled because it's often necessary to add `typeof` checks that the TypeScript
* compiler thinks are unnecessary.
*/
"strict-type-predicates": false,
/**
* Require a `default` case in all `switch` statements.
*
* @see https://palantir.github.io/tslint/rules/switch-default/
*/
"switch-default": true,
/**
* Checks whether the final clause of a switch statement ends in `break;`.
*
* @see https://palantir.github.io/tslint/rules/switch-final-break/
*
* This rule is disabled because the final `break` should _not_ be required for the `default` case,
* but it _should_ be required if the final case is not `default`.
*/
"switch-final-break": false,
/**
* Requires `===` and `!==` in place of `==` and `!=`.
*
* @see https://palantir.github.io/tslint/rules/triple-equals/
*/
"triple-equals": true,
/**
* Requires type definitions to exist.
*
* @see https://palantir.github.io/tslint/rules/typedef/
*
* This rule is disabled because it conflicts with "no-inferable-types".
* See https://github.com/palantir/tslint/issues/711
*/
typedef: false,
/**
* Prevents blank constructors, as they are redundant.
*
* @see https://palantir.github.io/tslint/rules/unnecessary-constructor/
*/
"unnecessary-constructor": true,
/**
* Enforces use of the `isNaN()` function to check for NaN references instead of a comparison to the `NaN` constant.
*
* @see https://palantir.github.io/tslint/rules/use-isnan/
*/
"use-isnan": true,
}
};