Registry / testing / eslint-plugin-lodash-fp

eslint-plugin-lodash-fp

JSON →
library2.2.0-a1jsnpmunverified

An ESLint plugin providing rules specifically for lodash/fp, the functional programming variant of Lodash. The current stable version is 2.2.0-alpha1 (pre-release) and targets ESLint >=3. It helps enforce FP best practices such as currying, data-last argument order, and composition, and prevents usage of impure or chain-based patterns. It offers over 20 rules, including `use-fp` to enforce lodash/fp over lodash, `no-chain` to forbid `_.chain`, and `prefer-constant` to replace arrow functions returning literals. It distinguishes itself from general Lodash linting by focusing on the FP paradigm and catching subtle issues like extraneous arguments and unused results.

testingdevops
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESLint automatically resolves 'eslint-plugin-' prefix when specifying plugin name in .eslintrc.

plugins: ['lodash-fp']

The plugin assumes you are using lodash/fp, not lodash. Use 'lodash/fp' import to match rules like `use-fp`.

import _ from 'lodash/fp';

For CommonJS, require the fp submodule. The plugin's `use-fp` rule will flag require('lodash').

const _ = require('lodash/fp');

Basic setup and a rule violation example: shows installation, configuration in .eslintrc.json, and how no-chain catches _.chain usage.

// Install: npm install --save-dev eslint eslint-plugin-lodash-fp // .eslintrc.json { "plugins": ["lodash-fp"], "rules": { "lodash-fp/consistent-name": ["error", "_"], "lodash-fp/no-chain": "error", "lodash-fp/prefer-compact": "error", "lodash-fp/use-fp": "error" } } // Example code that triggers no-chain: // _.chain([1,2,3]).map(x => x * 2).value(); // ❌ Error: Unexpected _.chain // Correct FP: compose or use lodash/fp directly import _ from 'lodash/fp'; const result = _.map(x => x * 2, [1, 2, 3]); // ✅
Debug
Known footguns
deprecatedRule 'no-extraneous-function-wrapping' may produce false positives for complex expressions.
gotchaRules assume lodash/fp is imported. If you use both lodash and lodash/fp, some rules may misbehave.
deprecatedThe 'no-extraneous-partials' rule can be too restrictive and may flag valid currying patterns.
breakingVersion 2.0.0 changed some rule defaults: 'no-chain' became error by default.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
9 hits · last 30 days
gptbot
4
ahrefsbot
4
script
1
Resources