1. eslint-config-typed-fp
An opinionated ESLint config to encourage pure(ish), typeful functional programming in TypeScript.
eslint-config-typed-fp
Package: eslint-config-typed-fp
Created by: danielnixon
Last modified: Wed, 03 Jan 2024 22:57:22 GMT
Version: 5.4.0
License: MIT
Downloads: 2,692
Repository: https://github.com/danielnixon/eslint-config-typed-fp

Install

npm install eslint-config-typed-fp
yarn add eslint-config-typed-fp

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

  • TypeScript for Functional Programmers
  • Typed functional programming in TypeScript (fp-ts)
  • https://github.com/danielnixon/eslint-plugin-total-functions
  • https://github.com/agiledigital/readonly-types
  • https://github.com/eslint-functional/eslint-plugin-functional
  • https://github.com/gcanti/fp-ts
  • https://github.com/plantain-00/type-coverage (and its strict mode)
  • https://github.com/immutable-js/immutable-js
  • https://github.com/uhyo/better-typescript-lib

RELATED POST

10 Must-Know Windows Shortcuts That Will Save You Time

10 Must-Know Windows Shortcuts That Will Save You Time

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Arrays vs Linked Lists: Which is Better for Memory Management in Data Structures?

Navigating AWS Networking: Essential Hacks for Smooth Operation

Navigating AWS Networking: Essential Hacks for Smooth Operation

Achieving Stunning Visuals with Unity's Global Illumination

Achieving Stunning Visuals with Unity's Global Illumination

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code

Nim's Hidden Gems: Lesser-known Features for Writing Efficient Code