Skip to content

Latest commit

 

History

History
19 lines (13 loc) · 1.37 KB

README.md

File metadata and controls

19 lines (13 loc) · 1.37 KB

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.