-
Notifications
You must be signed in to change notification settings - Fork 9
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
Illegal return statement outside of a function when used with Biome and Astro #52
Comments
There may be a bug in Biome or dprint-plugin-biome. It's a known issue and I even ignore this case in tests: https://github.com/g-plane/markup_fmt/blob/main/dprint_plugin/tests/integration.rs#L157-L161 . |
I think the issue is this:
Here is the exception they've carved out for Astro: When So for this to work, |
I submitted a PR in dprint-plugin-biome that would allow you to use those file extensions: dprint/dprint-plugin-biome#16 |
There's no way to know whether user is using Biome or not for choosing file extension. |
Could you maybe add an option to your dprint config? You wouldn't know for certain obviously, but it wouldn't be the plugin's fault if someone opted into something they weren't using. Alternatively, we could add something to your plugin documentation that calls out this core Astro functionality can't be supported when using the Biome plugin. |
Updating documentation sounds good, while adding an option just for "fixing some problems" isn't an ideal solution. Also, are there anything can do in dprint-plugin-biome? |
I don't think so. It receives the file path from your plugin and ultimately that determines which syntax is used in Biome. |
Here is what the Astro prettier plugin does: https://github.com/withastro/prettier-plugin-astro/?tab=readme-ov-file#astro-skip-frontmatter This seems reasonable to me as a general configuration option, since Biome can run on Astro files by itself. |
No, they are different cases. |
This error is encountered when formatting JavaScript in Astro frontmatter with Biome as the external formatter.
Biome itself can handle parsing frontmatter return statements provided that the language is "astro": https://github.com/biomejs/biome/pull/2273/files
Edit:
I see this is known:
markup_fmt/dprint_plugin/tests/integration.rs
Lines 158 to 159 in e989636
Is there a workaround or ignore statement that can be used?
Biome version: 1.8.4
markup_fmt version: 0.12.0
The text was updated successfully, but these errors were encountered: