# no-negated-condition

Rule `eslint/no-negated-condition`. Disallow negated conditions

- Source: eslint
- Technologies: JavaScript
- Kind: style
- Needs type information: no
- Autofix: yes, in at least one linter
- Reach: 2.2M weekly downloads of presets that enable it
- Trend: +137.0% last quarter
- Rank: #1491 by reach, #84 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-negated-condition` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-negated-condition) |
| Oxlint | `no-negated-condition` | no | safe | plugin `eslint`, category pedantic | [docs](https://oxc.rs/docs/guide/usage/linter/rules/eslint/no-negated-condition.html) |
| Biome | `style/noNegationElse` | no | safe | group style, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-negation-else/) |

## Code examples

### Incorrect: the rule reports this

```js
if (!a) {
    doSomething();
} else {
    doSomethingElse();
}

if (a != b) {
    doSomething();
} else {
    doSomethingElse();
}

if (a !== b) {
    doSomething();
} else {
    doSomethingElse();
}

!a ? c : b
```

### Correct: the rule accepts this

```js
if (!a) {
    doSomething();
}

if (!a) {
    doSomething();
} else if (b) {
    doSomething();
}

if (a != b) {
    doSomething();
}

a ? b : c
```

Examples from the ESLint documentation.

## Enable it

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

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

### Oxlint: `.oxlintrc.json`

```json
{
  "rules": {
    "no-negated-condition": "error"
  }
}
```

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "style": {
        "noNegationElse": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [Ultracite for Biome](https://lintradar.dev/presets/ultracite-biome.md) | Biome | `ultracite` | 616 | 2.1M | +151.7% |
| [eslint-config-love](https://lintradar.dev/presets/love.md) | ESLint | `eslint-config-love` | 258 | 171.7K | +39.3% |

## Related rules

- [unicorn/no-negated-condition](https://lintradar.dev/rules/unicorn/no-negated-condition.md): Disallow negated conditions.
- [vue/no-negated-condition](https://lintradar.dev/rules/vue/no-negated-condition.md): Disallow negated conditions in `<template>`
- [eslint/prefer-named-capture-group](https://lintradar.dev/rules/eslint/prefer-named-capture-group.md): Enforce using named capture group in regular expression
- [eslint/logical-assignment-operators](https://lintradar.dev/rules/eslint/logical-assignment-operators.md): Require or disallow logical assignment operator shorthand
- [eslint/no-warning-comments](https://lintradar.dev/rules/eslint/no-warning-comments.md): Disallow specified warning terms in comments
- [eslint/no-restricted-imports](https://lintradar.dev/rules/eslint/no-restricted-imports.md): Disallow specified modules when loaded by `import`

---

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