This rule should only be enforced for node.js > 0.12 There is no point in declaring a module as var. Module should always be a const if assigned on the same line as the require statement is. If you want to require module "A" or module "B" into a single variable, it should be done like this:
var aOrB
if (cond) {
aOrB = require('A')
} else {
aOrB = require('B')
}
if you would have do it like this:
var aOrB = require('A')
if (cond) {
aOrB = require('B')
}
That would be bad, because that way you are forcing node to load module "A" even if cond is true.
Thanks for you consideration and please let me know if I forgot some