There are 27 linting rules available in eslint-plugin-testing-library, here’s a summary of the linting rules picked for our web register
To reduce flaky tests (that passes when they should)
- Disallow the use of the global RegExp flag (/g) in queries (
testing-library/no-global-regexp-flag-in-query)
To create effective tests (that fails when they should)
- Enforce promises from async queries to be handled (
testing-library/await-async-query) - Enforce promises from async utils to be handled (
testing-library/await-async-utils)
To create more helpful error messages
To best mimic user interaction
- Disallow
containerand its too-powerful methods likequerySelector(testing-library/no-container)
To simplify tests
- Prefer
findByoverwaitFor+getBy
To use modern approach
- Use
waitForinstead ofwait-> deprecation - use
view,utils, or destructing forrenderresults, instead ofwrapper