vercel / style-guide

Vercel's engineering style guide
Mozilla Public License 2.0
1.18k stars 29 forks source link

Proposal for removing deprecated `no-return-await` rule #88

Closed AhmedBaset closed 3 months ago

AhmedBaset commented 4 months ago

no-return-await has been deprecated from eslint.

This rule was deprecated in ESLint v8.46.0 with no replacement. The original intent of this rule no longer applies due to the fact JavaScript now handles native Promises differently. It can now be slower to remove await rather than keeping it. More technical information can be found in this V8 blog entry.

Using return await inside an async function keeps the current function in the call stack until the Promise that is being awaited has resolved, at the cost of an extra microtask before resolving the outer Promise. return await can also be used in a try/catch statement to catch errors from another function that returns a Promise.

You can avoid the extra microtask by not awaiting the return value, with the trade off of the function no longer being a part of the stack trace if an error is thrown asynchronously from the Promise being returned. This can make debugging more difficult.

mrmckeb commented 3 months ago

Interesting, will create a PR now - thanks!

vercel-release-bot commented 3 months ago

:tada: This issue has been resolved in version 5.3.0-canary.5 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

vercel-release-bot commented 3 months ago

:tada: This issue has been resolved in version 6.0.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: