await is applied to a value that is never a promise
What it finds
await 42, await "ready", await [a(), b()]: awaiting something that is certainly not a promise gives back the same value one tick later. Usually a call or Promise.all was meant, as await Promise.all([a(), b()]), where the array of promises is otherwise not waited for at all.
Reported are literals other than null, templates, array and object literals, functions and classes, and the results of !, typeof and of arithmetic and comparison operators. await null and await undefined, a known way to wait for one tick, are left alone.
From the rule's source, await_plain_value.rs.
async function run(a: () => Promise<number>, b: () => Promise<number>) { await [a(), b()];tx0 reports: this awaits an array, which is never a promise const n = await 42;tx0 reports: this awaits a literal await null; await a(); return n + (await (1 + 2));tx0 reports: this awaits the result of an operator} Turn it on, off or suppress it
The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:await-plain-value" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:await-plain-value] reason="..."tx0 explain tx0/ts:await-plain-value shows the same in the terminal. Found a false positive? Report it.