---
title: "lint/style/prefer-early-return-over-prepared-value"
pagination: false
---

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

<RuleId id="lint/style/prefer-early-return-over-prepared-value" />

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

## What it does

Return early from each if instead of preparing a variable that is returned at the end.

## Configuration

```toml title="pun.toml"
[lint.rules]
"style/prefer-early-return-over-prepared-value" = "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

- [`PreparedValueToEarlyReturn`](https://getrector.com/rule-detail/prepared-value-to-early-return-rector) (rector)

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