undefinedfix
Sign in

Husky didn't work

tormes edited in Thu, 08 Dec 2022

package.json

  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  },
  "lint-staged": {
    "src/**/*.js": [
      "eslint --fix",
      "git add"
    ]
  },

Then I remove the suffix. Sample in hooks of. Git from commit msgpre commit prepare commit MSG

Next, test commit to estimate the write error

function XXX () {
    lkjdflaksjf  // 乱写的代码
    
    ....
}

But it can still be submitted normally. Why is it not blocked

1 Replies
ecisse
commented on Thu, 08 Dec 2022

Different versions of husky register hooks in different ways. You should use 1. X.x. The new one seems to register a script command precommit