Skip to content

promise/prefer-await-to-then Style

What it does

Prefer await to then()/catch()/finally() for reading Promise values

Why is this bad?

Async/await syntax can be seen as more readable.

Examples

Examples of incorrect code for this rule:

javascript
function foo() {
  hey.then((x) => {});
}

Examples of correct code for this rule:

javascript
async function hi() {
  await thing();
}

References

Released under the MIT License.