husky Output a warning but not fail precommit hook? - JavaScript

I have a custom script that I want to run in a precommit hook using husky. The issue is if it fails, I don't want husky to fail, but I still want it to print a warning. I have the script, when ran outside husky, exiting 0 and printing to the console. When it runs in husky it prints nothing. And just succeeds, because of the 0 exit code of course.

If I exit 1, it prints fine, but then the commit fails, which is not what I want. Any thoughts?

Asked Oct 15 '21 00:10
avatar bjenkins24
bjenkins24

2 Answer:

I just ran into this as well. I am using husky to lint git commits to an Angular project. Not all of our rules are currently deserving of an "error" severity (we are trying to introduce linters to a team that has gone without), but it still is worth raising any warnings to developers' consoles so they can get used to seeing things. Is there a way to configure husky to be vocal, even if tasks pass?

1
Answered May 04 '20 at 18:57
avatar  of clevi
clevi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

1
Answered Jul 02 '21 at 02:13
avatar  of stale[bot]
stale[bot]