# no-boolean-literal-compare

Disallow comparing boolean values to boolean literals

For a boolean operand, comparison with `true` returns the operand and comparison with `false` returns its negation.
Instead, you SHOULD use the boolean value directly or negate it.

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

## Reported

```ds title="main.ds"
function active(value: boolean): boolean {
    return value === true;
}
```

## Accepted

```ds title="main.ds"
function active(value: boolean): boolean {
    return value;
}
```

## Prior art

- [Clippy · bool_comparison](https://rust-lang.github.io/rust-clippy/master/index.html#bool_comparison)
- [typescript-eslint · no-unnecessary-boolean-literal-compare](https://typescript-eslint.io/rules/no-unnecessary-boolean-literal-compare)

[language/linter/src/rules/style/no_boolean_literal_compare.rs:8](https://github.com/destack-sh/destack/blob/main/language/linter/src/rules/style/no_boolean_literal_compare.rs#L8)
