typicode / husky

Git hooks made easy 🐶 woof!
https://typicode.github.io/husky
MIT License
32.41k stars 1.02k forks source link

Husky doens't working #947

Closed kallebenunes closed 3 years ago

kallebenunes commented 3 years ago

I was to configure a .huskyrc file, but the pre-commit is not running.

This is the packgage.json


  "name": "clean-react",
  "version": "1.0.0",
  "description": "Developed application in udemy course about clean architeture with ReactJs",
  "main": "index.js",
  "author": "Kallebe Nunes <kallebenm@gmail.com>",
  "license": "MIT",
  "scripts": {
    "test": "jest --passWithNoTests",
    "test:watch": "npm test -- --watch",
    "test:staged": "npm test -- --findRelatedTests",
    "test:ci": "npm test -- --coverage"
  },
  "husky": {
    "hooks": {
      "pre-commit": "npm test",
      "pre-push": "npm test"
    }
  },
  "dependencies": {},
  "devDependencies": {
    "@types/faker": "^5.5.1",
    "@types/jest": "^26.0.22",
    "@types/node": "^14.14.37",
    "@typescript-eslint/eslint-plugin": "^4.21.0",
    "@typescript-eslint/parser": "^4.21.0",
    "eslint": "^7.23.0",
    "eslint-config-standard": "^16.0.2",
    "eslint-config-standard-with-typescript": "^20.0.0",
    "eslint-plugin-import": "^2.22.1",
    "eslint-plugin-node": "^11.1.0",
    "eslint-plugin-promise": "^4.3.1",
    "eslint-plugin-react": "^7.23.1",
    "eslint-plugin-standard": "^5.0.0",
    "faker": "^5.5.3",
    "git-commit-msg-linter": "^3.1.0",
    "husky": "^6.0.0",
    "jest": "^26.6.3",
    "lint-staged": "^10.5.4",
    "ts-jest": "^26.5.4",
    "typescript": "^4.2.3"
  }
}

This is the .huskyrc:

{
   "hooks": {
       "pre-commit": "lint-staged",
       "pre-push": "npm run test:ci"
   }
}
Sufiane commented 3 years ago

this kind of configuration only works with husky v4, here you have husky v6 installed.

You no longer need configuration in your package.json but in the .husky folder, see the migration for more details: https://typicode.github.io/husky/#/?id=migrate-from-v4-to-v6

kallebenunes commented 3 years ago

Thanks man !