-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Labels
Description
The default setting for @typescript-eslint/return-await
is ['error', 'always'].
This disallows code like:
async function myAsyncFunction () {
return someOtherAsyncFunction()
}
instead demanding:
async function myAsyncFunction () {
return await someOtherAsyncFunction()
}
It doesn't seem to make any difference to the stack traces and we have other rules that catch floating promises so I'm not sure what value it adds, and it occasionally raises some eyebrows.
The rule comes from standard but it's not even clear that the standard maintainers are for this version of the rule.
It does have another mode which is "in-try-catch"
, this disallows this sort of thing, demanding and await
before the return
, which seems a bit more useful, as it looks like the author might think any rejection would be caught which is not the case:
try {
return someOtherAsyncFunction()
} catch (err) {
// phew!
}
Shall we switch this rule to "in-try-catch"
?
SgtPooki