# Is eslint-plugin-unicorn ESM-only? Can you require() it?

> eslint-plugin-unicorn@74.0.0 is ESM-only. ESM-only since 57.0.0 — last CommonJS version is 56.0.1.

More than 300 powerful ESLint rules

Last verified Sep 9, 2026 against eslint-plugin-unicorn@74.0.0.

eslint-plugin-unicorn dropped its CommonJS build in 57.0.0 (February 2025). The last version with a plain require()-able CommonJS entry is 56.0.1, published Nov 19, 2024; it declares support for Node.js >=18.18.

On Node.js 22.12+ and newer (eslint-plugin-unicorn@74.0.0 declares Node.js >=22), require("eslint-plugin-unicorn") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 22, 24 and 26. Node.js 18 has no require(esm), and eslint-plugin-unicorn@74.0.0 declares Node.js >=22, so 18 is outside its supported range anyway.

eslint-plugin-unicorn@74.0.0 declares engines ">=22", so Node.js 18, 20 are outside its supported range regardless of module format.

## What to do

1. On Node.js 22.12+ and newer (eslint-plugin-unicorn@74.0.0 declares Node.js >=22), require("eslint-plugin-unicorn") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 22, 24 and 26.
2. From a CommonJS file, use a dynamic import inside an async function: const eslintPluginUnicorn = await import("eslint-plugin-unicorn"). That works on every Node.js version the package supports (>=22).
3. If you need a synchronous require() or run Node.js 18: npm install eslint-plugin-unicorn@56.0.1, the last CommonJS release (published Nov 19, 2024); it declares Node.js >=18.18.
4. eslint-plugin-unicorn@74.0.0 declares engines ">=22", so Node.js 18, 20 are unsupported regardless: upgrade Node.js or pin an older release.
5. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 74.0.0 (Aug 28, 2026)
- Module format: ESM-only
- Last CommonJS version: 56.0.1
- ESM-only since: 57.0.0 (Feb 17, 2025)
- TypeScript types: bundled
- Node engines: >=22
- Weekly downloads: 6.5M
- License: MIT

## Runtime test results for eslint-plugin-unicorn@74.0.0

Installed and executed on Sep 9, 2026 with require("eslint-plugin-unicorn") from a CommonJS file and import "eslint-plugin-unicorn" from an ES module.

| Runtime | require("eslint-plugin-unicorn") | import "eslint-plugin-unicorn" |
|---|---|---|
| Node.js 18 | fails (ERR_REQUIRE_ESM) | fails (SyntaxError) |
| Node.js 20 | fails (TypeError) | fails (TypeError) |
| Node.js 22 | works | works |
| Node.js 24 | works | works |
| Node.js 26 | works | works |
| Bun 1.4.0 | works | works |

## How to import eslint-plugin-unicorn

ES modules:

```js
import * as eslintPluginUnicorn from "eslint-plugin-unicorn";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
// Node.js 22.12+ and newer (verified):
const eslintPluginUnicorn = require("eslint-plugin-unicorn");

// Any Node.js version the package supports (>=22), from an async function:
async function main() {
  const eslintPluginUnicorn = await import("eslint-plugin-unicorn");
}

// Or pin the last CommonJS release (declares Node.js >=18.18):
// npm install eslint-plugin-unicorn@56.0.1
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (130 versions; the newest 60 shown).

| Versions | Format | First published |
|---|---|---|
| 57.0.0 – 74.0.0 | ESM-only | Feb 17, 2025 |
| 35.0.0 – 56.0.1 | CommonJS | Aug 3, 2021 |

## Frequently asked

**Is eslint-plugin-unicorn ESM-only?**

eslint-plugin-unicorn@74.0.0 is ESM-only. eslint-plugin-unicorn dropped its CommonJS build in 57.0.0 (February 2025). The last version with a plain require()-able CommonJS entry is 56.0.1, published Nov 19, 2024; it declares support for Node.js >=18.18.

**Which version of eslint-plugin-unicorn still supports CommonJS / require()?**

56.0.1 is the last version of eslint-plugin-unicorn with a CommonJS build; it declares Node.js >=18.18. Install it with "npm install eslint-plugin-unicorn@56.0.1". Every version from 57.0.0 on is ESM-only.

**How do I use eslint-plugin-unicorn from a CommonJS file?**

From a CommonJS file, use a dynamic import inside an async function: const eslintPluginUnicorn = await import("eslint-plugin-unicorn"). That works on every Node.js version the package supports (>=22). On Node.js 22.12+ and newer (eslint-plugin-unicorn@74.0.0 declares Node.js >=22), require("eslint-plugin-unicorn") works with the latest version: Node.js loads synchronous ES modules through require(). Verified on Node.js 22, 24 and 26. Alternatively pin eslint-plugin-unicorn@56.0.1 (declares Node.js >=18.18).

**Does eslint-plugin-unicorn work in Bun?**

Yes. import "eslint-plugin-unicorn" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does eslint-plugin-unicorn ship TypeScript types?**

Yes. eslint-plugin-unicorn bundles its own type declarations; no @types package is needed.

## Links

- [eslint-plugin-unicorn on npm](https://www.npmjs.com/package/eslint-plugin-unicorn)
- [Source repository](https://github.com/sindresorhus/eslint-plugin-unicorn)
- [HTML version](https://canirequire.com/package/eslint-plugin-unicorn/)
- [JSON version](https://canirequire.com/package/eslint-plugin-unicorn.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
