Skip to content

fix(service): parse text expressions in svelte control flow blocks#9103

Merged
dyc3 merged 1 commit intomainfrom
dyc3/parse-svelte-control-flow-expressions
Feb 16, 2026
Merged

fix(service): parse text expressions in svelte control flow blocks#9103
dyc3 merged 1 commit intomainfrom
dyc3/parse-svelte-control-flow-expressions

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Feb 16, 2026

Summary

Generated by kimi k2.5, but I overhauled the test it created by hand.

fixes #9098

Test Plan

added a new cli test

Docs

@changeset-bot
Copy link

changeset-bot bot commented Feb 16, 2026

🦋 Changeset detected

Latest commit: 566b592

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 Feb 16, 2026
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

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

Awesome!

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 16, 2026

No actionable comments were generated in the recent review. 🎉


Walkthrough

Adds a patch changeset documenting a fix for issue #9098. Adds a CLI test ensuring useImportType is not reported for enums used inside Svelte control‑flow blocks. Extends HTML file handler parsing to extract expressions from Svelte control‑flow blocks ({#if}, {#each}, {#await}, {#key}) and emit them as embedded JS snippets so linters see the correct context. Minor whitespace test adjustment included.

Possibly related PRs

Suggested labels

A-Parser, L-JavaScript

Suggested reviewers

  • ematipico
  • arendjr
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Merge Conflict Detection ⚠️ Warning ⚠️ Unable to check for merge conflicts: Failed to fetch base branch: From https://github.com/biomejs/biome
! [rejected] main -> main (non-fast-forward)
+ 5153f2f...0c0fb6f main -> origin/main (forced update)
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarises the main change: fixing the parsing of text expressions within Svelte control flow blocks, which directly addresses issue #9098.
Description check ✅ Passed The description clearly explains the fix's motivation (resolving issue #9098), discloses AI assistance, documents the testing approach, and references the linked issue.
Linked Issues check ✅ Passed The PR fully addresses issue #9098 by preventing useImportType from incorrectly flagging value-imports of enums used in Svelte control flow blocks as type-only imports, implementing parser support for {#if}, {#each}, {#await}, and {#key} blocks.
Out of Scope Changes check ✅ Passed All changes are scoped to fixing the reported issue: a changeset entry, parser enhancements for Svelte control flow blocks, and a focused CLI test validating the fix.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/parse-svelte-control-flow-expressions
⚔️ Resolve merge conflicts (beta)
  • Auto-commit resolved conflicts to branch dyc3/parse-svelte-control-flow-expressions
  • Create stacked PR with resolved conflicts
  • Post resolved changes as copyable diffs in a comment

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@crates/biome_service/src/file_handlers/html.rs`:
- Around line 767-829: The each-block handling only parses opening_block.list()
but misses the optional key expression; update the SvelteEachBlock branch so
after obtaining opening_block (and parsing the list) also call
opening_block.item(), cast that item to SvelteEachAsKeyedItem
(SvelteEachAsKeyedItem::cast_ref), then if let Ok(key_expr) =
keyed_item.key().expression() call parse_text_expression(key_expr, cache,
biome_path, settings, file_source) and push the returned (content, doc_source)
into nodes (same as for list). Use the same parse_text_expression call pattern
and nodes.push((content.into(), doc_source)) so identifiers in the (key) are
embedded.

@dyc3 dyc3 force-pushed the dyc3/parse-svelte-control-flow-expressions branch from 00c9713 to 04d6531 Compare February 16, 2026 17:47
@dyc3 dyc3 force-pushed the dyc3/parse-svelte-control-flow-expressions branch from 04d6531 to 566b592 Compare February 16, 2026 17:51
@dyc3 dyc3 merged commit fc9850c into main Feb 16, 2026
13 of 14 checks passed
@dyc3 dyc3 deleted the dyc3/parse-svelte-control-flow-expressions branch February 16, 2026 18:28
@github-actions github-actions bot mentioned this pull request Feb 16, 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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

💅 useImportType changed value-import of enum to type-import

2 participants