Skip to content

Files

Latest commit

 

History

History
29 lines (20 loc) · 733 Bytes

no-floating-promise.md

File metadata and controls

29 lines (20 loc) · 733 Bytes

Pattern: Missing await on async function call

Issue: -

Description

Promises that are never awaited can cause unexpected behavior because they may be scheduled to execute at an unexpected time.

Examples of incorrect code for this rule:

function writeToDb() {
  // synchronously write to DB
}
writeToDb();

Examples of correct code for this rule:

async function writeToDb() {
  // asynchronously write to DB
}
writeToDb(); // <- note we have no await here but probably the user intended to await on this!

Further Reading