menu

unnecessary-filter-map

Disallow filterMap callbacks with a definitely defined result

A filterMap callback with a definitely defined result cannot filter any element. Instead, you SHOULD call map to express the unconditional transformation.

Reported

1function increment(values: int32[]): int32[] {2    return values.filterMap((value) => value + 1);3}

Accepted

1function increment(values: int32[]): int32[] {2    return values.map((value) => value + 1);3}