Skip to content

Commit abb28dc

Browse files
committed
perf(oxfmt): turn of pretty print from sort-package-json (#17452)
Prettier will format it nicely anyway.
1 parent 421d8e2 commit abb28dc

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

apps/oxfmt/src/core/format.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -228,12 +228,17 @@ impl SourceFormatter {
228228
sort_package_json: bool,
229229
) -> Result<String, OxcDiagnostic> {
230230
let source_text: Cow<'_, str> = if sort_package_json {
231-
Cow::Owned(sort_package_json::sort_package_json(source_text).map_err(|err| {
232-
OxcDiagnostic::error(format!(
233-
"Failed to sort package.json: {}\n{err}",
234-
path.display()
235-
))
236-
})?)
231+
let options = sort_package_json::SortOptions { pretty: false };
232+
Cow::Owned(
233+
sort_package_json::sort_package_json_with_options(source_text, &options).map_err(
234+
|err| {
235+
OxcDiagnostic::error(format!(
236+
"Failed to sort package.json: {}\n{err}",
237+
path.display()
238+
))
239+
},
240+
)?,
241+
)
237242
} else {
238243
Cow::Borrowed(source_text)
239244
};

0 commit comments

Comments
 (0)