Skip to content

Pre-push git hook to make sure JS code is linted before being pushed to a repository

Notifications You must be signed in to change notification settings

vincentbello/lint-enforcer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 

Repository files navigation

To use the lint enforcer pre-commit git hook:

Install the hook

To install the hook, run these two commands inside your repository:
curl https://raw.githubusercontent.com/vincentbello/lint-enforcer/master/pre-push -o ".git/hooks/pre-push"
chmod +x .git/hooks/pre-push

When you push to GitHub: If the JS files validate with JSHint and the Google Closure Linter, then the push will occur. If not, the hook will prevent the push and display the errors that must be fixed.

Ignore files/directories

If you want the two linters to ignore files/directories, put the file names in .jshintignore, with one file name per line. You may access the file with command open .jshintignore from inside your repository.

How the linters ignore files

- JSHint naturally ignores files in .jshintignore (one filename per line). - For GCL to ignore files, you need to add -x ignored1.js,ignored2.js ( -x followed by a list of comma-separated file names) to the gjslint -r . command. The hook gets the contents from .jshintignore, parses the file names to comma-separated values, and feeds them into the gjslint command. Therefore, the user only has to put the names of the files to ignore in .jshintignore, with one filename per line, and the hook skips them with both linters.

About

Pre-push git hook to make sure JS code is linted before being pushed to a repository

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages