# Is eslint-plugin-mocha ESM-only? Can you require() it?

> eslint-plugin-mocha@12.0.2 is ESM-only. ESM-only since 11.0.0 — last CommonJS version is 10.5.0.

Eslint rules for mocha.

Last verified Sep 9, 2026 against eslint-plugin-mocha@12.0.2.

eslint-plugin-mocha dropped its CommonJS build in 11.0.0 (April 2025). The last version with a plain require()-able CommonJS entry is 10.5.0, published Jul 29, 2024; it declares support for Node.js >=14.0.0.

require("eslint-plugin-mocha") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Node.js 18 has no require(esm), and eslint-plugin-mocha@12.0.2 declares Node.js >=22.0.0, so 18 is outside its supported range anyway.

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.

## What to do

1. require("eslint-plugin-mocha") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
2. From a CommonJS file, use a dynamic import inside an async function: const eslintPluginMocha = await import("eslint-plugin-mocha"). That works on every Node.js version the package supports (>=22.0.0).
3. If you need a synchronous require() or run Node.js 18: npm install eslint-plugin-mocha@10.5.0, the last CommonJS release (published Jul 29, 2024); it declares Node.js >=14.0.0.
4. eslint-plugin-mocha@12.0.2 declares engines ">=22.0.0", so Node.js 18, 20 are unsupported regardless: upgrade Node.js or pin an older release.
5. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 12.0.2 (Aug 4, 2026)
- Module format: ESM-only
- Last CommonJS version: 10.5.0
- ESM-only since: 11.0.0 (Apr 26, 2025)
- TypeScript types: bundled
- Node engines: >=22.0.0
- Weekly downloads: 1.6M
- License: MIT

## Runtime test results for eslint-plugin-mocha@12.0.2

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 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 20 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 22 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 24 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 26 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Bun 1.4.0 | fails (Error) | works |

## How to import eslint-plugin-mocha

ES modules:

```js
import * as eslintPluginMocha from "eslint-plugin-mocha";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
// require("eslint-plugin-mocha") failed in our probe on Node.js 22.12+ and newer as well (ERR_PACKAGE_PATH_NOT_EXPORTED); see the runtime table.

// Any Node.js version the package supports (>=22.0.0), from an async function:
async function main() {
  const eslintPluginMocha = await import("eslint-plugin-mocha");
}

// Or pin the last CommonJS release (declares Node.js >=14.0.0):
// npm install eslint-plugin-mocha@10.5.0
```

## Module 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 with a plain require()-able CommonJS entry is 10.5.0, published Jul 29, 2024; it declares support for Node.js >=14.0.0.

**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; it declares Node.js >=14.0.0. 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?**

From a CommonJS file, use a dynamic import inside an async function: const eslintPluginMocha = await import("eslint-plugin-mocha"). That works on every Node.js version the package supports (>=22.0.0). require("eslint-plugin-mocha") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Alternatively pin eslint-plugin-mocha@10.5.0 (declares Node.js >=14.0.0).

**Does eslint-plugin-mocha work in Bun?**

Yes. import "eslint-plugin-mocha" loaded successfully in Bun 1.4.0 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

- [eslint-plugin-mocha on npm](https://www.npmjs.com/package/eslint-plugin-mocha)
- [Source repository](https://github.com/lo1tuma/eslint-plugin-mocha)
- [HTML version](https://canirequire.com/package/eslint-plugin-mocha/)
- [JSON version](https://canirequire.com/package/eslint-plugin-mocha.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
