Created
April 6, 2015 10:47
-
-
Save davidwaterston/7827611bdb103d7e23a0 to your computer and use it in GitHub Desktop.
ESLint custom rule: Disallow multiple variables per var declaration (no-multi-vars)
This file contains 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
/* 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