Skip to content

fix(parse/html): svelte directive member expression#9925

Merged
ematipico merged 1 commit intomainfrom
fix/svelte-directive-member
Apr 11, 2026
Merged

fix(parse/html): svelte directive member expression#9925
ematipico merged 1 commit intomainfrom
fix/svelte-directive-member

Conversation

@ematipico
Copy link
Copy Markdown
Member

Summary

Closes #9910

Implemented via AI

Test Plan

Added new tests: ok parse cases, err parse cases, formatter

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 11, 2026

🦋 Changeset detected

Latest commit: 6cff41d

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

@ematipico ematipico requested review from a team April 11, 2026 15:30
@github-actions github-actions bot added A-Parser Area: parser A-Formatter Area: formatter A-Tooling Area: internal tools L-HTML Language: HTML and super languages labels Apr 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Parser conformance results on

js/262

Test result main count This PR count Difference
Total 53178 53178 0
Passed 51958 51958 0
Failed 1178 1178 0
Panics 42 42 0
Coverage 97.71% 97.71% 0.00%

jsx/babel

Test result main count This PR count Difference
Total 38 38 0
Passed 37 37 0
Failed 1 1 0
Panics 0 0 0
Coverage 97.37% 97.37% 0.00%

markdown/commonmark

Test result main count This PR count Difference
Total 652 652 0
Passed 652 652 0
Failed 0 0 0
Panics 0 0 0
Coverage 100.00% 100.00% 0.00%

symbols/microsoft

Test result main count This PR count Difference
Total 5467 5467 0
Passed 1915 1915 0
Failed 3552 3552 0
Panics 0 0 0
Coverage 35.03% 35.03% 0.00%

ts/babel

Test result main count This PR count Difference
Total 640 640 0
Passed 569 569 0
Failed 71 71 0
Panics 0 0 0
Coverage 88.91% 88.91% 0.00%

ts/microsoft

Test result main count This PR count Difference
Total 18876 18876 0
Passed 13014 13014 0
Failed 5861 5861 0
Panics 1 1 0
Coverage 68.94% 68.94% 0.00%

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 11, 2026

Walkthrough

This PR extends Biome's Svelte support to parse and format directive properties with member expressions (dot notation). Updates include grammar extensions for SvelteMemberProperty and AnySvelteMemberObject, parser logic to handle chained member access in directive bindings, formatter rules for the new syntax nodes, and lexer adjustments for dot token handling. Comprehensive test fixtures cover valid cases and error scenarios.

Suggested labels

A-Parser, A-Formatter, L-HTML

Suggested reviewers

  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: fixing Svelte directive member expression parsing in the HTML parser.
Description check ✅ Passed The description references issue #9910 and indicates test coverage (ok/error parse cases and formatter tests) relevant to the changeset.
Linked Issues check ✅ Passed The PR adds parser support for Svelte directive member expressions (e.g. in:renderer.in|global) and formatter rules to prevent unwanted whitespace, directly addressing the whitespace issue reported in #9910.
Out of Scope Changes check ✅ Passed All changes are focused on Svelte directive member expression support: grammar extensions, parser logic, formatter integrations, and test cases—nothing extraneous is included.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/svelte-directive-member

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

Copy link
Copy Markdown
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.

🧹 Nitpick comments (1)
.changeset/tender-chicken-swim.md (1)

5-5: Consider mentioning formatter behaviour as well as parsing.

The current sentence is correct, but the user-facing fix also includes whitespace/formatting behaviour for dotted Svelte directive properties; calling that out will make release notes clearer.

