JS.TS.REQUIRE.AWAIT

Disallow async functions which have no 'await' expression

Rule Details

This rule extends the base eslint/require-await (https://eslint.org/docs/rules/require-await) rule. It uses type information to add support for async functions that return a Promise.

Examples of correct code for this rule:

Copy
async function returnsPromise1() {
  return Promise.resolve(1);
}

const returnsPromise2 = () => returnsPromise1();

How to Use

Copy
{
  // note you must disable the base rule as it can report incorrect errors
  "require-await": "off",
  "@typescript-eslint/require-await": "error"
}

Options

See eslint/require-await options (https://eslint.org/docs/rules/require-await#options).

The content on this page is adapted from the ESLint User Guide. Copyright © OpenJS Foundation and other contributors, www.openjsf.org. All rights reserved. https://eslint.org/docs/rules/