# no-alias-methods

Rule `vitest/no-alias-methods`. Disallow alias methods

- Source: vitest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1775 by reach

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `vitest/no-alias-methods` | no | safe | package `@vitest/eslint-plugin` | [docs](https://github.com/vitest-dev/eslint-plugin-vitest/blob/main/docs/rules/no-alias-methods.md) |
| Oxlint | `vitest/no-alias-methods` | no | safe | plugin `vitest`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/vitest/no-alias-methods.html) |

## Code examples

### Incorrect: the rule reports this

```js
expect(a).toBeCalled()
```

```js
expect(a).toBeCalledTimes(1)
```

### Correct: the rule accepts this

```js
expect(a).toHaveBeenCalled()
```

```js
expect(a).toHaveBeenCalledTimes(1)
```

Examples from the ESLint documentation.

## Enable it

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

```js
import vitest from "@vitest/eslint-plugin";

export default [
  {
    plugins: { vitest },
    rules: {
      "vitest/no-alias-methods": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "vitest"
  ],
  "rules": {
    "vitest/no-alias-methods": "error"
  }
}
```

## Related rules

- [jest/no-alias-methods](https://lintradar.dev/rules/jest/no-alias-methods.md): Disallow alias methods
- [vitest/max-expects](https://lintradar.dev/rules/vitest/max-expects.md): Enforce a maximum number of expect per test
- [vitest/no-conditional-in-test](https://lintradar.dev/rules/vitest/no-conditional-in-test.md): Disallow conditional tests
- [vitest/hoisted-apis-on-top](https://lintradar.dev/rules/vitest/hoisted-apis-on-top.md): Enforce hoisted APIs to be on top of the file
- [vitest/no-conditional-tests](https://lintradar.dev/rules/vitest/no-conditional-tests.md): Disallow conditional tests
- [vitest/consistent-vitest-vi](https://lintradar.dev/rules/vitest/consistent-vitest-vi.md): Enforce using vitest or vi but not both

---

Web page: https://lintradar.dev/rules/vitest/no-alias-methods. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
