# no-useless-return

> Disallow a `return` without a value where the function ends anyway

A bare `return;` is for leaving a function early. If nothing would run after it anyway, it doesn't change anything and you can delete it.

`--fix` removes the statement.

{/* Generated by src/codegen/lint-rule-docs.ts. Do not edit this section. */}

## Configure

Off by default. To turn it on:

```toml bunfig.toml
[lint.rules]
"no-useless-return" = "error" # or "warn"
```

{/* End of the generated section. */}

## Examples

Reported:

{/* bad {"count": 2} */}
```js
function reset(form) {
  form.clear();
  return;
}

function notify(user) {
  if (user.muted) {
    return;
  } else {
    send(user);
  }
}
```

Not reported:

{/* good */}
```js
function reset(form) {
  form.clear();
}

function notify(user) {
  if (user.muted) {
    return;
  }
  send(user);
}

function find(id) {
  return undefined;
}
```
