-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Description
Describe the Bug
When formatting Astro files with Prettier and this plugin, JSX expressions are not formatted the same as when you use Prettier on JSX. If for example you have elements being conditionally rendered based on a value, Astro will place the value on a new line instead of on the same line as the brace:
---
const baz = true;
---
<div class="bar">
{
!!baz && (
<>
<span>Kek</span>
<span>Kek</span>
<span>Kek</span>
</>
)
}
</div>
// Foo.jsx
const Foo = ({ baz }) => (
<div class="bar">
{!!baz && (
<>
<span>Kek</span>
<span>Kek</span>
<span>Kek</span>
</>
)}
</div>
);
This is invalid behavior and should be corrected.
Steps to Reproduce
npm init astro
using default template.- Add prettier-plugin-astro.
- Add the following into a file:
--- const baz = true; --- <div class="bar"> {!!baz && ( <> <span>Kek</span> <span>Kek</span> <span>Kek</span> </> )} </div>
- Format the file using Prettier.
- Error! The formatting is not maintained, and
!!baz
... is placed on a new line.
mschadev
Metadata
Metadata
Assignees
Labels
No labels