Last active
June 25, 2018 15:37
-
-
Save muhammadghazali/5511c2ce67d7db08a193ad5ebe73defa to your computer and use it in GitHub Desktop.
Setup prettier pre-commit Hook. This bash script is suitable if you have a project without prettier integration and interested to add prettier into your current development workflow.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
npm i -D --save-exact prettier | |
npm i -D pretty-quick husky --save | |
# to manipulate the existing package.json file | |
npm i -g json | |
# add precommit to package.json scripts | |
json -I -f package.json -e 'this.scripts.precommit="pretty-quick --staged"' | |
# add prettier config file | |
touch .prettierrc | |
echo '{ | |
"singleQuote": true | |
} | |
' >> .prettierrc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment