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

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

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

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

## What it does

Drop the else after a branch that always returns, throws or exits, and move its body after the if.

## Configuration

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

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

## Replaces

- [`RemoveAlwaysElse`](https://getrector.com/rule-detail/remove-always-else-rector) (rector)

[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)
