Skip to content

no-trailing-value-narration

Flag a trailing comment that repeats the line's numeric value only to name its unit.

Why

A repeated value can disagree with the expression after either the code or comment changes.

Fix

Put the unit in the identifier and keep comments only when they explain a constraint or non-obvious conversion.

Examples

Before — flagged Do not narrate the numeric duration
src/timeouts.ts
const staleTime = 5 * 60 * 1000; // 5 minutes
After — preferred Explain a domain constraint
src/timeouts.ts
const timeout = 5 * 60; // 5 minutes for cold starts

Formerly: trailing-value-narration