-
Notifications
You must be signed in to change notification settings - Fork 36
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: Error: unhandled node type: 'expression'
#193
Comments
Another case of this (not entirely sure if it's the exact same bug though): {["/", "/a"].map((href) => <a {href}>hi</a>)} This is valid Astro, but doesn't format. Replacing |
This doesn't seem too similar to the other cases, so reporting it as well: {a.split("\n").map(x => <p>{x}</p>)} Works when you remove the |
Hi @mvolfik. |
@natemoo-re I have debugged this. There seems to be a problem with the https://github.com/withastro/compiler/blob/d5dd438d3f0aa5f005e9b4d7127230711ab126a1/packages/compiler/node/utils.ts#L96 |
Another case where I get this error is ---
---
<p>below is a js-style comment</p>
{/** this is a comment that throws the "unhandled node type: 'expression'" error */} maybe there's a new version I should try? |
It is not fixed in PR. The cause seems to be different. I think we need to open a new issue. |
I can confirm the original issue is fixed in the latest next version, however it still happens in that example. I think it's fine to keep it in the same issue for now, if it shows up in more cases we'll make a new issue 👍 |
Original issue appears to remain. I can trigger it with something as simple as: {(record.length) ? <Record {record} /> : null} or {(record.length) && <Record {record} /> } (using |
The cause is a shorthand attribute. I have already reported it. #224 |
Thanks -- apologies for the noise. |
Closing in favor of issues about the specific problems causing this error. This error happens whenever the babel parser is not able to parse an expression, as such it'll happens for multiple reasons that requires different fixes in most cases |
Describe the Bug
A reduced example of code that triggers the bug is:
which result in this error message:
Steps to Reproduce
Format the above code snippet w/ prettier plugin version
0.1.0-next.4
The text was updated successfully, but these errors were encountered: