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

# no-mocks-import

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

| Preset                             | Configured Value |
| ---------------------------------- | ---------------- |
| ✅ rstestPlugin.configs.all         | `"warn"`         |
| ✅ rstestPlugin.configs.recommended | `"error"`        |


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

export default defineConfig([
  rstestPlugin.configs.recommended,
  {
    rules: {
      'rstest/no-mocks-import': 'error',
    },
  },
]);
```

## Rule Details

Disallows importing a manual mock directly from a `__mocks__` directory. Tests should mock the original module path so Rstest controls which module instance is used.

The rule checks both `import` declarations and `require()` calls.

## Incorrect

```ts
import userClient from './__mocks__/user-client';
```

## Correct

```ts
rs.mock('./user-client');
import userClient from './user-client';
```
