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

In Astro files: "Parsing error: JSX expressions must have one parent element." #312

Closed
2 tasks done
mb21 opened this issue Jan 30, 2024 · 1 comment · Fixed by ota-meshi/astro-eslint-parser#289
Closed
2 tasks done
Labels
bug Something isn't working

Comments

@mb21
Copy link

mb21 commented Jan 30, 2024

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.56.0

What version of eslint-plugin-astro are you using?

0.31.3

What did you do?

Since updating from astro 4.2.1 to 4.2.6, I'm getting the error "Parsing error: JSX expressions must have one parent element." even in .astro files with e.g. the following content:

{[].map(i => (
  <p>title</p>
  <p>{i}</p>
)}

What did you expect to happen?

No error.

What actually happened?

Parsing error: JSX expressions must have one parent element

Link to Minimal Reproducible Example

https://ota-meshi.github.io/eslint-plugin-astro/playground/#eJyrVkrOT0lVslKqjo7Vy00s0MhUsLVT0IjJU1CwKbArySzJSbXRL7CD8qszayE8zVqlWgAiJhJ2

Additional comments

Using fragments like <>...</> instead of braces (...) fixes it of course. But is this changed intended? I thought Astro files were not supposed to require that?

@mb21
Copy link
Author

mb21 commented Jan 31, 2024

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants