Skip to content

fix(formatter): JSXFragment missed a leading semicolon when semicolon is disabled#17386

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-27-fix_formatter_jsxfragment_is_missing_a_leading_semicolon_when_semicolon_is_disabled
Dec 29, 2025
Merged

fix(formatter): JSXFragment missed a leading semicolon when semicolon is disabled#17386
graphite-app[bot] merged 1 commit intomainfrom
12-27-fix_formatter_jsxfragment_is_missing_a_leading_semicolon_when_semicolon_is_disabled

Conversation

@Dunqing
Copy link
Member

@Dunqing Dunqing commented Dec 27, 2025

Add a leading ; for the JSXFragment to solve a syntax error caused by the semicolon being disabled.

Copilot AI review requested due to automatic review settings December 27, 2025 08:35
@github-actions github-actions bot added A-formatter Area - Formatter C-bug Category - Bug labels Dec 27, 2025
Copy link
Member Author

Dunqing commented Dec 27, 2025


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where JSX fragments were missing a leading semicolon when the formatter's semicolon option is set to "AsNeeded". The fix ensures JSX fragments are handled consistently with JSX elements when determining if an expression statement needs a leading semicolon to prevent ASI (Automatic Semicolon Insertion) issues.

  • Added Expression::JSXFragment(_) to the pattern match in expression_statement_needs_semicolon function
  • Fixed 6 TypeScript test cases that were previously failing to parse
  • Improved test coverage from 99.40% to 99.46%

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
crates/oxc_formatter/src/write/mod.rs Added JSXFragment to the list of expressions that need a leading semicolon when semicolons are disabled, placing it alongside JSXElement for consistency
tasks/coverage/snapshots/formatter_typescript.snap Updated snapshot showing 6 previously failing JSX/TSX fragment-related tests now pass, improving overall test coverage

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 27, 2025

CodSpeed Performance Report

Merging #17386 will not alter performance

Comparing 12-27-fix_formatter_jsxfragment_is_missing_a_leading_semicolon_when_semicolon_is_disabled (a93d02b) with main (5fa85be)1

Summary

✅ 38 untouched
⏩ 7 skipped2

Footnotes

  1. No successful run was found on main (e9d346f) during the generation of this report, so 5fa85be was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 7 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.

@Dunqing Dunqing force-pushed the 12-27-fix_formatter_jsxfragment_is_missing_a_leading_semicolon_when_semicolon_is_disabled branch from f7d6de0 to a93d02b Compare December 29, 2025 07:39
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Dec 29, 2025
@graphite-app
Copy link
Contributor

graphite-app bot commented Dec 29, 2025

Merge activity

… is disabled (#17386)

Add a leading `;` for the `JSXFragment` to solve a syntax error caused by the semicolon being disabled.
@graphite-app graphite-app bot force-pushed the 12-27-fix_formatter_jsxfragment_is_missing_a_leading_semicolon_when_semicolon_is_disabled branch from a93d02b to 42ad9d6 Compare December 29, 2025 08:46
@graphite-app graphite-app bot merged commit 42ad9d6 into main Dec 29, 2025
20 checks passed
@graphite-app graphite-app bot deleted the 12-27-fix_formatter_jsxfragment_is_missing_a_leading_semicolon_when_semicolon_is_disabled branch December 29, 2025 08:52
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-formatter Area - Formatter C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants