# no-negated-in-lhs

Rule `eslint/no-negated-in-lhs`. Disallow negating the left operand in `in` expressions

- Source: eslint
- Technologies: JavaScript
- Kind: suspicious
- Needs type information: no
- Autofix: yes, in at least one linter
- Deprecated: yes
- Reach: 1.2M weekly downloads of presets that enable it
- Trend: +5.8% last quarter
- Rank: #1565 by reach, #1483 by growth

## Linters

| Linter | Rule name | Recommended | Autofix | Details | Docs |
| --- | --- | --- | --- | --- | --- |
| ESLint | `no-negated-in-lhs` | no | no | package `eslint` | [docs](https://eslint.org/docs/latest/rules/no-negated-in-lhs) |
| Biome | `suspicious/noUnsafeNegation` | yes | unsafe | group suspicious, since 1.0.0 | [docs](https://biomejs.dev/linter/rules/no-unsafe-negation/) |

## Code examples

### Incorrect: the rule reports this

```js
if(!key in object) {
    // operator precedence makes it equivalent to (!key) in object
    // and type conversion makes it equivalent to (key ? "false" : "true") in object
}
```

### Correct: the rule accepts this

```js
if(!(key in object)) {
    // key is not in object
}

if(('' + !key) in object) {
    // make operator precedence and type conversion explicit
    // in a rare situation when that is the intended meaning
}
```

Examples from the ESLint documentation.

## Enable it

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

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

### Biome: `biome.json`

```json
{
  "linter": {
    "rules": {
      "suspicious": {
        "noUnsafeNegation": "error"
      }
    }
  }
}
```

## Presets that enable it

| Preset | Linter | Package | Rules | Weekly downloads | Trend |
| --- | --- | --- | --- | --- | --- |
| [React Native](https://lintradar.dev/presets/react-native.md) | ESLint | `@react-native/eslint-config` | 79 | 1.2M | +5.8% |

## Related rules

- [eslint/consistent-this](https://lintradar.dev/rules/eslint/consistent-this.md): Enforce consistent naming when capturing the current execution context
- [eslint/no-invalid-this](https://lintradar.dev/rules/eslint/no-invalid-this.md): Disallow use of `this` in contexts where the value of `this` is `undefined`
- [eslint/max-depth](https://lintradar.dev/rules/eslint/max-depth.md): Enforce a maximum depth that blocks can be nested
- [eslint/max-lines](https://lintradar.dev/rules/eslint/max-lines.md): Enforce a maximum number of lines per file
- [eslint/max-params](https://lintradar.dev/rules/eslint/max-params.md): Enforce a maximum number of parameters in function definitions
- [eslint/sort-vars](https://lintradar.dev/rules/eslint/sort-vars.md): Require variables within the same declaration block to be sorted

---

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