canirequire

canirequire › ESM-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. Markdown · 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 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.
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.0✓ works✓ works

How to import eslint-plugin-unicorn

ES modules (import)

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 (require)

// 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, corrected where a runtime test of that version contradicted them (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 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

Other esm-only packages

Similar popularity