---
title: "lint/control-flow/no-useless-else"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/control-flow/no-useless-else" />

In the [`early-return`](/docs/rules/sets/early-return) set. Safe fix.

## What it does

There should not be useless `else` cases.

## Configuration

```toml title="pun.toml"
[lint.rules]
"control-flow/no-useless-else" = "error"
```

To skip it in some files, add an [override](/docs/configuration/pun-toml#lint) or a [`@pun-ignore-file`](/docs/configuration/ignore-comments) comment.

## Replaces

- [`no_useless_else`](https://cs.symfony.com/doc/rules/control_structure/no_useless_else.html) (php-cs-fixer)
- [`no-redundant-else`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#no-redundant-else) (mago-linter)

[More lint/control-flow rules](/docs/rules/lint/control-flow) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
