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

🐛 BUG: `bracketSameLine` not working as expected in self-closing tags

Open posti85 opened this issue 1 year ago • 0 comments

Describe the Bug

With this prettier configuration:

.prettierrc:

{
  "bracketSameLine": true,
  "singleAttributePerLine": true,
  "plugins": ["prettier-plugin-astro"]
}

In .astro files, I spect self-closing tags to be closed in the same line of its lasts attribute, but it closes in a new line.

unformated test.astro:

<input type="text" class="testing" />

formatted test.astro:

<input
  type="text"
  class="testing"
/>

In .html files it works as spected:

unformated test.html:

<input type="text" class="testing" />

formatted test.html:

<input
  type="text"
  class="testing" />

Steps to Reproduce

  1. npm init astro using template Empty
  2. npm i --save-dev prettier prettier-plugin-astro
  3. Create in the root the .prettierrc with:
{
  "bracketSameLine": true,
  "singleAttributePerLine": true,
  "plugins": ["prettier-plugin-astro"]
}
  1. Create in the pages folder the files test.astro and test.html files with the content:
<input type="text" class="testing" />
  1. npx prettier --write .
  2. Check the formatting results for both files are differents (it should be the same).

posti85 avatar May 03 '24 11:05 posti85