diff --git a/crates/rome_js_formatter/src/js/objects/property_object_member.rs b/crates/rome_js_formatter/src/js/objects/property_object_member.rs index 5bac7d9aec50..b71c455150c5 100644 --- a/crates/rome_js_formatter/src/js/objects/property_object_member.rs +++ b/crates/rome_js_formatter/src/js/objects/property_object_member.rs @@ -1,8 +1,16 @@ use crate::prelude::*; use crate::FormatNodeFields; +use rome_js_syntax::JsAnyExpression; +use rome_js_syntax::JsAnyLiteralExpression; +use rome_js_syntax::JsCallExpressionFields; +use rome_js_syntax::JsConditionalExpressionFields; use rome_js_syntax::JsPropertyObjectMember; use rome_js_syntax::JsPropertyObjectMemberFields; +use rome_js_syntax::JsSyntaxKind; +use rome_js_syntax::JsSyntaxNode; +use rome_rowan::SyntaxResult; +use rome_rowan::TextSize; impl FormatNodeFields for FormatNodeRule { fn format_fields( @@ -14,10 +22,175 @@ impl FormatNodeFields for FormatNodeRule { + let group_id = formatter.group_id("property_object_member"); + + let value = formatted![formatter, [value.format()]]?; + formatted![ + formatter, + [ + group_elements(formatted![formatter, [name.format()]]?), + colon_token.format(), + group_elements_with_options( + indent(soft_line_break_or_space()), + GroupElementsOptions { + group_id: Some(group_id) + } + ), + line_suffix_boundary(), + if_group_with_id_breaks(indent(value.clone()), group_id), + if_group_with_id_fits_on_line(value, group_id), + ] + ] + } + PropertyObjectMemberLayoutMode::BreakAfterOperator => formatted![ + formatter, + [ + group_elements(formatted![formatter, [name.format()]]?), + colon_token.format(), + space_token(), + group_elements(formatted![ + formatter, + [indent(soft_line_break_or_space()), value.format()] + ]?), + ] + ], + PropertyObjectMemberLayoutMode::NeverBreakAfterOperator => formatted![ + formatter, + [ + group_elements(formatted![formatter, [name.format()]]?), + colon_token.format(), + space_token(), + value.format() + ] + ], + }; + + Ok(group_elements(formatted?)) + } +} + +enum PropertyObjectMemberLayoutMode { + Fluid, + BreakAfterOperator, + NeverBreakAfterOperator, +} + +fn get_object_member_layout( + formatter: &Formatter, + node: &JsPropertyObjectMember, +) -> SyntaxResult { + let JsPropertyObjectMemberFields { + name, + colon_token: _, + value, + } = node.as_fields(); + + let name = name?; + let value = value?; + + let value = match value { + JsAnyExpression::TsAsExpression(expression) => expression.expression()?, + _ => value, + }; + + const MIN_OVERLAP_FOR_BREAK: u8 = 3; + + let text_width_for_break = (formatter.options().tab_width() + MIN_OVERLAP_FOR_BREAK) as u32; + let has_short_key = name.range().len() < TextSize::from(text_width_for_break); + + if is_break_after_operator(&value, has_short_key)? { + return Ok(PropertyObjectMemberLayoutMode::BreakAfterOperator); + } + + if is_never_break_after_operator(&value, has_short_key)? { + return Ok(PropertyObjectMemberLayoutMode::NeverBreakAfterOperator); + } + + Ok(PropertyObjectMemberLayoutMode::Fluid) +} + +fn is_break_after_operator(value: &JsAnyExpression, has_short_key: bool) -> SyntaxResult { + if is_binaryish_expression(value.syntax()) { + return Ok(true); + } + + if matches!(value, JsAnyExpression::JsSequenceExpression(_)) { + return Ok(true); } + + if let JsAnyExpression::JsConditionalExpression(conditional) = &value { + let JsConditionalExpressionFields { + test, + question_mark_token: _, + consequent: _, + colon_token: _, + alternate: _, + } = conditional.as_fields(); + + if is_binaryish_expression(test?.syntax()) { + return Ok(true); + } + } + + if has_short_key { + return Ok(false); + } + + if let JsAnyExpression::JsAnyLiteralExpression( + JsAnyLiteralExpression::JsStringLiteralExpression(_), + ) = &value + { + return Ok(true); + } + + Ok(false) +} + +fn is_never_break_after_operator( + value: &JsAnyExpression, + has_short_key: bool, +) -> SyntaxResult { + if let JsAnyExpression::JsCallExpression(call_expression) = &value { + let JsCallExpressionFields { + callee, + optional_chain_token: _, + type_arguments: _, + arguments: _, + } = call_expression.as_fields(); + + if callee?.syntax().kind() == JsSyntaxKind::REQUIRE_KW { + return Ok(true); + } + } + + if has_short_key { + return Ok(true); + } + + if matches!( + value, + JsAnyExpression::JsClassExpression(_) + | JsAnyExpression::JsTemplate(_) + | JsAnyExpression::JsAnyLiteralExpression( + JsAnyLiteralExpression::JsBooleanLiteralExpression(_), + ) + | JsAnyExpression::JsAnyLiteralExpression( + JsAnyLiteralExpression::JsNumberLiteralExpression(_) + ) + ) { + return Ok(true); + } + + Ok(false) +} + +fn is_binaryish_expression(node: &JsSyntaxNode) -> bool { + matches!( + node.kind(), + JsSyntaxKind::JS_BINARY_EXPRESSION | JsSyntaxKind::JS_LOGICAL_EXPRESSION + ) } diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap index 3a32ae44f618..25014d656938 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/sequence_expression.js.snap @@ -1,6 +1,5 @@ --- source: crates/rome_js_formatter/tests/spec_test.rs -assertion_line: 244 expression: sequence_expression.js --- # Input @@ -74,15 +73,16 @@ function a() { } const object = { - something: ( - ____________first, - ____________second, - ____________third, - ____________third, - ____________third, - ____________third, - ____________third - ), + something: + ( + ____________first, + ____________second, + ____________third, + ____________third, + ____________third, + ____________third, + ____________third + ), }; aLongIdentifierName, diff --git a/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap b/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap index 36f8ba3a5589..6b58cd3ea2d2 100644 --- a/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap +++ b/crates/rome_js_formatter/tests/specs/jsx/attributes.jsx.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/spec_test.rs -assertion_line: 242 expression: attributes.jsx - --- # Input @@ -67,7 +65,8 @@ Quote style: Double Quotes fontSize: 12, height: "40vh", overflowY: "scroll", - fontFamily: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", + fontFamily: + "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", }} />; @@ -89,7 +88,8 @@ Quote style: Double Quotes fontSize: 12, height: "50vh", overflowY: "scroll", - fontFamily: "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", + fontFamily: + "ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace", }} />; @@ -115,6 +115,6 @@ let a = { }; const obj = { - state: shouldHaveState && + state: + shouldHaveState && stateIsOK && { loadState: LOADED, opened: false, }, - loadNext: (stateIsOK && hasNext) || { + loadNext: + (stateIsOK && hasNext) || { skipNext: true, }, loaded: true, diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/functional-composition/ramda_compose.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/functional-composition/ramda_compose.js.snap index e07e0685e9f4..c6fba0ffa9c6 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/functional-composition/ramda_compose.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/functional-composition/ramda_compose.js.snap @@ -96,10 +96,8 @@ followersForUser( // Followers: ["STEVE","SUZY"] const mapStateToProps = (state) => ({ - users: R.compose( - R.filter(R.propEq("status", "active")), - R.values, - )(state.users), + users: + R.compose(R.filter(R.propEq("status", "active")), R.values)(state.users), }); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/break-parent.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/break-parent.js.snap index f6a75e948f50..6713fcb840b4 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/break-parent.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/break-parent.js.snap @@ -35,21 +35,23 @@ true # Output ```js ({ - processors: [ - require( - "autoprefixer", - { - browsers: ["> 1%", "last 2 versions", "ie >= 11", "Firefox ESR"], - }, - ), - require( - "postcss-url", - )({ - url: ( - url, - ) => url.startsWith("/") || /^[a-z]+:/.test(url) ? url : `/static/${url}`, - },), - ], + processors: + [ + require( + "autoprefixer", + { + browsers: ["> 1%", "last 2 versions", "ie >= 11", "Firefox ESR"], + }, + ), + require( + "postcss-url", + )({ + url: ( + url, + ) => + url.startsWith("/") || /^[a-z]+:/.test(url) ? url : `/static/${url}`, + },), + ], }); true ? test({ diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/edge_case.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/edge_case.js.snap index 8789aedf8576..47486a4d76d4 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/edge_case.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/last-argument-expansion/edge_case.js.snap @@ -78,11 +78,12 @@ a( exports.examples = [ { - render: withGraphQLQuery( - "node(1234567890){image{uri}}", - function (container, data) { - return ( -
+ render: + withGraphQLQuery( + "node(1234567890){image{uri}}", + function (container, data) { + return ( +
- ); - }, - ), + ); + }, + ), }, ]; @@ -136,6 +137,6 @@ someReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReal ``` 2: SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong, 5: SomethingVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryVeryLong: 1, - 31: someReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReally.a([ + 32: someReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReally.a([ ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/break-last-call.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/break-last-call.js.snap index b0399df1acf6..d6405529207d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/break-last-call.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/break-last-call.js.snap @@ -76,62 +76,66 @@ it( expect( groupMessages(messages).toJS(), ).toEqual({ - "11/01/2017 13:36": [ - { - message: "test", - messageType: "SMS", - status: "Unknown", - created: "11/01/2017 13:36", - }, - { - message: "test", - messageType: "Email", - status: "Unknown", - created: "11/01/2017 13:36", - }, - ], - "09/01/2017 17:25": [ - { - message: "te", - messageType: "SMS", - status: "Unknown", - created: "09/01/2017 17:25", - }, - { - message: "te", - messageType: "Email", - status: "Unknown", - created: "09/01/2017 17:25", - }, - ], - "11/01/2017 13:33": [ - { - message: "test", - messageType: "SMS", - status: "Unknown", - created: "11/01/2017 13:33", - }, - { - message: "test", - messageType: "Email", - status: "Unknown", - created: "11/01/2017 13:33", - }, - ], - "11/01/2017 13:37": [ - { - message: "test", - messageType: "SMS", - status: "Unknown", - created: "11/01/2017 13:37", - }, - { - message: "test", - messageType: "Email", - status: "Unknown", - created: "11/01/2017 13:37", - }, - ], + "11/01/2017 13:36": + [ + { + message: "test", + messageType: "SMS", + status: "Unknown", + created: "11/01/2017 13:36", + }, + { + message: "test", + messageType: "Email", + status: "Unknown", + created: "11/01/2017 13:36", + }, + ], + "09/01/2017 17:25": + [ + { + message: "te", + messageType: "SMS", + status: "Unknown", + created: "09/01/2017 17:25", + }, + { + message: "te", + messageType: "Email", + status: "Unknown", + created: "09/01/2017 17:25", + }, + ], + "11/01/2017 13:33": + [ + { + message: "test", + messageType: "SMS", + status: "Unknown", + created: "11/01/2017 13:33", + }, + { + message: "test", + messageType: "Email", + status: "Unknown", + created: "11/01/2017 13:33", + }, + ], + "11/01/2017 13:37": + [ + { + message: "test", + messageType: "SMS", + status: "Unknown", + created: "11/01/2017 13:37", + }, + { + message: "test", + messageType: "Email", + status: "Unknown", + created: "11/01/2017 13:37", + }, + ], },); }, ); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/first_long.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/first_long.js.snap index 114517cbb749..14892f3ee66d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/first_long.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/first_long.js.snap @@ -53,11 +53,12 @@ export default function theFunction(action$, store) { Observable.webSocket({ url: THE_URL, more: stuff(), - evenMore: stuff({ - value1: true, - value2: false, - value3: false, - },), + evenMore: + stuff({ + value1: true, + value2: false, + value3: false, + },), },) .filter((data) => theFilter(data)) .map(({ theType, ...data }) => theMap(theType, data)) diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/long-value.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/long-value.js.snap index ef976244f7ef..a6d083e37590 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/long-value.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/long-value.js.snap @@ -13,13 +13,14 @@ const x = { # Output ```js const x = { - "ABC": "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + "ABC": + "12345678901234567890123456789012345678901234567890123456789012345678901234567890", }; ``` # Lines exceeding max width of 80 characters ``` - 2: "ABC": "12345678901234567890123456789012345678901234567890123456789012345678901234567890", + 3: "12345678901234567890123456789012345678901234567890123456789012345678901234567890", ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/short-keys.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/short-keys.js.snap index 8a91a25ec8da..d4f13bf9b47d 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/short-keys.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/short-keys.js.snap @@ -31,19 +31,26 @@ var obj = { // an entry with a very long string x: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", url: "http://example.com/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - longName: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + longName: + "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", [i]: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - [prop]: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + [prop]: + "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", "x": "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", a: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", ab: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", abc: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", abcd: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - abcde: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - abcdef: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - "古": "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", - "古今": "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", - "古体诗": "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", + abcde: + "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + abcdef: + "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + "古": + "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", + "古今": + "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", + "古体诗": + "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", }; ``` @@ -52,18 +59,18 @@ var obj = { ``` 3: x: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", 4: url: "http://example.com/12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 5: longName: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 6: [i]: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 7: [prop]: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 8: "x": "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 9: a: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 10: ab: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 11: abc: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 12: abcd: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 13: abcde: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 14: abcdef: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", - 15: "古": "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", - 16: "古今": "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", - 17: "古体诗": "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", + 6: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 7: [i]: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 9: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 10: "x": "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 11: a: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 12: ab: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 13: abc: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 14: abcd: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 16: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 18: "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", + 20: "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", + 22: "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", + 24: "https://prettier.io/docs/en/rationale.html#what-prettier-is-concerned-about", ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/test.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/test.js.snap index 211ff06cf5a3..f5aea9804701 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/test.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/object-prop-break-in/test.js.snap @@ -44,7 +44,8 @@ const a = classnames({ },); const b = classnames({ - "some-prop": this.state.longLongLongLongLongLongLongLongLongTooLongProp === true, + "some-prop": + this.state.longLongLongLongLongLongLongLongLongTooLongProp === true, },); const c = classnames({ @@ -64,7 +65,8 @@ const f = classnames({ },); const g = classnames({ - "some-prop": longLongLongLongLongLongLongLongLongLongLongLongLongTooLongVar || 1337, + "some-prop": + longLongLongLongLongLongLongLongLongLongLongLongLongTooLongVar || 1337, },); const h = { @@ -75,9 +77,4 @@ ipsum`, ``` -# Lines exceeding max width of 80 characters -``` - 6: "some-prop": this.state.longLongLongLongLongLongLongLongLongTooLongProp === true, - 26: "some-prop": longLongLongLongLongLongLongLongLongLongLongLongLongTooLongVar || 1337, -``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap index 0304fdef6dff..1cb19d912bfd 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/objects/expression.js.snap @@ -1,6 +1,5 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 181 expression: expression.js --- # Input @@ -51,17 +50,17 @@ const a1 = { }; const a2 = { - someKey: ( - longLongLongLongLongLongLongLongLongLongLongLongLongLongName, shortName - ), + someKey: + (longLongLongLongLongLongLongLongLongLongLongLongLongLongName, shortName), }; const a3 = { - someKey: ( - longLongLongLongLongLongLongLongLongLongLongLongLongLongName, - longLongLongLongLongLongLongLongLongLongLongLongLongLongName, - longLongLongLongLongLongLongLongLongLongLongLongLongLongName - ), + someKey: + ( + longLongLongLongLongLongLongLongLongLongLongLongLongLongName, + longLongLongLongLongLongLongLongLongLongLongLongLongLongName, + longLongLongLongLongLongLongLongLongLongLongLongLongLongName + ), }; ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/objects/right-break.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/objects/right-break.js.snap index b96a12f54e6b..249d3009ada2 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/objects/right-break.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/objects/right-break.js.snap @@ -33,7 +33,8 @@ const blablah = "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf"; const k = { - blablah: "aldkfkladfskladklsfkladklfkaldfadfkdaf" + + blablah: + "aldkfkladfskladklsfkladklfkaldfadfkdaf" + "adlfasdklfkldsklfakldsfkladsfkadsfladsfa" + "dflkadfkladsfklkadlfkladlfkadklfjadlfdfdaf", }; @@ -42,13 +43,10 @@ somethingThatsAReallyLongPropName = this.props.cardType === AwesomizerCardEnum.SEEFIRST; const o = { - somethingThatsAReallyLongPropName: this.props.cardType === AwesomizerCardEnum.SEEFIRST, + somethingThatsAReallyLongPropName: + this.props.cardType === AwesomizerCardEnum.SEEFIRST, }; ``` -# Lines exceeding max width of 80 characters -``` - 16: somethingThatsAReallyLongPropName: this.props.cardType === AwesomizerCardEnum.SEEFIRST, -``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/template/graphql.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/template/graphql.js.snap index f63d31aa3fb9..f61e53172768 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/template/graphql.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/template/graphql.js.snap @@ -32,16 +32,17 @@ module.exports = // ... { fragments: { - nodes: ( - { solution_type, time_frame }, - ) => - Relay.QL` + nodes: + ( + { solution_type, time_frame }, + ) => + Relay.QL` fragment on RelatedNode @relay(plural: true) { __typename ${OptimalSolutionsSection.getFragment( - "node", - { solution_type, time_frame }, - )} + "node", + { solution_type, time_frame }, + )} } `, }, diff --git a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/long-identifiers.ts.snap b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/long-identifiers.ts.snap index fbaa9a8982e7..55893d10a6cf 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/typescript/as/long-identifiers.ts.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/typescript/as/long-identifiers.ts.snap @@ -31,7 +31,8 @@ averredBathersBoxroomBuggyNurl.anodyneCondosMalateOverateRetinol = averredBathersBoxroomBuggyNurl = { - anodyneCondosMalateOverateRetinol: annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave, + anodyneCondosMalateOverateRetinol: + annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave, }; averredBathersBoxroomBuggyNurl( @@ -43,7 +44,6 @@ averredBathersBoxroomBuggyNurl( # Lines exceeding max width of 80 characters ``` 1: const bifornCringerMoshedPerplexSawder = askTrovenaBeenaDependsRowans as glimseGlyphsHazardNoopsTieTie; - 8: anodyneCondosMalateOverateRetinol: annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave, - 12: anodyneCondosMalateOverateRetinol.annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave, + 13: anodyneCondosMalateOverateRetinol.annularCooeedSplicesWalksWayWay as kochabCooieGameOnOboleUnweave, ```