Prettier
1,初始化
npm install --save-dev --save-exact prettier
2,创建.prettierrc文件
node --eval "fs.writeFileSync('.prettierrc','{}\n')"
3,创建.prettierignore文件
# Ignore artifacts: build coverage
4,兼容eslint,安装eslint-config-prettier
5,git hook,安装husky lint-staged
npm install --save-dev husky lint-staged npx husky init node --eval "fs.writeFileSync('.husky/pre-commit','npx lint-staged\n')"
6,在package.json添加如下代码
{ "lint-staged": { "**/*": "prettier --write --ignore-unknown" } }
pre-commit
1,安装
npx mrm@2 lint-staged标签:配置,--,lint,staged,Prettier,husky,save From: https://www.cnblogs.com/sonwrain/p/18184724