Repository: jlongster/prettier (js)

Issue:
Trailing whitespaces
First of all, love the project. I'm using scalafmt to format scalacode and all the debates regarding lint and codestyle and nitpicks in PRs disappeared when enabling it. Really looking forward to this taking off!

Now to the issue. It seems that arrow functions are, at least in some cases, leaving a trailing whitespace when reformatted.

I've attached two examples off git diffs where it leaves a trailing comma for me.
![image](https://cloud.githubusercontent.com/assets/4514159/21851188/d50adc5a-d805-11e6-82b8-c6a033ec68a1.png)
![image](https://cloud.githubusercontent.com/assets/4514159/21851197/ddae94b4-d805-11e6-9d32-f1c269df3667.png)

If additional information is needed I'll try my best to get some more context.

Pull request description:
Remove trailing whitespace in broken arrow function expressions.
Closes #103.

Patch:
diff --git a/src/printer.js b/src/printer.js
index 52b5adeee..9e41a6a39 100644
--- a/src/printer.js
+++ b/src/printer.js
@@ -336,10 +336,10 @@ function genericPrintNoParens(path, options, print) {
       ])));
     }
 
-    parts.push(" => ");
+    parts.push(" =>");
 
     return conditionalGroup([
-      concat([ concat(parts), path.call(print, "body") ]),
+      concat([ concat(parts), " ", path.call(print, "body") ]),
       concat([ concat(parts),
                indent(options.tabWidth,
                       concat([line, path.call(print, "body")]))])


Test patch:
diff --git a/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap b/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap
index 9b27dbfff..0bb77ba91 100644
--- a/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap
+++ b/tests/predicates-parsing/__snapshots__/jsfmt.spec.js.snap
@@ -113,7 +113,7 @@ var a1 = (x: mixed): %checks => x !== null;
 
 (x): %checks => x !== null;
 
-const insert_a_really_big_predicated_arrow_function_name_here = (x): %checks => 
+const insert_a_really_big_predicated_arrow_function_name_here = (x): %checks =>
   x !== null;
 
 declare var x;