2021年
有时钩子不是添加的,所以你需要使用一个简单的简单的黑客来添加它。husky
在安装赫斯基之后,您需要首先卸载赫斯基,因为它可以确保您的钩子正确安装,之后安装最新版本,以便您获得最新的更新。V4
husky
断续器
npm uninstall husky
npm install -D husky@4
npm install -D husky
纱
yarn remove husky
yarn add -D husky@4
yarn add -D husky
如果有时上面的技巧不起作用,那么让我们将钩子添加到哈士奇中,下面的提及方法仅用于,我正在展示与示例。V6
husky
lint-staged
断续器
npm install -D husky
npm set-script prepare "husky install" && npm run prepare
npx husky add .husky/pre-commit "npx lint-staged"
git commit -m "added husky and lint-stagged" // here you will notice the lint-staged checking the files with help of husky
纱
yarn add -D husky
npm set-script prepare "husky install" && yarn prepare
npx husky add .husky/pre-commit "yarn lint-staged"
git commit -m "added husky and lint-stagged" // here you will notice the lint-staged checking the files with help of husky