Skip to content

Instantly share code, notes, and snippets.

@davidwaterston
Created April 6, 2015 10:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidwaterston/7827611bdb103d7e23a0 to your computer and use it in GitHub Desktop.
Save davidwaterston/7827611bdb103d7e23a0 to your computer and use it in GitHub Desktop.
ESLint custom rule: Disallow multiple variables per var declaration (no-multi-vars)
/* global module */
"use strict";
module.exports = function(context) {
function checkVarDeclarations(node) {
var hasMultipleVars = (node.declarations.length > 1);
if (hasMultipleVars) {
context.report(node, node.declarations.length + " variables defined with one var statement");
}
}
return {
"VariableDeclaration": checkVarDeclarations
};
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment