Skip to content

fix(linter): keep Svelte exported module-script bindings visible#9637

Closed
raashish1601 wants to merge 1 commit intobiomejs:mainfrom
raashish1601:contributor-13/biome-9541
Closed

fix(linter): keep Svelte exported module-script bindings visible#9637
raashish1601 wants to merge 1 commit intobiomejs:mainfrom
raashish1601:contributor-13/biome-9541

Conversation

@raashish1601
Copy link
Copy Markdown

@raashish1601 raashish1601 commented Mar 28, 2026

Summary

  • register exported declaration clauses when collecting embedded bindings for embedded JavaScript snippets
  • add a Svelte noUndeclaredVariables regression for exported <script module> functions
  • add an @biomejs/biome patch changeset for the user-visible fix

Test Plan

  • cargo test -p biome_service tracks_exported_declarations -- --nocapture
  • cargo test -p biome_cli no_undeclared_variables_not_triggered_for_exported_module_script_functions -- --nocapture
  • cargo fmt --all --check
  • git diff --check

Closes #9541

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 28, 2026

🦋 Changeset detected

Latest commit: a70871f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-CLI Area: CLI A-Project Area: project labels Mar 28, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 28, 2026

Walkthrough

This PR resolves a false-positive bug in the noUndeclaredVariables linter rule for Svelte files. The fix extends the embedded bindings collection logic to recognise exported declarations from <script module> blocks, ensuring that functions and constants exported at module scope are visible to instance scripts. Changes include updates to the binding collector in embedded_bindings.rs, a new CLI test case validating the fix, and supporting changeset documentation.

Possibly related PRs

Suggested labels

A-CLI, A-Linter, A-Project, L-JavaScript

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main fix: ensuring exported bindings from Svelte module-script blocks remain visible to the linter.
Linked Issues check ✅ Passed All coding objectives from #9541 are met: exported module-script declarations are now tracked in embedded bindings, regression tests confirm the fix works, and the changeset documents the user-visible change.
Out of Scope Changes check ✅ Passed All changes directly address the issue: binding collection refactor, CLI test case, unit test, and changeset—no extraneous modifications present.
Description check ✅ Passed The PR description clearly relates to the changeset, detailing the fix for Svelte exported module-script bindings, the test case added, and the changeset entry.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ematipico ematipico added the M-Likely Agent Meta: this was likely an automated PR without a human in the loop label Mar 28, 2026
@raashish1601

This comment was marked as spam.

@ematipico ematipico closed this Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-CLI Area: CLI A-Project Area: project M-Likely Agent Meta: this was likely an automated PR without a human in the loop

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 Linter does not recognise functions defined in module script blocks but only if exported (svelte)

2 participants