vue项目添加git提交前验证

cnpm i lint-staged -D
cnpm i pre-commit -D

// package.json script里添加拓展命令
script:{
    ...
    "lint-staged": "lint-staged",
    ....
}


// package.json 添加
 "pre-commit": [
    "lint-staged"
  ],
  "lint-staged": {
    "*.{js,vue}": [
      "vue-cli-service lint --max-warnings 0",
      "git add"
    ]
  }

你可能感兴趣的:(vue项目添加git提交前验证)