-
-
Notifications
You must be signed in to change notification settings - Fork 197
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-check hangs on <script> tag with specific attributes #2363
Comments
The hang is because of the regex for the script tag that is present in prettier-plugin-svelte, svelte and language-tools. It seems like the problem has to do with the multiple-line script tag. So until it's fixed, you can work around it by putting all the script tag attributes in one line. |
Nope, having it in one line causes the same issue:
|
The event won't work on top-level script tag so I think this is expected. The same error also exists in the svelte REPL. |
It fails on every level, not only on the top level. See https://gitlab.com/dexterlabs/dexlib/-/blob/f0679dc96428418e91c00ac879d15d762483ffed/packages/svelte-matomo/src/index.svelte for example. |
I can't reproduce the parser error with the linked component in both Svelte 4 and 5. Please provide a reproduction repository. |
Sure. The reproduction repository can be found here: https://github.com/shadow-identity/sveltejs-language-tools-issues-2363 |
Tho I was not able to reproduce the case with the error. It really appears if the <script> is on the top level, so not a bug (probably). Where is the regexp from your first comment is located? I can file a bug there. |
A similar regex is in the svelte, prettier-plugin-svelte and language tools. There's already a related issue for Svelte core sveltejs/svelte#9564. |
This regex can take longer than expected in certain situations, making it more explicit and adding "not a whitespace" to the set speeds it up Related sveltejs/language-tools#2363
This regex can take longer than expected in certain situations, making it more explicit and adding "not a whitespace" to the set speeds it up Related sveltejs/language-tools#2363
Describe the bug
svelte-check hangs on svelte file containing
<script>
tag with particular set of attributes.I noticed it because it was failing on this file.
Finally I was able to make a minimal reproduction.
Reproduction
svelte-check
on itLeading paces matters. Without spaces, it does not hang, but returns an error. But it doesn't change anything if the
<script>
is inside of another tag (still hangs).! It is not reproduced in the reproduction repository. Only hanging is reproduced.
It does not hangs nor returns error if any of attributes are missing. So all the attributes matters
Expected behaviour
It should never hang, because it is bad for CI/CD, pre-commit hooks, editors etc.
System Info
Which package is the issue about?
No response
Additional Information, eg. Screenshots
I believe it is related to similar
prettier-plugin-svelte
issueThe text was updated successfully, but these errors were encountered: