Enforce using @ts-expect-error over @ts-ignore.
This rule applies only to .js and .ts files.
// code-linter.json5
{
"rules": {
"@typescript-eslint/prefer-ts-expect-error": "error"
}
} // @ts-expect-error: with description export const str: string = 1; /** * Explaining comment * * @ts-expect-error: with description */ export const multiLine: number = 'value'; /** @ts-expect-error: with description */ export const block: string = 1;
// @ts-ignore
const str: string = 1;
/**
* Explaining comment
*
* @ts-ignore */
const multiLine: number = 'value';
/** @ts-ignore */
const block: string = 1;
const isOptionEnabled = (key: string): boolean => {
// @ts-ignore: if key isn't in globalOptions it'll be undefined which is false
return !!globalOptions[key];
}; plugin:@typescript-eslint/all
For details about how to configure Code Linter check rules, see Code Linter.