跳到主要内容

lint-staged

安装

npm install --save-dev lint-staged

配置

.lintstagedrc.json
{
"package.json": ["npx prettier --write"],
"*.{js,jsx,less,md,json}": ["prettier --write"],
"*.ts?(x)": ["prettier --parser=typescript --write"]
}
npm pkg set scripts.lint-staged="lint-staged"
echo "npx --no-install lint-staged" >> .husky/pre-commit