Appearance
This rule lets you set which directive comments you want to allow in your codebase.
Using TypeScript directives to suppress TypeScript compiler errors reduces the effectiveness of TypeScript overall.
Examples of incorrect code for this rule:
if (false) { // @ts-ignore: Unreachable code error console.log("hello"); }
This rule accepts a configuration object with the following properties:
type: integer
integer
default: 3
3
Minimum description length required when using directives with allow-with-description.
allow-with-description
How to handle the @ts-check directive.
@ts-check
How to handle the @ts-expect-error directive.
@ts-expect-error
How to handle the @ts-ignore directive.
@ts-ignore
How to handle the @ts-nocheck directive.
@ts-nocheck
To enable this rule in the CLI or using the config file, you can use:
oxlint --deny typescript/ban-ts-comment
{ "rules": { "typescript/ban-ts-comment": "error" } }
typescript/ban-ts-comment Pedantic
What it does
This rule lets you set which directive comments you want to allow in your codebase.
Why is this bad?
Using TypeScript directives to suppress TypeScript compiler errors reduces the effectiveness of TypeScript overall.
Examples
Examples of incorrect code for this rule:
Configuration
This rule accepts a configuration object with the following properties:
minimumDescriptionLength
type:
integerdefault:
3Minimum description length required when using directives with
allow-with-description.ts-check
How to handle the
@ts-checkdirective.ts-expect-error
How to handle the
@ts-expect-errordirective.ts-ignore
How to handle the
@ts-ignoredirective.ts-nocheck
How to handle the
@ts-nocheckdirective.How to use
To enable this rule in the CLI or using the config file, you can use:
References