# no-negation-in-equality-check

Disallow negation in equality checks

`!left === right` negates only the left operand, although its visual shape can be read as negating the complete equality check.
Instead, you SHOULD parenthesize the intended grouping or use the opposite equality operator.

- Category: suspicious
- Level: warning
- Fix: suggestion
- Scope: module

## Reported

```ds title="main.ds"
function differs(left: boolean, right: boolean): boolean {
    return !left === right;
}
```

## Accepted

```ds title="main.ds"
function differs(left: boolean, right: boolean): boolean {
    return !(left === right);
}
```

## Prior art

- [eslint-plugin-unicorn · no-negation-in-equality-check](https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/no-negation-in-equality-check.md)

[language/linter/src/rules/suspicious/no_negation_in_equality_check.rs:7](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/suspicious/no_negation_in_equality_check.rs#L7)
