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
Svelte parser fails with generic components #2875
Labels
good first issue
Experience Level - Good for newcomers
Comments
Similar to #2017, we need to improve the parser to balance out the angle brackets or quotes. The parsing code is here https://github.com/oxc-project/oxc/tree/main/crates/oxc_linter/src/partial_loader PRs are welcome. |
kalvenschraut
added a commit
to kalvenschraut/oxc
that referenced
this issue
Apr 7, 2024
Boshen
pushed a commit
that referenced
this issue
Apr 7, 2024
While looking into this, I knew vue would have similar problems. Which then led me to realize the generic case was handled already so I tried abstract out the function so both the vue and svelte partial loaders could reuse the code. Finally added some svelte test cases to prove this resolved the issue. I am a bit new to rust so if there was a better way to reuse the find_script_closing_angle function open to suggestions.
@Boshen this issue can be closed, not sure why it didn't auto close on my PR being merged |
eryue0220
added a commit
to eryue0220/oxc
that referenced
this issue
Apr 7, 2024
…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)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The Svelte parser fails when the component has TypeScript generics.
This is valid Svelte syntax:
The TS generic type syntax in
Record<string, unknown>
is considered as closing>
by the parser, disregarding that it's inside an attribute.The text was updated successfully, but these errors were encountered: