Overriding a variable declared in an outer scope can strongly impact the readability, and therefore the maintainability, of a piece of code. Further, it could lead maintainers to introduce bugs because they think they're using one variable but are really using another.
function foo() { let x = bar(1); if (x > 0) { let x = bar(2); // Noncompliant console.log(x); } else { console.log("Wrong Value"); } }
function foo() { let x = bar(1); if (x > 0) { let y = bar(2); console.log(y); } else { console.log("Wrong Value"); } }