npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

eslint-plugin-lodash-es

v1.2.1

Published

ESLint plugin that enforces destructured imports from lodash-es and auto-fixes them

Readme

eslint-plugin-lodash-es

npm npm GitHub
Coverage Quality Gate Status
Reliability Rating Maintainability Rating Security Rating

ESLint plugin that enforces destructured imports from lodash-es with auto-fixing and provides configurable function usage policies.

Key Benefits:

  • 🔧 Auto-fixes imports for better tree-shaking
  • 📦 Reduces bundle size significantly
  • 🛡️ Configurable function usage policies
  • 💡 Intelligent suggestions for native alternatives
  • 📝 Full TypeScript support

Installation

npm install -D eslint-plugin-lodash-es

Usage

Flat config

// eslint.config.js (ESLint 9+)
import eslintPluginLodashEs from 'eslint-plugin-lodash-es'

export default [
  ...eslintPluginLodashEs.configs.recommended
]

Define config

import { defineConfig } from 'eslint/config'

// Base
import globals from 'globals'
import eslint from '@eslint/js'
import tseslint from 'typescript-eslint'
// Plugins
import eslintPluginStylistic from '@stylistic/eslint-plugin'
import eslintPluginLodashEs from 'eslint-plugin-lodash-es'

export default defineConfig(
  {
    ignores: ['dist/', 'node_modules/', 'coverage/'],
  },
  {
    languageOptions: {
      globals: {
        ...globals.browser, // or globals.node
      },
    },
  },
  //Base
  eslint.configs.recommended,
  tseslint.configs.strict,
  tseslint.configs.stylistic,
  // Plugins
  eslintPluginStylistic.configs.recommended,
  eslintPluginLodashEs.configs.recommended
)

Manual Configuration

// eslint.config.js (ESLint 9+)
export default [
  {
    plugins: { 'lodash-es': eslintPluginLodashEs },
    rules: {
      'lodash-es/enforce-destructuring': 'error',
      'lodash-es/no-chaining': 'error',
      'lodash-es/no-method-imports': 'error',
      'lodash-es/enforce-functions': ['error', { exclude: ['forEach'] }],
      'lodash-es/suggest-native-alternatives': 'warn',
    }
  }
]

Legacy Config (ESLint 8)

// .eslintrc.js
module.exports = {
  extends: ['plugin:lodash-es/recommended-legacy']
}

What it does

1. Enforces Destructured Imports

Transforms this:

import _ from 'lodash-es'
const result = _.first([1, 2, 3])

Into this (automatically):

import { first } from 'lodash-es'
const result = first([1, 2, 3])

2. Transforms to Native JavaScript

Transforms this:

import { map, first, groupBy } from 'lodash-es'

const doubled = map([1, 2, 3], x => x * 2)
const firstItem = first(items)
const grouped = groupBy(users, 'department')

Into this (automatically):

import { map, first, groupBy } from 'lodash-es'

const doubled = [1, 2, 3].map(x => x * 2)
const firstItem = items.at(0)
const grouped = Object.groupBy(users, user => user.department)

Supports 104+ lodash functions with automatic transformation to modern JavaScript equivalents, including ES2022+ features like Array.at() and Object.groupBy().

Recently Added Native Alternatives (37 new functions)

Array slice operations: drop, dropRight, take, takeRight Math & arithmetic: add, subtract, multiply, divide, sum, mean Number utilities: clamp, inRange, random String transformations: capitalize, lowerFirst, upperFirst (using modern .at()) Type checking: isDate, isRegExp, isError, isSet, isWeakMap, isWeakSet, isSymbol, isSafeInteger Type conversion: castArray, toArray, toFinite, toInteger, toSafeInteger Comparisons: eq, gt, gte, lt, lte Function utilities: bind, delay, defer Object creation: create Utility stubs: identity, noop, stubArray, stubFalse, stubObject, stubString, stubTrue

Rules

| Rule | Description | 💡 | 🔧 | ✅ | |------|-------------|:--:|:--:|:--:| | enforce-destructuring | Enforce destructured imports from lodash-es | | 🔧 | ✅ | | no-chaining | Prevent chaining that kills tree-shaking | 💡 | 🔧 | ✅ | | no-method-imports | Prevent deprecated per-method imports | 💡 | 🔧 | ✅ | | enforce-functions | Transform lodash functions to native JavaScript | 💡 | 🔧 | | | suggest-native-alternatives | Suggest native JavaScript alternatives | 💡 | 🔧 | |

Legend: 💡 Suggestions • 🔧 Auto-fixable • ✅ Recommended

Why Use This?

Bundle Size: Reduces bundle from ~70KB (full lodash-es) to ~1KB per function

Better Tree Shaking: Modern bundlers eliminate unused code more effectively

Team Standards: Enforce consistent lodash usage across your codebase

Documentation

See detailed rule documentation for configuration options and examples.

Contributing

Contributions welcome! See CONTRIBUTING.md for details.