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.

Rule Change: make no-return-await suggestable

See original GitHub issue

What 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:closed
  • Created 9 months ago
  • Reactions:1
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
mdjermanoviccommented, Dec 8, 2022

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?

0reactions
dbartholomaecommented, Dec 10, 2022

I’ve opened #16637 to fix this.

Read more comments on GitHub >

github_iconTop 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 >

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