Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.language

Identical comparison operands

Both sides of a comparison use the same source text.

#Metadata

Rule ID
ts.correctness.identical-comparison-operands
Severity
low
Confidence
0.85
Languages
javascript, typescript
Presets
recommended, strict
Stability
stable
Applies to
file
Tags
correctness, crq-cor-023, language, public-directory-parity, rules-catalog

#Why it matters

Comparing an expression to itself is either always true or always false and usually indicates a copy-paste defect.

#Remediation

Replace one operand with the value you meant to compare against.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.correctness.identical-comparison-operands.rule.yaml.