# no-restricted-matchers

Rule `jest/no-restricted-matchers`. Disallow specific matchers & modifiers

- Source: jest
- Technologies: Testing
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 0 weekly downloads of presets that enable it
- Trend: 0% last quarter
- Rank: #1742 by reach

## Linters

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

## Code examples

### Incorrect: the rule reports this

```js
it('is false', () => {
  // if this has a modifier (i.e. `not.toBeFalsy`), it would be considered fine
  expect(a).toBeFalsy();
});

it('resolves', async () => {
  // all uses of this modifier are disallowed, regardless of matcher
  await expect(myPromise()).resolves.toBe(true);
});

describe('when an error happens', () => {
  it('does not upload the file', async () => {
    // all uses of this matcher are disallowed
    expect(uploadFileMock).not.toHaveBeenCalledWith('file.name');
  });
});
```

Examples from the ESLint documentation.

## Enable it

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

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

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

### Oxlint: `.oxlintrc.json`

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

## Related rules

- [vitest/no-restricted-matchers](https://lintradar.dev/rules/vitest/no-restricted-matchers.md): Disallow the use of certain matchers
- [jest/no-restricted-jest-methods](https://lintradar.dev/rules/jest/no-restricted-jest-methods.md): Disallow specific `jest.` methods
- [jest/no-unneeded-async-expect-function](https://lintradar.dev/rules/jest/no-unneeded-async-expect-function.md): Disallow unnecessary async function wrapper for expected promises
- [jest/no-large-snapshots](https://lintradar.dev/rules/jest/no-large-snapshots.md): Disallow large snapshots
- [jest/no-untyped-mock-factory](https://lintradar.dev/rules/jest/no-untyped-mock-factory.md): Disallow using `jest.mock()` factories without an explicit type parameter
- [jest/no-confusing-set-timeout](https://lintradar.dev/rules/jest/no-confusing-set-timeout.md): Disallow confusing usages of jest.setTimeout

---

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