{"id":19823,"library":"eslint-plugin-lodash-f","title":"eslint-plugin-lodash","description":"ESLint plugin for Lodash, forked from the original eslint-plugin-lodash by Wix, adding extra rules and ESLint v9 support. Current stable version is 7.6.0. It provides over 40 lint rules to enforce best practices with Lodash, including collection method usage, chaining, and performance traps. It supports both Lodash v3 and v4, and offers recommended and canonical configurations. This fork is actively maintained and adds rules like prefer-nullish-coalescing not present in the original.","status":"active","version":"7.6.0","language":"javascript","source_language":"en","source_url":"https://github.com/AndreaPontrandolfo/eslint-plugin-lodash","tags":["javascript","eslint","eslint-plugin","eslintplugin","lodash"],"install":[{"cmd":"npm install eslint-plugin-lodash-f","lang":"bash","label":"npm"},{"cmd":"yarn add eslint-plugin-lodash-f","lang":"bash","label":"yarn"},{"cmd":"pnpm add eslint-plugin-lodash-f","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency: plugin requires ESLint >=9.29.0","package":"eslint","optional":false}],"imports":[{"note":"The plugin exports rules as an object. You can also require it in CJS.","wrong":"const rules = require('eslint-plugin-lodash').rules","symbol":"rules","correct":"import { rules } from 'eslint-plugin-lodash'"},{"note":"Use configs.recommended in flat config.","symbol":"configs.recommended","correct":"import { configs } from 'eslint-plugin-lodash'"},{"note":"Default import works in ESM. In CJS, use require('eslint-plugin-lodash') directly.","wrong":"const plugin = require('eslint-plugin-lodash').default","symbol":"plugin","correct":"import plugin from 'eslint-plugin-lodash'"}],"quickstart":{"code":"// eslint.config.js (flat config)\nimport plugin from 'eslint-plugin-lodash';\nexport default [\n  {\n    plugins: { lodash: plugin },\n    rules: {\n      'lodash/collection-return': 'error',\n      'lodash/no-extra-args': 'warn',\n    },\n  },\n];","lang":"javascript","description":"Shows how to use the plugin in ESLint flat config, enabling two rules."},"warnings":[{"fix":"If using ESLint <8.40, stick to v6.x. Update rule configs to new names as per changelog.","message":"Version 7.0.0 dropped support for ESLint <8.40 and changed rule names.","severity":"breaking","affected_versions":">=7.0.0"},{"fix":"Ensure your code uses single method imports if possible, or update rule configurations.","message":"Version 2.0.0 switched from requiring full lodash to supporting single method imports. Rules may behave differently with method imports.","severity":"breaking","affected_versions":">=2.0.0 <3.0.0"},{"fix":"Use 'prefer-chain' instead.","message":"The 'no-single-chain' rule is deprecated and will be removed in the next major version.","severity":"deprecated","affected_versions":">=7.0.0"},{"fix":"Add 'settings: { lodash: { pragma: '_' } }' in your ESLint config.","message":"If using the 'canonical' config, you must set the lodash pragma in settings, otherwise rules may not work.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the 'v3' config or manually disable those rules if using lodash/fp.","message":"Rules that analyze chaining (e.g., 'chain', 'unwrap') may produce false positives when using method imports from lodash/fp.","severity":"gotcha","affected_versions":">=7.0.0"},{"fix":"Use the flat config format shown in the quickstart.","message":"ESLint v9 flat config requires importing the plugin differently. The legacy rc format is no longer supported.","severity":"breaking","affected_versions":">=7.6.0 <8.0.0"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install eslint-plugin-lodash --save-dev' and ensure it's in node_modules.","cause":"Plugin not installed or not resolved in ESLint's plugin resolution.","error":"Error: Failed to load plugin 'lodash': Cannot find module 'eslint-plugin-lodash'"},{"fix":"Use the legacy format: { \"plugins\": [\"lodash\"], \"extends\": [\"plugin:lodash/recommended\"] } or migrate to flat config.","cause":"Using the flat config export (configs) in a legacy .eslintrc file.","error":"Error: ESLint configuration in .eslintrc.json is invalid: - Unexpected top-level property \"configs\""},{"fix":"Use the plugin as an object: { plugins: { lodash: plugin } }.","cause":"Trying to call the plugin as a function in flat config.","error":"TypeError: plugin is not a function"},{"fix":"Check the list of rules in the plugin docs. Ensure the rule name is exact.","cause":"Rule name typo or rule not included in the loaded plugin.","error":"Rule 'lodash/xxx' is not defined."}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}