await
expression (require-await)Async functions which have no await
expression may be the unintentional result of refactoring.
This rule warns async functions which have no await
expression.
Examples of incorrect code for this rule:
/*eslint require-await: "error"*/ async function foo() { doSomething(); } bar(async () => { doSomething(); });
Examples of correct code for this rule:
/*eslint require-await: "error"*/ async function foo() { await doSomething(); } bar(async () => { await doSomething(); }); function foo() { doSomething(); } bar(() => { doSomething(); }); // Allow empty functions. async function noop() {}
If you don’t want to notify async functions which have no await
expression, then it’s safe to disable this rule.
This rule was introduced in ESLint 3.11.0.
© JS Foundation and other contributors
Licensed under the MIT License.
https://eslint.org/docs/rules/require-await