This repository has been archived by the owner on Nov 10, 2022. It is now read-only.
Docs: improve documentation of no-return-await #716
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First of all, I know that there have been a lot of discussions on wether this rule is a good one or not. I do not want to bring up that discussion here at all. I just want to clarify the documentation to better explain the implications, I don't want to advocate for either turning this rule on or off.
I've had some team member asking why we are using
return await
, especially after reading the current version of the documentation forno-return-await
. The reason we are usingreturn await
is because otherwise the functions are missing from the stack traces if an error is thrown asynchronously in the promise that is being returned.My intention with this change is to document that pitfall, and to clarify exactly what is being skipped when not using
return await
(that is, that the function is either still on the call stack, or not)I'm very open to suggestion on more improvements that we can do here! ❤️