Git - Lefthook
安装
- npm
- Yarn
- pnpm
npm install lefthook --save-dev
yarn add lefthook --dev
pnpm add lefthook --save-dev
npm pkg set scripts.prepare="lefthook install"
从 husky 迁移
配置文件
lefthook.yml
pre-commit:
commands:
check:
glob: '*.{js,ts,cjs,mjs,d.cts,d.mts,jsx,tsx,json,jsonc}'
run: npx @biomejs/biome check --no-errors-on-unmatched --files-ignore-unknown=true --colors=off {staged_files}
stylelint:
glob: '*.{css}'
run: stylelint --fix {staged_files}
commit-msg:
commands:
commitlint:
run: pnpm dlx commitlint --edit