Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ const pluginJest = require('eslint-plugin-jest')
✗ import pluginJest from 'eslint-plugin-jest' (CJS default in flat config works, but ESM users need dynamic import)
CommonJS is the primary import style due to ESLint's CJS core. ESM users should use dynamic import or await import('eslint-plugin-jest').
flat/recommended
✓ const jestPlugin = require('eslint-plugin-jest'); module.exports = [...jestPlugin.configs['flat/recommended']]
✗ module.exports = ['plugin:jest/recommended'] (this is for legacy .eslintrc configs)
For flat config (eslint.config.js), use string key 'flat/recommended'. For legacy .eslintrc, use 'plugin:jest/recommended'.
environments
✓ const { environments } = require('eslint-plugin-jest'); globals: environments.globals.globals
✗ environments.globals (missing .globals access)
The environment object has a 'globals' property containing the globals map, and that map has a 'globals' key with the actual globals object.
Sets up eslint-plugin-jest with flat config, enabling three common rules on test files.
const jestPlugin = require('eslint-plugin-jest');
module.exports = [
{
files: ['**/*.test.js', '**/*.spec.js'],
plugins: { jest: jestPlugin },
languageOptions: {
globals: jestPlugin.environments.globals.globals,
},
rules: {
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
},
},
];
Errors
Common errors & fixes
Error: Failed to load plugin 'jest': Cannot find module 'eslint-plugin-jest'
Missing or incorrect installation of the plugin.
fixRun 'npm install eslint-plugin-jest --save-dev' to install it.
Configuration for rule 'jest/no-disabled-tests' is invalid: Value "warn" is invalid.
Using 'warn' in flat config; flat config requires severity numbers or 'error'/'warn' as strings but only in certain contexts.
fixUse 'warn' (string) is actually allowed, but ensure you're not using a number like 1. If using shared configs, they may map to numbers. Use 'warn' or 'error' as strings.
ESLint couldn't find the config 'plugin:jest/recommended'.
Trying to use 'plugin:jest/recommended' in flat config (eslint.config.js).
fixIn flat config, use jestPlugin.configs['flat/recommended'] instead of the string 'plugin:jest/recommended'.
Parsing error: The keyword 'const' is reserved
Using ES6 syntax in a file that ESLint's parser doesn't recognize as modern JavaScript (e.g., .eslintrc.json doesn't support it).
fixUse CommonJS require syntax or ensure your config file is .js and uses module.exports.
TypeError: jestPlugin.environments.globals is not a function
Assuming environments.globals() is a function when it's an object.
fixAccess as jestPlugin.environments.globals.globals (property access).
Audit
Dependencies
@typescript-eslint/eslint-pluginoptionalRequired for TypeScript-aware rules
eslintrequiredCore peer dependency for ESLint integration
jestoptionalExpected testing framework - plugin provides rules for Jest syntax
typescriptoptionalOptional peer dependency for TypeScript support (>=4.8.4 <7.0.0)