Skip to content

git hooks

bash
pnpm add --save-dev husky
npx husky init
bash
# .husky/pre-commit
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
npm run lint-staged
json
{
  "scripts": {
    "lint-staged": "lint-staged",
  },
  "lint-staged":{
    "*": "prettier --write",
    "*.ts": "eslint --fix",
    "*.{js,jsx}":"eslint"
  }
}