fix(lint): make no-misused-promises follow contextual types#443
Merged
Conversation
Replace syntax and method-name heuristics with checker-backed contextual signature analysis across the complete upstream default and option surface. Constraint: Match typescript-eslint 8.63.0 semantics without transformer plugins. Rejected: Expand callback method-name lists | Ordinary functions and arbitrary APIs require resolved types. Confidence: medium Scope-risk: moderate Directive: Keep void-position and disposal decisions checker-backed; do not reintroduce async-syntax or callee-name shortcuts. Tested: Focused defaults and option cases passed before the final generic-signature adjustment. Not-tested: Final focused Go suite and real no-plugin fixture are intentionally deferred until after PR review per requested order.
Move rule registration beside its implementation and expand regression coverage across every acceptance boundary, including positive controls for Promise-aware signatures and async disposal. Constraint: Verification runs follow the requested three-clean-review gate. Rejected: Retain the old async-rule ownership comment | it no longer described the implementation boundary. Confidence: high Scope-risk: narrow Directive: Preserve positive and negative coverage for overload, union, generic, optional, rest, nested, and named callback contracts. Not-tested: Deferred until three clean whole-diff review rounds complete.
Keep nested logical expressions independently visible, resolve tuple-rest callback slots by position, cover all array predicates, and honor contextual synchronous-disposal contracts. Constraint: Reviews count by exhaustive pass, including passes that produce findings. Rejected: Treat tuple rest callbacks as one union element | it hides void-only positions beside Promise-aware positions. Confidence: high Scope-risk: moderate Directive: Nullish coalescing itself is not a boolean test; continue checking logical expressions nested within either branch. Not-tested: Focused verification follows the final exhaustive review.
Keep computed object methods out of the property-position pass so Symbol.dispose remains owned by the variable/disposal check, and guard tuple-rest classification against a missing checker type. Constraint: This is the final exhaustive review pass; findings count without resetting prior passes. Rejected: Deduplicate emitted findings afterward | preserving one semantic owner avoids masking unrelated duplicates. Confidence: high Scope-risk: narrow Directive: Computed disposal methods belong to the well-known-symbol variable check. Not-tested: Focused verification follows immediately.
Use a Promise-returning array predicate for the conditional option fixture so disabling the lint rule does not leave TypeScript's overlapping always-truthy diagnostic behind. Constraint: Focused tests assert command exit codes as well as rule diagnostic lines. Confidence: high Scope-risk: narrow Tested: Focused no-misused-promises Go run exposed the fixture-only failure; implementation and other focused cases passed.
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.
Intent
Close #414 by making
typescript/no-misused-promisesfollow resolved checker contracts instead of callback syntax or method names.Scope
Deferred
None.
Test plan
NoMisusedPromisesauto_discovered_lint_reports_complete_no_misused_promisesCLI fixtureCloses #414