esnext/es6-arrow-function

Avoid adding extra newlines to compilation result

Closed this issue · 4 comments

This would result with the preservation of correct line numbers in stack traces without the need to generate full-blown source maps.

Is something like this possible using recast?

This suggests that there should be a way to do it:

~ echo 'var foo = () => 42;' | es6-arrow-function
var foo = function() {
  return 42;
};
~ echo 'var foo = () => { 42 };' | es6-arrow-function
var foo = function() { 42 };

Pull requests welcome!

Thanks, I'll give it a try! :P

Edit: I figured out the reason. I guess this is not exactly configurable, unfortunately.

I worked around this by reprinting without recast. It's not a very elegant solution, but it seems to work.

https://github.com/rainbow-alex/afnc/blob/master/afnc.js#L162
https://github.com/rainbow-alex/afnc/blob/master/afnc.js#L181

Closing this as there's not really much we can do about it without changing recast.