avoidFilterMapChainDo not chain map(...) directly after filter(...). Combine both operations in a single loop.filter().map() Chainsmall-rules/no-filter-map-chainDisallow map(...) directly after filter(...).
avoidFilterMapChainDo not chain map(...) directly after filter(...). Combine both operations in a single loop.This rule does not accept options.
const baseArray = [1, 2, 3, 4, 5, 6, 7];const array = baseArray .filter((value) => value % 2 === 0) .map((value) => value * 2);const baseArray = [1, 2, 3, 4, 5, 6, 7];const filteredArray = new Array<number>();for (const value of baseArray) { if (value % 2 !== 0) continue; filteredArray.push(value * 2);}