Skip to content

When using Prettier v12.1.1 together with ESLint, incorrect code deletion occurs when removing lines of code #3931

Open

Description

@LostElkByte

Prettier Version: 12.1.1
ESLint Version: 3.0.20
Framework: Vue 3 (Setup Script)
Operating System: macOS 15 / 26.2

Steps to reproduce

  1. Write code containing a computed array in Vue 3 (see Input Code example below)
  2. Attempt to delete a single line (e.g., delete const { t } = useI18n())
  3. Trigger Prettier + ESLint auto-formatting (save file / manual formatting)
  4. Notice that the line below the deleted line is incorrectly removed
  5. This issue does NOT occur when rolling back Prettier to version 11.0.2

Input Code

<script setup lang="ts">
const { t } = useI18n()

const menuItems = computed(() => [
  { title: t("menus.mockGuide"), route: "/demo/mock" },
])
</script>

Actual Output

<script setup lang="ts">

  { title: t("menus.mockGuide"), route: "/demo/mock" },
])
</script>

Expected Output

<script setup lang="ts">

const menuItems = computed(() => [
  { title: t("menus.mockGuide"), route: "/demo/mock" },
])
</script>

Activity

  1. 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
  2. transferred this issue fromprettier/prettieron Jan 21, 2026
  3. fisker commented on Jan 21, 2026

    @fisker
    Member
  4. added
    bugSomething isn't working
    and removed on Jan 21, 2026
  5. colaquecez commented on Jan 22, 2026

    @colaquecez
  6. Somnus007 commented on Jan 22, 2026

    @Somnus007
  7. paulswan commented on Jan 22, 2026

    @paulswan
  8. lvzhenbo commented on Jan 22, 2026

    @lvzhenbo
  9. l246804 commented on Jan 22, 2026

    @l246804
  10. torsten-ueckert commented on Jan 26, 2026

    @torsten-ueckert
  11. torsten-ueckert commented on Jan 26, 2026

    @torsten-ueckert

    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?

  12. Vorobeyko commented on Jan 26, 2026

    @Vorobeyko

    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
  13. fisker commented on Jan 28, 2026

    @fisker
    Member

    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.

  14. segevfiner commented on Jan 29, 2026

    @segevfiner

    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.

  15. sagarpanchal commented on Feb 2, 2026

    @sagarpanchal

    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.

    Image
  16. torsten-ueckert commented on Mar 6, 2026

    @torsten-ueckert

    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?

  17. CesarWatrin commented on Mar 18, 2026

    @CesarWatrin

    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

  18. l246804 commented on Apr 2, 2026

    @l246804

    Is there any progress?

  19. DenVilden commented on Apr 9, 2026

    @DenVilden

    ping

  20. boldurean commented on Apr 14, 2026

    @boldurean

    is there any update?

  21. paulswan commented on Jun 10, 2026

    @paulswan

    Has anyone looked at this yet? It's been nearly 6 months and at least 3 releases since the issue was raised.

  22. l246804 commented on Jun 11, 2026

    @l246804

    Has anyone looked at this yet? It's been nearly 6 months and at least 3 releases since the issue was raised.

    I have replaced it with oxc. 😮‍💨

  23. aceArt-GmbH commented on Jul 1, 2026

    @aceArt-GmbH

    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 .ts files.
    .html (Angular, where eslint runs too) and .css seem fine.

  24. sagarpanchal commented on Sep 7, 2026

    @sagarpanchal

    I read this README section https://github.com/prettier/prettier-vscode#using-code-actions-on-save, and added this config in settings.json of 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.json for all the frontend projects because the previous config in the .vscode/settings.json was following:

    🔴 Bad config

    {
      "editor.codeActionsOnSave": {
        "source.fixAll": "always",
        "source.fixAll.eslint": "explicit"
      }
    }

    @LostElkByte @fisker @boldurean @Vorobeyko

  25. paulswan commented on Sep 8, 2026

    @paulswan

    I read this README section https://github.com/prettier/prettier-vscode#using-code-actions-on-save, and added this config in settings.json of the editor and the project's .vscode/settings.json

    🟢 Correct config

    {
    "editor.codeActionsOnSave": {
    "source.fixAll.eslint": "explicit",
    "source.fixAll.prettier": "explicit"
    }
    }
    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:

    🔴 Bad config

    {
    "editor.codeActionsOnSave": {
    "source.fixAll": "always",
    "source.fixAll.eslint": "explicit"
    }
    }
    @LostElkByte @fisker @boldurean @Vorobeyko

    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:

    {
      "editor.codeActionsOnSave": {
        "source.fixAll.eslint": "explicit"
      }
    }
    
  26. torsten-ueckert commented on Sep 8, 2026

    @torsten-ueckert

    @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"
      }
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions