How can I give a file as an input to the precommit hook in angular

50 views Asked by At

There has been some incidence where I have committed some file with 'fdescribe' and 'fit' and the build failed. A lot of time gets wasted on this.
I want that I should not even be allowed to commit the file in this case. I see we can use precommit hooks using husky, but it only tells that we can only specify some commands as below.

"husky": {  
   "hooks": 
       {
          "pre-commit": "ng lint && lint-staged",
          "pre-push": "ng build --prod"   
       }
   }

Is there any way where I can write the code to identify these words such as 'fdescribe' and 'fit' in a file and get this file executed at the time of commit. So it can notify me at this stage only.
Or is there any other way to define precommit hooks without even using husky.

0

There are 0 answers