---
url: /docs/guide/usage/linter/rules/typescript/ban-ts-comment.md
---

### 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:

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

## Configuration

This rule allows you to specify how different TypeScript directive comments
should be handled.

For each directive (`@ts-expect-error`, `@ts-ignore`, `@ts-nocheck`, `@ts-check`), you can choose one of the following options:

* `true`: Disallow the directive entirely, preventing its use in the entire codebase.
* `false`: Allow the directive without any restrictions.
* `"allow-with-description"`: Allow the directive only if it is followed by a description explaining its use. The description must meet the minimum length specified by `minimumDescriptionLength`.
* `{ "descriptionFormat": "<regex>" }`: Allow the directive only if the description matches the specified regex pattern.

For example:

```json
{
  "ts-expect-error": "allow-with-description",
  "ts-ignore": true,
  "ts-nocheck": { "descriptionFormat": "^: TS\\d+ because .+$" },
  "ts-check": false,
  "minimumDescriptionLength": 3
}
```

This rule accepts a configuration object with the following properties:

### minimumDescriptionLength

type: `integer`

default: `3`

Minimum description length required when using directives with `allow-with-description`.

### ts-check

type: `object | boolean | "allow-with-description"`

#### ts-check.descriptionFormat

type: `string`

### ts-expect-error

type: `object | boolean | "allow-with-description"`

#### ts-expect-error.descriptionFormat

type: `string`

### ts-ignore

type: `object | boolean | "allow-with-description"`

#### ts-ignore.descriptionFormat

type: `string`

### ts-nocheck

type: `object | boolean | "allow-with-description"`

#### ts-nocheck.descriptionFormat

type: `string`

## How to use

## Version

This rule was added in v0.0.8.

## References
