Skip to content

Instantly share code, notes, and snippets.

@justinabrahms
Created August 1, 2013 18:31
Show Gist options
  • Select an option

  • Save justinabrahms/6133950 to your computer and use it in GitHub Desktop.

Select an option

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
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