sonarjs/arguments-usage
eslint-plugin-sonarjs
No autofix
eslint.config.js
export default [
{
rules: {
"sonarjs/arguments-usage": "error",
},
},
];function concatenate() {
let args = Array.prototype.slice.call(arguments); // Noncompliant
return args.join(', ');
}
function doSomething(isTrue) {
var args = Array.prototype.slice.call(arguments, 1); // Noncompliant
if (!isTrue) {
for (var arg of args) {
...
}
}
}function concatenate(...args) {
return args.join(', ');
}
function doSomething(isTrue, ...values) {
if (!isTrue) {
for (var value of values) {
...
}
}
}Examples from the ESLint documentation.
No tracked preset enables this rule, so it has no reach yet.
None of the tracked presets enable this rule. Turn it on with the config below.
sonarjs/arguments-usage
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/arguments-usage": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Braces and parentheses should be used consistently with arrow functions
IAM policies should not grant access to all account resources
Optional boolean parameters should have default value
Class methods should be used instead of "prototype" assignments