Logo
  • DB
  • About
  • Updates
eslint-plugin-testing-library

ESLint plugin to follow best practices and anticipate common mistakes when writing tests with Testing Library

❯ npm i --save-dev eslint-plugin-testing-library
🏠 Homepage🐛 BugsGitHub LogoGitHubnpm Logonpm
🕵️‍♂️ Linter
  • 5 Configs
  • 26 Rules
GitHub LogoGitHub
  • TypeScript
  • 926 Stars
  • 10 Watchers
npm Logonpm
  • 3.1M Wkly Downloads
  • +44% WoW
  • 6.2.0 257 kB
📋 Requirements
  • Node: ^12.22 || ^14.17 || >=16
  • npm: >=6
  • ESLint: ^7.5 || ^8
🗂️ Keywords
  • angular
  • best-practices
  • development
  • dom
  • javascript
  • ...
ConfigurationRules
🔴 angular19 error • 1 warn
🟠 dom15
🟡 marko19 error • 1 warn
🟢 react21 error • 1 warn
🔵 vue19 error • 1 warn
RuleDescription🔧💡💭🗂️⚙️🔴🟠🟡🟢🔵
await-async-events

Enforce promises from async event methods are handled

🔧⚙️🔴🟠🟡🟢🔵
await-async-queries

Enforce promises from async queries to be handled

🔴🟠🟡🟢🔵
await-async-utils

Enforce promises from async utils to be awaited properly

🔴🟠🟡🟢🔵
consistent-data-testid

Ensures consistent usage of data-testid

📖⚙️
no-await-sync-events

Disallow unnecessary await for sync events

⚙️🔴🟠🟢
no-await-sync-queries

Disallow unnecessary await for sync queries

🔴🟠🟡🟢🔵
no-container

Disallow the use of container methods

🔴🟡🟢🔵
no-debugging-utils

Disallow the use of debugging utilities like debug

⚙️⚠️⚠️⚠️⚠️
no-dom-import

Disallow importing from DOM Testing Library

🔧🔴🟡🟢🔵
no-global-regexp-flag-in-query

Disallow the use of the global RegExp flag (/g) in queries

🔧📖🔴🟠🟡🟢🔵
no-manual-cleanup

Disallow the use of cleanup

🟢🔵
no-node-access

Disallow direct Node access

⚙️🔴🟠🟡🟢🔵
no-promise-in-fire-event

Disallow the use of promises passed to a fireEvent method

🔴🟠🟡🟢🔵
no-render-in-lifecycle

Disallow the use of render in testing frameworks setup functions

⚙️🔴🟡🟢🔵
no-unnecessary-act

Disallow wrapping Testing Library utils or empty callbacks in act

⚙️🟡🟢
no-wait-for-multiple-assertions

Disallow the use of multiple expect calls inside waitFor

📖🔴🟠🟡🟢🔵
no-wait-for-side-effects

Disallow the use of side effects in waitFor

📖🔴🟠🟡🟢🔵
no-wait-for-snapshot

Ensures no snapshot is generated inside of a waitFor call

🔴🟠🟡🟢🔵
prefer-explicit-assert

Suggest using explicit assertions rather than standalone queries

📖⚙️
prefer-find-by

Suggest using find(All)By* query instead of waitFor + get(All)By* to wait for elements

🔧📖🔴🟠🟡🟢🔵
prefer-presence-queries

Ensure appropriate get*/query* queries are used with their respective matchers

📖⚙️🔴🟠🟡🟢🔵
prefer-query-by-disappearance

Suggest using queryBy* queries when waiting for disappearance

🔴🟠🟡🟢🔵
prefer-query-matchers

Ensure the configured get*/query* query is used with the corresponding matchers

📖⚙️
prefer-screen-queries

Suggest using screen while querying

📖🔴🟠🟡🟢🔵
prefer-user-event

Suggest using userEvent over fireEvent for simulating user interactions

📖⚙️
render-result-naming-convention

Enforce a valid naming for return value from render

📖🔴🟡🟢🔵
© 2024 Lintbase