Created
August 1, 2013 18:31
-
-
Save justinabrahms/6133950 to your computer and use it in GitHub Desktop.
Small linter using jsl which will detect python-style variable names and complain. Usable as a precommit hook with: git diff --cached --name-only --diff-filter=ACM | grep ".js" | xargs node lint.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var lint = require('jsl') | |
| , linter = lint(); | |
| linter.rule('variable > id', | |
| function (node, subsource, alert) { | |
| var var_name = node.name; | |
| if (var_name.indexOf("_") !== -1) { | |
| alert(node, 'Found variable name with underscores: ' + var_name); | |
| } | |
| }, 'error'); | |
| linter.cli(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment