eslint-plugin-testing-library weekly downloads statistics
By testing-library (2 listings) · npm · ESLint plugins
ESLint plugin to follow best practices and anticipate common mistakes when writing tests with Testing Library
eslint-plugin-testing-library has 11,594,731 recorded weekly downloads on npm, an increase of 10.2% over the past 30 days, ranking #134 of 3,247 tracked listings.
About eslint-plugin-testing-library
[![Package version][version-badge]][version-url]
[![eslint-remote-tester][eslint-remote-tester-badge]][eslint-remote-tester-workflow]
[![eslint-plugin-testing-library][package-health-badge]][package-health-url]
[![MIT License][license-badge]][license-url]
<br />
[![PRs Welcome][pr-badge]][pr-url]
![All Contributors][all-contributors-badge]
Prerequisites
To use this plugin, you must have Node.js (^18.18.0, ^20.9.0, or >=21.1.0) installed.
Installation
You'll first need to install ESLint.
Next, install eslint-plugin-testing-library:
$ pnpm add --save-dev eslint-plugin-testing-library
# or
$ npm install --save-dev eslint-plugin-testing-library
# or
$ yarn add --dev eslint-plugin-testing-library
Note: If you installed ESLint globally (using the -g flag) then you must also install eslint-plugin-testing-library globally.
Migrating
You can find detailed guides for migrating eslint-plugin-testing-library in the migration guide docs:
Usage
Add testing-library to the plugins section of your .eslintrc.js configuration file. You can omit the eslint-plugin- prefix:
module.exports = {
plugins: ['testing-library'],
};
Then configure the rules you want to use within rules property of your .eslintrc:
module.exports = {
rules: {
'testing-library/await-async-queries': 'error',
'testing-library/no-await-sync-queries': 'error',
'testing-library/no-debugging-utils': 'warn',
'testing-library/no-dom-import': 'off',
},
};
Run the plugin only against test files
With the default setup mentioned before, eslint-plugin-testing-library will be run against your whole codebase. If you want to run this plugin only against your tests files, you have the following options:
ESLint overrides
One way of restricting ESLint config by file patterns is by using ESLint overrides.
Assuming you are using the same pattern for your test files as Jest by default, the following config would run eslint-plugin-testing-library only against your test files:
// .eslintrc.js
module.exports = {
// 1) Here we have our usual config which applies to the whole project, so we don't put testing-library preset here.
extends: ['airbnb', 'plugin:prettier/recommended'],
// 2) We load other plugins than eslint-plugin-testing-library globally if we want to.
plugins: ['react-hooks'],
overrides: [
{
// 3) Now we enable eslint-plugin-testing-library rules or preset only for matching testing files!
files: ['**/__tests__/**/*.[jt]s?(x)', '**/?(*.)+(spec|test).[jt]s?(x)'],
extends: ['plugin:testing-library/react'],
},
],
};
ESLint Cascading and Hierarchy
Another approach for customizing ESLint config by paths is through ESLint Cascading and Hierarchy. This is useful if all your tests are placed under the same folder, so you can place there another .eslintrc where you enable eslint-plugin-testing-library for applying it only to the files under such folder, rather than enabling it on your global .eslintrc which would apply to your whole project.
Shareable configurations
[!NOTE]
eslint.config.jscompatible versions of configs are available prefixed withflat/, though most of the plugin documentation still currently uses.eslintrcsyntax.Refer to the ESLint documentation on the new configuration file format for more.
This plugin exports several recommended configurations that enforce good practices for specific Testing Library packages.
You can find more info about enabled rules in the Supported Rules section, under the Configurations column.
Since each one of these configurations is aimed at a particular Testing Library package, they are not extendable between them, so you should use only one of them at once per .eslintrc file. For example, if you want to enable recommended configuration for React, you don't need to combine it somehow with DOM one:
// ❌ Don't do this
module.exports = {
extends: ['plugin:testing-library/dom', 'plugin:testing-library/react'],
};
// ✅ Just do this instead
module.exports = {
extends: ['plugin:testing-library/react'],
};
DOM Testing Library
Enforces recommended rules for DOM Testing Library.
To enable this configuration use the extends property in your
.eslintrc.js config file:…
Description from the npm listing.
- eslint
- eslintplugin
- eslint-plugin
- lint
- testing-library
- testing
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-testing-library 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-testing-library. First seen Oct 16, 2026; last successful collection Dec 6, 2026. See the methodology.