Tslint (probably as well as eslint) has a --fix param, that fixes style errors. Is there any reason I should also consider using prettier, other than "prettier has more style rules"?
Asked
Active
Viewed 1,156 times
1 Answers
4
sorry for the delay! There are a few good reasons why you'd use Prettier over TSLint:
- Prettier is much faster than TSLint at formatting because it doesn't need to run as many rules or use type information.
- Prettier is much more opinionated in its output. That means you get a much more strictly enforced style guide for you. TSLint's
whitespace
rule and related are intentionally not feature-complete with Prettier (reference). - Prettier reformats code more strictly than TSLint. You have to do a lot less of your own formatting work (and if others are working on your project, everybody's code will look much more similar).
Here's a common approach if you're still interested:
- In your
tslint.json
, usetslint-config-prettier
to disable any formatting rules that conflict with Prettier - Per Prettier's docs, use
husky
andpretty-quick
to auto-run Prettier on all Git commits

Josh
- 1,997
- 13
- 21
-
Even if I am still not convinced to use prettier, this is a good answer! Thanks! – Nurbol Alpysbayev Nov 10 '18 at 22:19