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"?
Tslint/eslint vs prettier [closed]
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
Even if I am still not convinced to use prettier, this is a good answer! Thanks! –
Soemba
© 2022 - 2024 — McMap. All rights reserved.