Skip to content

@rotki/no-comment-run

Disallow consecutive // comment lines

📖 Rule Details

Two or more // lines in a row are narration: prose that restates the code below it, drifts out of date independently of it, and is invisible to editors at the call site. A single // line is allowed.

A run made entirely of directives is allowed, so several suppressions may be stacked above the line they apply to. A run that mixes a directive with prose is reported. Directives are recognised by prefix: eslint-, @ts-expect-error, @ts-ignore, @ts-nocheck, prettier-, c8 ignore, v8 ignore and istanbul. A TypeScript triple-slash reference counts as a directive too, in its types, path, lib and no-default-lib forms, so the header of a .d.ts file is not a run.

Only comments alone on their line count. A trailing comment annotates the code it sits after rather than narrating what follows, so a column of them down an object literal or an enum is not a run.

The rule is deliberately not autofixable, because the replacement depends on what the comment says: documentation of the code below becomes a TSDoc block, a justified value becomes a named constant, and a claim about behaviour becomes an assertion or a test name.

⚙️ Options

Nothing.

🚀 Version

This rule was introduced in @rotki/eslint-plugin v1.6.0

🔍 Implementation