Skip to main content

What it flags

A numeric comparison sort on a private copy, or a nonmutating numeric sort, is used only to retrieve its first or last value. A single-pass extreme can use constant extra space.

How to review or fix

The suggested edit requires review. Confirm that every array slot holds a number and that no value is NaN before replacing the sort with a reduction. For example, a hole in the first slot can make the reduction return undefined even when the sorted copy starts with a number.

Configuration

Set the rule to "off" in loadwise.config.json to drop its findings: