danielnixon / eslint-config-typed-fp

An opinionated ESLint config to encourage pure(ish), typeful functional programming in TypeScript.
MIT License
28 stars 3 forks source link

Add an fp-ts strict config #313

Open danielnixon opened 1 year ago

danielnixon commented 1 year ago

For those codebases that have fully embraced fp-ts -- especially including Task and TaskEither, we want to forbid things like creating new promises or including promises in return types.

Not all codebases will be using fp-ts, and not all of those that do will have gone this far. But for those who have, the reminder via linting to not use promises would be valuable.

danielnixon commented 1 year ago

In such codebases, we may want to configure https://eslint.org/docs/latest/rules/no-console to forbid console logging entirely.

  1. It's too easy to log during program construction instead of during interpretation/execution.
  2. fp-ts provides https://gcanti.github.io/fp-ts/modules/Console.ts.html
danielnixon commented 1 year ago

https://github.com/danielnixon/eslint-plugin-total-functions/issues/727

danielnixon commented 1 year ago

We will also want the rule to flag when an IO or a TE or similar type is interpreted. We only want that to happen once "at the end of the world" (where the lint rule can be ignored). If a dev has sprinkled IO or TE execution/interpretation throughout the program, it is an error.

danielnixon commented 1 year ago

https://github.com/danielnixon/eslint-plugin-total-functions/blob/master/src/rules/no-premature-fp-ts-effects.ts takes care of the "at the end of the world" point.

danielnixon commented 1 year ago

Relevant: