eslint-config-typed-fp

An opinionated ESLint config to encourage pure(ish), typeful functional programming in TypeScript.

Usage no npm install needed!

<script type="module">
  import eslintConfigTypedFp from 'https://cdn.skypack.dev/eslint-config-typed-fp';
</script>

README

eslint-config-typed-fp

Build Status Type Coverage npm

dependencies Status devDependencies Status peerDependencies Status

An opinionated ESLint config to encourage pure(ish), typeful functional programming in TypeScript.

Installation

yarn add --dev eslint-config-typed-fp \
  @typescript-eslint/eslint-plugin \
  @typescript-eslint/parser \
  eslint \
  eslint-plugin-functional \
  eslint-plugin-total-functions \
  typescript

Usage

  1. Turn on TypeScript's strict mode and noUncheckedIndexedAccess option.
  2. Set up ESLint + TypeScript.
  3. Update your .eslintrc.js:
module.exports = {
+  parser: "@typescript-eslint/parser",
  parserOptions: {
+    project: "./tsconfig.json",
+    ecmaVersion: 2018,
+    sourceType: "module"
  },
  extends: [
+  "typed-fp",
  ...
  ],
  plugins: [
+  "@typescript-eslint",
+  "functional",
+  "total-functions",
  ...
],
  rules: {
    ...
  }
};

What's in the box?

Basically,

See the extends and rules sections in index.ts for the details.

How can I help?

Check out the TODOs in index.ts and of course the issues. Contributions welcome.

Why typed FP?

TypeScript (in)famously considers slavish adherance to type-safety and soundness (at least at the cost of developer ergonomics) a non-goal. With this ESLint config we take the opposite position.

Here's a selection of articles to motivate "why typed FP":

See Also