ESLint plugin providing rules specific to Mocha test suites, such as enforcing best practices, limiting nested describes, and requiring valid test titles. Current version 11.2.0 (January 2025) with a major breaking change in 11.0.0 that renamed several rules (e.g., *-description to *-title) and switched to ESM-only. The plugin ships TypeScript declarations now. It is maintained and released roughly every few months. Compared to other Mocha linting solutions, this is the official and most widely used plugin with ~1M weekly downloads.
npm install eslint-plugin-mochaVerified import paths — ran on the pinned version, not inferred.
Sets up eslint-plugin-mocha with recommended rules and custom overrides using flat config format.
Update all rule names: replace '-description' with '-title' in configs
Replace 'mocha/no-async-describe' with 'mocha/no-async-suite' in your config
Switch to ESM imports or disable the no-exports rule if using CJS
Convert your project to ESM or use dynamic import(). Alternatively, pin to v10.x
Use flat config format. If you need legacy configs, stay on v10.x
Use flat configs for better compatibility moving forward
Use import statement in an ESM context, or downgrade to v10.x: npm install eslint-plugin-mocha@^10
Replace 'mocha/valid-suite-description' with 'mocha/valid-suite-title' in your ESLint config
Import the plugin and spread it in your config array: export default [...mochaPlugin.configs.recommended, ...]
Update eslint-plugin-mocha to v10.4.0 or later, or use legacy .eslintrc format with v10.x