---
title: "lint/types/no-loose-comparison"
pagination: false
---

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

<RuleId id="lint/types/no-loose-comparison" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix where types prove it, unsafe otherwise. Intent: suspicious.

## What it does

Comparisons should be strict.

## Configuration

```toml title="pun.toml"
[lint.rules]
"types/no-loose-comparison" = "error"
```

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

## Replaces

- [`strict_comparison`](https://cs.symfony.com/doc/rules/strict/strict_comparison.html) (php-cs-fixer, risky)
- [`identity-comparison`](https://mago.carthage.software/1.61.0/en/tools/linter/rules/#identity-comparison) (mago-linter)

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