The promise of an async call inside an async function is dropped without await
What it finds
async function save() { ... } async function run() { save(); }: the promise of an async call that is neither awaited nor handled is dropped. The caller goes on before the work is done, and if it fails, the rejection reaches no catch and is reported as unhandled.
The rule reports calls that are statements of their own, inside an async function where await is at hand, of functions that certainly return a promise: async functions and async methods of this file that are not reassigned. Calls in other functions, of imported functions or with void in front, which marks a deliberate fire and forget, are left alone.
From the rule's source, unawaited_async_call.rs.
async function save(item: string) { return item;}const store = async (item: string) => item;class Sync { async push() { return 1; } async run(item: string) { save(item);tx0 reports: this async call is not awaited store(item);tx0 reports: this async call is not awaited this.push();tx0 reports: this async call is not awaited await save(item); void save(item); } start(item: string) { save(item); }} 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:unawaited-async-call" = "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:unawaited-async-call] reason="..."tx0 explain tx0/ts:unawaited-async-call shows the same in the terminal. Found a false positive? Report it.