no-return-await
eslint
Suggestion
eslint.config.js
export default [
{
rules: {
"no-return-await": "error",
},
},
];This rule is deprecated. Check its documentation for a replacement before enabling it.
async function foo() {
return await bar();
}async function foo1() {
return bar();
}
async function foo2() {
await bar();
return;
}
// This is essentially the same as `return await bar();`, but the rule checks only `await` in `return` statements
async function foo3() {
const x = await bar();
return x;
}
// In this example the `await` is necessary to be able to catch errors thrown from `bar()`
async function foo4() {
try {
return await bar();
} catch (error) {}
}Examples from the ESLint documentation.
no-return-await
eslint
export default [
{
rules: {
"no-return-await": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Require return statements to either always or never specify values
Disallow dangling underscores in identifiers
Disallow variable declarations from shadowing variables declared in the outer scope