no-export

July 2, 2026 Β· View on GitHub

πŸ“ Disallow exports from test files.

πŸ’ΌπŸš« This rule is enabled in the βœ… recommended config. This rule is disabled in the β˜‘οΈ unopinionated config.

A test file is run by the test runner for its side effects (registering and running tests); it is not a module meant to be imported elsewhere. Exporting from it is almost always a mistake β€” for example, leaving an export on a helper that should live in a separate file, or accidentally exporting test internals.

This rule reports export declarations (including re-exports and default exports) in a file that imports node:test.

Examples

import test from 'node:test';

// ❌
export function helper() {}

// βœ…
test('title', () => {});