Prettier
An opinionated code formatter enforces a consistent code style across your entire codebase
Target
提交代碼時…
自動格式化代碼
使用 ESLint 檢查代碼,並自動修復錯誤
在修復不了的時候,回報錯誤(此次 commit 不會提交)
Basic Configuration
.prettierrc
Install
package.json
Integrating with ESLint Linters
.eslintrc
Git Pre-commit Hooks
Run Prettier as a pre-commit hook to makes sure all your commits are formatted.
package.json
Additional
CI setup
Run prettier --check .
in CI to make sure that your project stays formatted.
Reference
Last updated
Was this helpful?