Reputation: 519
I use ESLint with Angular v13.
I got the following lint error while using // @ts-ignore
:
Do not use "// @ts-ignore" comments because they suppress compilation errors @typescript-eslint/ban-ts-ignore
Seems @typescript-eslint
doesn't recommend the use of @ts-ignore
.
Is there any alternative way to tell the TypeScript compiler to ignore a specific line from the code?
Upvotes: 3
Views: 3952
Reputation: 1077
You can configure the rule @typescript-eslint/ban-ts-comment
to allow a @ts-ignore
comment when it comes with a description. More info here.
@ts-ignore
comment://@ts-ignore: describe why you're using ts-ignore here
...code...
eslintrc.*
), configure the rule accordingly:{
"rules": {
"@typescript-eslint/ban-ts-comment": [
"error",
{
"ts-ignore": "allow-with-description"
}
]
}
}
Upvotes: 7