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

# triple-slash-reference

[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"`        |
| ✅ ts.configs.strictTypeChecked      | `"error"`        |


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

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

## Rule Details

Disallow certain triple slash directives in favor of ES6-style import declarations. TypeScript's `/// <reference ... />` triple-slash directives are an older mechanism for including type information. In most modern codebases, ES6-style `import` statements are preferred. This rule can ban `/// <reference path="..." />`, `/// <reference types="..." />`, and `/// <reference lib="..." />` directives.

The default options are:

- `lib: "always"`: allow `lib` references.
- `path: "never"`: disallow `path` references.
- `types: "prefer-import"`: disallow a `types` reference only when the same module is also imported.

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

```typescript
/// <reference types="jest" />
import 'jest';

/// <reference path="./types.d.ts" />
```

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

```typescript
/// <reference types="jest" />
import { foo } from 'bar';
// The "jest" reference is allowed because only "bar" is imported.
```

## Original Documentation

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