V
V
Valery Semenenko2021-06-17 18:49:02
Angular
Valery Semenenko, 2021-06-17 18:49:02

Husky - not starting pre-commit?

There is a file like this:

{
  "name": "angular-test-config",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "lint": "ng lint --fix"
  },
  "lint-staged": {
    "*.{js,ts}": [
      "eslint --fix"
    ],
    "*.{html,scss}": [
      "prettier --write"
    ]
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged --relative"
    }
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~12.0.0",
    "@angular/common": "~12.0.0",
    "@angular/compiler": "~12.0.0",
    "@angular/core": "~12.0.0",
    "@angular/forms": "~12.0.0",
    "@angular/platform-browser": "~12.0.0",
    "@angular/platform-browser-dynamic": "~12.0.0",
    "@angular/router": "~12.0.0",
    "rxjs": "~6.6.0",
    "tslib": "^2.1.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~12.0.0",
    "@angular-eslint/builder": "12.1.0",
    "@angular-eslint/eslint-plugin": "12.1.0",
    "@angular-eslint/eslint-plugin-template": "12.1.0",
    "@angular-eslint/schematics": "12.1.0",
    "@angular-eslint/template-parser": "12.1.0",
    "@angular/cli": "~12.0.0",
    "@angular/compiler-cli": "~12.0.0",
    "@types/jasmine": "~3.6.0",
    "@types/node": "^12.11.1",
    "@typescript-eslint/eslint-plugin": "4.23.0",
    "@typescript-eslint/parser": "4.23.0",
    "eslint": "^7.26.0",
    "eslint-config-airbnb-typescript": "^12.3.1",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-import": "^2.23.4",
    "eslint-plugin-jasmine": "^4.1.2",
    "eslint-plugin-prettier": "^3.4.0",
    "husky": "^6.0.0",
    "jasmine-core": "~3.7.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.0.3",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "lint-staged": "^11.0.0",
    "prettier": "^2.3.1",
    "typescript": "~4.2.3"
  }
}


I make changes in any ts-file, make a commit - and the hook does not work; files are committed as usual.
I can't see the reason why.

did the setup step by step, according to this tutorial - "Moving an Angular project to ESLint, with Prettier, Husky and lint-staged"
all steps are successful - except the last one, with husky

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Valery Semenenko, 2021-06-17
@hiperteksto

solution found. in version 6 of husky you need to use configuration files in .husky

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question