Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
sonar-javascript rules

XPath rules


undefined should not be assigned


var x = undefined; // bad
var x; // ok
x = undefined; // bad
if (x === undefined) { // ok*
    undefined = x; // totally NOT ok ;)

undefined should not be checked (in favor of == null)


var x = null, y = x;
if (x === undefined) { // bad, falls trough
    x = y;
} else if (x == null) { // ok
    x = y;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.