Skip to content

fix(html-formatter): remove extra space before > when bracketSameLine…#9535

Merged
ematipico merged 4 commits intobiomejs:mainfrom
leno23:fix/html-bracket-same-line-spacing
Mar 18, 2026
Merged

fix(html-formatter): remove extra space before > when bracketSameLine…#9535
ematipico merged 4 commits intobiomejs:mainfrom
leno23:fix/html-bracket-same-line-spacing

Conversation

@leno23
Copy link
Contributor

@leno23 leno23 commented Mar 18, 2026

… is true and slash is absent

Summary

Closes #9524

Test Plan

Docs

@changeset-bot
Copy link

changeset-bot bot commented Mar 18, 2026

🦋 Changeset detected

Latest commit: 3677804

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-Formatter Area: formatter L-HTML Language: HTML and super languages labels Mar 18, 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.

Please comply to the contribution guidelines:

  • use our PR template
  • add a changeset
  • test your changes and add a new test if necessary

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 18, 2026

Walkthrough

Adjusts whitespace logic when formatting self-closing HTML elements with bracket_same_line = true: a hard space before the next token is now written only if a slash will be present. The will_have_slash condition is computed from self_close_void_elements and the presence of slash_token, with is_void derived from node.is_void_element().unwrap_or_default(). Other attribute, line-break and slash-handling logic is unchanged.

Possibly related PRs

Suggested reviewers

  • dyc3
  • ematipico
🚥 Pre-merge checks | ✅ 1 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description is vague and incomplete, lacking meaningful context about the changeset despite referencing issue #9524. Expand the description to explain the bug being fixed, why it occurs, and what the intended behaviour is. Include details about the test plan demonstrating the fix.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title directly addresses the core fix: removing extra space before > when bracketSameLine is true and slash is absent, matching the changeset and code modifications.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@codspeed-hq
Copy link

codspeed-hq bot commented Mar 18, 2026

Merging this PR will not alter performance

✅ 64 untouched benchmarks
⏩ 152 skipped benchmarks1


Comparing leno23:fix/html-bracket-same-line-spacing (3677804) with main (4df86ca)2

Open in CodSpeed

Footnotes

  1. 152 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.

  2. No successful run was found on main (7fe43c8) during the generation of this report, so 4df86ca was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@ematipico ematipico merged commit b630d93 into biomejs:main Mar 18, 2026
18 checks passed
@github-actions github-actions bot mentioned this pull request Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Formatter Area: formatter L-HTML Language: HTML and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📝 HTML Formatter adds unnecessary spaces before ">" characters on self-closing tags

2 participants