ESLint plugin
@toets/eslint-plugin catches the habits that make TV tests flaky or platform-specific: fixed waits, behavior assertions hidden in page objects, raw platform escape hatches and raw keycodes. Flat config only.
Setup
Scope the plugin to your E2E folder so app code is never linted with test rules:
js
// eslint.config.js
import toets from '@toets/eslint-plugin';
export default [
// ...your other configs
{ files: ['e2e/**/*.{ts,tsx,js}'], ...toets.configs.recommended },
];TypeScript files need a TS parser (for example typescript-eslint) configured as usual.
Rules
| Rule | Recommended | What it prevents |
|---|---|---|
no-sleep | error | Fixed waits (sleep, raw setTimeout) |
page-object-assertions | error | Behavior assertions inside page objects |
no-platform-only | warn | app.platformOnly escape hatches |
prefer-semantic-keys | error | Raw keycodes and string keys in remote.press |
Override levels or options per rule as with any plugin:
js
{
files: ['e2e/**'],
...toets.configs.recommended,
rules: {
...toets.configs.recommended.rules,
'@toets/page-object-assertions': ['error', { files: ['e2e/screens/**'] }],
},
}