Open Trombach opened 1 month ago
The Astro extensions formatter seems to expect elements inside expressions to be wrapped in a single element just like JSX. The code however compiles fine and displays the correct elements without using a wrapper element.
For example, this compiles and displays fine
--- import Card from "something" const cards = ["a", "b"]; --- {cards.map(card => (<Card href="https://docs.astro.build/" title={card} body={card}/> <Card href="https://docs.astro.build/" title={card} body={card}/>))}
However, the extension fails to format this and gives the following error message.
SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment <>...</>?
Wrapping the cards components in a fragment results in the correct formatting.
https://github.com/Trombach/withastro-astro-fmqmba/blob/main/src/pages/formatting.astro
this also happened to me
Describe the Bug
The Astro extensions formatter seems to expect elements inside expressions to be wrapped in a single element just like JSX. The code however compiles fine and displays the correct elements without using a wrapper element.
For example, this compiles and displays fine
However, the extension fails to format this and gives the following error message.
Wrapping the cards components in a fragment results in the correct formatting.
Steps to Reproduce
Link to Minimal Reproducible Example
https://github.com/Trombach/withastro-astro-fmqmba/blob/main/src/pages/formatting.astro