Repository navigation
fix(no-misused-promises): don't report comma expressions as conditionals - #1254
Merged
camc314 merged 3 commits intoOct 2, 2026
Merged
Conversation
camc314
reviewed
Oct 2, 2026
Signed-off-by: Cameron <cameron.clark@hey.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1252
The
KindBinaryExpressionlistener passed every binary expression tocheckConditional. A comma expression is aBinaryExpressionin the TypeScript AST, so(a, promise)was reported as a boolean conditional even when it was only returned or assigned. In typescript-eslint the same code is aSequenceExpression, which itsLogicalExpressionlistener never sees.The listener now calls
checkConditionalonly for&&,||and??. A comma expression that really is a condition (anifor?:test, a!operand, a logical operand) is still reported through those paths, and now once instead of twice.Tests
?:condition and as a||operand, one diagnostic each. typescript-eslint 8.71.0 reports one diagnostic at the same range for both.Before the fix, the three valid cases each get a
conditionalreport and the two invalid cases report 2 errors instead of 1. After the fix,go test ./internal/rules/no_misused_promises/and the e2e suite pass, andgofmtandgolangci-lint runon the rule package are clean. With this build, oxlint 1.86.0 reports nothing on the issue's reproduction, and its output for the conditional cases matches typescript-eslint.AI disclosure: fix and tests written with an AI coding assistant (Claude Code). The test results above are from real runs.