Skip to content

noTsIgnore

Prevents the use of the TypeScript directive @ts-ignore.

The directive @ts-ignore suppresses all compilation errors, even ones that could be considered bugs coming from an upstream library or the compiler itself. If you use @ts-ignore, it won’t be possible to know when and if the bug is fixed.

The rule promotes the use the directive @ts-expect-error, which is meant to raise an error if there aren’t any errors. This means that once the bug is fixed, you can delete the directive, safely.

// @ts-ignore
let foo;
code-block.ts:1:4 lint/nursery/noTsIgnore  FIXABLE  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Unsafe use of the @ts-ignore directive found in this comment.

> 1 │ // @ts-ignore
^^^^^^^^^^
2 │ let foo;
3 │

The directive is applied to this line.

1 │ // @ts-ignore
> 2 │ let foo;
^^^
3 │

The @ts-ignore directive suppresses any kind of error, even possible errors that might be fixed by upstream libraries or the compiler itself.

Safe fix: Use the @ts-expect-error directive instead.

1 - //·@ts-ignore
1+ //·@ts-expect-error
2 2 let foo;
3 3

// @ts-expect-error
let foo;
biome.json
{
"linter": {
"rules": {
"nursery": {
"noTsIgnore": "error"
}
}
}
}