-
-
Notifications
You must be signed in to change notification settings - Fork 760
fix(parse/html/vue): fix modifier list parser aggressively parsing tokens it shouldn't #8084
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…kens it shouldn't
🦋 Changeset detectedLatest commit: 826f4db 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 |
WalkthroughThis change fixes Vue directive parsing where directives with no argument, modifiers, or initializer (e.g. Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (11)
Comment |
There was a problem hiding this 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
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (5)
crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-modifiers-no-value.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-no-modifiers-no-value.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/directive-only.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/modifiers-no-arg-no-value.vue.snapis excluded by!**/*.snapand included by**crates/biome_html_parser/tests/html_specs/ok/vue/v-else.vue.snapis excluded by!**/*.snapand included by**
📒 Files selected for processing (7)
.changeset/seven-signs-sip.md(1 hunks)crates/biome_html_parser/src/syntax/vue.rs(1 hunks)crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-modifiers-no-value.vue(1 hunks)crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-no-modifiers-no-value.vue(1 hunks)crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/directive-only.vue(1 hunks)crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/modifiers-no-arg-no-value.vue(1 hunks)crates/biome_html_parser/tests/html_specs/ok/vue/v-else.vue(1 hunks)
🧰 Additional context used
🧠 Learnings (5)
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : Do not attempt to fix code; if a mandatory token/node is missing, return `None` instead
Applied to files:
crates/biome_html_parser/src/syntax/vue.rs
📚 Learning: 2025-10-15T09:22:15.851Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:15.851Z
Learning: Applies to crates/biome_formatter/src/**/*.rs : After generation, remove usages of `format_verbatim_node` and implement real formatting with biome_formatter utilities
Applied to files:
crates/biome_html_parser/src/syntax/vue.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: Applies to crates/biome_parser/xtask/codegen/*.ungram : List node types must end with the postfix List (e.g., HtmlAttributeList)
Applied to files:
crates/biome_html_parser/src/syntax/vue.rs
📚 Learning: 2025-10-15T09:22:46.002Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_js_formatter/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:22:46.002Z
Learning: Applies to crates/biome_js_formatter/**/*.rs : When a token is mandatory and present in the AST, use the AST-provided token (e.g., `node.l_paren_token().format()`) instead of emitting a static token
Applied to files:
crates/biome_html_parser/src/syntax/vue.rs
📚 Learning: 2025-10-15T09:24:31.042Z
Learnt from: CR
Repo: biomejs/biome PR: 0
File: crates/biome_parser/CONTRIBUTING.md:0-0
Timestamp: 2025-10-15T09:24:31.042Z
Learning: When parsing lists, implement error recovery (e.g., via ParseSeparatedList/ParseNodeList) to avoid infinite loops
Applied to files:
crates/biome_html_parser/src/syntax/vue.rs
🪛 LanguageTool
.changeset/seven-signs-sip.md
[uncategorized] ~5-~5: The abbreviation “e.g.” (= for example) requires two periods.
Context: ...no argument, modifiers, or initializer (eg. v-else). It will no longer treat subs...
(E_G)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
- GitHub Check: Test Node.js API
- GitHub Check: Test (depot-windows-2022-16)
- GitHub Check: Test (depot-ubuntu-24.04-arm-16)
- GitHub Check: Lint project (depot-windows-2022)
- GitHub Check: Documentation
- GitHub Check: End-to-end tests
- GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
- GitHub Check: Check Dependencies
- GitHub Check: autofix
🔇 Additional comments (6)
crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/directive-only.vue (1)
1-3: Excellent test coverage for directive-only scenarios.These cases validate that directives without arguments or modifiers don't interfere with attribute parsing, regardless of ordering.
crates/biome_html_parser/tests/html_specs/ok/vue/v-else.vue (1)
1-4: Perfect reproducer for issue #8080.This test case ensures the parser correctly handles
v-elsefollowed by attributes, preventing regression of the reported bug.crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-no-modifiers-no-value.vue (1)
1-3: Good coverage for directives with arguments but no modifiers.These cases validate that the parser correctly terminates modifier list parsing when no modifiers are present, regardless of attribute positioning.
crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/modifiers-no-arg-no-value.vue (1)
1-3: Solid coverage for modifiers without arguments.These cases ensure the new dot-based continuation logic correctly identifies and parses modifiers whilst not consuming subsequent attributes.
crates/biome_html_parser/src/syntax/vue.rs (1)
124-126: Excellent fix: simplifies and corrects modifier list parsing.The new logic is more precise: modifier lists should only continue when a dot is present (since modifiers are always of the form
.modifier). This prevents the parser from aggressively consuming subsequent attributes when no modifiers exist, fixing thev-elseissue whilst maintaining correct behaviour for directives with modifiers.crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-modifiers-no-value.vue (1)
1-3: Thorough coverage for the full directive structure.These cases validate the most complex scenario (argument + modifier) without a value, ensuring the dot-based continuation logic works correctly when modifiers are actually present.
Co-authored-by: Emanuele Stoppa <[email protected]>
Summary
The modifier list parser will now only continue when
.is encountered, indicating a modifier is present.fixes #8080
Test Plan
Added more comprehensive tests for different variations of vue directives.
Docs