eslint-plugin-fp-ts icon indicating copy to clipboard operation
eslint-plugin-fp-ts copied to clipboard

Prefer pipe to nested call expressions

Open OliverJAsh opened this issue 2 years ago • 2 comments

import { pipe } from "fp-ts/function";

declare const a: (n: number) => number;
declare const b: (n: number) => number;
declare const c: (n: number) => number;

// ❌
c(b(a(1)));

// ✅
pipe(1, a, b, c);

OliverJAsh avatar Sep 04 '22 13:09 OliverJAsh

Opinions on?

import { pipe } from "fp-ts/function";

declare const a: (n: number) => number;

// ❌
pipe(1, a);

// ✅
a(1);

mlegenhausen avatar Feb 20 '23 13:02 mlegenhausen

@mlegenhausen I was about to comment the same thing! I'd personally prefer a(1) until a second function is applied, then preferring pipe.

samhh avatar Feb 20 '23 15:02 samhh