eslint-plugin-jest-extended
raw JSON → 3.0.1 verified Sat Apr 25 auth: no javascript
ESLint plugin providing rules for Jest Extended matchers, version 3.0.1 (latest stable). Released under the jest-community organization, this plugin offers rules like prefer-to-be-true, prefer-to-be-false, prefer-to-be-array, prefer-to-be-object, and prefer-to-have-been-called-once, all auto-fixable. It supports ESLint 7/8/9, Node >=16.10, and flat config. Differentiates from eslint-plugin-jest by focusing on jest-extended matchers rather than general Jest best practices. Release cadence: occasional major/minor updates with breaking changes tied to Node and ESLint version support.
Common errors
error Error: Cannot find module 'eslint-plugin-jest-extended' ↓
cause Package not installed or missing from node_modules
fix
Run
npm install --save-dev eslint-plugin-jest-extended error Configuration for rule "jest-extended/prefer-to-be-true" is invalid ↓
cause Typo in rule name or using 'jest-extended' as a rule without proper plugin declaration
fix
Ensure plugin is listed in 'plugins': ['jest-extended'] and rule names are correct (e.g., 'jest-extended/prefer-to-be-true')
error ESLint couldn't find the plugin "eslint-plugin-jest-extended". ↓
cause Plugin not installed, or ESLint is global and plugin is local
fix
Install plugin locally or globally to match ESLint installation:
npm install --save-dev eslint-plugin-jest-extended or npm install -g eslint-plugin-jest-extended error TypeError: Cannot read properties of undefined (reading 'flat/all') ↓
cause Using an older version before flat config support was added (v2.3.0)
fix
Upgrade to v2.3.0 or later, or use .eslintrc syntax
Warnings
breaking v3.0.0 drops support for Node v14 and Node v18 versions below 18.12.0 ↓
fix Upgrade Node to ^16.10.0 || ^18.12.0 || >=20.0.0
breaking v3.0.0 raises minimum peer dependency for @typescript-eslint/utils to v6; v7 and v8 also supported. ↓
fix If using TypeScript-related ESLint configs, ensure @typescript-eslint/utils is at least v6.
gotcha The 'all' config may change in any release and is not suitable for long-term consistency. ↓
fix Pin to specific rules instead of using 'all' configuration for stable behavior.
deprecated v2.x is no longer maintained; upgrades to v3 are recommended. ↓
fix Upgrade to v3.0.1 with `npm install eslint-plugin-jest-extended@latest`.
Install
npm install eslint-plugin-jest-extended yarn add eslint-plugin-jest-extended pnpm add eslint-plugin-jest-extended Imports
- plugin wrong
import jestExtended from 'eslint-plugin-jest-extended';correctconst jestExtended = require('eslint-plugin-jest-extended'); - configs wrong
jestExtended.configs.allcorrectjestExtended.configs['flat/all'] - rules wrong
"jest-extended/prefer-to-be-true": "error"correct"jest-extended/prefer-to-be-true": "warn"
Quickstart
// .eslintrc.json
{
"plugins": ["jest-extended"],
"rules": {
"jest-extended/prefer-to-be-true": "warn",
"jest-extended/prefer-to-be-false": "error"
}
}
// eslint.config.js
const jestExtended = require('eslint-plugin-jest-extended');
module.exports = [
{
files: ['**/*.test.js', '**/*.spec.js'],
...jestExtended.configs['flat/all'],
rules: {
'jest-extended/prefer-to-be-true': 'warn',
},
},
];