| name | ESLint for Test Quality |
| description | Enforce test quality with ESLint - eslint-plugin-jest, eslint-plugin-playwright, and eslint-plugin-testing-library rules in flat config, blocking focused tests, missing assertions, and flaky waits via a CI lint gate. |
| version | 1.0.0 |
| author | thetestingacademy |
| license | MIT |
| tags | ["eslint","lint","test-quality","jest","playwright","testing-library","flat-config","ci","code-quality"] |
| testingTypes | ["code-quality"] |
| frameworks | ["jest","playwright","vitest"] |
| languages | ["javascript","typescript"] |
| domains | ["web"] |
| agents | ["claude-code","cursor","github-copilot","windsurf","codex","aider","continue","cline","zed","bolt","gemini-cli","amp"] |
ESLint for Test Quality
This skill makes an AI agent wire ESLint plugins that lint the tests themselves - catching focused tests that silently skip entire suites in CI, assertion-free tests, conditional expects, and flaky waitForTimeout calls before they merge. Trigger it when a project has test files but no test-specific lint rules, when an it.only ever reaches main, or when the user asks to "lint tests", "block .only", or "enforce testing best practices".
Core Principles
- A committed
.only is a silent CI outage. it.only makes every other test in the file stop running while the build stays green. no-focused-tests set to error is the single highest-value test lint rule; it is non-negotiable.
- Tests without assertions must fail the lint. A test that calls code and asserts nothing passes forever.
expect-expect (Jest/Playwright) turns these into lint errors and accepts custom assertion wrappers via configuration.
- Lint rules encode review comments you are tired of writing. "Do not put expects in conditionals", "use userEvent not fireEvent", "no waitForTimeout" - each has a rule; automate the comment.
- Scope test rules to test files only. Apply plugin configs with
files: ['**/*.test.ts'] globs in flat config so production code is not subjected to test rules and vice versa.
- Warnings are noise; errors are gates. CI must run with
--max-warnings 0 or set every rule you care about to error. A warning that scrolls by in CI logs changes nothing.
- Adopt recommended configs first, then tighten. Start from
flat/recommended for each plugin, then promote the high-signal rules (no-conditional-expect, no-standalone-expect, prefer-user-event) to error as the suite cleans up.
Setup
npm install --save-dev eslint eslint-plugin-jest eslint-plugin-testing-library \
eslint-plugin-jest-dom eslint-plugin-playwright
Flat config with per-suite scoping
import jest from 'eslint-plugin-jest';
import testingLibrary from ;
jestDom ;
playwright ;
[
{
: [, ],
: { jest, : testingLibrary, : jestDom },
: { : jest... },
: {
...jest.[].,
...testingLibrary.[].,
...jestDom.[].,
: ,
: ,
: ,
: ,
: ,
: ,
: [
,
{ : [, , ] },
],
: ,
: ,
: ,
},
},
{
: [],
: { playwright },
: {
...playwright.[].,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
: ,
},
},
];