Avoid adding extra newlines to compilation result
Closed this issue · 4 comments
spion commented
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?
eventualbuddha commented
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!
spion commented
Thanks, I'll give it a try! :P
Edit: I figured out the reason. I guess this is not exactly configurable, unfortunately.
rainbow-alex commented
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
eventualbuddha commented
Closing this as there's not really much we can do about it without changing recast.