# jsx-no-leaked-render

Rule `sonarjs/jsx-no-leaked-render`. React components should not render non-boolean condition values

- 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: #1230 by reach, #531 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `sonarjs/jsx-no-leaked-render` | yes | suggestion | package `eslint-plugin-sonarjs` | [docs](https://rules.sonarsource.com/javascript/RSPEC-6439/) |

## Code examples

### Incorrect: the rule reports this

```js
function Profile(props) {
  return <div>
    <h1>{ props.username }</h1>
    { props.orders && <Orders /> } { /* Noncompliant, 0 will be rendered if no orders available */ }
  </div>
}
```

### Correct: the rule accepts this

```js
function Profile(props) {
  return <div>
    <h1>{ props.username }</h1>
    { props.orders > 0 && <Orders /> }
  </div>;
}
```

```js
function Profile(props) {
  return <div>
    <h1>{ props.username }</h1>
    { props.orders ? <Orders /> : null }
  </div>;
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "sonarjs/jsx-no-leaked-render": "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

- [react/jsx-no-leaked-render](https://lintradar.dev/rules/react/jsx-no-leaked-render.md): Disallow problematic leaked values from being rendered
- [sonarjs/inverted-assertion-arguments](https://lintradar.dev/rules/sonarjs/inverted-assertion-arguments.md): Assertion arguments should be passed in the correct order
- [sonarjs/label-position](https://lintradar.dev/rules/sonarjs/label-position.md): Only "while", "do", "for" and "switch" statements should be labelled
- [sonarjs/insecure-jwt-token](https://lintradar.dev/rules/sonarjs/insecure-jwt-token.md): JWT should be signed and verified with strong cipher algorithms
- [sonarjs/link-with-target-blank](https://lintradar.dev/rules/sonarjs/link-with-target-blank.md): Opened windows should not have access to the originating page
- [sonarjs/insecure-cookie](https://lintradar.dev/rules/sonarjs/insecure-cookie.md): Cookies should have the "secure" flag

---

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