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

Parse Error on Astro File #59

Open
Sirius902 opened this issue Oct 5, 2023 · 2 comments
Open

Parse Error on Astro File #59

Sirius902 opened this issue Oct 5, 2023 · 2 comments

Comments

@Sirius902
Copy link

The below Astro file will fail to format with this error, however formatting it with prettier using prettier-plugin-astro directly parses the file successfully.

Message: ParseError: (0 , $029a36b82dce9f90$var$import__2.default) is not a function
    at $72712c1d1f727ace$var$error (dprint:prettier.js:150:17)
    at $8edc5f76a317f62c$var$Parser.error (dprint:prettier.js:415:56)
    at $8edc5f76a317f62c$var$Parser.acorn_error (dprint:prettier.js:409:14)
    at $029a36b82dce9f90$var$read_expression (dprint:prettier.js:6519:16)
    at $dd20ca6627ece4f3$var$mustache (dprint:prettier.js:9673:80)
    at new $8edc5f76a317f62c$var$Parser (dprint:prettier.js:382:57)
    at Object.$8edc5f76a317f62c$var$parse (dprint:prettier.js:491:20)
    at Object.$65e641842dbfc372$var$parse [as parse] (dprint:prettier.js:84132:71)
    at Object.h [as parse] (dprint:prettier.js:67890:36)
    at N (dprint:prettier.js:68555:51)
Had 1 error(s) formatting.
---

---

<html lang="en">
  <body>
    {[1, 2, 3].map((n) => <div>{n}</div>)}
  </body>
</html>

It is worth noting that the following file parses successfully unlike the above file.

---

---

<html lang="en">
  <body>
    {[1, 2, 3].map((n) => n)}
  </body>
</html>
@its-jman
Copy link

its-jman commented Oct 10, 2023

Has anyone found any workarounds to get Astro formatting with JSX(?) working?

@g-plane
Copy link

g-plane commented Feb 18, 2024

Try this plugin: https://github.com/g-plane/markup_fmt . It supports JSX in Astro.

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

3 participants