Registry / testing / eslint-plugin-lodash

eslint-plugin-lodash

JSON →
library8.0.0jsnpmunverified

ESLint plugin providing Lodash-specific linting rules for ESLint 9+. Version 8.0.0 supports ESM and CJS, automatically detects Lodash imports (require/import), and includes shared rule settings for pragma and version. Major differentiator: first Lodash plugin for ESLint, with rules covering collection method usage, chaining, callbacks, and stylistic preferences. Active maintenance, with configs for recommended, canonical, and Lodash v3.

npm install eslint-plugin-lodash
INSTALL
IMPORT
SIG · ESLINT-PLUGIN-LODA
E
eslint-plugin-lodash
testingjavascriptv8.0.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
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 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

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

plugin
✓ import plugin from 'eslint-plugin-lodash'
✗ const plugin = require('eslint-plugin-lodash')
ESM default export; CJS require() still works for Node <12 but plugin is ESM-only for v8.
recommended config
✓ module.exports = { plugins: ['lodash'], extends: ['plugin:lodash/recommended'] }
✗ module.exports = { plugins: ['eslint-plugin-lodash'], extends: ['eslint-plugin-lodash/recommended'] }
Use shorthand 'lodash' for plugin and 'plugin:lodash/recommended' for config.
canonical config
✓ extends: ['plugin:lodash/canonical']
✗ extends: ['lodash/canonical']
Configs must be prefixed with 'plugin:'. The 'canonical' config assumes a single Lodash object (e.g., '_') without explicit imports.

Shows installation, ESLint config for recommended rules, and examples of rule-triggering code.

// Install: npm install --save-dev eslint eslint-plugin-lodash // .eslintrc.json { "plugins": ["lodash"], "extends": ["plugin:lodash/recommended"], "rules": { "lodash/callback-binding": "error", "lodash/collection-method-value": "warn", "lodash/collection-return": "error", "lodash/no-double-unwrap": "error", "lodash/no-extra-args": "error", "lodash/no-unbound-this": "error", "lodash/unwrap": "error" }, "settings": { "lodash": { "pragma": "_" } } } // Example file import _ from 'lodash'; const arr = [1, 2, 3]; // OK: _.forEach returns undefined, but collection-method-value rule warns _.forEach(arr, item => console.log(item)); // Error: collection-return rule expects return in non-forEach iteratee const doubled = _.map(arr, item => item * 2); // OK, returns value
Debug
Known issues
breakingVersion 2.0.0 changed import detection and removed support for automatic pragma detection in some cases.
fix
Use shared settings with explicit 'pragma' if import detection fails.
affects: >=2.0.0 <8.0.0
breakingESLint 9+ is required; older ESLint versions are not supported.
fix
Upgrade ESLint to >=9.0.0.
affects: >=8.0.0
deprecatedThe 'v3' config may be removed in a future major version.
fix
Migrate to Lodash v4 or use settings.lodash.version = 3.
affects: >=1.0.0
gotchaThe 'canonical' config requires the Lodash object to be assigned to the variable specified in pragma (default '_'), and does not work with imported single methods.
fix
Use the 'recommended' config for mixed usage, or set 'pragma' to your variable name.
affects: >=1.0.0
Errors
Common errors & fixes
ESLint couldn't find the plugin "eslint-plugin-lodash".
Plugin not installed or ESLint config incorrectly references the plugin.
fix
Run 'npm install eslint-plugin-lodash --save-dev' and ensure .eslintrc.json has 'plugins: ["lodash"]'.
Configuration for rule "lodash/collection-return" is invalid: Value "error" is not allowed.
Rule does not exist or is misspelled.
fix
Check the rule name in the official list; ensure it's included in the plugin.
Parsing error: The keyword 'import' is reserved.
ESLint parser does not support ES modules.
fix
Add 'parserOptions: { sourceType: "module" }' to your ESLint config.
Upgrade
Version history
8.0.0latest on npm
Audit
Dependencies
eslintrequiredpeer dependency; requires ESLint >=9.0.0
Agent activity
12 hits · last 30 days
node
10
Amazon
1
Resources
eslint-plugin-lodash — npm install eslint-plugin-lodash · libregistry