Skip to content

typescript/ban-ts-comment Pedantic

🛠️ An auto-fix is available for this rule for some violations.

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.

Example

ts
if (false) {
  // @ts-ignore: Unreachable code error
  console.log("hello");
}

How to use

To enable this rule in the CLI or using the config file, you can use:

bash
oxlint --deny typescript/ban-ts-comment
json
{
  "rules": {
    "typescript/ban-ts-comment": "error"
  }
}

References

Released under the MIT License.