> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# deep-control-flow

> Control structures are nested four levels deep.

## What it flags

Four nested control structures. JS/TS reports the deepest site in each function. The other parsers report threshold crossings in supported conditional and loop bodies. Independent function scopes start fresh.

## Inline fix

Lifts the deepest branch one level with a guard clause, a merged nested `if`, or by dropping an `else` after a branch that exits.

## Configuration

Set the rule to `"off"` in `loadwise.config.json` to drop its findings:

```json theme={null}
{
  "rules": { "deep-control-flow": "off" }
}
```

For JavaScript and TypeScript files, an object with a `level` and `options` sets the rule's threshold. It takes a `maxDepth` option, a positive integer. The rule then reports control flow nested more than `maxDepth` levels deep. Without the option, it reports from four nested levels, the same as `maxDepth: 3`. Other languages keep the built-in threshold.

```json theme={null}
{
  "rules": {
    "deep-control-flow": { "level": "warn", "options": { "maxDepth": 5 } }
  }
}
```

`level` is required: `"warn"` reports findings without changing the exit code. An `overrides` entry can set different options for the files it matches, and its options win over the top-level ones.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.