Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
posti85 opened this issue May 3, 2024 · 0 comments
Open

Comments

@posti85
Copy link

posti85 commented May 3, 2024

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).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant