array-callback-return
Configuration
rslint.config.ts
Rule Details
Enforces return statements in callbacks of array methods such as map, filter, find, findIndex, findLast, findLastIndex, every, some, reduce, reduceRight, flatMap, sort, toSorted, and Array.from. Callbacks for these methods must return a value; otherwise, the code likely contains a mistake.
Options
allowImplicit(default:false): When set totrue, allows callbacks to implicitly returnundefinedby usingreturn;without a value.checkForEach(default:false): When set totrue, also checks thatforEachcallbacks do not return a value.allowVoid(default:false): When set totruealong withcheckForEach, allowsforEachcallbacks to returnvoidexpressions (e.g.,void bar(x)).
Examples of incorrect code for this rule:
Examples of correct code for this rule: