Skip to content
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

Fix husky configuration and remove needless packages #5196

Merged
merged 3 commits into from
Mar 10, 2021
Merged

Conversation

ybiquitous
Copy link
Member

husky no longer requires pinst and is-ci since v5.1.2.
(see typicode/husky@84be675)

So, this change simplifies the husky configuration and removes the needless packages.
See also https://typicode.github.io/husky.

Which issue, if any, is this issue related to?

None.

Is there anything in the PR that needs further explanation?

None.

.husky/pre-commit Outdated Show resolved Hide resolved
package.json Outdated
@@ -38,25 +38,18 @@
"scripts": {
"benchmark-rule": "node scripts/benchmark-rule.js",
"format": "prettier . --write",
"postinstall": "is-ci || husky install",
"prepare": "husky install",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] The husky document uses prepare instead of postinstall:
https://typicode.github.io/husky/#/?id=install

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need to do something to disable hooks on the CI?

Perhaps:

# .husky/pre-commit
# ...
[ -n "$CI" ] && exit 0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Fixed via 57eeb86.

I think we now don't need the CI check for the prepare script via is-ci:

{
  "scripts": {
    "prepare": "is-ci || husky install"
  }
}

If we would need it in the future, then let's install it again.

"hooks": {
"pre-commit": "lint-staged"
}
},
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[note] This is an old configuration.

`husky` no longer requires `pinst` and `is-ci` since v5.1.2.
(see <typicode/husky@84be675>)

So, this change simplifies the `husky` configuration and removes the needless packages.
See also <https://typicode.github.io/husky>.
@ybiquitous ybiquitous marked this pull request as ready for review March 10, 2021 08:46
Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! That's cleaner. I've left one comment.

@hudochenkov
Copy link
Member

There is so much hustle with husky. Maybe we should switch to a simpler solution? https://github.com/toplenboren/simple-git-hooks

@ybiquitous
Copy link
Member Author

@hudochenkov Honestly, I also don't like husky v5 so much... 😓
If simple-git-hooks is sufficient, I think it good to switch it. I'll look into it more.

@jeddy3
Copy link
Member

jeddy3 commented Mar 10, 2021

If simple-git-hooks is sufficient, I think it good to switch it. I'll look into it more.

If none of the limitations are an issue for us, then I say go for it.

@ybiquitous
Copy link
Member Author

simple-git-hooks is renaming. The old name is simple-pre-commit. It looks a bit unstable yet. 🙄
toplenboren/simple-git-hooks#21

Copy link
Member

@jeddy3 jeddy3 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good to me.

We can shift to simple-git-hooks when it's released.

@ybiquitous
Copy link
Member Author

Thank you for the feedback! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants