# no-iterator

Rule `eslint/no-iterator`. Disallow the use of the `__iterator__` property

- Source: eslint
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 72.9M weekly downloads of presets that enable it
- Trend: +94.0% last quarter
- Rank: #233 by reach, #275 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-iterator` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-iterator) |
| Oxlint | `no-iterator` | yes | safe | plugin `eslint`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-iterator.html) |

## Code examples

### Incorrect: the rule reports this

```js
Foo.prototype.__iterator__ = function() {
    return new FooIterator(this);
};

foo.__iterator__ = function () {};

foo["__iterator__"] = function () {};
```

### Correct: the rule accepts this

```js
const __iterator__ = foo; // Not using the `__iterator__` property.
```

Examples from the ESLint documentation.

## Enable it

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

```js
export default [
  {
    rules: {
      "no-iterator": "error",
    },
  },
];
```

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-iterator": "error"
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Oxlint default](https://lintradar.dev/presets/oxlint-default.md) | Oxlint | `oxlint` | 111 | 50.8M | +183.6% |
| [Airbnb base](https://lintradar.dev/presets/airbnb-base.md) | ESLint | `eslint-config-airbnb-base` | 241 | 6.5M | +2.1% |
| [Create React App](https://lintradar.dev/presets/react-app.md) | ESLint | `eslint-config-react-app` | 109 | 4.1M | +4.3% |
| [Airbnb](https://lintradar.dev/presets/airbnb.md) | ESLint | `eslint-config-airbnb` | 346 | 3.4M | +2.3% |
| [JavaScript Standard Style](https://lintradar.dev/presets/standard.md) | ESLint | `eslint-config-standard` | 161 | 3.1M | +12.9% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |
| [React Native](https://lintradar.dev/presets/react-native.md) | ESLint | `@react-native/eslint-config` | 79 | 1.2M | +5.8% |
| [Anthony Fu's config](https://lintradar.dev/presets/antfu.md) | ESLint | `@antfu/eslint-config` | 294 | 758.7K | +49.9% |
| [XO](https://lintradar.dev/presets/xo.md) | ESLint | `eslint-config-xo` | 618 | 413K | −5.0% |
| [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% |
| [Alloy](https://lintradar.dev/presets/alloy.md) | ESLint | `eslint-config-alloy` | 166 | 31.4K | +32.4% |

## Related rules

- [eslint/no-unused-expressions](https://lintradar.dev/rules/eslint/no-unused-expressions.md): Disallow unused expressions
- [eslint/eqeqeq](https://lintradar.dev/rules/eslint/eqeqeq.md): Require the use of `===` and `!==`
- [eslint/no-self-compare](https://lintradar.dev/rules/eslint/no-self-compare.md): Disallow comparisons where both sides are exactly the same
- [eslint/no-sequences](https://lintradar.dev/rules/eslint/no-sequences.md): Disallow comma operators
- [eslint/no-octal-escape](https://lintradar.dev/rules/eslint/no-octal-escape.md): Disallow octal escape sequences in string literals
- [eslint/no-implied-eval](https://lintradar.dev/rules/eslint/no-implied-eval.md): Disallow the use of `eval()`-like methods

---

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