menu

prefer-is-empty

Prefer isEmpty over comparisons with zero length

Zero comparisons over canonical length and size members duplicate the isEmpty query. Instead, you SHOULD use isEmpty, negating it when the comparison asks whether elements exist.

Reported

1function empty(values: int32[]): boolean {2    return values.length === 0;3}

Accepted

1function empty(values: int32[]): boolean {2    return values.isEmpty;3}