This repository has been archived by the owner on Mar 25, 2021. It is now read-only.
/
test.ts.lint
66 lines (51 loc) · 2.45 KB
/
test.ts.lint
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
[typescript]: >= 2.4.0
async function promiseFunc() {
return false;
}
normalExpression = promiseFunc();
const stringLiteral = "text" + promiseFunc();
const globalUnaryExpression = !!promiseFunc();
~~~~~~~~~~~~~ [0]
const globalBinaryExpression = "text" && promiseFunc();
~~~~~~~~~~~~~ [0]
promiseFunc() && console.log("topLevelBinaryExpression");
~~~~~~~~~~~~~ [0]
function union(promiseOrUndefined: Promise<any> | undefined, promiseOrFalse: Promise<any> | false, promiseOrNull: Promise<any> | null) {
if (promiseOrUndefined || promiseOrFalse || promiseOrNull) {
return;
}
};
function funky(maybePromise?: Promise<number>) {
while (promiseFunc() && maybePromise) {
~~~~~~~~~~~~~ [0]
const binaryExpression = (promiseFunc() && "1") || ("1" && !promiseFunc()) ? ("1" && promiseFunc() ? "1" : "1") : maybePromise;
~~~~~~~~~~~~~ [0]
~~~~~~~~~~~~~ [0]
~~~~~~~~~~~~~~~~~~~~ [0]
~~~~~~~~~~~~~ [0]
// For-loop
for (let index = 0; promiseFunc(); index++) {
~~~~~~~~~~~~~ [0]
// a non-promise
if ("just some text" + promiseFunc()) {
// Promise literal
} else if (new Promise(() => { })) {
~~~~~~~~~~~~~~~~~~~~~~ [0]
// Nested Promise
if (promiseFunc()) {
~~~~~~~~~~~~~ [0]
}
// Parenthesized Expression + Exclamation Tokens
} else if (promiseFunc() && !!promiseFunc()) {
~~~~~~~~~~~~~ [0]
~~~~~~~~~~~~~ [0]
}
}
}
}
async function waiter(custumerDecisionPromise: Promise<any>) {
if (await custumerDecisionPromise) {
console.log("Customer ready to take an order.")
}
}
[0]: Promises are not allowed as boolean.