---
title: "lint/refactor/no-negated-condition"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/refactor/no-negated-condition" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Unsafe fix: it can change behaviour.

## What it does

Flip a ternary whose condition is negated: drop the `!` (or use `===` / `==`) and swap the branches.

## Configuration

```toml title="pun.toml"
[lint.rules]
"refactor/no-negated-condition" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`no-negated-ternary`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#no-negated-ternary) (mago-linter)

[More lint/refactor rules](/docs/rules/lint/refactor) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
