canirequire › ESM-only › eslint-plugin-mocha
Is eslint-plugin-mocha ESM-only? Can you require() it?
Eslint rules for mocha.
Last verified Sep 9, 2026 against eslint-plugin-mocha@12.0.2. JSON
ESM-only ESM-only since 11.0.0 — last CommonJS version is 10.5.0
eslint-plugin-mocha dropped its CommonJS build in 11.0.0 (April 2025). The last version you can require() on every Node.js version, including 18 and older, is 10.5.0, published Jul 29, 2024.
require("eslint-plugin-mocha") failed in our probe on Node.js 20+ as well. See the runtime matrix below for the exact error.
eslint-plugin-mocha@12.0.2 declares engines ">=22.0.0", so Node.js 18, 20 are outside its supported range regardless of module format.
Does eslint-plugin-mocha@12.0.2 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("eslint-plugin-mocha") from a CommonJS file and import "eslint-plugin-mocha" from an ES module.
| Runtime | require("eslint-plugin-mocha") | import "eslint-plugin-mocha" |
|---|---|---|
| Node.js 18 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 20 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 22 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 24 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Node.js 26 | ✗ failsERR_PACKAGE_PATH_NOT_EXPORTED | ✓ works |
| Bun 1.4 | ✗ failserror: Cannot find package 'eslint-plugin-mocha' from '/Users/boat/Projects/top-seo/data/probe-work/eslint-plugin-mocha/req.cjs' | ✓ works |
How to import eslint-plugin-mocha
ES modules (import)
import eslintPluginMocha from "eslint-plugin-mocha";CommonJS (require)
// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const eslintPluginMocha = require("eslint-plugin-mocha");
// Any Node.js version:
const eslintPluginMocha = await import("eslint-plugin-mocha");
// Or pin the last CommonJS release:
// npm install eslint-plugin-mocha@10.5.0Module format by version
Derived from the type, main and exports fields of every stable release on npm (70 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 11.0.0 – 12.0.2 | ESM-only | Apr 26, 2025 |
| 1.1.0 – 10.5.0 | CommonJS | Nov 13, 2015 |
Frequently asked
Is eslint-plugin-mocha ESM-only?
eslint-plugin-mocha@12.0.2 is ESM-only. eslint-plugin-mocha dropped its CommonJS build in 11.0.0 (April 2025). The last version you can require() on every Node.js version, including 18 and older, is 10.5.0, published Jul 29, 2024.
Which version of eslint-plugin-mocha still supports CommonJS / require()?
10.5.0 is the last version of eslint-plugin-mocha with a CommonJS build. Install it with "npm install eslint-plugin-mocha@10.5.0". Every version from 11.0.0 on is ESM-only.
How do I use eslint-plugin-mocha from a CommonJS file?
Use a dynamic import: const mod = await import("eslint-plugin-mocha"). On Node.js 20.19+, 22.12+ and newer, a plain require("eslint-plugin-mocha") also works for ESM packages that do not use top-level await. Alternatively pin eslint-plugin-mocha@10.5.0.
Does eslint-plugin-mocha work in Bun?
Yes. import "eslint-plugin-mocha" loaded successfully in Bun 1.4 on Sep 9, 2026.
Does eslint-plugin-mocha ship TypeScript types?
Yes. eslint-plugin-mocha 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
- clean-webpack-plugin 4.0.0CommonJS
- karma-jasmine 5.1.0CommonJS
- babel-polyfill 6.26.0CommonJS
- babel-plugin-transform-es2015-modules-commonjs 6.26.2CommonJS
- async-validator 4.2.5CommonJS
- jest-extended 7.0.0CommonJS
- express-validator 7.3.2CommonJS
- config 5.0.1CommonJS