diff --git a/src/printer.js b/src/printer.js index 349921bca..1b8944767 100644 --- a/src/printer.js +++ b/src/printer.js @@ -454,7 +454,7 @@ function genericPrintNoParens(path, options, print) { if (grouped.length > 0) { parts.push( - group( + multilineGroup( concat([ "{", indent( @@ -462,7 +462,7 @@ function genericPrintNoParens(path, options, print) { concat([ options.bracketSpacing ? line : softline, join( - concat([ ",", options.bracketSpacing ? line : softline ]), + concat([ ",", line ]), grouped ) ]) diff --git a/tests/import/__snapshots__/jsfmt.spec.js.snap b/tests/import/__snapshots__/jsfmt.spec.js.snap new file mode 100644 index 000000000..f428cf7fa --- /dev/null +++ b/tests/import/__snapshots__/jsfmt.spec.js.snap @@ -0,0 +1,53 @@ +exports[`test brackets.js 1`] = ` +"import { + runTaskForChanged, + description, + someOtherLabel, + thatMakes, + itGo, + multiLine, + andMore, + soWeCanGetItTo80Columns +} from \'.\'; +import {fitsIn, oneLine} from \'.\'; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +import { + runTaskForChanged, + description, + someOtherLabel, + thatMakes, + itGo, + multiLine, + andMore, + soWeCanGetItTo80Columns +} from \".\"; +import { fitsIn, oneLine } from \".\"; +" +`; + +exports[`test brackets.js 2`] = ` +"import { + runTaskForChanged, + description, + someOtherLabel, + thatMakes, + itGo, + multiLine, + andMore, + soWeCanGetItTo80Columns +} from \'.\'; +import {fitsIn, oneLine} from \'.\'; +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +import { + runTaskForChanged, + description, + someOtherLabel, + thatMakes, + itGo, + multiLine, + andMore, + soWeCanGetItTo80Columns +} from \".\"; +import { fitsIn, oneLine } from \".\"; +" +`; diff --git a/tests/import/brackets.js b/tests/import/brackets.js new file mode 100644 index 000000000..a0e353e95 --- /dev/null +++ b/tests/import/brackets.js @@ -0,0 +1,11 @@ +import { + runTaskForChanged, + description, + someOtherLabel, + thatMakes, + itGo, + multiLine, + andMore, + soWeCanGetItTo80Columns +} from '.'; +import {fitsIn, oneLine} from '.'; diff --git a/tests/import/jsfmt.spec.js b/tests/import/jsfmt.spec.js new file mode 100644 index 000000000..b6e518ff7 --- /dev/null +++ b/tests/import/jsfmt.spec.js @@ -0,0 +1,2 @@ +run_spec(__dirname); +run_spec(__dirname, {bracketsSpacing: false});