fix(migration): add Svelte rune globals to Oxlint config#2192
fix(migration): add Svelte rune globals to Oxlint config#2192naokihaba wants to merge 3 commits into
Conversation
✅ Deploy Preview for viteplus-preview canceled.
|
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a1dc7a048c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| continue; | ||
| } | ||
| override.globals = { | ||
| ...SVELTE_RUNE_GLOBALS, |
There was a problem hiding this comment.
Disable no-undef for Svelte overrides
For Svelte components that use valid store auto-subscriptions such as $count (where count is a Svelte store), enumerating only the built-in rune names still leaves the migrated top-level no-undef rule active and Oxlint will continue reporting those $... references as undefined. This means migrated/generated Svelte projects with stores can still fail vp check; the Svelte override needs to turn off no-undef (or otherwise account for dynamic store subscriptions) rather than only adding a fixed globals list.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Disabling no-undef weakens our checks for undefined variables, so I think the best quick fix is to register Runes as globals.
I wanted to avoid turning off no-undef for all .svelte files, so I chose to register each Rune individually. Disabling it globally runs the risk of missing real errors. We already agreed on this approach in #1967.
So, this PR focuses on properly supporting Runes like $props(). Supporting custom user store variables is out of scope for now.
Resolves #1967
I accidentally closed the previous PR due to a force-push, so I have opened a new one from a dedicated branch. #2174