Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.0k views
in Technique[技术] by (71.8m points)

vue-cli 生成的项目,commit -m""时没有触发githooks

vue-cli 生成的项目,在vscode使用git commit -m“--”的时候为什么没有触发package.json中的

  "gitHooks": {
    "pre-commit": "lint-staged"
  },
  "lint-staged": {
    "*.{js,jsx,vue}": [
      "vue-cli-service lint",
      "git add"
    ]
  }

这两个命令
下面附图
1、package.json
image.png
2、vue.config.js
image.png
3、eslintrc.js
image.png

4、.git/hooks
image.png


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

你看一眼你项目目录下的 .git/hooks/ 目录下面有这些定义好的钩子脚本么?

vue-cli 是用 yorkie 这个库帮你生成一些 .git/hooks/ 钩子脚本,但你要是自己动过 .git 目录(比如重新执行了 git init 之类的),那就没用了。


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...