What is Prettier?
Why Prettier?
Building and enforcing a style guide
Helping Newcomers
Writing code
Easy to adopt
Clean up an existing codebase
Ride the hype train
Prettier vs. Linters
linter有两类规则:
- Formatting rules: eg: max-len, no-mixed-spaces-and-tabs, keyword-spacing, comma-style…
- Code-quality rules: eg no-unused-vars, no-extra-bind, no-implicit-globals, prefer-promise-reject-errors…
对于格式化规则:Prettier 减轻了对这一整类规则的需求! Prettier 会以一致的方式从头开始重新打印整个程序,因此程序员不可能再在那里犯错:)
对于代码质量规则:Prettier对其没有作任何判断,只有linter会捕获这些错误