News for hackers. Stuff that matters.
Re:A Prettier JavaScript Formatter by evmar on Tuesday January 10, 2017 @11:02AM (#13365805)
How does this compare to clang-format, which also formats JavaScript and also (to use one of the features highlighted in the article) obeys line length?
Re:A Prettier JavaScript Formatter by Derander on Tuesday January 10, 2017 @03:46PM (#13368820)
I attempted to use clang-format on a mixed typescript/tsx codebase and found that it mangled jsx expressions. This wasn't surprising but I suspect that typescript users probably overlap heavily with react users so it's not a great solution as is.
Re:A Prettier JavaScript Formatter by jlongster on Tuesday January 10, 2017 @11:24AM (#13365985)
Not sure, didn't know it formatted JavaScript! This is written in JS at least so if anything it's more approachable to the community.
Re:A Prettier JavaScript Formatter by evmar on Tuesday January 10, 2017 @12:38PM (#13366831)
Yes, that's a good point. If you ever get a chance to compare to clang-format I'd be interested to read your results. My vague understanding is that clang-format has some sophisticated-ish algorithms for intelligently wrapping complex expressions. However, I also think its output is inferior on code like your .then() chain example.