question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Documentation of "no-return-await"

See original GitHub issue

The version of ESLint you are using: 6.0.0 (but this is about the text on https://eslint.org/docs/rules/no-return-await — 1st paragraph there already)

The documentation of “no-return-await” was written without asynchronous stack traces in mind, which make using return await promise over return promise a vastly different experience — if you need to debug a rejected promise: With the await the calling function will be included in the stack trace (as of recent V8).

V8 recently introduced zero-cost async stack traces. Look for this term on https://v8.dev/blog/fast-async The example there with two functions foo()/bar() can be easily slightly modified to have a return await to convince yourself, if that is necessary, that what they write also applies when the await-ed promise is at the very end.

I think this changes the reasons given against return await, in the current documentation for the rule as well as on StackOverflow (but of course we can’t do anything about those) significantly. Anyone who ever had to debug a promise rejected by a sub-function called from different places, where seeing the parameters didn’t help knowing where it was called from (such as simply trying to load a file, if there is more than one place in the code that does that), knows that async. stack traces are a godsend, and getting them for free also during production and also on node.js and not just in Chrome dev. tools (with significant overhead) IMHO is reason enough to rethink the advice given thus far.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
ilyavolodincommented, Jun 26, 2019

By purely for debugging I mean for getting information about the error. This does not have any positive effect (only unnoticeable negative effect) to the end consumer.

0reactions
kaicataldocommented, Jun 27, 2019

Closing since the proposal author is no longer interested in pursuing this change.

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-return-await - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
no-return-await - Rules - ESLint - Pluggable ... - GitHub Pages
Disallows unnecessary return await (no-return-await) ... Inside an async function , return await is useless. Since the return value of an async function...
Read more >
Considering the 'no-return-await' rule… - Yoichi Michael Nagano
Given that async functions always return a promise, the second await statement is essentially a redundancy. If the value returned by the second...
Read more >
Why no-return-await vs const x = await? - javascript
Basically, because return await is redundant. Look at it from a slightly higher level of how you actually use an async function:
Read more >
No-return-await - ESLint - W3cubDocs
Using return await inside an async function keeps the current function in the call stack until the Promise that is being awaited has...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found