feat(parse/html): parse svelte function bindings more precisely#10300
feat(parse/html): parse svelte function bindings more precisely#10300dyc3 wants to merge 1 commit into
Conversation
🦋 Changeset detectedLatest commit: 7300cbc The changes in this PR will be included in the next version bump. This PR includes changesets to release 13 packages
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 |
Parser conformance results onjs/262
jsx/babel
markdown/commonmark
symbols/microsoft
ts/babel
ts/microsoft
|
|
ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (9)
📒 Files selected for processing (17)
✅ Files skipped from review due to trivial changes (5)
🚧 Files skipped from review as they are similar to previous changes (9)
WalkthroughThis PR adds grammar and HTML-kind entries for Svelte bind-function initializers, implements dedicated parsing (with guarded lookahead and fallback), updates token lexing for comma-restricted expressions, adds formatter rules and generated wiring for the new nodes, changes embedded-JS extraction to emit separate candidates for bind get/set, tightens compact formatting gating, and adds tests covering valid and invalid comma uses. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.changeset/fix-svelte-bind-comma.md:
- Line 5: Update the changeset line that references the lint rule by linking
`noCommaOperator` to its docs using the required format; replace the plain rule
name in the sentence with
[`noCommaOperator`](https://biomejs.dev/linter/rules/no-comma-operator) so the
changeset reads as: "Svelte function bindings ... so
[`noCommaOperator`](https://biomejs.dev/linter/rules/no-comma-operator) won't
emit false positives..." and ensure the link appears exactly in that
markdown-style format.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 6d003fd6-bc33-424c-8235-ba635ae8d4f2
⛔ Files ignored due to path filters (9)
crates/biome_html_factory/src/generated/node_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_factory/src/generated/syntax_factory.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_parser/tests/html_specs/ok/svelte/directives/bind_function.svelte.snapis excluded by!**/*.snapand included by**crates/biome_html_syntax/src/generated/kind.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_syntax/src/generated/macros.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_syntax/src/generated/nodes.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_html_syntax/src/generated/nodes_mut.rsis excluded by!**/generated/**,!**/generated/**and included by**crates/biome_js_analyze/tests/specs/complexity/noCommaOperator/invalid-svelte-template.svelte.snapis excluded by!**/*.snapand included by**crates/biome_js_analyze/tests/specs/complexity/noCommaOperator/valid-svelte-bind-function.svelte.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (17)
.changeset/fix-svelte-bind-comma.mdcrates/biome_html_formatter/src/generated.rscrates/biome_html_formatter/src/svelte/any/directive_initializer_clause.rscrates/biome_html_formatter/src/svelte/any/mod.rscrates/biome_html_formatter/src/svelte/auxiliary/bind_function_binding_expression.rscrates/biome_html_formatter/src/svelte/auxiliary/bind_function_binding_initializer_clause.rscrates/biome_html_formatter/src/svelte/auxiliary/mod.rscrates/biome_html_formatter/src/svelte/value/directive_value.rscrates/biome_html_parser/src/syntax/svelte.rscrates/biome_html_parser/src/token_source.rscrates/biome_html_parser/tests/html_specs/ok/svelte/directives/bind_function.sveltecrates/biome_html_syntax/src/directive_ext.rscrates/biome_js_analyze/tests/specs/complexity/noCommaOperator/invalid-svelte-template.sveltecrates/biome_js_analyze/tests/specs/complexity/noCommaOperator/valid-svelte-bind-function.sveltecrates/biome_service/src/file_handlers/html/parse_embedded_nodes.rsxtask/codegen/html.ungramxtask/codegen/src/html_kinds_src.rs
Merging this PR will not alter performance
Comparing Footnotes
|
39fbc46 to
c664879
Compare
c664879 to
7300cbc
Compare
Summary
Function bindings in svelte are where you can use getter/setter functions in a bind directive. documented here: https://svelte.dev/docs/svelte/bind#Function-bindings
This makes it so we parse that syntax more precisely.
Implemented by gpt 5.5, but i had to do a bit of steering.
fixes #10265
Test Plan
snapshots
Docs