> 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.

# prefer-includes

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

| Preset                            | Configured Value |
| --------------------------------- | ---------------- |
| ✅ ts.configs.stylisticTypeChecked | `"error"`        |


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

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

## Rule Details

Disallow `indexOf(...) !== -1` / `indexOf(...) === -1` style checks when
`includes(...)` expresses intent more clearly.

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

```ts
if (arr.indexOf(value) !== -1) {
  doSomething();
}
```

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

```ts
if (arr.includes(value)) {
  doSomething();
}
```

## Original Documentation

- [typescript-eslint: prefer-includes](https://typescript-eslint.io/rules/prefer-includes)
- [Source code](https://github.com/typescript-eslint/typescript-eslint/blob/v8.67.0/packages/eslint-plugin/src/rules/prefer-includes.ts)
