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. 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.
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.
| Runtime | require("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.1Module 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 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
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - tslib 2.8.1last CJS
2.5.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1
Similar popularity
- postcss-custom-properties 15.0.1ESM-only
- identity-obj-proxy 3.0.0CommonJS
- koa 3.2.1Dual
- postcss-preset-env 11.5.2ESM-only
- react-test-renderer 19.2.8CommonJS
- babel-runtime 6.26.0CommonJS
- http-server 14.1.1CommonJS
- cypress 16.0.0Dual