-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prettier precommit hook #126
Prettier precommit hook #126
Conversation
@johnpapa I figured if i went ahead and opened a PR then you can pull it down and play around if you wanted until we find what works best |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks!
.prettierrc
Outdated
@@ -0,0 +1,5 @@ | |||
{ | |||
"printWidth": 100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change to 80 please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, if you want me to switch the staged files over to the add script you pointed out, i can change that too while im at it
.prettierignore
Outdated
@@ -0,0 +1,4 @@ | |||
# ignore all files | |||
* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure we need this file. there are some files outside of src which are fine to pretty. let's make this file blank
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
update to @wardbell should try this out before we merge |
@@ -64,6 +65,7 @@ | |||
"@types/node": "~6.0.60", | |||
"codelyzer": "^4.1.0", | |||
"concurrently": "^3.5.0", | |||
"husky": "^0.14.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we also need this?
"precommit": ["precommit"],
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it looks like pretty-quick is using husky according to the documentation. looking to see if i can find any more information about that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Husky can prevent bad git commit, git push and more
this is from the husky repo...
i could be wrong but it sounds like husky purpose is to prevent you from committing if your precommit fails.
Honestly i was just following the docs on prettier site and installed the things they said to install.
I can remove if wanted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think we are good. i tested this elsewhere and here is hwat I have:
npm i husky prettier pretty-quick -D
Then i added this to the package.json, inside of scripts
"pretty-quick": "pretty-quick",
"precommit": "pretty-quick --staged"
The first one is for formatting the entire project, the latter for the hook that husky calls
@wardbell - please take a look. if you like this, let's merge |
thanks for the PR! |
Purpose
Adds initial setup for running prettier during commit so that code styles are always followed
#35
Does this introduce a breaking change?
Pull Request Type
What kind of change does this Pull Request introduce?
How to Test
What to Check
Verify that the following are valid
Other Information
adding prettier styling to the repo.
Also adds a nice prettier configuration badge to the readme file to show that prettier is used