You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
When using Prettier v12.1.1 together with ESLint, incorrect code deletion occurs when removing lines of code #3931
changed the title [-]Prettier v12.1.1 搭配ESlint 在删除代码时会出现错误删除[/-][+]When using Prettier v12.1.1 together with ESLint, incorrect code deletion occurs when removing lines of code[/+]on Jan 21, 2026
As this is bug is a real downer and potentially a source of true bugs if it just happens to delete code in the wrong place, is there any update on this?
I downgraded the version to 11.0.3, and everything works fine for me.
I also confirm that when using the plugin together with ESLint, Prettier breaks the code by removing lines or characters.
Screen.Recording.2026-01-27.at.00.32.48.mov
Reacted by Isabela Moreira, dangkiet2000, Kyle Baker, Chris Shepherd, Ruben B, César Watrin, Manuel Kostka, Valentyn Borysenkov, Jochen Wikenhauser and Ruslan Baigunussov
There is another issue about code been deleted, prettier/prettier#18769 I'm not sure if they are the same problem, because user says that different Prettier(NPM Prettier package, not VSCode extension) behave differently.
I'm also hitting this, this is a show stopper bug in this extension making it pretty horrible to use. I think it is introduced in either 12.1.0 or 12.1.1, and might or might not be related to interaction with the ESLint plugin and/or prettier version used in the project.
There is another issue about code been deleted, prettier/prettier#18769 I'm not sure if they are the same problem, because user says that different Prettier(NPM Prettier package, not VSCode extension) behave differently.
@fisker That issue is definitely a plugin specific with version above 11.0.3. I have tried versions 12.3.0, 12.2.0, 12.1.1, 12.1.0, and all those have this exact issue where it deletes lines.
Reacted by Vasilii Boldurean, César Watrin, Jarek Radosz, Ruslan Baigunussov, Valentyn Borysenkov and Jochen Wikenhauser
Can one of the maintainers probably give a short update of the status of this issue? Is that something that you can reproduce and are you working on this?
{
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.prettier": "explicit"// use this, if you're not using eslint prettier plugin
}
}
Solves the issue.
But, I had to update the .vscode/settings.json for all the frontend projects because the previous config in the .vscode/settings.json was following:
This fix seems to be working for me so far. Note that, because I am using eslint-plugin-prettier I did not need the "source.fixAll.prettier": "explicit". All I needed was this:
@paulswan fix also works for me.
Maybe worth noting that I had to remove the sorce.fixAll setting and it did not matter whether that was set to always or to explicit.
The source.fixAll.prettier may not be necessary, but it also does not seem to hurt in my case.
{
"editor.codeActionsOnSave": {
# "source.fixAll": "explicit", <-- must be removed"source.fixAll.eslint": "explicit""source.fixAll.prettier": "explicit"
}
}
Activity
[-]Prettier v12.1.1 搭配ESlint 在删除代码时会出现错误删除[/-][+]When using Prettier v12.1.1 together with ESLint, incorrect code deletion occurs when removing lines of code[/+]fisker commentedon Jan 21, 2026
Transferred from https://github.com/prettier/prettier
colaquecez commentedon Jan 22, 2026
Somnus007 commentedon Jan 22, 2026
paulswan commentedon Jan 22, 2026
lvzhenbo commentedon Jan 22, 2026
l246804 commentedon Jan 22, 2026
torsten-ueckert commentedon Jan 26, 2026
torsten-ueckert commentedon Jan 26, 2026
As this is bug is a real downer and potentially a source of true bugs if it just happens to delete code in the wrong place, is there any update on this?
Vorobeyko commentedon Jan 26, 2026
I downgraded the version to 11.0.3, and everything works fine for me.
I also confirm that when using the plugin together with ESLint, Prettier breaks the code by removing lines or characters.
Screen.Recording.2026-01-27.at.00.32.48.mov
fisker commentedon Jan 28, 2026
There is another issue about code been deleted, prettier/prettier#18769 I'm not sure if they are the same problem, because user says that different Prettier(NPM Prettier package, not VSCode extension) behave differently.
segevfiner commentedon Jan 29, 2026
I'm also hitting this, this is a show stopper bug in this extension making it pretty horrible to use. I think it is introduced in either 12.1.0 or 12.1.1, and might or might not be related to interaction with the ESLint plugin and/or prettier version used in the project.
sagarpanchal commentedon Feb 2, 2026
@fisker That issue is definitely a plugin specific with version above 11.0.3. I have tried versions 12.3.0, 12.2.0, 12.1.1, 12.1.0, and all those have this exact issue where it deletes lines.
torsten-ueckert commentedon Mar 6, 2026
Can one of the maintainers probably give a short update of the status of this issue? Is that something that you can reproduce and are you working on this?
CesarWatrin commentedon Mar 18, 2026
Version 12.4.0 has been released 2 days ago, and this issue has been persisting for over two months with still no fix... I go back to 11.0.3 again
l246804 commentedon Apr 2, 2026
Is there any progress?
DenVilden commentedon Apr 9, 2026
ping
boldurean commentedon Apr 14, 2026
is there any update?
paulswan commentedon Jun 10, 2026
Has anyone looked at this yet? It's been nearly 6 months and at least 3 releases since the issue was raised.
l246804 commentedon Jun 11, 2026
I have replaced it with oxc. 😮💨
aceArt-GmbH commentedon Jul 1, 2026
ESLint Plugin Version: 3.0.24
Prettier Plugin Version: 12.4.0
prettier: 3.9.1
eslint: 10.6.0
The issue sadly seems to still persist.
Very easy to reproduce in
.tsfiles..html(Angular, where eslint runs too) and.cssseem fine.sagarpanchal commentedon Sep 7, 2026
I read this README section https://github.com/prettier/prettier-vscode#using-code-actions-on-save, and added this config in
settings.jsonof the editor and the project's.vscode/settings.json🟢 Correct config
{ "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.fixAll.prettier": "explicit" // use this, if you're not using eslint prettier plugin } }Solves the issue.
But, I had to update the
.vscode/settings.jsonfor all the frontend projects because the previous config in the.vscode/settings.jsonwas following:🔴 Bad config
{ "editor.codeActionsOnSave": { "source.fixAll": "always", "source.fixAll.eslint": "explicit" } }@LostElkByte @fisker @boldurean @Vorobeyko
paulswan commentedon Sep 8, 2026
This fix seems to be working for me so far. Note that, because I am using
eslint-plugin-prettierI did not need the"source.fixAll.prettier": "explicit". All I needed was this:torsten-ueckert commentedon Sep 8, 2026
@paulswan fix also works for me.
Maybe worth noting that I had to remove the
sorce.fixAllsetting and it did not matter whether that was set toalwaysor toexplicit.The
source.fixAll.prettiermay not be necessary, but it also does not seem to hurt in my case.{ "editor.codeActionsOnSave": { # "source.fixAll": "explicit", <-- must be removed "source.fixAll.eslint": "explicit" "source.fixAll.prettier": "explicit" } }