-
Copy the file
pre-commitfile fromgit-hooksdirectory to.git/hooksinside your project root directory by running the following commandcp git-hooks/pre-commit [PROJECT ROOT DIRECTORY]/.git/hooks/ -
Open the
.git/hooks/pre-commitfile. Update the language in Line number:4. Possible languages are: ruby, javascript, typescript -
Install the linters
- If you are on ruby, run
gem install rubocopcommand - If you are on javascript, then run
npm install -g eslintcommand - If you are on typescript, then run
npm install -g tslintcommand - 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!
Kameshwaran/lint-pre-commit-githook
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|