require-await
Disallow async functions which have no
awaitexpression.
🧠
Extending "plugin:@typescript-eslint/recommended-requiring-type-checking" in an ESLint configuration enables this rule.
💭
This rule requires type information to run.
Examples
This rule extends the base eslint/require-await rule.
It uses type information to add support for async functions that return a Promise.
Examples of correct code for this rule:
async function returnsPromise1() {
return Promise.resolve(1);
}
const returnsPromise2 = () => returnsPromise1();
Options
.eslintrc.cjs
module.exports = {
"rules": {
// Note: you must disable the base rule as it can report incorrect errors
"require-await": "off",
"@typescript-eslint/require-await": "error"
}
};
See eslint/require-await options.
How to Use
Resources
Taken with ❤️ from ESLint core