sonarjs/no-unused-collection
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/no-unused-collection": "error",
},
},
];function getLength(a, b, c) {
const strings = []; // Noncompliant
strings.push(a);
strings.push(b);
strings.push(c);
return a.length + b.length + c.length;
}function getLength(a, b, c) {
return a.length + b.length + c.length;
}Examples from the ESLint documentation.
sonarjs/no-unused-collection
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/no-unused-collection": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Errors should not be created without being thrown
Unused local variables and functions should be removed
JSX list components keys should match up between renders
The return value of void functions should not be used
Multiline blocks should be enclosed in curly braces