Rule Change: make no-return-await suggestable
See original GitHub issueWhat rule do you want to change?
no-return-await
What change to do you want to make?
Implement autofix
How do you think the change should be implemented?
A new option
Example code
async function foo {
return await Promise.resolve("bar")
}
What does the rule currently do for this code?
// Error, but don’t change: async function foo { return await Promise.resolve(“bar”) }
What will the rule do after it’s changed?
// Fix it async function foo { return Promise.resolve(“bar”) }
Participation
- I am willing to submit a pull request to implement this change.
Additional comments
Hi! There have been discussions about whether no-return-await
should be a core rule. These are resolved - and, consequently, I would argue that the rule should be auto-fixable.
Issue Analytics
- State:
- Created 9 months ago
- Reactions:1
- Comments:12 (12 by maintainers)
Top Results From Across the Web
eslint-config-ash-nazg - npm
The ash-nazg/sauron config expands upon the regular ash-nazg rules to indicate what are generally best practices but are less likely to be due ......
Read more >Why no-return-await vs const x = await? - Stack Overflow
Basically, because return await is redundant. Look at it from a slightly higher level of how you actually use an async function:
Read more >How return await can slow down your code - Arthur's place
Awaiting a promise before returning it slows down your code. TL;DR: Enable the no-return-await ESLint rule. A major paradigm of large-scale ...
Read more >Rules - 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 >14 Linting Rules To Help You Write Asynchronous Code in ...
It's best practice to always reject a Promise with an Error object. Doing so will make it easier to trace where the error...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I agree with @yeonjuan, per https://github.com/eslint/eslint/issues/7593#issuecomment-260419426 this doesn’t seem safe for autofixing.
Perhaps we could consider implementing this as suggestions?
I’ve opened #16637 to fix this.