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: Fragment is moved if it wraps a component #416

Open
AlphaJack opened this issue May 4, 2024 · 1 comment
Open

🐛 BUG: Fragment is moved if it wraps a component #416

AlphaJack opened this issue May 4, 2024 · 1 comment

Comments

@AlphaJack
Copy link

Describe the Bug

It seems that wrapping a component within causes the formatter to move at the end of the parent element, breaking the structure.

Steps to Reproduce

npm init astro using template any

<BaseLayout>
    <Fragment slot="AdditionalSEO">
        <Problem>
     </Fragment>
    <header>
    </header>
    <article>
    </article>
</BaseLayout>

Wrong result:

<BaseLayout>
  <Fragment slot="AdditionalSEO">
    <Problem />
    <header></header>
    <article></article>
  </Fragment></BaseLayout
>

Expected result:

<BaseLayout>
  <Fragment slot="AdditionalSEO"> <Problem /> </Fragment>
  <header></header>
  <article></article>
</BaseLayout>

With text it works:

<BaseLayout>
    <Fragment slot="AdditionalSEO">
        Not a problem
     </Fragment>
    <header>
    </header>
    <article>
    </article>
</BaseLayout>

...

<BaseLayout>
  <Fragment slot="AdditionalSEO"> Not a problem </Fragment>
  <header></header>
  <article></article>
</BaseLayout>
@horo-fox
Copy link

This is just a prettier configuration thing I think. Try "bracketSameLine": true in your .prettierrc. Note that this configuration doesn't work within braces, which is annoying.

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

2 participants