ESLint@^8 cannot format the code when saving
See original GitHub issueHi, After my test, ESLint@^8 cannot format the code when saving with the following configuration, and versions ^5 to ^7 do fine.
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
}
I don’t know if this issue is reported to eslint or vscode-eslint.
Issue Analytics
- State:
- Created a year ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Extension 'eslint' is configured as formatter but it cannot format ...
I am experiencing an intermittent problem with ESLint in VS Code. When saving a file, instead of formatting it, this message shows in...
Read more >v2.1.10 - Extension 'ESlint' cannot format file · Issue #1086
Same issue for me while using insiders build of vs code. I have the default formatter set to "dbaeumer.vscode-eslint" and it no longer...
Read more >How to Format Code on Save in VS Code with ESlint
Finally, it's time to configure VS Code to auto-format code with ESLint whenever you save a file. You can do this in one...
Read more >How To Enable Linting on Save with Visual Studio Code and ...
Learn how to lint your code on every file save using ESLint rules and VS Code settings.
Read more >VS Code - You don't need a formatting extension (Prettier and ...
I don't use React, so I can't comment how well React code is formatted. Settings added to control the formatting of CSS, LESS,...
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
@vvizden I just cloned your repo and everything worked for me.
That makes sense. That setting lists the rules that should be auto-fixed when saving/formatting a file. If it’s empty, the extension will not make any changes. If not defined, then the default is to use the rules in the
.eslintrc
file.Good question. The README says:
So what I think was happening is that with earlier versions of ESLint this extension would just ignore your
"eslint.codeActionsOnSave.rules": []
setting, but now that you’ve upgraded to v8 it results in the behavior explained above.Thank you very much for the careful answer, and here is a summary to help friends who encounter the same problem.
Solve this problem quickly:
It doesn’t matter which version of eslint ( now the latest version is 8.27.0 ) in package.json, just remove the
"eslint.codeActionsOnSave.rules": []
in your VSCode settings.json.