---
title: "lint/style/prefer-early-continue"
pagination: false
---

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

<RuleId id="lint/style/prefer-early-continue" />

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

## What it does

Continue early instead of nesting the loop body in an if.

## Configuration

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

- [`prefer-early-continue`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#prefer-early-continue) (mago-linter)

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