Skip to content

fix(lint): make no-misused-promises follow contextual types#443

Merged
samchon merged 5 commits into
masterfrom
fix/lint-no-misused-promises
Jul 13, 2026
Merged

fix(lint): make no-misused-promises follow contextual types#443
samchon merged 5 commits into
masterfrom
fix/lint-no-misused-promises

Conversation

@samchon

@samchon samchon commented Jul 13, 2026

Copy link
Copy Markdown
Owner

Intent

Close #414 by making typescript/no-misused-promises follow resolved checker contracts instead of callback syntax or method names.

Scope

  • cover default conditional, predicate, spread, void-return, inherited-method, JSX, and synchronous-disposal contexts
  • expose the upstream scalar and per-position option shape
  • add focused native regression coverage and a real package-auto-discovered no-plugin CLI fixture
  • update the public rule documentation

Deferred

None.

Test plan

  • focused Go tests matching NoMisusedPromises
  • real auto_discovered_lint_reports_complete_no_misused_promises CLI fixture

Closes #414

samchon added 5 commits July 14, 2026 03:29
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.
@samchon
samchon merged commit 0534caa into master Jul 13, 2026
46 of 48 checks passed
@samchon
samchon deleted the fix/lint-no-misused-promises branch July 13, 2026 18:53
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.

fix(lint): make no-misused-promises follow contextual types

1 participant