Skip to content

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 ​

RuleRecommendedWhat it prevents
no-sleeperrorFixed waits (sleep, raw setTimeout)
page-object-assertionserrorBehavior assertions inside page objects
no-platform-onlywarnapp.platformOnly escape hatches
prefer-semantic-keyserrorRaw 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/**'] }],
  },
}