Lefthook
Add one command to the pre-commit hook in lefthook.yml, alongside any commands you already have:
yaml
pre-commit:
commands:
stagelint:
run: stagelintThen install the hooks as usual:
sh
lefthook installLeave {staged_files} and stage_fixed out, since stagelint finds the staged files itself and stages what its commands changed.
Do not set parallel: true on a hook that contains stagelint. It hides unstaged changes, writes to the git index and creates a stash ref while it runs, so other commands must not run at the same time.