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
- 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.
- 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).
- 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.
- 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.
- TypeScript: types are bundled; install nothing extra.
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.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.1Module 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).
| 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
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 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1 - escape-string-regexp 5.0.0last CJS
4.0.0
Similar popularity
- koa 3.2.1Dual
- @babel/register 8.0.1ESM-only
- postcss-preset-env 11.5.2ESM-only
- @mui/icons-material 9.4.0Dual
- @storybook/addon-links 10.6.0ESM-only
- @nestjs/testing 12.0.1ESM-only
- react-test-renderer 19.2.8CommonJS
- babel-runtime 6.26.0No entry