Skip to content
Critiq Docs

Search docs

Search documentation pages and rules

correctness.language

Duplicate if-else-if condition

Do not repeat the same test in an if-else-if chain.

#Metadata

Rule ID
ts.correctness.duplicate-if-else-condition
Severity
medium
Confidence
0.9
Languages
javascript, typescript
Presets
recommended, strict
Stability
stable
Applies to
file
Tags
correctness, crq-cor-031, language, rules-catalog

#Why it matters

Duplicate conditions create unreachable branches and usually indicate a copy-paste defect.

#Remediation

Remove the duplicate branch or change the condition to the intended distinct test.

#Repository path

The generated metadata points to critiq-rules/libs/rules/catalog/rules/typescript/ts.correctness.duplicate-if-else-condition.rule.yaml.