# ban-ts-comment

Rule `typescript/ban-ts-comment`. Disallow `@ts-<directive>` comments or require descriptions after directives

- Source: typescript
- Technologies: TypeScript
- Kind: suspicious
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 209.9M weekly downloads of presets that enable it
- Trend: +37.3% last quarter
- Rank: #74 by reach, #1045 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/ban-ts-comment` | yes | suggestion | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/ban-ts-comment) |
| Oxlint | `typescript/ban-ts-comment` | no | suggestion | plugin `typescript`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/ban-ts-comment.html) |
| Biome | `suspicious/noTsIgnore` | yes | safe | group suspicious, since 2.0.0 | [docs](https://biomejs.dev/linter/rules/no-ts-ignore/) |

## Code examples

### Incorrect: the rule reports this

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

```ts
if (false) {
  // @ts-expect-error
  console.log('hello');
}
if (false) {
  /* @ts-expect-error */
  console.log('hello');
}
```

```ts
// @ts-expect-error: the library definition is wrong
const a = doSomething('hello');
```

### Correct: the rule accepts this

```ts
if (false) {
  // Compiler warns about unreachable code error
  console.log('hello');
}
```

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

```ts
// @ts-expect-error: TS1234 because the library definition is wrong
const a = doSomething('hello');
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/ban-ts-comment": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/ban-ts-comment": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "noTsIgnore": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [typescript-eslint recommended](https://lintradar.dev/presets/typescript-eslint-recommended.md) | ESLint | `@typescript-eslint/eslint-plugin` | 24 | 175.9M | +29.5% |
| [typescript-eslint strict](https://lintradar.dev/presets/typescript-eslint-strict.md) | ESLint | `@typescript-eslint/eslint-plugin` | 32 | 175.9M | +29.5% |
| [typescript-eslint strict type-checked](https://lintradar.dev/presets/typescript-eslint-strict-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 75 | 175.9M | +29.5% |
| [typescript-eslint recommended type-checked](https://lintradar.dev/presets/typescript-eslint-recommended-type-checked.md) | ESLint | `@typescript-eslint/eslint-plugin` | 47 | 175.9M | +29.5% |
| [Biome recommended](https://lintradar.dev/presets/biome-recommended.md) | Biome | `@biomejs/biome` | 491 | 28.5M | +106.8% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [Nuxt](https://lintradar.dev/presets/nuxt.md) | ESLint | `@nuxt/eslint-config` | 188 | 1.5M | +72.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [Google TypeScript Style](https://lintradar.dev/presets/gts.md) | ESLint | `gts` | 71 | 553.3K | +10.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [typescript/no-unnecessary-type-constraint](https://lintradar.dev/rules/typescript/no-unnecessary-type-constraint.md): Disallow unnecessary constraints on generic types
- [typescript/no-explicit-any](https://lintradar.dev/rules/typescript/no-explicit-any.md): Disallow the `any` type
- [typescript/no-unused-vars](https://lintradar.dev/rules/typescript/no-unused-vars.md): Disallow unused variables
- [typescript/no-array-constructor](https://lintradar.dev/rules/typescript/no-array-constructor.md): Disallow generic `Array` constructors
- [typescript/no-unused-expressions](https://lintradar.dev/rules/typescript/no-unused-expressions.md): Disallow unused expressions
- [typescript/no-wrapper-object-types](https://lintradar.dev/rules/typescript/no-wrapper-object-types.md): Disallow using confusing built-in primitive class wrappers

---

Web page: https://lintradar.dev/rules/typescript/ban-ts-comment. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
