fix(formatter): JSXFragment missed a leading semicolon when semicolon is disabled#17386
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
There was a problem hiding this comment.
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 inexpression_statement_needs_semicolonfunction - 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 Performance ReportMerging #17386 will not alter performanceComparing Summary
Footnotes
|
f7d6de0 to
a93d02b
Compare
Merge activity
|
… is disabled (#17386) Add a leading `;` for the `JSXFragment` to solve a syntax error caused by the semicolon being disabled.
a93d02b to
42ad9d6
Compare

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