# no-alias-methods

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

- Source: jest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 16.7M weekly downloads of presets that enable it
- Trend: +10.1% last quarter
- Rank: #659 by reach, #1466 by growth

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
expect(a).toBeCalled()
expect(a).toBeCalledTimes()
expect(a).toBeCalledWith()
expect(a).lastCalledWith()
expect(a).nthCalledWith()
expect(a).toReturn()
expect(a).toReturnTimes()
expect(a).toReturnWith()
expect(a).lastReturnedWith()
expect(a).nthReturnedWith()
expect(a).toThrowError()
```

### Correct: the rule accepts this

```js
expect(a).toHaveBeenCalled()
expect(a).toHaveBeenCalledTimes()
expect(a).toHaveBeenCalledWith()
expect(a).toHaveBeenLastCalledWith()
expect(a).toHaveBeenNthCalledWith()
expect(a).toHaveReturned()
expect(a).toHaveReturnedTimes()
expect(a).toHaveReturnedWith()
expect(a).toHaveLastReturnedWith()
expect(a).toHaveNthReturnedWith()
expect(a).toThrow()
```

Examples from the Oxlint documentation.

## Enable it

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

```js
import jest from "eslint-plugin-jest";

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

### Oxlint: `.oxlintrc.json`

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Jest recommended](https://lintradar.dev/presets/jest-recommended.md) | ESLint | `eslint-plugin-jest` | 19 | 16.7M | +10.1% |

## Related rules

- [vitest/no-alias-methods](https://lintradar.dev/rules/vitest/no-alias-methods.md): Disallow alias methods
- [jest/valid-title](https://lintradar.dev/rules/jest/valid-title.md): Enforce valid titles
- [jest/no-commented-out-tests](https://lintradar.dev/rules/jest/no-commented-out-tests.md): Disallow commented out tests
- [jest/no-standalone-expect](https://lintradar.dev/rules/jest/no-standalone-expect.md): Disallow using `expect` outside of `it` or `test` blocks
- [jest/no-deprecated-functions](https://lintradar.dev/rules/jest/no-deprecated-functions.md): Disallow use of deprecated functions
- [jest/no-jasmine-globals](https://lintradar.dev/rules/jest/no-jasmine-globals.md): Disallow Jasmine globals

---

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