pnpm install husky-init
git init
pnpm dlx husky-init ; pnpm install
Other commands to install
npx husky-init ; npm install # npm
npx husky-init ; yarn # Yarn 1
yarn dlx husky-init --yarn2 ; yarn # Yarn 2+
pnpm dlx husky-init ; pnpm install # pnpm
pnpm install lint-staged
pnpm i lint-staged -D
Configure package.json
"lint-staged": {
"*.{js,ts,vue}": [
"eslint --fix"
]
}
Modify the configuration of husky
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
#npm test
#pnpm lint
pnpm lint-staged