5 ms·
Having an auto formatter was one of my favorite things about using go (gofmt). We’ve been using prettier for over a year now at work and it’s been really nice
by NegativeLatency 9y ago
Having an auto formatter was one of my favorite things about using go (gofmt).
We’ve been using prettier for over a year now at work and it’s been really nice not having to spend much time keeping the code neat. (Works well with typescript and react also)
- kaiby 9y agoIt's also a great answer to dissenting opinions about code style. No more arguing about when to line break inside an 'if' statement.
- xab9 9y agoExactly. Lint and code formatters are a must with big teams - now we can concentrate on the code and not on the style.
- thatswrong0 9y agoAnd it’s even better than go fmt cause it breaks lines for you. Wish all languages had this sort of thing. It really has made reviewing and editing code much more pleasant at my company.
- swyx 9y agoah a perfect chance to get some Prettier+Typescript help! I am using Prettier+Typescript+React and when I do methods within classes, Prettier adds a semicolon for me at the end of each class which `tslint` doesnt like. As far as I can tell, there is no setting for Prettier to ignore ONLY semicolons WITHIN classes, its just a blanket on or off. And its somehow not respecting tslint's semicolon preference. Any idea how to fix this? ``` class Demo extends React.Component<{}, {}> { someStuff() { // some code }; // prettier adds this ; for me, i have to tslint:disable-line every time } ```
- seepel 9y agoWe just turn off tslint formatting rules. There isn’t really a need for them if you are using prettier.
- swyx 9y agooh. unfortunately my team lead insists on having them. thanks anyway.
- mceachen 9y agotslint, while quite useful last year, still had (and has) known bugs with unused variables, missing/incorrect type assertions, and other annoyances. Most new versions of TypeScript expand on their `strict` rules, and just enabling `strict` in your tsconfig, as well as using prettier, is arguably a more robust superset of seatbelts than tslint offered. I deleted tslint from all my TS projects several months ago and don't miss it at all.
- saranshk 9y agoI don't think they will add them. They are very opinionated and skeptical about adding configuration options. If there is more of those, then again everyone will try and have an opinion of their own and it will end up being like ESLint. Also that will lead to a lot of time spent on understanding the configuration file which will be a disadvantage as well since currently prettier just works!
- b-glad 9y agoNpm install tslint-config-prettier and add it to the extends array in tslint.json to switch tslint rules to be compatible with prettier
- swyx 9y agoappreciate the tip, have an upvote
- NegativeLatency 9y agoI don’t use semicolons ;)
- saranshk 9y agoI remember reading that gofmt was one of the inspirations for prettier