# no-callback-literal

Rule `node/no-callback-literal`. Enforce Node.js-style error-first callback pattern is followed

- Source: node
- Technologies: Node.js
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 3.6M weekly downloads of presets that enable it
- Trend: +16.5% last quarter
- Rank: #1414 by reach, #1400 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `n/no-callback-literal` | no | no | package `eslint-plugin-n` | [docs](https://github.com/eslint-community/eslint-plugin-n/blob/HEAD/docs/rules/no-callback-literal.md) |

## Code examples

### Incorrect: the rule reports this

```js
cb('this is an error string');
cb({ a: 1 });
callback(0);
```

### Correct: the rule accepts this

```js
cb(undefined);
cb(null, 5);
callback(new Error('some error'));
callback(someVariable);
```

Examples from the ESLint documentation.

## Enable it

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

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

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

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [neostandard](https://lintradar.dev/presets/neostandard.md) | ESLint | `neostandard` | 95 | 317.6K | +50.2% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [node/no-mixed-requires](https://lintradar.dev/rules/node/no-mixed-requires.md): Disallow `require` calls to be mixed with regular variable declarations
- [node/global-require](https://lintradar.dev/rules/node/global-require.md): Require `require()` calls to be placed at top-level module scope
- [node/callback-return](https://lintradar.dev/rules/node/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/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/no-callback-literal. Data from npm and the linters' documentation, collected Dec 4, 2026. Site guide for agents: https://lintradar.dev/llms.txt
