> For AI agents: the complete documentation index is available at https://rslint.rs/llms.txt, the full documentation bundle is available at https://rslint.rs/llms-full.txt.

# ban-ts-comment

[Added in v0.1.14](https://github.com/web-infra-dev/rslint/releases/tag/v0.1.14)
## Configuration

| Preset                              | Configured Value                            |
| ----------------------------------- | ------------------------------------------- |
| ✅ ts.configs.recommended            | `"error"`                                   |
| ✅ ts.configs.recommendedTypeChecked | `"error"`                                   |
| ✅ ts.configs.strict                 | `["error",{"minimumDescriptionLength":10}]` |
| ✅ ts.configs.strictTypeChecked      | `["error",{"minimumDescriptionLength":10}]` |


```ts title=rslint.config.ts
import { defineConfig, ts } from '@rslint/core';

export default defineConfig([
  ts.configs.recommended,
  {
    rules: {
      '@typescript-eslint/ban-ts-comment': 'error',
    },
  },
]);
```

## Rule Details

Disallow `@ts-<directive>` comments or require descriptions after directives. TypeScript provides several directive comments (`@ts-expect-error`, `@ts-ignore`, `@ts-nocheck`, `@ts-check`) that alter how the compiler processes code. Overusing these directives can hide real errors and reduce type safety.

By default, `@ts-expect-error`, `@ts-ignore`, and `@ts-nocheck` are banned. Directives can optionally be allowed if accompanied by a description meeting a minimum length requirement.

Examples of **incorrect** code for this rule:

```typescript
// @ts-ignore
const x: number = 'hello';

// @ts-nocheck

/* @ts-ignore */
const y = undefined;
```

Examples of **correct** code for this rule:

```typescript
// @ts-expect-error: this is intentional for testing
const x: number = 'hello';

// @ts-check

// Regular comments that mention @ts-ignore in passing are fine
```

## Original Documentation

- [typescript-eslint: ban-ts-comment](https://typescript-eslint.io/rules/ban-ts-comment)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.46.3/packages/eslint-plugin/src/rules/ban-ts-comment.ts)
