Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@dyc3
Copy link
Contributor

@dyc3 dyc3 commented Nov 12, 2025

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

@changeset-bot
Copy link

changeset-bot bot commented Nov 12, 2025

🦋 Changeset detected

Latest commit: 826f4db

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-Parser Area: parser L-HTML Language: HTML and super languages labels Nov 12, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 12, 2025

Walkthrough

This change fixes Vue directive parsing where directives with no argument, modifiers, or initializer (e.g. v-else) caused subsequent attributes to be misparsed. The parser's Vue modifier-list end condition was changed from checking specific tokens to a generic “not dot” check, altering when modifier listing stops. Several HTML test fixtures were added to cover directives with/without args, modifiers, and values, including a v-else case that verifies attributes following the directive are parsed correctly.

Suggested reviewers

  • ematipico

Pre-merge checks and finishing touches

✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main fix: correcting the Vue modifier list parser to stop aggressively parsing tokens beyond what it should.
Description check ✅ Passed The description explains the motivation (modifier parser now only continues with .), references the fixed issue (#8080), and mentions added tests for Vue directives.
Linked Issues check ✅ Passed The PR addresses issue #8080 by fixing the modifier list parser to correctly handle attributes after v-else directives, enabling proper parsing of elements like

.

Out of Scope Changes check ✅ Passed All changes are scoped to fixing the Vue modifier list parser and adding related test cases for various directive scenarios.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/fix-vue-v-else

📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 91e8b18 and 826f4db.

📒 Files selected for processing (1)
  • .changeset/seven-signs-sip.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .changeset/seven-signs-sip.md
⏰ 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)
  • GitHub Check: Test (depot-ubuntu-24.04-arm-16)
  • GitHub Check: Test (depot-windows-2022-16)
  • GitHub Check: Check Dependencies
  • GitHub Check: Lint project (depot-ubuntu-24.04-arm-16)
  • GitHub Check: End-to-end tests
  • GitHub Check: Documentation
  • GitHub Check: Lint project (depot-windows-2022)
  • GitHub Check: Test Node.js API
  • GitHub Check: autofix
  • GitHub Check: lint
  • GitHub Check: triage

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

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5cd3d27 and 91e8b18.

⛔ Files ignored due to path filters (5)
  • crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-modifiers-no-value.vue.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/arg-no-modifiers-no-value.vue.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/directive-only.vue.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_parser/tests/html_specs/ok/vue/generic-directives/modifiers-no-arg-no-value.vue.snap is excluded by !**/*.snap and included by **
  • crates/biome_html_parser/tests/html_specs/ok/vue/v-else.vue.snap is excluded by !**/*.snap and 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-else followed 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 the v-else issue 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.

@dyc3 dyc3 merged commit c2983f9 into main Nov 12, 2025
13 checks passed
@dyc3 dyc3 deleted the dyc3/fix-vue-v-else branch November 12, 2025 16:57
@github-actions github-actions bot mentioned this pull request Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser L-HTML Language: HTML and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

🐛 Vue parser fails when there are attributes after v-else

3 participants