I have a React project named x-y-z
which has a private remote repo.
Inside this project, I have another project named a-b-c
which is a git submodule
.
I am using Husky: v6.0.0 and have set up a pre-commit
hook.
The pre-commit
hook is working fine for the parent project (x-y-z
), but it is not working for the submodule project (a-b-c
).
I cannot figure out anything. Can anyone please suggest a workaround?
pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm run pre-commit
pre-commit script
"pre-commit": "lint-staged",
lint-staged config
module.exports = {
'*.(js|jsx)': ['npm run prettify', 'npm run lint'],
'*.(html|css|scss|json)': ['npm run prettify'],
};
Submodules are separate repositories, hooks in the superproject don't work in submodules. You need to install and configure the hook into all the submodules where you want the hook to work.