I've already installed husky and commitlint, but when I make a commit that commitlint should consider invalid, it normally passes as if it wasn't installed.
i have one script that installs husky on package.json
:
{
"name": "frontend",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "cd ../ && husky install ./frontend/.husky"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@commitlint/cli": "^16.2.4",
"@commitlint/config-conventional": "^16.2.4",
"husky": "^8.0.1"
}
}
pre-commit
file inside .husky
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
cd ./frontend && npx commitlint --edit
What should I do? My husky is installed so it should be working fine
alexandreafa,
I got the same issue with yours, package.json file and .git directory are not at the same level. But I found a way to fix it, Step by step.
commit-msg
fixed.
Now you could use
git commit -m "type: xxxx"
to commit it.