Skip to content

no-restated-comment

Flag short standalone comments that repeat the adjacent statement's identifiers.

Why

A comment that only repeats code adds no context and can become stale independently.

Fix

Remove a genuine restatement; retain conditions, constraints, rationale, and information absent from the statement.

Examples

Before — flagged Remove a comment that repeats the statement
src/cache.ts
// Serialize key
const key = serialize(input);
After — preferred Keep a condition the statement does not establish
src/cache.ts
// Serialize key only after validation.
const key = serialize(input);