If you aren't linting your Typescript before pushing your code, you are probably pushing bugs.
As a developer, you want to make sure you are pushing good code that passes tests and doesn't break any builds. One thing that can be done to assist with this is implementing a git pre-push hook.
This hook will run a script before your code is pushed to your version control remote. All you have to do is put it in the correct location. Easy Peasy.
We also have the need to push WIP (Work In Progress) from time to time. The following hook will look at the beginning of your last commit message for
WIP: If the string is found, it wont run the linter.
You have an existing codebase that is tracking a remote and you have a
.git directory in your project.
You also have
eslint installed in your
We are going to create a
pre-push-hook hook that will do all the work for us.
By putting the file
pre-push-hook file in the
.git/hooks/ directory of your project, you will be good to go.
You will need to give the
pre-push-hook execute permissions or it wont run.
chmod +x .git/hooks/pre-push-hook