close

prefer-todo

Added in v0.8.2

Configuration

rslint.config.ts
import { defineConfig, rstestPlugin } from '@rslint/core';

export default defineConfig([
  rstestPlugin.configs.recommended,
  {
    rules: {
      'rstest/prefer-todo': 'error',
    },
  },
]);

Rule Details

Prefers test.todo(...) for a test that has no implementation. A todo test states the work is intentional instead of looking like a passing test.

The rule reports missing callbacks and inline empty callbacks. Existing test.todo registrations are allowed.

Incorrect

test('exports a CSV file');

test('imports a CSV file', () => {});

Correct

test.todo('exports a CSV file');

test('imports a CSV file', () => {
  expect(importCsv('name\nAda')).toEqual([{ name: 'Ada' }]);
});

Autofix

Rewrites the registration to test.todo, replacing a .skip accessor at the call site and removing an empty callback argument. A registration whose skip comes from an alias, or that chains .skip twice, is reported without a fix, because rewriting one accessor would leave the other skip active.