Skip to content

fix(migration): add Svelte rune globals to Oxlint config#2192

Open
naokihaba wants to merge 3 commits into
voidzero-dev:mainfrom
naokihaba:fix/svelte-rune-globals
Open

fix(migration): add Svelte rune globals to Oxlint config#2192
naokihaba wants to merge 3 commits into
voidzero-dev:mainfrom
naokihaba:fix/svelte-rune-globals

Conversation

@naokihaba

@naokihaba naokihaba commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

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

@netlify

netlify Bot commented Jul 17, 2026

Copy link
Copy Markdown

Deploy Preview for viteplus-preview canceled.

Name Link
🔨 Latest commit a1dc7a0
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-preview/deploys/6a597d7560b7d80008551592

@naokihaba

Copy link
Copy Markdown
Collaborator Author

@codex review

@naokihaba naokihaba self-assigned this Jul 17, 2026
@naokihaba
naokihaba marked this pull request as ready for review July 17, 2026 01:01

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@naokihaba
naokihaba requested a review from fengmk2 July 17, 2026 01:19
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

Successfully merging this pull request may close these issues.

vp create svelte generates config where vp check reports $props as no-undef

1 participant