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

Github Desktop commit not working with husky prehook

I installed husky and set up a prehook, which works in the CLI. However, when I try to commit in the Github desktop, the "committing to..." button is loading forever. For context, .git file is located one level higher than…
Jaeeun Lee
  • 3,056
  • 11
  • 40
  • 60
0
votes
1 answer

Run ESLint during commit on Angular projects

I configured Eslint on an Angular project to check the code during commits. I made an error on purpouse to test if my configuration works: I set the rule "no-console":"error" and I left a console.log() inside the code. When committing ESLint gives…
Matt
  • 265
  • 4
  • 17
0
votes
1 answer

react native eslint pre-commit does not work

I want to enforce eslint rules before commit and I have configured pre-commit in react-native package.js file but it is not showing eslint error on commit. if I run yar run lint works fine. Below is my Package.js file { "name": "test", …
Nitin
  • 7,455
  • 2
  • 32
  • 51
0
votes
1 answer

husky pre-commit hook for 'test' does not finish

Hi i installed husky & lint-stage so as to have pre-commit hooks for lint & tests, for the staged files. The pre-commit hook works, when i go to git commit -m 'something', and the commands are triggered. What i have so far in terms of files…
Theo Itzaris
  • 4,321
  • 3
  • 37
  • 68
0
votes
1 answer

.NET Core solution projects and husky v6 installation

I'd like to migrate husky from v4 to v6. As it says in the installation guide: Another case you may be in is if your package.json file and .git directory are not at the same level. [...] By design, husky install must be run in the same directory as…
0
votes
1 answer

Escape hatch for husky v6?

I've recently installed husky v6 - and I love it. But sometimes I would like to avoid running it - is there some argument that provides an escape hatch?
Paul Razvan Berg
  • 16,949
  • 9
  • 76
  • 114
0
votes
1 answer

Jest and Commitizen: Commit works even if tests fail

I am currently using Jest, Husky, Commitizen, and Vuepress. However, when jest tests or the build fails, the commit hook still works. How can I fix this to exit the commitizen hook when things fail? Here is the relevant lines in package.json: { …
Staghouse
  • 167
  • 12
0
votes
1 answer

Commit doesn't happen

I set up husky to do pre-commit formatting and run tests. When i do git commit -m "readme fix" I got this: PASS src/App.test.jsx ✓ plug (15 ms) Test Suites: 1 passed, 1 total Tests: 1 passed, 1 total Snapshots: 0 total Time: 0.91…
Phelizer
  • 309
  • 2
  • 17
0
votes
1 answer

Edit package version on gitlab with husky on merge request

I want to edit my package version when I make a merge on Gitlab. I try with Husky like that but it's not working. { "hooks":{ "pre-commit": "npm run lint:fix", "post-merge": "(git-branch-is staging && npm version minor ||…
Monsieur Sam
  • 333
  • 1
  • 6
  • 20
0
votes
0 answers

React-bootstrap not installing due to husky error

I am trying to install react-bootstrap. Yesterday I managed to successfully install react-bootstrap but I then later uninstalled it. Today I tried to reinstall it in the same project but it gives me the bellow errors. I then created a new react app…
Noah Gwynn
  • 256
  • 2
  • 12
0
votes
2 answers

npm ERR! code EJSONPARSE npm install with husky and lint-staged

My package.json works without husky and lint-staged but not with them. It's saying: npm ERR! code EJSONPARSE npm ERR! file C:\Proyectos\my-app\package.json npm ERR! JSON.parse Failed to parse json npm ERR! JSON.parse Unexpected token ​ in JSON at…
Carlos
  • 5
  • 3
0
votes
1 answer

GITHook Husky Angular

In our angular application we want to run "ng test" before we push the code to GIT. So do this we integrated with husky for GIT hook. { "hooks": { "pre-push": "npm run git-hook" } } In package.json, below is mentioned "git-hook": "npm run…
Kiran
  • 1
  • 1
0
votes
1 answer

Check code quality on CI server using Husky and/or Lint-Staged

In the Python world, it's common to use pre-commit, which provides a git commit hook, and then on your CI server you can run pre-commit run --all-files which will ignore the commit and run the linting tools on all files. This ensures that, for…
Migwell
  • 18,631
  • 21
  • 91
  • 160
0
votes
0 answers

Protect deleting/renaming file in git repository

Is it possible to have one or more files in a git repository that can be changed but not deleted or renamed? The use case is about a repository setup where multiple env files can only be tweaked by developers but prevent them to accidentally delete…
kuus
  • 453
  • 1
  • 5
  • 15
0
votes
1 answer

How to prepend partial branch name to git commit with husky

I have a functional commit-msg git hook that takes the string from beginning up to the first underscore from a git branch's name and prepends it to the commit message. For better understanding: The branch name is JIRA-123_fix_problem, the commit…
RSeidelsohn
  • 1,149
  • 18
  • 33