# consistent-return

Rule `typescript/consistent-return`. Require `return` statements to either always or never specify values

- Source: typescript
- Technologies: TypeScript
- Kind: suspicious
- Needs type information: yes
- Autofix: no
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1506 by reach, #10 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `@typescript-eslint/consistent-return` | no | no | package `@typescript-eslint/eslint-plugin` | [docs](https://typescript-eslint.io/rules/consistent-return) |
| Oxlint | `typescript/consistent-return` | no | no | plugin `typescript`, category suspicious | [docs](https://oxc.rs/docs/guide/usage/linter/rules/typescript/consistent-return.html) |
| Biome | `nursery/noMixedReturns` | no | no | group nursery, since 2.6.10 | [docs](https://biomejs.dev/linter/rules/no-mixed-returns/) |

## Code examples

### Incorrect: the rule reports this

```ts
function foo(): undefined {}
function bar(flag: boolean): undefined {
  if (flag) return foo();
  return;
}

async function baz(flag: boolean): Promise<undefined> {
  if (flag) return;
  return foo();
}
```

### Correct: the rule accepts this

```ts
function foo(): void {}
function bar(flag: boolean): void {
  if (flag) return foo();
  return;
}

async function baz(flag: boolean): Promise<void | number> {
  if (flag) return 42;
  return;
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
import tseslint from "typescript-eslint";

export default [
  {
    plugins: { "@typescript-eslint": tseslint.plugin },
    rules: {
      "@typescript-eslint/consistent-return": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "typescript/consistent-return": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noMixedReturns": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |

## Related rules

- [eslint/consistent-return](https://lintradar.dev/rules/eslint/consistent-return.md): Require `return` statements to either always or never specify values
- [typescript/prefer-enum-initializers](https://lintradar.dev/rules/typescript/prefer-enum-initializers.md): Require each enum member value to be explicitly initialized
- [typescript/parameter-properties](https://lintradar.dev/rules/typescript/parameter-properties.md): Require or disallow parameter properties in class constructors
- [typescript/explicit-member-accessibility](https://lintradar.dev/rules/typescript/explicit-member-accessibility.md): Require explicit accessibility modifiers on class properties and methods
- [typescript/no-unsafe-type-assertion](https://lintradar.dev/rules/typescript/no-unsafe-type-assertion.md): Disallow type assertions that narrow a type
- [typescript/prefer-regexp-exec](https://lintradar.dev/rules/typescript/prefer-regexp-exec.md): Enforce `RegExp#exec` over `String#match` if no global flag is provided

---

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