# double-comparisons

Rule `oxc/double-comparisons`. This rule checks for double comparisons in logical expressions.

- Source: oxc
- Technologies: JavaScript
- Kind: correctness
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 52.9M weekly downloads of presets that enable it
- Trend: +182.2% last quarter
- Rank: #243 by reach, #2 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| Oxlint | `oxc/double-comparisons` | yes | safe | plugin `oxc`, category correctness | [docs](https://oxc.rs/docs/guide/usage/linter/rules/oxc/double-comparisons.html) |
| Biome | `nursery/noDoubleComparison` | yes | unsafe | group nursery, since 2.6.0 | [docs](https://biomejs.dev/linter/rules/no-double-comparison/) |

## Code examples

### Incorrect: the rule reports this

```js
x === y || x < y;
x < y || x === y;
```

### Correct: the rule accepts this

```js
x <= y;
x >= y;
```

Examples from the Oxlint documentation.

## Enable it

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "oxc/double-comparisons": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "nursery": {
        "noDoubleComparison": "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% |
| [Ultracite for Oxlint](https://lintradar.dev/presets/ultracite-oxlint.md) | Oxlint | `ultracite` | 475 | 2.1M | +151.7% |

## Related rules

- [oxc/only-used-in-recursion](https://lintradar.dev/rules/oxc/only-used-in-recursion.md): Checks for arguments that are only used in recursion with no side-effects.
- [oxc/uninvoked-array-callback](https://lintradar.dev/rules/oxc/uninvoked-array-callback.md): This rule applies when an Array function has a callback argument used for an array with empty slots.
- [oxc/number-arg-out-of-range](https://lintradar.dev/rules/oxc/number-arg-out-of-range.md): Checks whether the radix or precision arguments of number-related functions exceed the limit.
- [oxc/missing-throw](https://lintradar.dev/rules/oxc/missing-throw.md): Checks whether the `throw` keyword is missing in front of a `new` expression.
- [oxc/erasing-op](https://lintradar.dev/rules/oxc/erasing-op.md): Checks for erasing operations, e.g., `x * 0`.
- [oxc/const-comparisons](https://lintradar.dev/rules/oxc/const-comparisons.md): Checks for redundant or logically impossible comparisons. This includes: - Ineffective double comparisons against constants. - Impossible comparisons involving constants. - Redundant comparisons where both operands are the same (e.g., a < a).

---

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