Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

prefer-set-has: Add a min array length option #2491

Open
omril1 opened this issue Oct 28, 2024 · 0 comments
Open

prefer-set-has: Add a min array length option #2491

omril1 opened this issue Oct 28, 2024 · 0 comments

Comments

@omril1
Copy link

omril1 commented Oct 28, 2024

Description

Add a min or minLength option so only arrays from a certain known size will be linted (default 0).

The rule can sometimes be too strict, using sets over arrays is usually more performant the more elements it has, and it's negligible in small numbers and readability is preferred.

Fail

min: 5

const array = [1, 2, 3, 4, 5, 6, 7];
const hasValue = value => array.includes(value);

Pass

min: 5

const array = [1, 2];
const hasValue = value => array.includes(value);

Additional Info

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant