eslint-plugin-fp-ts
eslint-plugin-fp-ts copied to clipboard
Prefer flow to multiple maps and chains
T.map(one),
T.map(two),
and
T.map(one),
T.chain(two),
can become
T.map(flow(
one,
two,
)),
and
T.chain(flow(
one,
two,
)),
respectively to avoid working in the Task (applies to other categories too).
This applies to 1..n map
optionally followed by a chain
(where the total number is at least 2).
Probably a bit thorny to catch these cases, but can help readability.
👍
This also makes it easier to extract a function, e.g. to convert from
T.map(flow(
one,
two,
)),
to
const fn = flow(
one,
two,
);
T.map(fn),