✍️ Suggested wording tweak
-Fixed [`#9910`](https://github.com/biomejs/biome/issues/9910): added support for parsing member expressions in Svelte directive properties. Biome now correctly parses directives like `in:renderer.in|global`, `use:obj.action`, and deeply nested forms like `in:a.b.c|global`.
+Fixed [`#9910`](https://github.com/biomejs/biome/issues/9910): added support for parsing and formatting member expressions in Svelte directive properties. Biome now preserves directives like `in:renderer.in|global`, `use:obj.action`, and deeply nested forms like `in:a.b.c|global` without introducing extra whitespace.

As per coding guidelines, "Changeset descriptions should focus on user-facing changes only" and "Write changeset descriptions concisely and clearly (1-3 sentences)".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/tender-chicken-swim.md at line 5, Update the changeset text in
.changeset/tender-chicken-swim.md to also mention the formatter/whitespace
behavior for dotted Svelte directive properties in addition to parsing; edit the
sentence that currently reads about parsing support for examples like
`in:renderer.in|global`, `use:obj.action`, and `in:a.b.c|global` to add a short
clause that the formatter now preserves or normalizes whitespace/formatting for
these dotted directive properties so the release note reflects both parsing and
formatting user-visible changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.changeset/tender-chicken-swim.md:
- Line 5: Update the changeset text in .changeset/tender-chicken-swim.md to also
mention the formatter/whitespace behavior for dotted Svelte directive properties
in addition to parsing; edit the sentence that currently reads about parsing
support for examples like `in:renderer.in|global`, `use:obj.action`, and
`in:a.b.c|global` to add a short clause that the formatter now preserves or
normalizes whitespace/formatting for these dotted directive properties so the
release note reflects both parsing and formatting user-visible changes.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a2b599f2-fbc7-40a0-a633-33d7a995573c

📥 Commits

Reviewing files that changed from the base of the PR and between 46b9340 and 6cff41d.

⛔ Files ignored due to path filters (9)
  • crates/biome_html_factory/src/generated/node_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_html_factory/src/generated/syntax_factory.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_html_formatter/tests/specs/html/svelte/directive_member_expression.svelte.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_parser/tests/html_specs/error/svelte/directives/directive_member_expression_invalid.svelte.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_parser/tests/html_specs/ok/svelte/directives/directive_member_expression.svelte.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_syntax/src/generated/kind.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_html_syntax/src/generated/macros.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_html_syntax/src/generated/nodes.rs is excluded by !**/generated/**, !**/generated/** and included by **
  • crates/biome_html_syntax/src/generated/nodes_mut.rs is excluded by !**/generated/**, !**/generated/** and included by **
📒 Files selected for processing (15)
  • .changeset/tender-chicken-swim.md
  • crates/biome_html_formatter/src/generated.rs
  • crates/biome_html_formatter/src/svelte/any/binding_property.rs
  • crates/biome_html_formatter/src/svelte/any/member_object.rs
  • crates/biome_html_formatter/src/svelte/any/mod.rs
  • crates/biome_html_formatter/src/svelte/auxiliary/member_property.rs
  • crates/biome_html_formatter/src/svelte/auxiliary/mod.rs
  • crates/biome_html_formatter/src/svelte/value/directive_value.rs
  • crates/biome_html_formatter/tests/specs/html/svelte/directive_member_expression.svelte
  • crates/biome_html_parser/src/lexer/mod.rs
  • crates/biome_html_parser/src/syntax/svelte.rs
  • crates/biome_html_parser/tests/html_specs/error/svelte/directives/directive_member_expression_invalid.svelte
  • crates/biome_html_parser/tests/html_specs/ok/svelte/directives/directive_member_expression.svelte
  • xtask/codegen/html.ungram
  • xtask/codegen/src/html_kinds_src.rs

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 11, 2026

Merging this PR will not alter performance

✅ 67 untouched benchmarks
⏩ 189 skipped benchmarks1


Comparing fix/svelte-directive-member (6cff41d) with main (4d9ac51)

Open in CodSpeed

Footnotes

  1. 189 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@ematipico ematipico merged commit 29accb3 into main Apr 11, 2026
19 checks passed
@ematipico ematipico deleted the fix/svelte-directive-member branch April 11, 2026 16:16
@github-actions github-actions bot mentioned this pull request Apr 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter A-Parser Area: parser A-Tooling Area: internal tools L-HTML Language: HTML and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📝 Extra whitespaces in Svelte attributes with accessors

2 participants