eslint-plugin-fp-ts
eslint-plugin-fp-ts copied to clipboard
ESLint rules for fp-ts
While a widen function can be useful for times where the return value isnt cared about, there are ways to avoid needing widen functions at all with a bit of...
Depends on https://github.com/buildo/eslint-plugin-fp-ts/pull/224 Closes https://github.com/buildo/eslint-plugin-fp-ts/issues/221 cc @gabro
Same as [`no-redundant-flow`](https://github.com/buildo/eslint-plugin-fp-ts/pull/10) but for `pipe` instead of `flow`. Example of incorrect code: ```ts const x = pipe(1); ```
```ts T.map(one), T.map(two), ``` and ```ts T.map(one), T.chain(two), ``` can become ```ts T.map(flow( one, two, )), ``` and ```ts T.chain(flow( one, two, )), ``` respectively to avoid working in the...
A `bind`/`bindW` that takes no input can be an `apS`/`apSW`. There's also some ordering optimisation but sounds pretty tricky. [Examples](https://github.com/sciety/sciety/commit/06d6c51dd3d9ada14a89e6e5344f6425ab349b07)
`T.map(E.fold(` can be replaced with `TE.match`. Likewise, `TE.fold`/`TE.matchE` can also be `TE.match` if they're a pipe that lifts them into a `Task` at the end. (We used the former to...
`T.map(E.chain(` and `T.map(E.chainW(` can be `TE.chainEitherK` and `TE.chainEitherKW` respectively. Likewise, `TE.chainW(flow([...], TE.rightTask))` can be `TE.chainTaskK([...])`. [Example](https://github.com/sciety/sciety/commit/ace28b0610de4a7216ef74c22f5b5b13df2ffbda) ([Another example](https://github.com/sciety/sciety/commit/5f635296f2118930fb481c2f5a074639b1e8bcf4)) ([More examples](https://github.com/sciety/sciety/commit/073be01392e366dafbb000fb3de47ee94cd1ef57))
(This issue probably deserves a better name.) fp-ts 2.10 includes `TaskOption`, which can replace usage of nesting an `Option` in `Task`. The same also applies with `TaskEither` etc. [Real examples](https://github.com/sciety/sciety/commit/66ab1f1c75ea1b6807a26db8c5a7e5a714114fd6)
`E.fold(identity, identity)` (and variants) can be replaced with `E.union` released in fp-ts 2.10. [Real example](https://github.com/sciety/sciety/commit/0953010cebdb629fb3665a1bccd167964a60e3d0)