# expression-complexity

Rule `sonarjs/expression-complexity`. Expressions should not be too complex

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

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/expression-complexity` | no | no | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-1067/) |

## Enable it

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

```js
export default [
  {
    rules: {
      "sonarjs/expression-complexity": "error",
    },
  },
];
```

## Related rules

- [sonarjs/elseif-without-else](https://lintradar.dev/rules/sonarjs/elseif-without-else.md): "if ... else if" constructs should end with "else" clauses
- [sonarjs/file-header](https://lintradar.dev/rules/sonarjs/file-header.md): Track lack of copyright and license headers
- [sonarjs/destructuring-assignment-syntax](https://lintradar.dev/rules/sonarjs/destructuring-assignment-syntax.md): Destructuring syntax should be used for assignments
- [sonarjs/file-name-differ-from-class](https://lintradar.dev/rules/sonarjs/file-name-differ-from-class.md): Default export names and file names should match
- [sonarjs/declarations-in-global-scope](https://lintradar.dev/rules/sonarjs/declarations-in-global-scope.md): Variables and functions should not be declared in the global scope
- [sonarjs/for-in](https://lintradar.dev/rules/sonarjs/for-in.md): "for...in" loops should filter properties before acting on them

---

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