Disallows multiple var
declaration (except for-loop).
Types: Boolean
or Object
Values:
true
disallows multiple variable declarations except within a for loopObject
:'strict'
disallows all multiple variable declarations'allExcept'
array of exceptions:'undefined'
allows declarations where all variables are not defined'require'
allows declarations where all variables are importing external modules with require"disallowMultipleVarDecl": true
true
var x = 1;
var y = 2;
for (var i = 0, j = arr.length; i < j; i++) {}
{ strict: true }
var x = 1;
var y = 2;
{ allExcept: ['undefined'] }
var a, b;
var x = 1;
var y = 2;
for (var i = 0, j = arr.length; i < j; i++) {}
{ allExcept: ['require'] }
var a = require('a'),
b = require('b');
var x = 1;
var y = 2;
for (var i = 0, j = arr.length; i < j; i++) {}
var x = 1,
y = 2;
var x, y = 2, z;