A @ts-ignore or @ts-nocheck comment hides compiler errors without naming one
What it finds
// @ts-ignore silences whatever error the next line has, now or after later changes, and // @ts-nocheck switches type checking off for the whole file. Both hide mistakes that the compiler would report. // @ts-expect-error silences one expected error and complains when the error goes away, so it does not outlive its reason.
Reported are comments that start with @ts-ignore or @ts-nocheck.
From the rule's source, ts_ignore_comment.rs.
function f(x: number) { // @ts-ignoretx0 reports: @ts-ignore hides any error on the next line return x.foo;}function g(x: number) { // @ts-expect-error property does not exist return x.bar;} Turn it on, off or suppress it
The rule runs from the strict tier up. To turn it on in a lower tier, give it a level in tx0.toml:
[rules]
"tx0/ts:ts-ignore-comment" = "warning"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:ts-ignore-comment] reason="..."tx0 explain tx0/ts:ts-ignore-comment shows the same in the terminal. Found a false positive? Report it.