Andreas Vasd
Andreas Vasd

Reputation: 29

Husky pre-commit issue

In an Angular project I have installed Prettier for formatting and now I'm trying to use Husky for autofixing any formatting issues beofre commiting. I have run the command npx husky init and the directory .husky with the pre-commit file has been created. Into it I have added this command npm run format and the "scripts" of package.json have the following configuration:

    "scripts": {
        "ng": "ng",
        "start": "ng serve",
        "build": "ng build",
        "watch": "ng build --watch --configuration development",
        "test": "ng test",
        "format": "prettier --write \"src/**/*.{ts,html,scss}\"",
        "write-format": "prettier --write 'src/**/*.{ts,js,json,css,scss,html}'",
        "prepare": "husky install"
      },

What else do I have to do so the formatter runs and fixes formatting issues automatically before commiting?

Upvotes: 0

Views: 111

Answers (0)

Related Questions