withastro / prettier-plugin-astro

Prettier plugin for Astro
Other
475 stars 33 forks source link

🐛 BUG: HTML-style `prettier-ignore` comments do not work for script tags #410

Open ony3000 opened 6 months ago

ony3000 commented 6 months ago

Describe the Bug

Hello. I maintain three Prettier plugins.

I've recently been implementing Astro support in a plugin, and while adding tests, I found two bugs. I'm going to report them in this issue and the next issue.

Steps to Reproduce

  1. Prepare Astro code in the following form: (I'll call it foobar.astro here.)
    <!-- prettier-ignore -->
    <script>
    const foo = '123'
    </script>
  2. In terminal, run pnpm prettier --check foobar.astro --no-config --plugin=prettier-plugin-astro --parser=astro. (Depending on the package manager you use, the first part of the command may be slightly different.)

The current behavior

current

The expected behavior

expected