Open kb1995 opened 1 year ago
We are also experiencing this error. Astro supports early returns inside their script part
---
const { slug } = Astro.params
if (!slug) {
return new Response(null, { status: 404 })
}
---
In regular javascript top level return is not supported. I have zero idea how any of the prettier plugins are integrated, but maybe source from astro code could be wrapped in fake function before giving it to the babel used in this plugin? Or some sort integration with astro plugin?
I have this too, how to solve it?
<script is:inline define:vars={{ defaultTheme: UI.theme }}>
if (window.basic_script) {
return;
}
I also ran into this error trying to save some files. Strangely, changing my Format On Save Mode setting of VS Code to file
ended up solving the issue for me, amongst a few others related to the Trivago plugin. I don't think the modifications
value (which is what I had) works well with this plugin.
Does using this with .astro
files work fine for you? Mine don't seem to sort, while my .ts
files do, and the rest of my .astro
documents are in fact being formatted.
Your Environment
Describe the bug
I want to use this plugin with my Astro project. My prettier config looks like this:
The plugin works great for most files, but I encountered the following error when I'm using Astro's SSR's redirect function:
Expected behavior
The file to be compiled successfully even when using SSR's return function
Error log
Contribute to @trivago/prettier-plugin-sort-imports