Proposal: Implement autofix for `no-return-await`
See original GitHub issueVersions
- ESLint: 3.10
- Node: 7.1
- npm: 4.0.2
Description
I propose to implement an auto-fixer for the new no-return-await
rule. Since return await value
has the same meaning as return value
in async functions, an auto-fix can be implemented which simply removes the await
keyword.
There is currently one known exception to this - try/catch
blocks. See pending issue #7581 (PR with fix also pending merge).
I have an implementation of the auto-fixer ready - if you are interested you may see it here. Once this issue gets accepted I will open a PR with the actual implementation for further review.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:10 (5 by maintainers)
Top Results From Across the Web
Auto-fix and format your JavaScript with ESLint - IBM Developer
Get the quick tips and tricks you need to use ESLint to autofix and format your JavaScript.
Read more >eslint | Yarn - Package Manager
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and...
Read more >ESLint v3.13.0 released
This is a summary of some of the notable changes in this version of ESLint. New Rules. One new rule was added: prefer-destructuring....
Read more >demo-outil-edition - node_modules - eslint - CHANGELOG.md
73596cb Update: Add enforceForSwitchCase option to use-isnan (#12106) ... e85d27a Fix: no-regex-spaces false positives and invalid autofix ...
Read more >Node.js API - ESLint - Breword 文档集合
The purpose of the Node.js API is to allow plugin and tool authors to use the ESLint functionality ... And here is an...
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
@isiahmeadows @not-an-aardvark This is interesting discussion, but can we please keep this issue focused to autofixing (or not) for
no-return-await
? Please feel free to visit our Gitter chat if you wish to continue the general auto-fix discussion, or please feel free to open an issue if you believe you have identified an issue with one of our other rules.Oh. I didn’t realize
strict
limited itself to that.I’ll also point out that it’s generally a bad idea to rely on the resolution order of two independent promises, so I’d be shocked if they would actually break anything in practice. (The above sample already warns, and the autofixer doesn’t touch ignored lines IIUC).
If you actually wish for that kind of behavior, it’s best to make it explicit, though, so ESLint doesn’t complain.