canirequire

canirequireESM-only › eslint-plugin-unicorn

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

More than 300 powerful ESLint rules

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

ESM-only ESM-only since 57.0.0 — last CommonJS version is 56.0.1

eslint-plugin-unicorn dropped its CommonJS build in 57.0.0 (February 2025). The last version you can require() on every Node.js version, including 18 and older, is 56.0.1, published Nov 19, 2024.

On Node.js 20.19+, 22.12+ and every newer release, require("eslint-plugin-unicorn") works anyway: Node can load synchronous ES modules through require(). Verified on Node 22, 24, 26. Node.js 18 and older still fail with ERR_REQUIRE_ESM.

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

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

Does eslint-plugin-unicorn@74.0.0 actually load? Runtime test results

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.

Runtimerequire("eslint-plugin-unicorn")import "eslint-plugin-unicorn"
Node.js 18✗ failsERR_REQUIRE_ESM✗ failsSyntaxError
Node.js 20✗ failsTypeError✗ failsTypeError
Node.js 22✓ works✓ works
Node.js 24✓ works✓ works
Node.js 26✓ works✓ works
Bun 1.4✓ works✓ works

How to import eslint-plugin-unicorn

ES modules (import)

import eslintPluginUnicorn from "eslint-plugin-unicorn";

CommonJS (require)

// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const eslintPluginUnicorn = require("eslint-plugin-unicorn");

// Any Node.js version:
const eslintPluginUnicorn = await import("eslint-plugin-unicorn");

// Or pin the last CommonJS release:
// 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).

VersionsFormatFirst published
57.0.0 – 74.0.0ESM-onlyFeb 17, 2025
35.0.0 – 56.0.1CommonJSAug 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 you can require() on every Node.js version, including 18 and older, is 56.0.1, published Nov 19, 2024.

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. 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?

Use a dynamic import: const mod = await import("eslint-plugin-unicorn"). On Node.js 20.19+, 22.12+ and newer, a plain require("eslint-plugin-unicorn") also works for ESM packages that do not use top-level await. Alternatively pin eslint-plugin-unicorn@56.0.1.

Does eslint-plugin-unicorn work in Bun?

Yes. import "eslint-plugin-unicorn" loaded successfully in Bun 1.4 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

Other esm-only packages

Similar popularity