Skip to content
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

Parsing error with <script> in a string literal #402

Closed
2 tasks done
aradalvand opened this issue Sep 3, 2023 · 4 comments
Closed
2 tasks done

Parsing error with <script> in a string literal #402

aradalvand opened this issue Sep 3, 2023 · 4 comments

Comments

@aradalvand
Copy link

aradalvand commented Sep 3, 2023

Before You File a Bug Report Please Confirm You Have Done The Following...

  • I have tried restarting my IDE and the issue persists.
  • I have updated to the latest version of the packages.

What version of ESLint are you using?

8.48.0

What version of eslint-plugin-svelte are you using?

2.33.0

What did you do?

I'm using Partytown with SvelteKit based on the official guide, here's the code I have in my +layout.svelte:

<script>
  import { partytownSnippet } from '@builder.io/partytown/integration'
</script>

<svelte:head>
  {@html `<script>${partytownSnippet()}</script>`}
</svelte:head>

eslint-plugin-svelte seems to get confused at the <script> part inside the string literal; I get the following error:

Parsing error: Unexpected keyword or identifier. eslint

What did you expect to happen?

The <script> inside the string should be recognized as a string.

What actually happened?

It seems to be confused by the <script> part, it may worth noting that if you changed <script> to any other tag like <style> here the error would go away, so the issue must be specific to <script>.

Link to GitHub Repo with Minimal Reproducible Example

Repro: https://github.com/aradalvand/eslint-plugin-svelte-bug

Go to src/routes/+layout.svelte — you'll see the error:

image

Additional comments

No response

@aradalvand aradalvand changed the title Parsing error when a tag exists ina string Parsing error with <script> in a string literal Sep 3, 2023
@baseballyama
Copy link
Member

Duplicate of sveltejs/eslint-plugin-svelte#562

@baseballyama baseballyama closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
@aradalvand
Copy link
Author

aradalvand commented Sep 4, 2023

@baseballyama I don't think so, this is working properly Svelte-wise. I'm not getting any errors from the Svelte compiler.

@aradalvand
Copy link
Author

aradalvand commented Sep 4, 2023

@baseballyama Check this out: https://svelte.dev/repl/f14935265f4f4953b1f9d6991f747987?version=4.2.0
You can see Svelte doesn't yield any parsing errors here, unlike in the REPL you linked to in sveltejs/eslint-plugin-svelte#562.

@baseballyama baseballyama reopened this Sep 4, 2023
@baseballyama baseballyama transferred this issue from sveltejs/eslint-plugin-svelte Sep 4, 2023
@baseballyama
Copy link
Member

Duplicate of #346

@baseballyama baseballyama marked this as a duplicate of #346 Sep 4, 2023
@baseballyama baseballyama closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants