prettier-plugin-astro icon indicating copy to clipboard operation
prettier-plugin-astro copied to clipboard

🐛 BUG: Not always respecting `bracketSameLine` option

Open alexpdraper opened this issue 1 year ago • 0 comments

Describe the Bug

Empty with multiple attributes do not always format as expected with the bracketSameLine option. The following is how Prettier formats this as HTML.

<script
  is:inline
  src="https://www.example.com/path/that/is/kinda/long/ish/"
  async
></script>

<span
  id="important-span"
  class="some class and another one"
  data-check="for sure"
  >{value}</span
>

But, Astro formats this as:

<script
  is:inline
  src="https://www.example.com/path/that/is/kinda/long/ish/"
  async></script>

<span
  id="important-span"
  class="some class and another one"
  data-check="for sure">{value}</span
>

Setting the bracketSameLine option doesn’t change the output at all.

Steps to Reproduce

  1. npm create astro@latest using template Empty
  2. npm install --save-dev prettier prettier-plugin-astro
  3. Add a prettier config
// prettier.config.cjs
module.exports = {
  plugins: [require.resolve("prettier-plugin-astro")],
  overrides: [
    {
      files: ["**/*.astro"],
      options: { parser: "astro" },
    },
  ],
};
  1. Create an astro file with a template like the ones described in the bug above
  2. Format the new file and see it look as described

alexpdraper avatar Jul 24 '23 22:07 alexpdraper