rdio/jsfmt

Format with extra newline

CatTail opened this issue · 4 comments

Example javascript file test.js

var a = 0;

when I invoke it with jsfmt test.js, the result is

var a = 0;

With extra newline at the end of file.

I'll have to test this. It might be intentional since git complains when there's no trailing line break.

jish commented

I have this problem as well. It adds an extra newline, every time. If I run it three times, I get three extra newlines.

I think this might be a side effect of spitting the result out to standard output. Is it adding an extra newline every time because it expects the output to be written to a terminal, and wants the prompt to be down an extra line?

on esformatter we had the same problem, we solved by using process.stdout.write instead of a simple console.log

A fix #134 for this was merged in last week thanks to aredridel.