prefer-set-has
: Add option for number of elements required
#2473
Labels
prefer-set-has
: Add option for number of elements required
#2473
Description
From the docs:
This is only true for sets containing a larger number of elements. For a small number of elements, using
array.includes
is both faster for look-ups, and has a smaller memory footprint.I would like to propose adding an option to this rule to specify how many elements are needed before this rule kicks in. Additionally, it would be nice if the rule enforced using an array over a set when this threshold isn't met.
I suggest the name
threshold
for this option.If this option were to be enabled by default, then the default should probably be somewhere between 10 and 30.
Fail
Pass
Additional Info
No response
The text was updated successfully, but these errors were encountered: