# no-async-iterator-callback

Rule `unicorn/no-async-iterator-callback`. Disallow asynchronous callbacks in synchronous iterator helpers.

- Source: unicorn
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: no
- Reach: 9.9M weekly downloads of presets that enable it
- Trend: +28.3% last quarter
- Rank: #917 by reach, #1172 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `unicorn/no-async-iterator-callback` | no | no | package `eslint-plugin-unicorn` | [docs](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v80.0.0/docs/rules/no-async-iterator-callback.md) |

## Code examples

### Incorrect: the rule reports this

```js
Iterator.from(values).filter(async value => isAllowed(value));

Iterator.from(values).some(async value => isAllowed(value));

Iterator.from(values).every(async value => isAllowed(value));

Iterator.from(values).find(async value => isAllowed(value));

Iterator.from(values).forEach(async value => {
  await save(value);
});

Iterator.from(values).flatMap(async value => getChildren(value));
```

### Correct: the rule accepts this

```js
Iterator.from(values).filter(value => value.isAllowed);

for (const value of values) {
  await save(value);
}

const allowedValues = [];
for (const value of values) {
  if (await isAllowed(value)) {
    allowedValues.push(value);
  }
}
```

Examples from the ESLint documentation.

## Enable it

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

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

export default [
  {
    plugins: { unicorn },
    rules: {
      "unicorn/no-async-iterator-callback": "error",
    },
  },
];
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Unicorn recommended](https://lintradar.dev/presets/unicorn-recommended.md) | ESLint | `eslint-plugin-unicorn` | 340 | 9.5M | +30.3% |
| [Unicorn unopinionated](https://lintradar.dev/presets/unicorn-unopinionated.md) | ESLint | `eslint-plugin-unicorn` | 236 | 9.5M | +30.3% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |

## Related rules

- [unicorn/no-array-from-fill](https://lintradar.dev/rules/unicorn/no-array-from-fill.md): Disallow `.fill()` after `Array.from({length: …})`.
- [unicorn/no-blob-to-file](https://lintradar.dev/rules/unicorn/no-blob-to-file.md): Disallow unnecessary `Blob` to `File` conversion.
- [unicorn/expiring-todo-comments](https://lintradar.dev/rules/unicorn/expiring-todo-comments.md): Add expiration conditions to TODO comments.
- [unicorn/no-chained-comparison](https://lintradar.dev/rules/unicorn/no-chained-comparison.md): Disallow chained comparisons such as `a < b < c`.
- [unicorn/dom-node-dataset](https://lintradar.dev/rules/unicorn/dom-node-dataset.md): Enforce consistent style for DOM element dataset access.
- [unicorn/no-conflicting-constraints](https://lintradar.dev/rules/unicorn/no-conflicting-constraints.md): Disallow conflicting CSS query and HTML form constraints.

---

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