prettier-plugin-astro
prettier-plugin-astro copied to clipboard
🐛 BUG: Not always respecting `bracketSameLine` option
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
-
npm create astro@latest
using template Empty -
npm install --save-dev prettier prettier-plugin-astro
- Add a prettier config
// prettier.config.cjs
module.exports = {
plugins: [require.resolve("prettier-plugin-astro")],
overrides: [
{
files: ["**/*.astro"],
options: { parser: "astro" },
},
],
};
- Create an astro file with a template like the ones described in the bug above
- Format the new file and see it look as described