规范格式化github

统一standard代码风格

  1. yarn add standard --dev

package.json中加入相关基础配置

  1. scripts:{
  2. "code-fix": "standard --fix",
  3. },
  4. "standard": {
  5. "ignore": [
  6. "/src/utils/",
  7. "/src/plugins/",
  8. "node_modules/"
  9. ],
  10. "globals": [
  11. "window",
  12. "localStorage"
  13. ]
  14. },

husky工具包-githooks

  1. npm install husky --save-dev
  2. //
  3. yarn add husky --dev

使用配置

  1. npm set-script prepare "husky install"
  2. npm run prepare
  1. npx husky add .husky/pre-commit "npm run code-fix"
  2. git add .husky/pre-commit