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

Svelte 5 - "illegal variable name" when using stores #746

Closed
2 tasks done
rChaoz opened this issue May 2, 2024 · 1 comment
Closed
2 tasks done

Svelte 5 - "illegal variable name" when using stores #746

rChaoz opened this issue May 2, 2024 · 1 comment

Comments

@rChaoz
Copy link

rChaoz commented May 2, 2024

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.57.0

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

2.38.0

What did you do?

<script>
    import { page } from "$app/stores"
    const something = $page
</script>

What did you expect to happen?

No errors.

What actually happened?

  6:34  error  `$page` is an illegal variable name. To reference a global variable called `$page`, use `globalThis.$page`(global_reference_invalid)  svelte/valid-compile

Link to GitHub Repo with Minimal Reproducible Example

Additional comments

This happens for all stores in .svelte files. I haven't checked but the same issue might happen in .svelte.[ts|js] files.

@rChaoz rChaoz changed the title Svelte 5 - $page is an illegal variable name Svelte 5 - "$page is an illegal variable name" when using stores May 2, 2024
@rChaoz rChaoz changed the title Svelte 5 - "$page is an illegal variable name" when using stores Svelte 5 - "illegal variable name" when using stores May 2, 2024
@ota-meshi
Copy link
Member

Duplicate of #652

@ota-meshi ota-meshi marked this as a duplicate of #652 May 2, 2024
@ota-meshi ota-meshi closed this as not planned Won't fix, can't repro, duplicate, stale May 2, 2024
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