menu
manual-range-contains
Prefer range membership over equivalent bound comparisons
Separate lower-bound and upper-bound comparisons obscure a range membership test.
Instead, you SHOULD call .contains() on the corresponding range.
Out-of-range disjunctions over floating-point values are excluded because negating .contains() changes NaN behavior.
Reported
1function isByte(value: int64): boolean {2 return value >= 0 && value <= 255;3}Accepted
1function isByte(value: int64): boolean {2 return (0..=255).contains(value);3}