Skip to content

Conversation

@sunrabbit123
Copy link
Contributor

resolve #188

234/293 (79.9%)

This commit introduces the `no-unnecessary-condition` rule to the linter, which detects unnecessary conditional expressions in TypeScript code. The rule is implemented in `no_unnecessary_condition.go` and is accompanied by comprehensive tests in `no_unnecessary_condition_test.go`. The rule checks for always truthy or falsy conditions, unnecessary optional chaining, and allows configuration for constant loop conditions.
This commit expands the `no-unnecessary-condition` rule by adding new checks for unnecessary conditions, including handling of the `never` type, literal comparisons, and type overlap in equality operations. It also introduces new messages for specific cases, improving the rule's ability to detect unnecessary conditional expressions in TypeScript code. Comprehensive tests have been updated to cover these new scenarios.
@sunrabbit123 sunrabbit123 marked this pull request as draft November 10, 2025 10:27
@graphite-app
Copy link

graphite-app bot commented Nov 10, 2025

How to use the Graphite Merge Queue

Add the label 0-merge to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[no-unnecessary-condition](https://typescript-eslint.io/rules/no-unnecessary-condition)

1 participant