Rules
force-iterable-empty
Use Iterable.isEmpty rather than size-based emptiness checks.
Purpose and behavior
Use Iterable.isEmpty rather than size-based emptiness checks.
The rule checks Iterable.size calls compared with 0 or 1 using the force-array-empty criteria. The rule ignores bracket calls, other namespaces and other thresholds. Use !Iterable.isEmpty for non-empty checks.
Options
No configurable options. Enable with "rules/force-iterable-empty": "error".
Invalid example
if (Iterable.size(xs) === 0) {}Valid example
if (Iterable.isEmpty(xs)) {}Fixes and exceptions
This rule provides no automatic fix. Rewrite the code to preserve its intended behavior.
For a boundary exception, use oxlint-disable-next-line rules/force-iterable-empty -- reason. Examples cover this rule only and may omit imports or declarations.
Source and tests
Enabled by the Effect preset.