/eslint-config-typed-fp

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

Primary LanguageTypeScriptMIT LicenseMIT

eslint-config-typed-fp

Build Status Type Coverage npm Snyk Vulnerabilities for GitHub Repo

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