-
-
Notifications
You must be signed in to change notification settings - Fork 525
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
feat(biome_js_formatter): introduce the new objectWrap option #5068
base: next
Are you sure you want to change the base?
Conversation
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
…ectWrap is collapse Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
… snippets as Prettier Signed-off-by: Naoki Ikeguchi <[email protected]>
CodSpeed Performance ReportMerging #5068 will not alter performanceComparing Summary
|
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.
Looking good, just a couple minor things.
"as-needed" => Ok(Self::Preserve), | ||
"always" => Ok(Self::Collapse), |
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.
This doesn't look right.
"as-needed" => Ok(Self::Preserve), | |
"always" => Ok(Self::Collapse), | |
"preserve" => Ok(Self::Preserve), | |
"collapse" => Ok(Self::Collapse), |
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.
My bad, thank you for catching this. Fixed in 5eb499b
@@ -103,6 +103,11 @@ pub struct JsFormatterConfiguration { | |||
#[bpaf(long("bracket-spacing"), argument("true|false"))] | |||
#[serde(skip_serializing_if = "Option::is_none")] | |||
pub bracket_spacing: Option<BracketSpacing>, | |||
|
|||
/// Whether to enforce collapsing object literals when possible. Defaults to preserve. | |||
#[bpaf(long("object-wrap"), argument("preserve|collapse"))] |
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.
This argument should be prefixed with javascript
, like the args are since this is javascript specific. eg --javascript-object-wrap
#[bpaf(long("object-wrap"), argument("preserve|collapse"))] | |
#[bpaf(long("javascript-object-wrap"), argument("preserve|collapse"))] |
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.
Fixed in f220b66.
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
Signed-off-by: Naoki Ikeguchi <[email protected]>
I don't see any new snapshots added. Can you please point me to those? |
Summary
Prettier 3.5 introduced a new Object Wrap option. This improves code consistency, so it will be great if Biome also support this option.
This pull request introduces the
objectWrap
option to enforce collapsing object literals when possible.Test Plan
Snapshot test cases added.