-
-
Notifications
You must be signed in to change notification settings - Fork 875
Description
Description
Follow-up to #8043 / PR #8952.
Add three configuration options to bring the existing || -> ?? check to feature parity with the ESLint rule. These all enhance the base behavior that already exists without introducing new AST visitors.
ignoreMixedLogicalExpressions (default: false)
When true, suppress diagnostics when the || expression is part of a mixed logical expression involving &&. The current implementation already blocks fixes in this scenario for safety, but doesn't expose this as a user-facing option to also suppress the diagnostic. This option makes that behavior configurable.
Example suppressed when enabled: a || b && c
ignorePrimitives (default: all false)
Allow users to suppress diagnostics for specific primitive types in the left operand's type union. Accepts either true (ignore all primitives) or an object with string, number, boolean, bigint fields.
Example suppressed when number: true: declare const x: number | null; x || 0
ignoreBooleanCoercion (default: false)
When true, suppress diagnostics when the || expression appears inside a Boolean() call, where the falsy-coalescing behavior is intentional.
Example suppressed when enabled: Boolean(a || b)
References:
- ESLint rule options: prefer-nullish-coalescing schema
Once this and the preceding issues are all integrated and validated in nursery, the rule source can be rebranded from inspired() to same().