ban-ts-comment
What it does
Section titled “What it does”Reports a @ts-ignore comment, a @ts-nocheck comment before the first statement, and a @ts-expect-error comment whose description is shorter than three characters (// @ts-expect-error: the API types are wrong is fine). Line and block comments are read. @ts-check is not reported.
Why it matters
Section titled “Why it matters”@ts-ignore hides every type error on the next line and keeps hiding them after the code changes, so a later, real error on that line is never shown. @ts-nocheck turns checking off for the whole file. @ts-expect-error is safer, because the compiler complains when the error is gone, but without a reason nobody knows when it is safe to remove.
To fix, remove the error with a proper type, or use @ts-expect-error with a short reason.
Example
Section titled “Example”let a = 1;// @ts-ignorea = "";// @ts-expect-errora = "";// @ts-expect-error: not a numbera = "";/* @ts-ignore *//** * @ts-expect-error */// @ts-check// @ts-nocheck/// @ts-ignoreConfiguration
Section titled “Configuration”js: lint: rules: ban-ts-comment: warn # off (default), warn, errorEnabled by the presets: js/typescript-eslint-recommended, js/biome-recommended.
Suppress one line with sudsy-disable-next-line ban-ts-comment in a comment of the file’s language.
Upstream equivalents
Section titled “Upstream equivalents”The same check in other tools. full: Sudsy reports what the upstream rule reports; partial: only part of it, as the last column says.
| Tool | Rule | Match | What differs |
|---|---|---|---|
| typescript-eslint | ban-ts-comment |
partial | the options (minimumDescriptionLength, per-directive settings, descriptionFormat) keep their defaults |