sonarjs/array-callback-without-return
eslint-plugin-sonarjs
No autofixRecommended
eslint.config.js
export default [
{
rules: {
"sonarjs/array-callback-without-return": "error",
},
},
];Callbacks of array methods should have return statements
let arr = ["a", "b", "c"];
let merged = arr.reduce(function(a, b) {
a.concat(b);
}); // Noncompliant: No return statement, will result in TypeErrorlet arr = ["a", "b", "c"];
let merged = arr.reduce(function(a, b) {
return a.concat(b);
}); // merged === "abc"Examples from the ESLint documentation.
sonarjs/array-callback-without-return
eslint-plugin-sonarjs
export default [
{
rules: {
"sonarjs/array-callback-without-return": "error",
},
},
];Oxlint does not have this rule.
Biome does not have this rule.
Assertions should be placed inside test cases or hooks
Arguments to built-in functions should match documented types
Alternatives in regular expressions should be grouped when used with anchors
Async test assertions should be awaited or returned