admin管理员组

文章数量:1287505

I created an empty git project and then added a git hook to auto-format my code using prettier when code is commited. I followed the prettier docs and the hook works, however it's very slow. Taking something like 5 seconds when only one file was committed. I've uploaded a short video demonstrating this.

From the husky docs it looks like the hook should run much faster.

Have I set it up wrong?

Here is content of the package.json file if that helps.

{
  "devDependencies": {
    "prettier": "^3.5.1"
  },
  "lint-staged": {
    "*.{js,css,md}": "prettier --write"
  },
  "scripts": {
    "prepare": "husky install"
  }
}

本文标签: githooksGit hook using lintstaged is very slowStack Overflow