{"id":19825,"library":"eslint-plugin-lodash","title":"eslint-plugin-lodash","description":"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.","status":"active","version":"8.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/idok/eslint-plugin-lodash","tags":["javascript","eslint","eslint-plugin","eslintplugin","lodash"],"install":[{"cmd":"npm install eslint-plugin-lodash","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-lodash","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-lodash","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; requires ESLint >=9.0.0","package":"eslint","optional":false}],"imports":[{"note":"ESM default export; CJS require() still works for Node <12 but plugin is ESM-only for v8.","wrong":"const plugin = require('eslint-plugin-lodash')","symbol":"plugin","correct":"import plugin from 'eslint-plugin-lodash'"},{"note":"Use shorthand 'lodash' for plugin and 'plugin:lodash/recommended' for config.","wrong":"module.exports = { plugins: ['eslint-plugin-lodash'], extends: ['eslint-plugin-lodash/recommended'] }","symbol":"recommended config","correct":"module.exports = { plugins: ['lodash'], extends: ['plugin:lodash/recommended'] }"},{"note":"Configs must be prefixed with 'plugin:'. The 'canonical' config assumes a single Lodash object (e.g., '_') without explicit imports.","wrong":"extends: ['lodash/canonical']","symbol":"canonical config","correct":"extends: ['plugin:lodash/canonical']"}],"quickstart":{"code":"// Install: npm install --save-dev eslint eslint-plugin-lodash\n\n// .eslintrc.json\n{\n  \"plugins\": [\"lodash\"],\n  \"extends\": [\"plugin:lodash/recommended\"],\n  \"rules\": {\n    \"lodash/callback-binding\": \"error\",\n    \"lodash/collection-method-value\": \"warn\",\n    \"lodash/collection-return\": \"error\",\n    \"lodash/no-double-unwrap\": \"error\",\n    \"lodash/no-extra-args\": \"error\",\n    \"lodash/no-unbound-this\": \"error\",\n    \"lodash/unwrap\": \"error\"\n  },\n  \"settings\": {\n    \"lodash\": {\n      \"pragma\": \"_\"\n    }\n  }\n}\n\n// Example file\nimport _ from 'lodash';\n\nconst arr = [1, 2, 3];\n// OK: _.forEach returns undefined, but collection-method-value rule warns\n_.forEach(arr, item => console.log(item));\n\n// Error: collection-return rule expects return in non-forEach iteratee\nconst doubled = _.map(arr, item => item * 2); // OK, returns value","lang":"javascript","description":"Shows installation, ESLint config for recommended rules, and examples of rule-triggering code."},"warnings":[{"fix":"Use shared settings with explicit 'pragma' if import detection fails.","message":"Version 2.0.0 changed import detection and removed support for automatic pragma detection in some cases.","severity":"breaking","affected_versions":">=2.0.0 <8.0.0"},{"fix":"Upgrade ESLint to >=9.0.0.","message":"ESLint 9+ is required; older ESLint versions are not supported.","severity":"breaking","affected_versions":">=8.0.0"},{"fix":"Migrate to Lodash v4 or use settings.lodash.version = 3.","message":"The 'v3' config may be removed in a future major version.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use the 'recommended' config for mixed usage, or set 'pragma' to your variable name.","message":"The 'canonical' config requires the Lodash object to be assigned to the variable specified in pragma (default '_'), and does not work with imported single methods.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'8.0.0':17 '9':15 'activ':54 'automat':22 'callback':50 'canon':60 'chain':49 'cjs':21 'collect':46 'config':57 'cover':45 'detect':23 'differenti':37 'eslint':2,5,14,42,65,67 'eslint-plugin':66 'eslint-plugin-lodash':1 'eslintplugin':69 'esm':19 'first':38 'import':25 'includ':28 'javascript':64 'lint':11 'lodash':4,9,24,39,62,70 'lodash-specif':8 'mainten':55 'major':36 'method':47 'plugin':3,6,40,68 'pragma':33 'prefer':53 'provid':7 'recommend':59 'require/import':26 'rule':12,30,44 'set':31 'share':29 'specif':10 'stylist':52 'support':18 'usag':48 'v3':63 'version':16,35","created_at":"2026-04-25T11:19:51.924443+00:00","updated_at":"2026-04-25T11:19:51.924443+00:00","problems":[{"fix":"Run 'npm install eslint-plugin-lodash --save-dev' and ensure .eslintrc.json has 'plugins: [\"lodash\"]'.","cause":"Plugin not installed or ESLint config incorrectly references the plugin.","error":"ESLint couldn't find the plugin \"eslint-plugin-lodash\"."},{"fix":"Check the rule name in the official list; ensure it's included in the plugin.","cause":"Rule does not exist or is misspelled.","error":"Configuration for rule \"lodash/collection-return\" is invalid: Value \"error\" is not allowed."},{"fix":"Add 'parserOptions: { sourceType: \"module\" }' to your ESLint config.","cause":"ESLint parser does not support ES modules.","error":"Parsing error: The keyword 'import' is reserved."}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":null,"github":"https://github.com/idok/eslint-plugin-lodash","docs":null,"changelog":null,"pypi":null,"npm":"https://www.npmjs.com/package/eslint-plugin-lodash","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-17","next_check":"2026-07-24","install_tag":null}}