canirequire › Dual (CommonJS + ESM) › eslint-plugin-unused-imports
Is eslint-plugin-unused-imports ESM-only? Can you require() it?
Report and remove unused es6 modules
Last verified Sep 9, 2026 against eslint-plugin-unused-imports@4.4.1. Markdown · JSON
Dual (CommonJS + ESM) Dual package — require() works on every Node.js version we test; import works too
eslint-plugin-unused-imports publishes both a CommonJS entry and a native ESM entry (ESM added in 4.1.0). require("eslint-plugin-unused-imports") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "eslint-plugin-unused-imports" works alongside it.
What to do
- Nothing to change. require("eslint-plugin-unused-imports") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import * as eslintPluginUnusedImports from "eslint-plugin-unused-imports" works alongside it; use named imports for what the ESM entry exports.
- TypeScript: types are bundled; install nothing extra.
Does eslint-plugin-unused-imports@4.4.1 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("eslint-plugin-unused-imports") from a CommonJS file and import "eslint-plugin-unused-imports" from an ES module.
| Runtime | require("eslint-plugin-unused-imports") | import "eslint-plugin-unused-imports" |
|---|---|---|
| Node.js 18 | ✓ works | ✓ works |
| Node.js 20 | ✓ works | ✓ works |
| 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-unused-imports
ES modules (import)
import * as eslintPluginUnusedImports from "eslint-plugin-unused-imports";Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.
CommonJS (require)
const eslintPluginUnusedImports = require("eslint-plugin-unused-imports");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 (30 versions; the newest 30 shown).
| Versions | Format | First published |
|---|---|---|
| 4.1.0 – 4.4.1 | Dual (CommonJS + ESM) | Aug 8, 2024 |
| 0.0.2 – 4.0.1 | CommonJS | Sep 18, 2019 |
Frequently asked
Is eslint-plugin-unused-imports ESM-only?
eslint-plugin-unused-imports@4.4.1 ships CommonJS and ESM builds. eslint-plugin-unused-imports publishes both a CommonJS entry and a native ESM entry (ESM added in 4.1.0). require("eslint-plugin-unused-imports") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun. import "eslint-plugin-unused-imports" works alongside it.
Can I require eslint-plugin-unused-imports?
Yes. eslint-plugin-unused-imports ships a CommonJS entry alongside the native ESM entry. require("eslint-plugin-unused-imports") works on every Node.js version we test (18, 20, 22, 24 and 26) and in Bun.
Does eslint-plugin-unused-imports work in Bun?
Yes. import "eslint-plugin-unused-imports" loaded successfully in Bun 1.4.0 on Sep 9, 2026.
Does eslint-plugin-unused-imports ship TypeScript types?
Yes. eslint-plugin-unused-imports bundles its own type declarations; no @types package is needed.
Links
Other dual (commonjs + esm) packages
- minimatch 10.2.6Dual
- brace-expansion 5.0.9Dual
- lru-cache 11.5.2Dual
- tslib 2.8.1Dual
- glob 13.0.6Dual
- eslint-visitor-keys 5.0.1Dual
- yallist 5.0.0Dual
- balanced-match 4.0.4Dual
Similar popularity
- update-notifier 7.3.1ESM-only
- webpack-bundle-analyzer 5.3.2CommonJS
- @svgr/webpack 8.1.0CommonJS
- jest-junit 17.0.0CommonJS
- copy-webpack-plugin 14.0.0CommonJS
- @vitejs/plugin-vue 6.0.8ESM-only
- case-sensitive-paths-webpack-plugin 2.4.0CommonJS
- @vueuse/core 14.4.0ESM-only