#21328·eslint

Rule Change: support "object spread" boolean context

Author: abrahamguoCreated Sep 15, 2026Updated Sep 16, 2026
Labelsenhancementrule

What rule do you want to change?

no-extra-boolean-cast

What change do you want to make?

Generate more warnings

How do you think the change should be implemented?

Other

Example code

javascript
Boolean(a ?? !!x)            // ✅ flagged  — "Redundant double negation"
const o = { ...(!!x && a) }  // ❌ not flagged — but the !! is just as redundant

What does the rule currently do for this code?

When enforceForInnerExpressions is true, it checks the RHS of ?? and correctly determines that the !! is unnecessary, and reports on line 1, but it does NOT check the LHS of &&.

What will the rule do after it's changed?

When enforceForInnerExpressions is true, it will also check the LHS of a && inside an object spread, as a "boolean context".

Participation

  • I am willing to submit a pull request to implement this change.

AI acknowledgment

  • I did not use AI to generate this issue report.
  • (If the above is not checked) I have reviewed the AI-generated content before submitting.

Additional comments

No response