-
-
Notifications
You must be signed in to change notification settings - Fork 686
fix(formatter): skip the leading semicolon when calculating leading lines #14653
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
fix(formatter): skip the leading semicolon when calculating leading lines #14653
Conversation
CodSpeed Performance ReportMerging #14653 will not alter performanceComparing Summary
Footnotes
|
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.
Pull Request Overview
This PR fixes a formatting issue where the formatter incorrectly calculated leading lines when a semicolon preceded a statement, specifically affecting cases like ;(function() {})()
where the leading semicolon should be considered when determining line breaks.
- Added logic to skip leading semicolons when calculating leading lines in the formatter
- Added test fixtures to verify the fix handles semicolon-prefixed expressions correctly
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
crates/oxc_formatter/src/formatter/source_text.rs | Added logic to detect and skip leading semicolons when calculating leading lines |
crates/oxc_formatter/tests/fixtures/js/semicolons/empty-line.js | Test input file with semicolon-prefixed IIFE to verify the fix |
crates/oxc_formatter/tests/fixtures/js/semicolons/empty-line.js.snap | Expected test output showing correct formatting with and without semicolons |
crates/oxc_formatter/tests/fixtures/js/semicolons/options.json | Test configuration for both semicolon true and false options |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Merge activity
|
001b24e
to
e0eb966
Compare
No description provided.