dsheiko / jscodesniffer

⛔️ [DEPRECATED] Tool to ensure that your JavaScript code does not violate the specified coding standard (Idiomatic Style Manifesto or JQuery Core Style Guidelines)
http://dsheiko.github.io/jscodesniffer/
42 stars 8 forks source link

VariableDeclarationPerScopeConventions -> requireInTheBeginning reports functions without any variables #12

Closed benthemonkey closed 10 years ago

benthemonkey commented 10 years ago

If I set requireInTheBeginning: true, I expected 0 or 1 occurrences of the var keyword as the first line of a function would be accepted. However, jscodesniffer is reporting an error for code like the following (sorry but I had difficulties making a mocha test case):

var noVariables = function(x) {
    return x;
};

Is this a bug or intentional?

dsheiko commented 10 years ago

It was a bug. Pushed changes with the fix to GitHub