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
add 'postinstall' to enable hooks after install #32
Conversation
So I fixed it now and working, it's a windows issue (for me at least) I followed this |
Just fyi, the husky script does not work with Github Desktop but I am able to do it using gitbash. |
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.
see FYI comment but otherwise is working for me.
So current husky setup is not quite working for me, it goes like this, So the correct workflow should be
is this happening to anyone else? I haven't looked it up yet but I was wondering if it was just me or not |
Pre-commit - Detect and format files after commit Although, it does seem strange why Husky is only doing changes after a push when it's supposed to be "pre-push". I'll look it up this weekend if no one else does. edit: "When you run the git push command, Git triggers any pre-push hooks that are installed. These hooks are intended to inspect the changes that are about to be pushed and possibly prevent the push if something isn't right. However, at this stage, the changes have already been committed to your local repository and are ready to be pushed. If your pre-push hook makes additional changes to the code (like reformatting it), these changes will not be included in the push because they haven't been committed yet" It seems like we would need to enter additional commands for it to work as you intended.
This will make two separate commits in one single push command. What do you think? |
that's basically what I have to do now, but manually, but we shouldn't have to make an extra commit to include husky changes if you look at this as an example, I basically have to do 2 commits every time I push, and one just for the husky changes Is there any reason we can't use a pre commit hook? I've used pre commit hooks for format in all my other projects and no issues |
Dan doesn't like it 😄 "Pre-commit would get too annoying" in his exact words. |
he's not going to commit or push this repo much. double commits annoys me and clogging the commit history 😂 What does everyone else in the team think? |
edit: Nvm I realized my solution isn't the correct approach for pre-push. I reverted my recent changes. |
085dde2
to
d883e97
Compare
I haven't tried any of this yet - but agree that it should be a pre-commit hook and we shouldn't push two commits for this. |
If you use a pre commit hook, literally every time you try to commit, you will have to fix any linting errors. This honestly is a just a huge hassle. For me personally, I always do multiple commits and then when I'm done, I'll push it up to the repo and before I push, I do a lint/format. I like having the check in a pre-push in case I or someone else forgets to do that. Having to do 1 extra commit is way better tradeoff for me than having to fix stuff every time I commit (I'm not really sure what you mean about double commit, it should only be 1 extra). That being said that part is not relevant to the husky workflow issue and can be tweaked for each team. When I tried to set it up on the fe, it didn't matter what I used, it wasn't working for other people so yea. |
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.
works for me, thanks for fixing this
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 works for me after I set the pre-commit script to executable. Approved!
Description
Enable Git hooks for Husky immediately after
yarn install
husky's docFor current developers, please run
yarn husky install
to ensure that Husky functions correctly.Type of change
How Has This Been Tested?
After
yarn husky install
-- Intentionally made lint mistakes in some files after
yarn husky install
-- Detected by Husky after push
Before
yarn husky install
-- Intentionally made lint mistakes before
yarn husky install
-- Not detected by Husky after push
Checklist: