From 98fef67b4ec57980b19fcbdeb80abc7ffe2f0b03 Mon Sep 17 00:00:00 2001 From: James Long Date: Wed, 4 Jan 2017 17:08:28 -0500 Subject: [PATCH] Fix a bug with expanding function args by passing group opts properly --- src/printer.js | 4 +-- .../arraylib/__snapshots__/jsfmt.spec.js.snap | 7 +++-- .../__snapshots__/jsfmt.spec.js.snap | 27 ++++++++++--------- .../__snapshots__/jsfmt.spec.js.snap | 7 +++-- 4 files changed, 27 insertions(+), 18 deletions(-) diff --git a/src/printer.js b/src/printer.js index 024fd2a87..ac3b3fd13 100644 --- a/src/printer.js +++ b/src/printer.js @@ -1775,7 +1775,7 @@ function printArgumentsList(path, options, print) { { shouldBreak: true } ), ], - shouldBreak + { shouldBreak } ); } @@ -1789,7 +1789,7 @@ function printArgumentsList(path, options, print) { softline, ")" ]), - shouldBreak + { shouldBreak } ); } diff --git a/tests/arraylib/__snapshots__/jsfmt.spec.js.snap b/tests/arraylib/__snapshots__/jsfmt.spec.js.snap index 47cb14b0f..12a142f40 100644 --- a/tests/arraylib/__snapshots__/jsfmt.spec.js.snap +++ b/tests/arraylib/__snapshots__/jsfmt.spec.js.snap @@ -94,9 +94,12 @@ function reduce_test() { return previousValue + currentValue + array[index]; }); - [ 0, 1, 2, 3, 4 ].reduce(function(previousValue, currentValue, index, array) { + [ 0, 1, 2, 3, 4 ].reduce( + function(previousValue, currentValue, index, array) { return previousValue + currentValue + array[index]; - }, 10); + }, + 10 + ); var total = [ 0, 1, 2, 3 ].reduce(function(a, b) { return a + b; diff --git a/tests/geolocation/__snapshots__/jsfmt.spec.js.snap b/tests/geolocation/__snapshots__/jsfmt.spec.js.snap index 1dde54699..2be6e37cf 100644 --- a/tests/geolocation/__snapshots__/jsfmt.spec.js.snap +++ b/tests/geolocation/__snapshots__/jsfmt.spec.js.snap @@ -22,19 +22,22 @@ geolocation.clearWatch(id); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /* @flow */ var geolocation = new Geolocation(); -var id = geolocation.watchPosition(position => { - var coords: Coordinates = position.coords; - var accuracy: number = coords.accuracy; -}, e => { - var message: string = e.message; - switch (e.code) { - case e.PERMISSION_DENIED: - case e.POSITION_UNAVAILABLE: - case e.TIMEOUT: - default: - break; +var id = geolocation.watchPosition( + position => { + var coords: Coordinates = position.coords; + var accuracy: number = coords.accuracy; + }, + e => { + var message: string = e.message; + switch (e.code) { + case e.PERMISSION_DENIED: + case e.POSITION_UNAVAILABLE: + case e.TIMEOUT: + default: + break; + } } -}); +); geolocation.clearWatch(id); " diff --git a/tests/union_new/__snapshots__/jsfmt.spec.js.snap b/tests/union_new/__snapshots__/jsfmt.spec.js.snap index d94fa1371..81c2db096 100644 --- a/tests/union_new/__snapshots__/jsfmt.spec.js.snap +++ b/tests/union_new/__snapshots__/jsfmt.spec.js.snap @@ -1461,9 +1461,12 @@ exports[`test test20.js 1`] = ` // Array#reduce [ 0, 1 ].reduce((x, y, i) => y); -[ \"a\", \"b\" ].reduce((regex, representation, index) => { +[ \"a\", \"b\" ].reduce( + (regex, representation, index) => { return regex + ((index ? \"|\" : \"\")) + \"(\" + representation + \")\"; - }, \"\"); + }, + \"\" +); [ \"\" ].reduce((acc, str) => acc * str.length); "