feat(formatter): normalize line break for directive#17303
feat(formatter): normalize line break for directive#17303graphite-app[bot] merged 1 commit intomainfrom
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 adds line break normalization for directive strings in the formatter. The main changes normalize carriage return characters (\r) to newlines (\n) in directive strings while preserving the directive's quote style and escape sequences.
Key changes:
- Fixes typo in comment: "diretcives" → "directives"
- Removes
#[expect(unused)]attribute fromnormalize_newlinesfunction (now being used) - Updates
normalize_directiveto callnormalize_newlineson directive content and handle both borrowed and owned results
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/oxc_formatter/src/formatter/format_element/mod.rs | Removes unused warning attribute since normalize_newlines is now actively used |
| crates/oxc_formatter/src/utils/string.rs | Fixes typo and adds newline normalization logic to normalize_directive method |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #17303 will not alter performanceComparing Summary
Footnotes
|
4f1fcf9 to
bbb5a43
Compare
Merge activity
|
bbb5a43 to
b00da37
Compare

Fixes panic caused by
oxc/crates/oxc_formatter/src/formatter/builders.rs
Lines 336 to 348 in 88a38b2
in #17261