diff --git a/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap b/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap index acfa9b8e3069..47e2808b7b79 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/arrow/params.js.snap @@ -337,35 +337,181 @@ fooooooooooooooooooooooooooooooooooooooooooooooooooo( (action) => (next) => dispatch(action), ); -foo(({ a, b }) => {}); +foo( + ( + { + a, + b, + }, + ) => {}, +); -foo(({ a, b }) => {}); +foo( + ( + { + a, + b, + }, + ) => {}, +); -foo(({ a, b }) => {}); +foo( + ( + { + a, + b, + }, + ) => {}, +); -foo(a, ({ a, b }) => {}); +foo( + a, + ( + { + a, + b, + }, + ) => {}, +); -foo(({ a, b }) => a); +foo( + ( + { + a, + b, + }, + ) => a, +); -foo(({ a, b }) => a); +foo( + ( + { + a, + b, + }, + ) => a, +); -foo(({ a, b }) => a); +foo( + ( + { + a, + b, + }, + ) => a, +); -foo(({ a: { a, b } }) => {}); +foo( + ( + { + a: { + a, + b, + }, + }, + ) => {}, +); -foo(({ a: { b: { c, d } } }) => {}); +foo( + ( + { + a: { + b: { + c, + d, + }, + }, + }, + ) => {}, +); -foo(({ a: { b: { c: { d, e } } } }) => {}); +foo( + ( + { + a: { + b: { + c: { + d, + e, + }, + }, + }, + }, + ) => {}, +); -foo(({ a: { a, b } }) => a); +foo( + ( + { + a: { + a, + b, + }, + }, + ) => a, +); -foo(({ a: { b: { c, d } } }) => a); +foo( + ( + { + a: { + b: { + c, + d, + }, + }, + }, + ) => a, +); -foo(({ a: { b: { c: { d, e } } } }) => a); +foo( + ( + { + a: { + b: { + c: { + d, + e, + }, + }, + }, + }, + ) => a, +); -foo(([{ a: { b: { c: { d, e } } } }]) => {}); +foo( + ( + [ + { + a: { + b: { + c: { + d, + e, + }, + }, + }, + }, + ], + ) => {}, +); -foo(([...{ a: { b: { c: { d, e } } } }]) => {}); +foo( + ( + [ + ...{ + a: { + b: { + c: { + d, + e, + }, + }, + }, + } + ], + ) => {}, +); foo( ( @@ -383,7 +529,18 @@ foo( ) => {}, ); -foo(({ x: [{ a, b }] }) => {}); +foo( + ( + { + x: [ + { + a, + b, + }, + ], + }, + ) => {}, +); foo( ( @@ -397,15 +554,74 @@ foo( ) => a, ); -foo(([[{ a, b }]]) => {}); +foo( + ( + [ + [ + { + a, + b, + }, + ], + ], + ) => {}, +); -foo(([[[[{ a, b: { c, d: { e, f } } }]]]]) => {}); +foo( + ( + [ + [ + [ + [ + { + a, + b: { + c, + d: { + e, + f, + }, + }, + }, + ], + ], + ], + ], + ) => {}, +); -foo((...{ a, b }) => {}); +foo( + ( + ...{ + a, + b, + } + ) => {}, +); -foo((...[{ a, b }]) => {}); +foo( + ( + ...[ + { + a, + b, + }, + ] + ) => {}, +); -foo(([...[{ a, b }]]) => {}); +foo( + ( + [ + ...[ + { + a, + b, + }, + ] + ], + ) => {}, +); foo( ( @@ -419,7 +635,18 @@ foo( ) => {}, ); -foo((a = (({ a, b }) => {})()) => {}); +foo( + ( + a = ( + ( + { + a, + b, + }, + ) => {} + )(), + ) => {}, +); foo( ( @@ -431,7 +658,16 @@ foo( ) => {}, ); -foo((a = ({ a, b }) => {}) => {}); +foo( + ( + a = ( + { + a, + b, + }, + ) => {}, + ) => {}, +); foo( ( diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap index 3a5d7a39da6d..393bd74ca003 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/bare_import.js.snap @@ -35,7 +35,9 @@ import "very_long_import_very_long_import_very_long_import_very_long_import_very import "very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_very_long" assert { type: "json", }; -import "short" assert { type: "json" }; +import "short" assert { + type: "json", +}; import "very_long_import_very_long_import_very" assert { // something good is here @@ -56,5 +58,5 @@ import "very_long_import_very_long_import_very" assert { 1: import "very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_"; 2: import "very_long_import_very_long_import_very_long_import_very_long_import_very_long_import_very_long" assert { - 18: "typetypetypetypetypetypetypetypetypetypetype": "typetypetypetypetypetypetypetypetypetypetypetypetypetype", /****/ + 20: "typetypetypetypetypetypetypetypetypetypetype": "typetypetypetypetypetypetypetypetypetypetypetypetypetype", /****/ diff --git a/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap b/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap index 01cbe3667bb6..04b61d3ba6f3 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/import/default_import.js.snap @@ -28,7 +28,9 @@ import hey from "hey"; import "x" assert { type: "json" }; import "foo" assert { "type": "json" }; import foo from "foo.json" assert { type: "json" }; -import foo from "foo.json" assert { type: "json" }; +import foo from "foo.json" assert { + type: "json", +}; import foo2 from "foo.json" assert { "type": "json", type: "html", 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 3ddec127fe81..914ad7e38c48 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,12 +25,16 @@ let a = { ...spread, } -const x = {apple: "banana"} +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 @@ -65,3 +69,13 @@ 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/string/string.js.snap b/crates/rome_js_formatter/tests/specs/js/module/string/string.js.snap index e4014fa37da1..f5cbfb51259c 100644 --- a/crates/rome_js_formatter/tests/specs/js/module/string/string.js.snap +++ b/crates/rome_js_formatter/tests/specs/js/module/string/string.js.snap @@ -61,7 +61,9 @@ import hey from "hey"; import "x" assert { type: "json" }; import "foo" assert { "type": "json" }; import foo from "foo.json" assert { type: "json" }; -import foo from "foo.json" assert { type: "json" }; +import foo from "foo.json" assert { + type: "json", +}; import foo2 from "foo.json" assert { "type": "json", type: "html", @@ -111,7 +113,7 @@ export * as something_bad_will_happen from "something_bad_might_not_happen" asse ## Lines exceeding width of 80 characters - 48: export * as something_bad_will_happen from "something_bad_might_not_happen" assert { + 50: export * as something_bad_will_happen from "something_bad_might_not_happen" assert { ## Output 2 ----- Indent style: Tab @@ -123,7 +125,9 @@ import hey from 'hey'; import 'x' assert { type: 'json' }; import 'foo' assert { 'type': 'json' }; import foo from 'foo.json' assert { type: 'json' }; -import foo from 'foo.json' assert { type: 'json' }; +import foo from 'foo.json' assert { + type: 'json', +}; import foo2 from 'foo.json' assert { 'type': 'json', type: "html", @@ -173,5 +177,5 @@ export * as something_bad_will_happen from 'something_bad_might_not_happen' asse ## Lines exceeding width of 80 characters - 48: export * as something_bad_will_happen from 'something_bad_might_not_happen' assert { + 50: export * as something_bad_will_happen from 'something_bad_might_not_happen' assert { 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 4ec6d7dce791..65d96651c750 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/destructuring-heuristic.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/destructuring-heuristic.js.snap index 2fe389ebf444..07d1b3e68c88 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/assignment/destructuring-heuristic.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/destructuring-heuristic.js.snap @@ -39,27 +39,35 @@ expression: destructuring-heuristic.js ```js { { - const { id, static: isStatic, method: isMethod, methodId, getId, setId } = privateNamesMap.get( - name, - ); + const { + id, + static: isStatic, + method: isMethod, + methodId, + getId, + setId, + } = privateNamesMap.get(name); - const { id1, method: isMethod1, methodId1 } = privateNamesMap.get(name); + const { + id1, + method: isMethod1, + methodId1, + } = privateNamesMap.get(name); - const { id2, method: isMethod2, methodId2 } = privateNamesMap.get( - bifornCringerMoshedPerplexSawder, - ); + const { + id2, + method: isMethod2, + methodId2, + } = privateNamesMap.get(bifornCringerMoshedPerplexSawder); - const { id3, method: isMethod3, methodId3 } = anodyneCondosMalateOverateRetinol.get( - bifornCringerMoshedPerplexSawder, - ); + const { + id3, + method: isMethod3, + methodId3, + } = anodyneCondosMalateOverateRetinol.get(bifornCringerMoshedPerplexSawder); } } ``` -# Lines exceeding max width of 80 characters -``` - 3: const { id, static: isStatic, method: isMethod, methodId, getId, setId } = privateNamesMap.get( - 13: const { id3, method: isMethod3, methodId3 } = anodyneCondosMalateOverateRetinol.get( -``` diff --git a/crates/rome_js_formatter/tests/specs/prettier/js/assignment/issue-7091.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/issue-7091.js.snap index ff8d57e6d69b..3595b53fd49e 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/assignment/issue-7091.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/assignment/issue-7091.js.snap @@ -12,12 +12,12 @@ const { # Output ```js -const { imStore, showChat, customerServiceAccount } = store[config.reduxStoreName]; +const { + imStore, + showChat, + customerServiceAccount, +} = store[config.reduxStoreName]; ``` -# Lines exceeding max width of 80 characters -``` - 1: const { imStore, showChat, customerServiceAccount } = store[config.reduxStoreName]; -``` 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 ab351da6e6cc..5c6932c4652c 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 2653d14d7786..b7972f2de606 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 e7650c28ed09..12e1dd515adb 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 b99738cd6ace..65e7f5a8facf 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 @@ -38,14 +36,17 @@ function f() { } function f2() { - const appEntities = getAppEntities(loadObject).map( - (entity) => - entity && - entity.isInstallAvailable() && - !entity.isQueue() && - entity.isDisabled() && - { id: entity.id }, - ); + const appEntities = getAppEntities(loadObject) + .map( + (entity) => + entity && + entity.isInstallAvailable() && + !entity.isQueue() && + entity.isDisabled() && + { + id: entity.id, + }, + ); } ((x) => x) + ""; 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 4a67e9ee2d19..48eb268f67e4 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 c57c9fe3b5d8..2e4b3430ca43 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 @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 153 expression: jsx_parent.js - --- # Input ```js @@ -62,7 +60,10 @@ expression: jsx_parent.js style={ !isJellyfishEnabled && diffUpdateMessageInput && - { fontSize: 14, color: "#fff" } + { + fontSize: 14, + color: "#fff", + } } />; 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 a80d721b800c..a25247a9b7fc 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 b2e90ad793cb..271de49030b4 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 @@ -1,8 +1,6 @@ --- source: crates/rome_js_formatter/tests/prettier_tests.rs -assertion_line: 144 expression: closure-compiler-type-cast.js - --- # Input ```js @@ -123,13 +121,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 c6aad9cbe748..c78ef0a81e8c 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/issue-3532.js.snap b/crates/rome_js_formatter/tests/specs/prettier/js/comments/issue-3532.js.snap index 06c72c4b8fa1..161085242e26 100644 --- a/crates/rome_js_formatter/tests/specs/prettier/js/comments/issue-3532.js.snap +++ b/crates/rome_js_formatter/tests/specs/prettier/js/comments/issue-3532.js.snap @@ -74,7 +74,13 @@ const AspectRatioBox = styled.div` `; */ -const AspectRatioBox = ({ aspectRatio, children, ...props }) => ( +const AspectRatioBox = ( + { + aspectRatio, + children, + ...props + }, +) => (