src/content/docs/linter/rules/no-ts-ignore.mdx
import { Tabs, TabItem } from '@astrojs/starlight/components';
<Tabs> <TabItem label="JavaScript (and super languages)" icon="seti:javascript"> ## Summary - Rule available since: `v2.0.0` - Diagnostic Category: [`lint/suspicious/noTsIgnore`](/reference/diagnostics#diagnostic-category) - This rule is **recommended**, meaning it is enabled by default. - This rule has a [**safe**](/linter/#safe-fixes) fix. - The default severity of this rule is [**warning**](/reference/diagnostics#warning). - Sources: - Inspired from [`@typescript-eslint/ban-ts-comment`](https://typescript-eslint.io/rules/ban-ts-comment){
"linter": {
"rules": {
"suspicious": {
"noTsIgnore": "error"
}
}
}
}
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;
// @ts-expect-error
let foo;