News for hackers. Stuff that matters.
Re:The State of JavaScript 2017 by vjeux on Tuesday December 12, 2017 @11:23PM (#15912012)
This is so exciting that prettier is being used by 15% of people that responded to the survey, it hasn't even been a year since it was open sourced!
Re:The State of JavaScript 2017 by Androider on Wednesday December 13, 2017 @09:38AM (#15914443)
Two steps to better code reviews and happiness that everyone working with JS should implement:

1. Setup prettier, using the defaults, with the recommended pre-commit git hook

2. Never talk about code formatting again

(Don't like the prettier defaults? Please refer to bullet point #2)

Re:The State of JavaScript 2017 by cpburns2009 on Wednesday December 13, 2017 @10:37AM (#15914869)
Prettier could really use some example inputs and outputs for the supported languages. Sure, all of the settings appear to be documented in the API, but there's no concrete examples. I'd like know if its defaults look reasonable to me. I've seen some weird JavaScript conventions which makes me leery (e.g., jQuery). And I don't even know what that JavaScript/HTML hybrid is in the "Playground".
Re:The State of JavaScript 2017 by rattray on Wednesday December 13, 2017 @12:41PM (#15915825)
A PR with this would likely be very welcome!
Re:The State of JavaScript 2017 by spectrum1234 on Wednesday December 13, 2017 @12:21AM (#15912209)
Prettier is amazing!!!!
Re:The State of JavaScript 2017 by elbear on Wednesday December 13, 2017 @03:23AM (#15912861)
Thank you for mentioning this. I didn't know it existed and I was looking for a formatter for TypeScript.
Re:The State of JavaScript 2017 by alexkoeh on Wednesday December 13, 2017 @11:35AM (#15915283)
I've heard more and more about prettier, but I can't figure out how it's much different from eslint. What are the advantages?
Re:The State of JavaScript 2017 by bakkoting on Wednesday December 13, 2017 @04:33PM (#15917876)
Briefly: there's _tons_ of style things eslint can't even warn about which prettier will just automatically fix. Most dramatically, eslint doesn't know how to wrap long lines.

Also, though, eslint offers a bunch of non-style code correctness checks, which is something prettier doesn't even try to do. So the general advice is to use eslint with all the style rules off, and use prettier to handle style.