I have my editor set to fix all issues upon saving. However, once I saved, it formats the code to fix the issues, then a split second later reverts back to the original unfixed and unformatted code. This started happening after I updated vscode.
I solved my issue by following the steps outlined in this answer https://mcmap.net/q/382888/-can-39-t-get-correct-autoformat-on-save-in-visual-studio-code-with-eslint-and-prettier
Short answer: I needed:
"editor.formatOnSave": false,
"javascript.format.enable": false
Not saying this will be your case, but worth checking:
- Make sure this setting is false:
"editor.formatOnSave": false
- Add this to the
settings.json
file :
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
If you don't use ESLint / Prettier installed, then do the opposite, meaning just make sure that formatOnSave
is set to true and you don't have other formatters enabled.
I had the same problem and it really killed me as I uninstalled prettier and eslint, reset the rules and everything...
Until I saw I had that lonefy.vscode-js-css-html-formatter
package, which is silent in the settings but still forces its own opinionated formatting rules. Uninstalling it made the trick :)
I solved my issue by following the steps outlined in this answer https://mcmap.net/q/382888/-can-39-t-get-correct-autoformat-on-save-in-visual-studio-code-with-eslint-and-prettier
Short answer: I needed:
"editor.formatOnSave": false,
"javascript.format.enable": false
I solved mine by removing this settings:
"editor.codeActionsOnSave": {
"source.organizeImports": "explicit",
"source.fixAll.eslint": "explicit"
},
Autoimports formatted imports and then eslint reformatted code.
© 2022 - 2025 — McMap. All rights reserved.