question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: how to work with husky precommit

See original GitHub issue

I’m having a problem running, it was working well until I added a pre-commit task to run some linter validations and flow typechecker. I have this configuration in my package.json

"husky": {
    "hooks": {
      "pre-commit": "lint-staged && yarn flow"
    }
  },

running yarn semantic-release it start running well until it try to commit and push the package.json with the new generated version. at that moment I can see how the pre-commit task start but when it finishes without errors, the semantic-releases never resume.

I tried changing this: await execa('git', ['commit', '-m', message], execaOpts); to this: await execa('git', ['commit', '-m', message, '--no-verify'], execaOpts); and it worked well because I’m preventing to run husky.

So, my questions is, how can I send the --no-verify flag when I run semantic-release? or how can I tell semantic-release to resume when the linters and flow finished without error?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

11reactions
flo-schcommented, Apr 7, 2021

On the same subject, husky v6 has removed HUSKY_SKIP_HOOKS=1 but HUSKY=0 can be used instead

8reactions
trentrandcommented, Sep 17, 2019

For what is worth, the answer provided by @jfairley absolutely does solve this issue; however, using HUSKY_SKIP_HOOKS=1 (instead of CI=true) seems like a more appropriate solution.

https://github.com/typicode/husky/blob/master/README.md#skip-all-hooks-rebase

Read more comments on GitHub >

github_iconTop Results From Across the Web

Enforcing Coding Conventions with Husky Pre-commit Hooks
In this guide, we'll learn how to setup Husky to prevent bad git commits and enforce code standards in your project.
Read more >
Husky - Git hooks
husky -init is a one-time command to quickly initialize a project with husky. ... It will setup husky, modify package.json and create a...
Read more >
How to use Husky to create pre-commit and pre-push hooks
The easiest way to use git hooks locally in a Node environment, it's by using a library called husky. It handles git hooks...
Read more >
husky pre-commit hook not triggering - git - Stack Overflow
I think for this to work with husky v7, you need to move what you want to run pre-commit into a file called...
Read more >
Run ESLint on git commit with Husky and Lint Staged
How do you make sure every member in your team follows best coding practices and never commits code with issues to remote repository?...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found