# synchronous-exception-assertions

Rule `sonarjs/synchronous-exception-assertions`. Synchronous exception assertions should receive synchronous callbacks

- Source: sonarjs
- Technologies: JavaScript
- Kind: correctness
- Needs type information: yes
- Autofix: yes, in at least one linter
- Reach: 6.2M weekly downloads of presets that enable it
- Trend: +62.1% last quarter
- Rank: #1369 by reach, #670 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/synchronous-exception-assertions` | yes | suggestion | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-9072/) |

## Enable it

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

```js
export default [
  {
    rules: {
      "sonarjs/synchronous-exception-assertions": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [SonarJS recommended](https://lintradar.dev/presets/sonarjs-recommended.md) | ESLint | `eslint-plugin-sonarjs` | 230 | 6.2M | +62.1% |

## Related rules

- [sonarjs/super-linear-regex](https://lintradar.dev/rules/sonarjs/super-linear-regex.md): Regular expressions should not cause non-linear backtracking
- [sonarjs/synchronous-suite-callback](https://lintradar.dev/rules/sonarjs/synchronous-suite-callback.md): Tests should not be registered asynchronously in suite callbacks
- [sonarjs/strict-transport-security](https://lintradar.dev/rules/sonarjs/strict-transport-security.md): HTTP Strict-Transport-Security policy should not be disabled
- [sonarjs/table-header](https://lintradar.dev/rules/sonarjs/table-header.md): Tables should have headers
- [sonarjs/stateful-regex](https://lintradar.dev/rules/sonarjs/stateful-regex.md): Regular expressions with the global flag should be used with caution
- [sonarjs/table-header-reference](https://lintradar.dev/rules/sonarjs/table-header-reference.md): Table cells should reference their headers

---

Web page: https://lintradar.dev/rules/sonarjs/synchronous-exception-assertions. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
