sonarjs/no-globals-shadowing
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-globals-shadowing": "error",
},
},
];Special identifiers should not be bound or assigned
eval = 17; // Noncompliant
arguments++; // Noncompliant
++eval; // Noncompliant
var obj = { set p(arguments) { } }; // Noncompliant
var eval; // Noncompliant
try { } catch (arguments) { } // Noncompliant
function x(eval) { } // Noncompliant
function arguments() { } // Noncompliant
var y = function eval() { }; // Noncompliant
var f = new Function("arguments", "return 17;"); // Noncompliant
function fun() {
if (arguments.length == 0) { // Compliant
// do something
}
}result = 17;
args++;
++result;
var obj = { set p(arg) { } };
var result;
try { } catch (args) { }
function x(arg) { }
function args() { }
var y = function fun() { };
var f = new Function("args", "return 17;");
function fun() {
if (arguments.length == 0) {
// do something
}
}Examples from the ESLint documentation.
sonarjs/no-globals-shadowing
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-globals-shadowing": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Boolean expressions should not be gratuitous
Forced browser interactions should not bypass actionability checks
Floating point numbers should not be tested for equality