Hacker News new | past | comments | ask | show | jobs | submit login

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!



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)


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".


A PR with this would likely be very welcome!


Prettier is amazing!!!!


Thank you for mentioning this. I didn't know it existed and I was looking for a formatter for TypeScript.


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?


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.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: