Husky pre-commit issue

Discussão em 'Angular' iniciado por Andreas Vasd, Novembro 7, 2024.

  1. Andreas Vasd

    Andreas Vasd Guest

    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?

    Continue reading...

Compartilhe esta Página