---
title: "Remove Unnecessary NPM Packages with eslint-plugin-depend"
description: "eslint-plugin-depend flags npm packages like is-odd that plain JavaScript replaces. How to install and configure it, and its move to @e18e/eslint-plugin."
canonical: "https://www.trevorlasn.com/blog/eslint-plugin-depend"
author: "Trevor I. Lasn"
published: "2024-08-13"
last-updated: "2026-11-08"
topics: ["Developer tools", "JavaScript"]
---

# Remove Unnecessary NPM Packages with eslint-plugin-depend

eslint-plugin-depend flags npm packages like is-odd that plain JavaScript replaces. How to install and configure it, and its move to @e18e/eslint-plugin.

By Trevor I. Lasn · Published 2024-08-13 · Updated 2026-11-08 · https://www.trevorlasn.com/blog/eslint-plugin-depend

The NPM ecosystem is cluttered with unnecessary packages like *is-odd*, *is-even*, *is-number*, and more. We don't need this unnecessary clutter.

## Update: eslint-plugin-depend now points to @e18e/eslint-plugin

Since August 2026, the [eslint-plugin-depend README](https://github.com/es-tooling/eslint-plugin-depend) says its rules now live in [@e18e/eslint-plugin](https://github.com/e18e/eslint-plugin), which ships the same `ban-dependencies` rule plus other performance rules. eslint-plugin-depend 1.5.0 still works with the config below. To switch, run `npm i -D @e18e/eslint-plugin`, then add `e18e.configs.recommended` (imported from `@e18e/eslint-plugin`) to your `eslint.config.js`.

Corrected: the MDN URL in the `left-pad` warning below ran into the rule name, so it pointed nowhere when copied. They are separated now.

Ever heard of the `is-number`? It's an infamous NPM package that simply checks if a value is a number or not.

```js
import isNumber from 'is-number';
```

I checked out the *is-number* package and here’s what it actually does.

```js
module.exports = function(num) {
  if (typeof num === 'number') {
    return num - num === 0;
  }
  if (typeof num === 'string' && num.trim() !== '') {
    return Number.isFinite ? Number.isFinite(+num) : isFinite(+num);
  }
  return false;
};
```

If only there were a built-in method to check if something is a number. Oh, wait... there is.

```js
const number = 5;
typeof number === "number" && Number.isFinite(number); // true
```
1. **typeof num === 'number'**: Verifies that num is of the type "number". This excludes other data types like strings, objects, etc.

2. **Number.isFinite(num)**: Ensures that num is a finite number, meaning it is not NaN, Infinity, or -Infinity.

*Infinity*, *-Infinity*, and *NaN* are all considered numbers in JavaScript, so typeof returns *'number'* for each of them. Thus, these statements are true.

```js
typeof Infinity === 'number';  // true
typeof -Infinity === 'number'; // true
typeof NaN === 'number';       // true
```

While typeof returns true for each of these values, *Number.isFinite* returns false because Infinity, -Infinity, and NaN are not finite numbers. Therefore, the combined expressions using && evaluate to false.

```js
typeof Infinity === "number" && Number.isFinite(Infinity); // false
typeof -Infinity === "number" && Number.isFinite(-Infinity); // false
typeof NaN === "number" && Number.isFinite(NaN); // false
```

Both 5 and -5 are valid, finite numbers, so both expressions are true.

```js
typeof 5 === "number" && Number.isFinite(5); //true
typeof -5 === "number" && Number.isFinite(-5); // true
```

Moving back to rubbish packages. How on earth does **is-number** have 68,049,915 weekly downloads? 

I guess it’s likely because is-number is a dependency for many popular libraries and frameworks. Even if you’re not using it directly, it could be included in your project through another package that relies on it.

### left-pad package

In 2016, the left-pad package was unexpectedly removed from the npm registry, causing widespread disruption in the JavaScript ecosystem. 

Many projects depended on this tiny package for a simple string padding function. 

Its removal led to broken builds and errors in numerous projects, highlighting the risks of relying on overly granular or unnecessary dependencies. 

The incident underscored the importance of using native functionality whenever possible to avoid such issues. [See the left-pad incident wikipedia page.](https://en.wikipedia.org/wiki/Npm_left-pad_incident)

```js
import leftpad from 'left-pad';
```

Since *String.prototype.padStart* is a standard part of modern JavaScript, there's no need to rely on an additional package for this.

```yaml
"left-pad" should be replaced with native functionality. You can instead use String.prototype.padStart. 

Read more here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/padStart eslint depend/ban-dependencies
```

<br />

### eslint-plugin-depend

This ESLint plugin detects redundant packages and suggests more efficient alternatives.

```js
import isNumber from 'is-number';
```

Would trigger a notification inside the code editor/IDE

```yaml
"is-number" should be replaced with inline/local logic. Use typeof v === "number" || (typeof v === "string" && Number.isFinite(+v)) eslint depend/ban-dependencies
```

![Editor tooltip flags require('is-number') with depend/ban-dependencies and suggests an inline typeof check](https://i.imgur.com/BoumQnd.png)

### Installing

<br />

```bash
npm i -D eslint-plugin-depend
```

<br />

### eslint.config.js

```js
import * as depend from 'eslint-plugin-depend';

export default [
  depend.configs['flat/recommended']
];
```
You may choose a preset list of dependencies (or none). The following are available:

1. **microutilities**: micro utilities (e.g. one liners)
2. **native**: redundant packages with native equivalents
3. **preferred**: an opinionated list of packages with better maintained and lighter alternatives

```sh
{
  "rules": {
    "depend/ban-dependencies": ["error", {
      "presets": ["native"]
    }]
  }
}
```
The default is **['native', 'microutilities', 'preferred']**.

**modules**: You may specify your own list of packages which will be disallowed in code.

```sh
{
  "rules": {
    "depend/ban-dependencies": ["error", {
      "modules": ["im-a-banned-package"]
    }]
  }
}
```

<br />

### Putting it together

```js
import * as depend from 'eslint-plugin-depend';

export default [
  depend.configs['flat/recommended'],
  {
    rules: {
      "depend/ban-dependencies": ["error", {
        presets: ["native"],
        modules: ["im-a-banned-package"]
      }]
    }
  }
];
```

Trim the fat, clear out the clutter, and let your code breathe. Your users will thank you for it.
