-
Copy the file
pre-commit
file fromgit-hooks
directory to.git/hooks
inside your project root directory by running the following commandcp git-hooks/pre-commit [PROJECT ROOT DIRECTORY]/.git/hooks/
-
Open the
.git/hooks/pre-commit
file. Update the language in Line number:4. Possible languages are: ruby, javascript, typescript -
Install the linters
- If you are on ruby, run
gem install rubocop
command - If you are on javascript, then run
npm install -g eslint
command - If you are on typescript, then run
npm install -g tslint
command - You can skip the linter installation, if you have them already installed.
- If you are on ruby, run
-
Make the file executable by the running the below command.
chmod +x .git/hooks/pre-commit
-
Now, switch to project's root directory and make a tiny commit to check this out!