Husky hook fail
Closed this issue · 2 comments
Husky hook fail
Hi I followed all the instruction from the following article:
Maybe it could be something pretty simple in the configuration from my side, so I share my files content:
.husky/pre-commit
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npx --no-install lint-staged
package.json
{
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"prepare": "husky install"
},
"devDependencies": {
"axios": "^1.1.2",
"laravel-vite-plugin": "^0.7.5",
"vite": "^4.0.0",
"husky": "^8.0.0"
},
"lint-staged": {
"**/*.php*": [
"vendor/bin/duster lint"
]
}
}
The output on the command line is:
husky - pre-commit hook exited with code 1 (error)
The reference article was missing, but I assume you're referring to this one:
https://tighten.com/insights/announcing-duster-a-laravel-code-linter-and-fixer/
Your dev dependencies should also include lint-staged
.
The line npx husky-init && npm install lint-staged --save-dev
should have installed lint-staged
as well.
Let me know if that works for you.
@driftingly Thanks I was struggling more than necessary with the setup, as you said it requires previously some tools installed... for anyone that has this issues in the future I posted a blogpost about it, but basically just install husky and lint-staged previously in order to make it work:
Link to the blogpost
https://dev.to/arielmejiadev/run-duster-with-husky-in-laravel-5ael