# callback-return

Rule `node/callback-return`. Require `return` statements after callbacks

- Source: node
- Technologies: Node.js
- Kind: style
- Needs type information: no
- Autofix: no
- Reach: 2.1M weekly downloads of presets that enable it
- Trend: +151.7% last quarter
- Rank: #1519 by reach, #23 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `n/callback-return` | no | no | package `eslint-plugin-n` | [docs](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/callback-return.md) |
| Oxlint | `node/callback-return` | no | no | plugin `node`, category style | [docs](https://oxc.rs/docs/guide/usage/linter/rules/node/callback-return.html) |

## Code examples

### Incorrect: the rule reports this

```js
function foo(err, callback) {
    if (err) {
        callback(err);
    }
    callback();
}
```

```js
function foo(err, done) {
    if (err) {
        done(err);
    }
    done();
}

function bar(err, send) {
    if (err) {
        send.error(err);
    }
    send.success();
}
```

```js
function foo(err, callback) {
    if (err) {
        callback(err); // this is fine, but WILL warn
    } else {
        callback();    // this is fine, but WILL warn
    }
}
```

### Correct: the rule accepts this

```js
function foo(err, callback) {
    if (err) {
        return callback(err);
    }
    callback();
}
```

```js
function foo(err, done) {
    if (err) {
        return done(err);
    }
    done();
}

function bar(err, send) {
    if (err) {
        return send.error(err);
    }
    send.success();
}
```

```js
function foo(err, callback) {
    if (err) {
        setTimeout(callback, 0); // this is bad, but WILL NOT warn
    }
    callback();
}
```

Examples from the ESLint documentation.

## Enable it

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

```js
import n from "eslint-plugin-n";

export default [
  {
    plugins: { n },
    rules: {
      "n/callback-return": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "plugins": [
    "node"
  ],
  "rules": {
    "node/callback-return": "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/callback-return](https://lintradar.dev/rules/eslint/callback-return.md): Require `return` statements after callbacks
- [node/exports-style](https://lintradar.dev/rules/node/exports-style.md): Enforce either `module.exports` or `exports`
- [node/global-require](https://lintradar.dev/rules/node/global-require.md): Require `require()` calls to be placed at top-level module scope
- [node/no-mixed-requires](https://lintradar.dev/rules/node/no-mixed-requires.md): Disallow `require` calls to be mixed with regular variable declarations
- [node/file-extension-in-import](https://lintradar.dev/rules/node/file-extension-in-import.md): Enforce the style of file extensions in `import` declarations
- [node/no-unpublished-bin](https://lintradar.dev/rules/node/no-unpublished-bin.md): Disallow `bin` files that npm ignores

---

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