eslint-plugin-jest weekly downloads statistics
By jest-community (2 listings) · npm · ESLint plugins
ESLint rules for Jest
eslint-plugin-jest has 18,069,727 recorded weekly downloads on npm, an increase of 3.8% over the past 30 days, ranking #127 of 3,247 tracked listings.
About eslint-plugin-jest
Installation
yarn add --dev eslint eslint-plugin-jest
Note: If you installed ESLint globally then you must also install
eslint-plugin-jest globally.
Usage
If you're using flat configuration:
With flat configuration, just import the plugin and away you go:
const pluginJest = require('eslint-plugin-jest');
module.exports = [
{
// update this to match your test files
files: ['**/*.spec.js', '**/*.test.js'],
plugins: { jest: pluginJest },
languageOptions: {
globals: pluginJest.environments.globals.globals,
},
rules: {
'jest/no-disabled-tests': 'warn',
'jest/no-focused-tests': 'error',
'jest/no-identical-title': 'error',
'jest/prefer-to-have-length': 'warn',
'jest/valid-expect': 'error',
},
},
];
With legacy configuration, add jest to the plugins section of your .eslintrc
configuration file. You can omit the eslint-plugin- prefix:
{
"plugins": ["jest"],
"env": {
"jest/globals": true
},
"rules": {
"jest/no-disabled-tests": "warn",
"jest/no-focused-tests": "error",
"jest/no-identical-title": "error",
"jest/prefer-to-have-length": "warn",
"jest/valid-expect": "error"
}
}
[!NOTE]
You only need to explicitly include our globals if you're not using one of our shared configs
Aliased Jest globals
You can tell this plugin about any global Jests you have aliased using the
globalAliases setting:
{
"settings": {
"jest": {
"globalAliases": {
"describe": ["context"],
"fdescribe": ["fcontext"],
"xdescribe": ["xcontext"]
}
}
}
}
Aliased @jest/globals
You can tell this plugin to treat a different package as the source of Jest
globals using the globalPackage setting:
{
"settings": {
"jest": {
"globalPackage": "bun:test"
}
}
}
[!WARNING]
While this can be used to apply rules when using alternative testing libraries and frameworks like
bun,vitestandnode, there's no guarantee the semantics this plugin assumes will hold outside of Jest
Running rules only on test-related files
The rules provided by this plugin assume that the files they are checking are test-related. This means it's generally not suitable to include them in your top-level configuration as that applies to all files being linted which can include source files.
For .eslintrc configs you can use
overrides
to have ESLint apply additional rules to specific files:
{
"extends": ["eslint:recommended"],
"overrides": [
{
"files": ["test/**"],
"plugins": ["jest"],
"extends": ["plugin:jest/recommended"],
"rules": { "jest/prefer-expect-assertions": "off" }
}
],
"rules": {
"indent": ["error", 2]
}
}
For eslint.config.js you can use
files and ignores:
const jest = require('eslint-plugin-jest');
module.exports = [
...require('@eslint/js').configs.recommended,
{
files: ['test/**'],
...jest.configs['flat/recommended'],
rules: {
...jest.configs['flat/recommended'].rules,
'jest/prefer-expect-assertions': 'off',
},
},
// you can also configure jest rules in other objects, so long as some of the `files` match
{
files: ['test/**'],
rules: { 'jest/prefer-expect-assertions': 'off' },
},
];
Jest version setting
The behaviour of some rules (specifically [no-deprecated-functions][]) change
depending on the version of Jest being used.
By default, this plugin will attempt to determine to locate Jest using
require.resolve, meaning it will start looking in the closest node_modules
folder to the file being linted and work its way up.
Since we cache the automatically determined version, if you're linting sub-folders that have different versions of Jest, you may find that the wrong version of Jest is considered when linting. You can work around this by providing the Jest version explicitly in nested ESLint configs:
{
"settings": {
"jest": {
"version": 27
}
}
}
To avoid hard-coding a number, you can also fetch it from the installed version
of Jest if you use a JavaScript config file such as .eslintrc.js:
module.exports = {
settings: {
jest: {
version: require('jest/package.json').version,
},
},
};
Shareable configurations
[!NOTE]
eslint.config.jscompatible versions of configs are available prefixed withflat/and may be subject to small breaking changes while ESLint v9 is being finalized.
Recommended
This plugin exports a recommended configuration that enforces good testing practices.
To enable this configuration with .eslintrc, use the extends property:
{
"extends": ["plugin:jest/recommended"]
}
To enable this configuration with eslint.config.js, use
jest.configs['flat/recommended']:
const jest = require('eslint-plugin-jest');
module.exports = [
{
files: [/* glob matching your test files */],
...jest.configs['flat/recommended'],
},
];
Style…
Description from the npm listing.
- eslint
- eslintplugin
- eslint-plugin
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (591)Similar npm ESLint plugins plugins
All 20 eslint-plugin-jest alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/eslint-plugin-jest. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.