Many methods provided by utility libraries like Lodash and Underscore.js have native equivalents in modern JavaScript environments (ES6 and later).

Why is this an issue?

Using native methods reduces the dependency on external libraries, decreases the bundle size of an application, and often improves performance because JavaScript engines heavily optimize built-in APIs.

When the standard API already covers the same use case, keeping the Lodash or Underscore.js call adds unnecessary indirection. Readers must translate a library-specific helper into a platform feature they already know, and the project keeps a dependency for behavior that the runtime already exposes.

Instead of importing and using lodash or underscore methods, prefer the native standard libraries unless the code specifically relies on the extra edge-case handling or null-safety the external library provides.

What is the potential impact?

Using utility wrappers when the platform already provides the same behavior makes code less idiomatic and harder to maintain. It also keeps an unnecessary dependency surface in the codebase.

How to fix it

Replace the library call with the standard API that matches the current behavior. This rule only recommends alternatives that are available for the configured ECMAScript version.

Code examples

Noncompliant code example

import _ from "lodash";

const uniqueIds = _.uniq(ids); // Noncompliant
const isList = _.isArray(value); // Noncompliant

Compliant solution

const uniqueIds = [...new Set(ids)]; // Compliant
const isList = Array.isArray(value); // Compliant

Pitfalls

Do not assume that every Lodash or Underscore.js helper maps directly to the same standard API.

Resources

Documentation