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
Incorrect parsing of Astro component script tags #2017
Comments
Commenting out code ---
const { props } = Astro
const attrs = {}
---
<script is:inline {...attrs} set:html={props.src ? '' : props.code} />
<!-- <script>
interface Attrs {
'data-attrs'?: string
}
</script> --> Produces
|
This is harder than I thought 😅 |
Maybe we can give a |
Since it has error recovery, we don't need to struggle with the wired edge case, the only drawback is it may increase binary size. |
Binary size + performance is not something I'd trade off for, I'll take a look at their compiler test suite. |
They don't have too many test suites, https://github.com/ikatyang/tree-sitter-vue/blob/master/corpus/spec.txt, the most attractive feature of |
we need to improve the parser to balance out the angle brackets. The parsing code is here https://github.com/oxc-project/oxc/tree/main/crates/oxc_linter/src/partial_loader PRs are welcome. |
…2017) (#2907) Added tests to figure out what the problem from the issue was and realize the self closing tag was not expected. Added code to handle this case. I am not that familiar with astro to know how common self closing script tags are, their docs seem to use an opening and closing one for inline scripts https://docs.astro.build/en/guides/client-side-scripts/#load-external-scripts
@Boshen this issue can be closed, not sure why it didn't auto close on my PR being merged |
…20/oxc into feat/jest-prefer-lowercase-title * 'feat/jest-prefer-lowercase-title' of github.com:eryue0220/oxc: feat(linter/import): Add `ignoreTypes` option for the `import/no-cycle` rule (oxc-project#2905) fix(linter): handle self closing script tags in astro partial loader (oxc-project#2017) (oxc-project#2907) fix(linter): svelte partial loader handle generics (oxc-project#2875) (oxc-project#2906) fix(tasks/rulegen): read quasi in TaggedTemplateExpression (oxc-project#2903)
Have astro component like this
running OXC 0.2 produces
My guess is that oxc does not recognize script as typescript
The text was updated successfully, but these errors were encountered: