Skip to content

Files

Latest commit

 

History

History
23 lines (17 loc) · 454 Bytes

no-unnecessary-await.md

File metadata and controls

23 lines (17 loc) · 454 Bytes

Pattern: Redundant await operator usage

Issue: -

Description

The await operator should only be used with Promise values. Using it with non-promise values or multiple times on the same promise is unnecessary and can make code harder to read.

Examples

Example of incorrect code:

async function bad() {
  await await promise;
}

Example of correct code:

async function good() {
  await promise;
}