talira

eslint-plugin-you-dont-need-lodash-underscore

ESLint plugin that flags Lodash and Underscore calls you can replace with native JavaScript methods

open sourceMITfree

eslint-plugin-you-dont-need-lodash-underscore is an ESLint plugin that finds the places in a codebase where a Lodash or Underscore method has a native JavaScript equivalent (ES5 and later), so a project can drop the dependency. Its compatible preset flags only the methods whose native version behaves the same. It comes from the You Don't Need Lodash/Underscore project, whose README lists each method with its native replacement and browser support.

Problems it solves

  • find the Lodash calls in my project I could replace with built-in JavaScript
  • cut the Lodash dependency from a front-end bundle
  • stop teammates adding Underscore calls where native array methods would do

Features

  • ESLint rules for Lodash and Underscore methods with native equivalents
  • compatible preset for methods whose native version behaves the same
  • list of each method's native replacement with browser support

Limitations

  • Many Lodash methods are null safe while their native equivalents aren't, so a suggested replacement can need an extra guard; the list isn't a one-to-one comparison.1