diff --git a/crates/rome_js_formatter/src/js/expressions/object_expression.rs b/crates/rome_js_formatter/src/js/expressions/object_expression.rs index fee1f998c98..b603fd8176b 100644 --- a/crates/rome_js_formatter/src/js/expressions/object_expression.rs +++ b/crates/rome_js_formatter/src/js/expressions/object_expression.rs @@ -1,5 +1,5 @@ use crate::prelude::*; - +use crate::utils::has_leading_newline; use crate::FormatNodeFields; use rome_js_syntax::JsObjectExpression; use rome_js_syntax::JsObjectExpressionFields; @@ -15,6 +15,7 @@ impl FormatNodeFields for FormatNodeRule r_curly_token, } = node.as_fields(); + let has_newline = has_leading_newline(members.syntax()); let members_content = formatted![formatter, [members.format()]]?; if members.is_empty() { @@ -22,6 +23,11 @@ impl FormatNodeFields for FormatNodeRule .delimited(&l_curly_token?, members_content, &r_curly_token?) .soft_block_indent() .finish() + } else if has_newline { + formatter + .delimited(&l_curly_token?, members_content, &r_curly_token?) + .block_indent() + .finish() } else { formatter .delimited(&l_curly_token?, members_content, &r_curly_token?) diff --git a/crates/rome_js_formatter/src/js/module/export_named_from_clause.rs b/crates/rome_js_formatter/src/js/module/export_named_from_clause.rs index 64ba9c67598..22367c7f8bc 100644 --- a/crates/rome_js_formatter/src/js/module/export_named_from_clause.rs +++ b/crates/rome_js_formatter/src/js/module/export_named_from_clause.rs @@ -1,10 +1,11 @@ use crate::prelude::*; - use crate::utils::format_with_semicolon; +use crate::utils::has_leading_newline; use crate::FormatNodeFields; use rome_js_syntax::JsExportNamedFromClause; use rome_js_syntax::JsExportNamedFromClauseFields; +use rome_rowan::AstNode; impl FormatNodeFields for FormatNodeRule { fn format_fields( @@ -22,14 +23,25 @@ impl FormatNodeFields for FormatNodeRule for FormatNodeRule { fn format_fields( @@ -16,11 +18,16 @@ impl FormatNodeFields for FormatNodeRule { r_curly_token, } = node.as_fields(); + let has_newline = has_leading_newline(members.syntax()); let list = formatter .delimited( &l_curly_token?, join_elements( - soft_line_break_or_space(), + if has_newline { + hard_line_break() + } else { + soft_line_break_or_space() + }, formatter.format_separated(&members, || token(","))?, ), &r_curly_token?, diff --git a/crates/rome_js_formatter/src/ts/types/object_type.rs b/crates/rome_js_formatter/src/ts/types/object_type.rs index 0b0c62f504d..88e0c34c7b1 100644 --- a/crates/rome_js_formatter/src/ts/types/object_type.rs +++ b/crates/rome_js_formatter/src/ts/types/object_type.rs @@ -1,4 +1,5 @@ use crate::prelude::*; +use crate::utils::has_leading_newline; use crate::FormatNodeFields; use rome_js_syntax::{TsObjectType, TsObjectTypeFields}; @@ -13,13 +14,24 @@ impl FormatNodeFields for FormatNodeRule { r_curly_token, } = node.as_fields(); - formatter - .delimited( - &l_curly_token?, - formatted![formatter, [members.format()]]?, - &r_curly_token?, - ) - .soft_block_spaces() - .finish() + if has_leading_newline(members.syntax()) { + formatter + .delimited( + &l_curly_token?, + formatted![formatter, [members.format()]]?, + &r_curly_token?, + ) + .block_indent() + .finish() + } else { + formatter + .delimited( + &l_curly_token?, + formatted![formatter, [members.format()]]?, + &r_curly_token?, + ) + .soft_block_spaces() + .finish() + } } } diff --git a/crates/rome_js_formatter/src/utils/mod.rs b/crates/rome_js_formatter/src/utils/mod.rs index cec7ea82908..23b7dac4da8 100644 --- a/crates/rome_js_formatter/src/utils/mod.rs +++ b/crates/rome_js_formatter/src/utils/mod.rs @@ -105,6 +105,18 @@ pub(crate) fn has_formatter_trivia(node: &JsSyntaxNode) -> bool { false } +/// Returns true if this node contains newlines in trivias. +pub(crate) fn has_leading_newline(node: &JsSyntaxNode) -> bool { + if let Some(leading_trivia) = node.first_leading_trivia() { + for piece in leading_trivia.pieces() { + if piece.is_newline() { + return true; + } + } + } + false +} + /// Format an element with a single line head and a body that might /// be either a block or a single statement /// diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap index b1648a2e2bc..f029b3e708e 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/computed.js.snap @@ -19,5 +19,10 @@ Quote style: Double Quotes ----- nock(/test/) .matchHeader("Accept", "application/json")[httpMethodNock(method)]("/foo") - .reply(200, { foo: "bar" }); + .reply( + 200, + { + foo: "bar", + }, + ); diff --git a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap index 24de06a8681..613f9b8e67b 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/expression/member-chain/inline-merge.js.snap @@ -28,7 +28,11 @@ _.flatMap(this.visibilityHandlers, (fn) => fn()) .concat(this.record.resolved_legacy_visrules) .filter(Boolean); -Object.keys(availableLocales({ test: true })).forEach( +Object.keys( + availableLocales({ + test: true, + }), +).forEach( (locale) => { // ... }, diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js b/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js index c9175a6dcf4..1d6c7bb23b2 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js +++ b/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js @@ -1,5 +1,8 @@ import { hey } from "hey" import { hey } from "hey"; +import { + apple, +banana } from "fruits"; import {test} from "foo.json" assert { for: "for" } import { // some funky comment loooooooooooooooooooong as moreeeeeeloooooooooooooooooooong, diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap index 3e03817b7f1..7cb1e0b7a72 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/import_specifiers.js.snap @@ -5,6 +5,9 @@ expression: import_specifiers.js # Input import { hey } from "hey" import { hey } from "hey"; +import { + apple, +banana } from "fruits"; import {test} from "foo.json" assert { for: "for" } import { // some funky comment loooooooooooooooooooong as moreeeeeeloooooooooooooooooooong, @@ -30,6 +33,7 @@ Quote style: Double Quotes ----- import { hey } from "hey"; import { hey } from "hey"; +import { apple, banana } from "fruits"; import { test } from "foo.json" assert { for: "for" }; import { // some funky comment diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap index a6c4e09dee5..fd62753121d 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/getter_setter.js.snap @@ -18,6 +18,10 @@ Indent style: Tab Line width: 80 Quote style: Double Quotes ----- -let a = { get foo() {} }; -let b = { set foo(a) {} }; +let a = { + get foo() {}, +}; +let b = { + set foo(a) {}, +}; diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/object.js b/crates/rome_js_formatter/tests/specs/js/module/object/object.js index b2ab2ef8006..3c4b9f2d8c5 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/object.js +++ b/crates/rome_js_formatter/tests/specs/js/module/object/object.js @@ -19,3 +19,14 @@ let a = { ...spread, } + +const x = {apple: "banana"}; + +const y = { + apple: "banana", +}; + +({a, b, c} = {a: 'apple', b: 'banana', c: 'coconut'}); + +({ + a, b, c} = {a: 'apple', b: 'banana', c: 'coconut'}); diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap index cb01977708a..b74b5407b06 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/object.js.snap @@ -25,6 +25,17 @@ let a = { ...spread, } +const x = {apple: "banana"}; + +const y = { + apple: "banana", +}; + +({a, b, c} = {a: 'apple', b: 'banana', c: 'coconut'}); + +({ + a, b, c} = {a: 'apple', b: 'banana', c: 'coconut'}); + ============================= # Outputs ## Output 1 @@ -53,3 +64,13 @@ let a = { ...spread, }; +const x = { apple: "banana" }; + +const y = { + apple: "banana", +}; + +({ a, b, c } = { a: "apple", b: "banana", c: "coconut" }); + +({ a, b, c } = { a: "apple", b: "banana", c: "coconut" }); + diff --git a/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap b/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap index 19b624cd5e7..3c448632dc2 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/object/property_key.js.snap @@ -22,6 +22,10 @@ Quote style: Double Quotes ----- const foo = { "foo-bar": true, - "bar": { "lorem_ispsum": { "lorem-ipsum": true } }, + "bar": { + "lorem_ispsum": { + "lorem-ipsum": true, + }, + }, }; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/assignment/call-with-template.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/call-with-template.js.snap index 4ec6d7dce79..65d96651c75 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/assignment/call-with-template.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/call-with-template.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 57 expression: call-with-template.js - --- # Input ```js @@ -25,9 +23,13 @@ const result = template( ` if (SOME_VAR === "") {} `, -)({ SOME_VAR: value }); +)({ + SOME_VAR: value, +}); -const output = template(`function f() %%A%%`)({ A: t.blockStatement([]) }); +const output = template(`function f() %%A%%`)({ + A: t.blockStatement([]), +}); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/assignment/lone-arg.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/lone-arg.js.snap index ab351da6e6c..5c6932c4652 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/assignment/lone-arg.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/lone-arg.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 57 expression: lone-arg.js - --- # Input ```js @@ -31,7 +29,11 @@ const bifornCringerMoshedPerplexSawderGlyphsHb = someBigFunctionName(`foo # Output ```js -let vgChannel = pointPositionDefaultRef({ model, defaultPos, channel })(); +let vgChannel = pointPositionDefaultRef({ + model, + defaultPos, + channel, +})(); let vgChannel2 = pointPositionDefaultRef({ model, defaultPos, channel })(); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/async/async-shorthand-method.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/async/async-shorthand-method.js.snap index 2653d14d778..b7972f2de60 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/async/async-shorthand-method.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/async/async-shorthand-method.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 57 expression: async-shorthand-method.js - --- # Input ```js @@ -15,7 +13,10 @@ expression: async-shorthand-method.js # Output ```js -({ async get() {}, async set() {} }); +({ + async get() {}, + async set() {}, +}); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/optional-chaining.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/optional-chaining.js.snap index e7650c28ed0..12e1dd515ad 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/optional-chaining.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/babel-plugins/optional-chaining.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 121 expression: optional-chaining.js - --- # Input ```js @@ -75,7 +73,13 @@ const ret = delete obj?.foo?.bar?.baz; // true ```js // https://babeljs.io/docs/en/babel-plugin-proposal-optional-chaining -const obj = { foo: { bar: { baz: 42 } } }; +const obj = { + foo: { + bar: { + baz: 42, + }, + }, +}; const baz = obj?.foo?.bar?.baz; // 42 @@ -113,9 +117,19 @@ test?.(); // 42 exists?.(); // undefined -const obj3 = { foo: { bar: { baz: class {} } } }; +const obj3 = { + foo: { + bar: { + baz: class {}, + }, + }, +}; -const obj4 = { foo: { bar: {} } }; +const obj4 = { + foo: { + bar: {}, + }, +}; const ret = delete obj?.foo?.bar?.baz; // true diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/arrow.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/arrow.js.snap index b99738cd6ac..2e5eadb453e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/arrow.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/arrow.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 125 expression: arrow.js - --- # Input ```js @@ -44,7 +42,9 @@ function f2() { entity.isInstallAvailable() && !entity.isQueue() && entity.isDisabled() && - { id: entity.id }, + { + id: entity.id, + }, ); } diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/inline-object-array.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/inline-object-array.js.snap index 4a67e9ee2d1..48eb268f67e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/inline-object-array.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/inline-object-array.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 144 expression: inline-object-array.js - --- # Input ```js @@ -142,20 +140,42 @@ prevState = selectedCatalog: null, }; -this.steps = steps || [{ name: "mock-module", path: "/nux/mock-module" }]; +this.steps = + steps || [ + { + name: "mock-module", + path: "/nux/mock-module", + }, + ]; this.steps = - steps || (checkStep && [{ name: "mock-module", path: "/nux/mock-module" }]); + steps || ( + checkStep && [ + { + name: "mock-module", + path: "/nux/mock-module", + }, + ] + ); this.steps = - (steps && checkStep) || [{ name: "mock-module", path: "/nux/mock-module" }]; + (steps && checkStep) || [ + { + name: "mock-module", + path: "/nux/mock-module", + }, + ]; const create = () => { const result = doSomething(); return ( shouldReturn && result.ok && - { status: "ok", createdAt: result.createdAt, updatedAt: result.updatedAt } + { + status: "ok", + createdAt: result.createdAt, + updatedAt: result.updatedAt, + } ); }; @@ -171,8 +191,15 @@ const create2 = () => { }; const obj = { - state: shouldHaveState && stateIsOK && { loadState: LOADED, opened: false }, - loadNext: (stateIsOK && hasNext) || { skipNext: true }, + state: shouldHaveState && + stateIsOK && + { + loadState: LOADED, + opened: false, + }, + loadNext: (stateIsOK && hasNext) || { + skipNext: true, + }, loaded: true, }; diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/jsx_parent.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/jsx_parent.js.snap index 28dd58f948d..61a69b178aa 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/jsx_parent.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/binary-expressions/jsx_parent.js.snap @@ -61,7 +61,10 @@ expression: jsx_parent.js style={ !isJellyfishEnabled && diffUpdateMessageInput && - { fontSize: 14, color: "#fff" } + { + fontSize: 14, + color: "#fff", + } } />; @@ -76,5 +79,3 @@ expression: jsx_parent.js ; ``` - - diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/classes/method.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/classes/method.js.snap index a80d721b800..a25247a9b7f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/classes/method.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/classes/method.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 121 expression: method.js - --- # Input ```js @@ -26,7 +24,9 @@ class C { name /*comment*/ () {} } -({ name /*comment*/ () {} }); +({ + name /*comment*/ () {}, +}); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/closure-compiler-type-cast.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/closure-compiler-type-cast.js.snap index 526f5c70f3f..297992e2d3e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/closure-compiler-type-cast.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/closure-compiler-type-cast.js.snap @@ -118,13 +118,19 @@ const style = /** @type {{ marginLeft: number, marginRight: number, marginBottom: number, -}} */ ({ width, height, ...margins }); +}} */ ({ + width, + height, + ...margins, +}); const style2 = /** * @type {{ * width: number, * }} -*/ ({ width }); +*/ ({ + width, +}); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/object-with-comment.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/object-with-comment.js.snap index c6aad9cbe74..c78ef0a81e8 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/object-with-comment.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments-closure-typecast/object-with-comment.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 144 expression: object-with-comment.js - --- # Input ```js @@ -24,10 +22,17 @@ const objectWithComment2 = /** @type MyType */ ( /* comment */ { ```js const objectWithComment = /** @type MyType */ ( /* comment */ - { foo: bar } + { + foo: bar, + } ); -const objectWithComment2 = /** @type MyType */ ( /* comment */ { foo: bar }); +const objectWithComment2 = /** @type MyType */ ( + /* comment */ + { + foo: bar, + } +); ``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/comments/variable_declarator.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/variable_declarator.js.snap index 15ee108aa87..03d5db3070f 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/variable_declarator.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/variable_declarator.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 144 expression: variable_declarator.js - --- # Input ```js @@ -77,9 +75,15 @@ const foo3 = 123 # Output ```js -let obj1 = { key: "val" }; // Comment +let obj1 = { + // Comment + key: "val", +}; -let obj2 = { key: "val" }; // Comment +let obj2 = { + // Comment + key: "val", +}; let obj3 = { // Comment diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/function-first-param/function_expression.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/function-first-param/function_expression.js.snap index 6ad920c652f..1d63a77c60b 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/function-first-param/function_expression.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/function-first-param/function_expression.js.snap @@ -36,7 +36,13 @@ db.collection('indexOptionDefault').createIndex({ a: 1 }, { //https://github.com/prettier/prettier/issues/3002 beep.boop().baz( "foo", - { some: { thing: { nested: true } } }, + { + some: { + thing: { + nested: true, + }, + }, + }, { another: { thing: true } }, () => {}, ); @@ -44,7 +50,11 @@ beep.boop().baz( //https://github.com/prettier/prettier/issues/2984 db.collection("indexOptionDefault").createIndex( { a: 1 }, - { indexOptionDefaults: true, w: 2, wtimeout: 1000 }, + { + indexOptionDefaults: true, + w: 2, + wtimeout: 1000, + }, function (err) { test.equal(null, err); test.deepEqual({ w: 2, wtimeout: 1000 }, commandResult.writeConcern); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/function-single-destructuring/object.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/function-single-destructuring/object.js.snap index f4f58d73055..4d7ab4717f9 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/function-single-destructuring/object.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/function-single-destructuring/object.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 151 expression: object.js - --- # Input ```js @@ -109,7 +107,9 @@ function StatelessFunctionalComponent3( searchFilters = null, title = "", items = [], - } = { isActive: true }, + } = { + isActive: true, + }, ) { return
; } 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 088d05d5f05..b4b94c0d0dd 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 @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 125 expression: ramda_compose.js - --- # Input ```js @@ -74,7 +72,14 @@ var getStateCode = R.composeK( getStateCode({ user: { address: { state: "ny" } } }); //=> Maybe.Just("NY") getStateCode({}); //=> Maybe.Nothing() -var db = { users: { JOE: { name: "Joe", followers: ["STEVE", "SUZY"] } } }; +var db = { + users: { + JOE: { + name: "Joe", + followers: ["STEVE", "SUZY"], + }, + }, +}; // We'll pretend to do a db lookup which returns a promise var lookupUser = (userId) => Promise.resolve(db.users[userId]); 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 01db462ced4..4a8566228f2 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 @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 153 expression: break-parent.js - --- # Input ```js @@ -40,7 +38,9 @@ true processors: [ require( "autoprefixer", - { browsers: ["> 1%", "last 2 versions", "ie >= 11", "Firefox ESR"] }, + { + browsers: ["> 1%", "last 2 versions", "ie >= 11", "Firefox ESR"], + }, ), require("postcss-url")({ url: (url) => @@ -49,7 +49,9 @@ true ], }); -true ? test({ a: 1 }) :
{ ```js export default (store) => { return callApi(endpoint, schema).then( - (response) => next(actionWith({ response, type: successType })), + (response) => + next( + actionWith({ + response, + type: successType, + }), + ), (error) => next( actionWith({ diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/computed.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/computed.js.snap index 8d45c1dd655..27f9b0153c7 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/computed.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/computed.js.snap @@ -1,6 +1,5 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 175 expression: computed.js --- # Input @@ -18,7 +17,12 @@ nock(/test/) ```js nock(/test/) .matchHeader("Accept", "application/json")[httpMethodNock(method)]("/foo") - .reply(200, { foo: "bar" }); + .reply( + 200, + { + foo: "bar", + }, + ); ``` 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 c09055525d5..95988f9a91a 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 @@ -49,7 +49,11 @@ 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/method-chain/inline_merge.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/inline_merge.js.snap index 86668e688c5..ece8dc83c68 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/inline_merge.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/inline_merge.js.snap @@ -27,7 +27,11 @@ var jqxhr = $.ajax("example.php") # Output ```js -Object.keys(availableLocales({ test: true })).forEach( +Object.keys( + availableLocales({ + test: true, + }), +).forEach( (locale) => { // ... }, diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap index afc24bb79fc..91b3743c962 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/method-chain/issue-4125.js.snap @@ -252,7 +252,10 @@ function HelloWorld() { authorizationToken: data.token, }).initVerify("foo_container"); - fejax.ajax({ url: "/verification/", dataType: "json" }).then( + fejax.ajax({ + url: "/verification/", + dataType: "json", + }).then( (data) => { this.setState({ isLoading: false }); this.initWidget(data); diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap index 869a0af1a24..7e5a5c3a21e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-graphql/graphql-tag.js.snap @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 121 expression: graphql-tag.js - --- # Input ```js @@ -307,7 +305,9 @@ ${USER_DETAILS_FRAGMENT} # and has a blank line in the middle ${FRIENDS_FRAGMENT} - ${generateFragment({ totally: "a good idea" })} + ${generateFragment({ + totally: "a good idea", +})} ${fragment}#comment diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap index a53411144ac..9167778a183 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/multiparser-html/lit-html.js.snap @@ -115,7 +115,9 @@ import { LitElement, html } from "@polymer/lit-element"; class MyElement extends LitElement { static get properties() { - return { mood: { type: String } }; + return { + mood: { type: String }, + }; } constructor() { @@ -216,7 +218,7 @@ ${foo}:${bar}; # Lines exceeding max width of 80 characters ``` - 68: const nestedFun = /* HTML */ `${outerExpr(1)}