quick-lint-js

Find bugs in JavaScript programs.

E0266: redundant 'await'

The await operator unwraps a Promise, giving you the value when the Promise is resolved. Because a Promise cannot resolve to another Promise, await will never give you a Promise object. Therefore, using await on the result of await is redundant:

await await fs.promises.rmdir(tempDir);

let data = await await fetch(uri).json();

To fix this error, delete the redundant await operator:

await fs.promises.rmdir(tempDir);

Alternatively, wrap the inner await expression in parentheses:

let data = await (await fetch(uri)).json();

Introduced in quick-lint-js version 2.8.0.

Documentation for other errors