News for hackers. Stuff that matters.
Re:A Prettier JavaScript Formatter by jlongster on Tuesday January 10, 2017 @11:36AM (#13366115)
We do. The entire Flow test suite passes when pretty-printing and re-parsing and comparing ASTs.

There are a very few subtle bugs like the one you mentioned above. As noted in the readme, this is a beta. It's certainly more than an attempt.

Re:A Prettier JavaScript Formatter by artursapek on Tuesday January 10, 2017 @11:55AM (#13366297)
Don't let HN negativity get you down. This is an awesome project and I'll contribute bug fixes/test cases if we end up adopting it on our team (very likely based on your blog post).
Re:A Prettier JavaScript Formatter by mi_lk on Tuesday January 10, 2017 @12:07PM (#13366461)
the parent gave an ill example and suggest a solution, how's that a negativity?
Re:A Prettier JavaScript Formatter by dangoor on Tuesday January 10, 2017 @12:35PM (#13366791)
I believe it was the "Nice attempt, but currently wrong." at the start of the comment. "Nice attempt" could imply that this should be thrown out in favor of another attempt to solve the problem.
Re:A Prettier JavaScript Formatter by n42 on Tuesday January 10, 2017 @01:46PM (#13367637)
The entire comment was patronizing. "Nice attempt" minimizes the effort involved and implies the author is a novice. "but currently wrong" categorizes the entire project as a failure because of a single bug. The followup "From my own experience writing a formatter" really drives the whole thing home.
Re:A Prettier JavaScript Formatter by artursapek on Tuesday January 10, 2017 @01:58PM (#13367775)
Classic HN :-)
Re:A Prettier JavaScript Formatter by tomp on Tuesday January 10, 2017 @03:12PM (#13368501)
Wasn't meant that way.
Re:A Prettier JavaScript Formatter by softawre on Tuesday January 10, 2017 @05:18PM (#13369713)
"Nice attempt" used to actually mean the words it said. You know, like "nice job".
Re:A Prettier JavaScript Formatter by acdha on Tuesday January 10, 2017 @12:48PM (#13366965)
Also, “currently wrong” is a really sweeping statement to make based on a single problem written in a fairly uncommon style. Yes, there are things which need to be fixed but that doesn't mean we have to be so dismissive of someone else's work which they've given away for free to the community.
Re:A Prettier JavaScript Formatter by artursapek on Tuesday January 10, 2017 @01:28PM (#13367439)
Like dangoor said, it was the way it was delivered.
Re:A Prettier JavaScript Formatter by moogleii on Tuesday January 10, 2017 @11:38AM (#13366135)
I'm actually very excited by your "attempt". Looking forward to where it goes!
Re:A Prettier JavaScript Formatter by mnarayan01 on Tuesday January 10, 2017 @01:36PM (#13367527)
I think what the GP is saying is to do the re-parsing before/after every time you reformat (and then presumably error exit if the ASTs don't match). When/if you no longer have any known bugs like that you might want to remove it, but it does seem like a good idea until you get there.
Re:A Prettier JavaScript Formatter by tlrobinson on Tuesday January 10, 2017 @01:24PM (#13367381)
Running existing codebases through it and comparing the ASTs is a nice idea. Seems like it should be pretty easy to automated it for the top N (100?) JavaScript projects.