# no-else-return

Rule `eslint/no-else-return`. Disallow `else` blocks after `return` statements in `if` statements

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 12.4M weekly downloads of presets that enable it
- Trend: +13.0% last quarter
- Rank: #745 by reach, #1438 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-else-return` | no | safe | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-else-return) |
| Oxlint | `no-else-return` | no | safe | plugin `eslint`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-else-return.html) |
| Biome | `style/noUselessElse` | no | safe | group style, since 1.3.0 | [docs](https://biomejs.dev/linter/rules/no-useless-else/) |

## Code examples

### Incorrect: the rule reports this

```js
function foo1() {
    if (x) {
        return y;
    } else {
        return z;
    }
}

function foo2() {
    if (x) {
        return y;
    } else {
        const t = "foo";
    }
}

function foo3() {
    if (error) {
        return 'It failed';
    } else {
        if (loading) {
            return "It's still loading";
        }
    }
}

// Two warnings for nested occurrences
function foo4() {
    if (x) {
        if (y) {
            return y;
        } else {
// …
```

### Correct: the rule accepts this

```js
function foo1() {
    if (x) {
        return y;
    }

    return z;
}

function foo2() {
    if (x) {
        return y;
    }

    const t = "foo";
}

function foo3() {
    if (error) {
        return 'It failed';
    }

    if (loading) {
        return "It's still loading";
    }
}

function foo4() {
    if (x) {
        if (y) {
            return y;
        }

// …
```

Examples from the ESLint documentation.

## Enable it

### ESLint: `eslint.config.js`

```js
export default [
  {
    rules: {
      "no-else-return": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-else-return": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noUselessElse": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [eslint/operator-assignment](https://lintradar.dev/rules/eslint/operator-assignment.md): Require or disallow assignment operator shorthand where possible
- [eslint/prefer-destructuring](https://lintradar.dev/rules/eslint/prefer-destructuring.md): Require destructuring from arrays and/or objects
- [eslint/no-multi-assign](https://lintradar.dev/rules/eslint/no-multi-assign.md): Disallow use of chained assignment expressions
- [eslint/no-lonely-if](https://lintradar.dev/rules/eslint/no-lonely-if.md): Disallow `if` statements as the only statement in `else` blocks
- [eslint/func-names](https://lintradar.dev/rules/eslint/func-names.md): Require or disallow named `function` expressions
- [eslint/no-await-in-loop](https://lintradar.dev/rules/eslint/no-await-in-loop.md): Disallow `await` inside of loops

---

Web page: https://lintradar.dev/rules/eslint/no-else-return. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
