eslint-plugin-fp
raw JSON → 2.3.0 verified Sat Apr 25 auth: no javascript maintenance
ESLint plugin with 18 rules enforcing functional programming style in JavaScript. Version 2.3.0 is the latest (2017), with no new releases since. It forbids imperative constructs like loops, mutation, classes, this, and null. Differentiates from eslint-plugin-functional by broader rule set and stricter defaults. Works with ESLint >=3 and Node >=4.
Common errors
error ESLint couldn't find the plugin "eslint-plugin-fp". ↓
cause Plugin not installed or not properly referenced in plugins array.
fix
Run npm install --save-dev eslint-plugin-fp and ensure it's listed in plugins: ["fp"].
error Definition for rule 'fp/no-let' was not found. ↓
cause Rule name misspelled or plugin not loaded.
fix
Check that plugin is in plugins array and rule name is exactly 'fp/no-let'.
error Configuration for rule "fp/no-mutation" is invalid. ↓
cause Rule configuration uses wrong format.
fix
Use 'error' or ['error', options] not just options.
Warnings
deprecated Plugin is no longer actively maintained; last release 2017. ↓
fix Consider eslint-plugin-functional or eslint-plugin-ramda for maintained alternatives.
gotcha Rules are very strict and may conflict with common patterns like array methods (mutating methods rule flags .sort, .reverse). ↓
fix Use only functional array methods and avoid mutating methods.
gotcha The no-nil rule forbids both null and undefined, which can break code relying on undefined checks. ↓
fix Use Maybe/Option patterns or disable the rule.
Install
npm install eslint-plugin-fp yarn add eslint-plugin-fp pnpm add eslint-plugin-fp Imports
- recommended config wrong
extends: 'eslint-plugin-fp/recommended'correctextends: ['plugin:fp/recommended'] - rules wrong
const fpPlugin = require('eslint-plugin-fp')correctimport from ESLint config; require('eslint-plugin-fp') is not needed directly - single rules wrong
rules: { 'no-let': 'error' }correctrules: { 'fp/no-let': 'error' }
Quickstart
// Install: npm install --save-dev eslint eslint-plugin-fp
// .eslintrc.json
{
"plugins": ["fp"],
"extends": "plugin:fp/recommended",
"rules": {
"fp/no-let": "error",
"fp/no-loops": "error",
"fp/no-mutation": "error"
}
}