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

Husky and lint-staged unable to run gulp command

Am trying to run gulp commands from package.json. But unable to execute. This is my package.json. "scripts": { "deploy": "gulp deploy", "lint": "eslint", "lint-fix": "eslint --ext .js" }, "husky": { "hooks": { …
Prashanth Harish
  • 158
  • 1
  • 1
  • 17
0
votes
1 answer

Husky not getting triggered on git events

I have created a react app which implements husky to capture lint errors: Environment git version 2.21.0 (Apple Git-122), node v8.16.2, npm v6.4.1 Lint implementation Created a react using npx create-react-app my-app-name Implemented eslint using…
Zameer Ansari
  • 28,977
  • 24
  • 140
  • 219
0
votes
1 answer

GIT: How to trigger an npm script, after git push of particular file in the remote branch?

I have a requirement that once I push a csv file to remote branch, it should call an npm script to process the data from CSV file. Please advice which would be the best way to do this.
Narasimhan
  • 73
  • 1
  • 7
0
votes
0 answers

How to catch unused variables with husky precommit

In my react/typescript project, I used no-unused-variable rule with tslint. So if there are no unused variables or imports it will block the commit. Now it says that, it has been deprecated and use noUnusedLocals and **noUnusedParameters* in…
Shashika Virajh
  • 8,497
  • 17
  • 59
  • 103
0
votes
1 answer

Git pre-push configuration with condition

We have both the server and client parts of the project in our project directory. Structure looks like project/ |_java_server/ |_react_ui/ |_README.md |_... On the project we enabled the git pre-push script with the husky library. The pre-push…
torokhkun
  • 49
  • 1
  • 6
0
votes
1 answer

Running npm install .nvmrc gets populated with seemingly random node version

Running npm install from my project creates an .nvmrc file under ./node_modules/sockjs-client/.nvmrc which points to 6.14.2. Some information about my local installation: nvm --version: 0.34.0 npm --version: 6.4.1 node --version: v11.3.0 nvm ls ->…
Niko
  • 616
  • 4
  • 20
0
votes
1 answer

Yorkie git hooks always fail with "not found"

I am using yorkie 2.0.0, and cannot run any custom shell scripts in my git hooks. My directory structure looks like this: |-- .githooks | |-- commit-msg | |-- package.json |-- .git | |-- hooks | | |--
Daniel Smedema
  • 919
  • 8
  • 15
0
votes
2 answers

Precommit hook not triggering even after failures

"scripts": { "precommit": "pretty-quick --staged & npm run lint & npm run test", "lint": "eslint 'src/**/*.{js,jsx}' --quiet --fix", "test": "cross-env CI=true react-scripts test --env=jsdom --coverage" } Even after the failure of lint,…
Mithun Shreevatsa
  • 3,588
  • 9
  • 50
  • 95
0
votes
1 answer

Eslint precommit husky hook is not working as expected in create-react-app project

Here's my configuration package.json { "name": "hello-world", "version": "0.1.0", "private": true, "dependencies": { "react": "^16.8.6", "react-dom": "^16.8.6", "react-scripts": "3.0.1" }, "scripts":…
Nobody
  • 397
  • 1
  • 5
  • 25
0
votes
0 answers

lint-staged fails with "npm could not be found. Try `npm install npm`."

I have lint-staged installed in a multi-package repository. The structure is: |-- package.json |-- package-one |-- package.json |-- javascript |-- package-two |-- package.json |-- javascript I have the same setup in a different repo on…
glenrothes
  • 1,543
  • 1
  • 14
  • 17
0
votes
1 answer

Why does `git` commands fail when run as part of a git hook in a subfolder?

We recently moved a Node project into a subfolder of a mono-repo, and after that our commit hooks (installed using Husky) started failing due to being executed in the wrong directory: { Error: Command failed: git rev-parse HEAD fatal: not a git…
oligofren
  • 20,744
  • 16
  • 93
  • 180
0
votes
1 answer

How to create custom husky hook? (node.js/package.json)

How to create custom husky hook? I would like to do something like this: // package.json ... husky: { "pre-commit": "node customHook.js" }, ... How to get access to the commit params from the customHook.js file? P.S. I found almost the same…
Roman Mahotskyi
  • 4,576
  • 5
  • 35
  • 68
0
votes
1 answer

Sort json-file precommit with husky

I want to sort file in alphabetic before commit. package.json: "scripts": { ...., "sort": "sort-json ./app/locales/de.json", ...... }, "husky": { "hooks": { "pre-commit": "npm run sort && npm run eslint", …
0
votes
1 answer

GIT (HUSKY): exit code when a file is being committed?

is there a way to check if a file is being committed and exit with an error ? I have a file in git that needs to be there but should never be modified and i was hoping to use husky as a pre-commit - so if anybody tries to modify the file and commit…
Mark Smith
  • 437
  • 1
  • 6
  • 11
0
votes
1 answer

Multiple branch push issue - prepush Git Hooks using Husky

My problem is quiet simple: I'm using Husky to deal with git hooks I have configured a prepush hooks that run 2 scripts: "prepush": "npm-run-all --parallel lint test" It's working correctly on single push But when I try to push to 2 branches or…
G. Frx
  • 2,350
  • 3
  • 19
  • 31
1 2 3
17
18