Questions tagged [husky]

Tool that provides git hooks to prevent bad commits

Husky is a tool to make modern native Git hooks easy. Husky supports all Git hooks. It can be used to improve your commits by linting your commit messages, running tests, linting code, etc...

268 questions
0
votes
1 answer

Adding precommit hooks with Husky without pushing addition to git

Hey i want to add a script to my package.json but don't want to check in this addition to our git because it affects the behaviour of the project for my colleagues. The script i want to add is a precommit-Hook which is handled by husky. Is there a…
takethefake
  • 795
  • 1
  • 9
  • 20
-1
votes
0 answers

How should I configure Husky in a monorepo context?

I'm trying to run the yarn prettier command at each pre-commit. I found out that I should use Husky in order to create a git hook. And it works but since I'm a monorepo it pushed my working directory and erased the parent. Here are the steps that I…
JSharles
  • 565
  • 1
  • 5
  • 16
-1
votes
0 answers

"No such file or directory" when using Husky with GitHub Desktop

I'm using husky in my React project for pre-commit. When using command to commit husky running normally. But when I'm using GitHub Desktop to commit it throws an error. How can I fix that? This is the error message from GitHub Desktop: /bin/bash:…
-1
votes
1 answer

React 18 with Husky pre-commit and jest - No tests found, exiting with code 1

After going down the rabbit-hole, this is as far as I seem to be able to get. I've got my husky pre-commit hook "working", but it's not finding tests when there clearly is a test, and it appears to be looking in the correct folder for it. This is…
Tsar Bomba
  • 1,047
  • 6
  • 29
  • 52
-1
votes
1 answer

When using npm scripts, how can I tell if I am currently running windwos or mac

Since it is a multi-person development, in mac environment, it is required to set chmod + x.usky /pre-commit for projects, but many people may deliberately leave it unset in an attempt to submit the wrong code to the repository I know you can do…
laterday
  • 353
  • 1
  • 4
  • 11
-1
votes
1 answer

Cannot install commit-msg-linter with pnpm: sh: .git/hooks/commit-msg: No such file or directory

Description I can't install commit-msg-linter, all other hooks work fine. Reproduce git init pnpm init pnpm add -D husky pnpm add -D git-commit-msg-linter pnpm exec husky install git add . git commit -m "hello" Result sh: .git/hooks/commit-msg:…
ZauJulio
  • 1
  • 3
-1
votes
1 answer

Using github desktop on windows can't commit changes

Committing changes fails on github desktop on windows Error says: warning: Empty last update token. /bin/bash: C:/Program Files/nodejs/npm: No such file or directory husky - pre-commit hook exited with code 127 (error)
Muhammad Akram
  • 124
  • 2
  • 7
-1
votes
1 answer

Is it possible to add ESLint directly to Git?

I want ESLint to check my files before committing them to git. I found husky and lint-staged to do this but in this way every programmer has to have husky and lint-staged in their machine. What if ESLint is directly injected into git so that all the…
Soorya J
  • 145
  • 6
-1
votes
1 answer

`npx mrm@2 lint-staged` throw err that `.git` can't be found husky custom directrory

xxx-MacBook-Pro:client xxx$ npx mrm@2 lint-staged npx: installed 239 in 8.29s Running lint-staged... /Users/xxx/.npm/_npx/34378/lib/node_modules/mrm/bin/mrm.js:56 throw err; ^ Error: .git can't be found (see…
Mia.Zhang
  • 31
  • 6
-1
votes
1 answer

How can I use a shell function with a return code in my git pre-commit hook using husky?

I have a project with githooks managed by the husky package. Usually I appreciate the fail-fast nature of the hooks (unsure if set -e is being used like in a shell script) but I ran into an issue today with my own custom function. I am trying to do…
Rosey
  • 739
  • 1
  • 12
  • 27
-1
votes
1 answer

Why do untracked files get committed?

When I type git status, I get the output below. Changes to be committed: (use "git restore --staged ..." to unstage) new file: services/replication/jobs/go.mod new file: services/replication/jobs/go.sum modified: …
Victor Cui
  • 1,393
  • 2
  • 15
  • 35
-1
votes
1 answer

Husky showing Bundler::RubyVersionMismatch error

Recently I tried integrating husky on my application for pre-commit formatting. I am only using rubocop to test the commit but it gives out an error when I try to commit. My package.json { "name": "asdf", "private": true, "husky": { …
meerkat
  • 361
  • 1
  • 3
  • 11
-2
votes
1 answer

I can't make a commit and push

I can't commit and push my code in git. What i do: git add . git commit -m "init commit" What i get: after that nothing works for me, I can't click anything. My package.json "devDependencies": { "husky": "^8.0.2", "lint-staged":…
1 2 3
17
18