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

explicit-length-check: Check Set#size #958

Closed
fisker opened this issue Dec 23, 2020 · 7 comments · Fixed by #1226
Closed

explicit-length-check: Check Set#size #958

fisker opened this issue Dec 23, 2020 · 7 comments · Fixed by #1226

Comments

@fisker
Copy link
Collaborator

fisker commented Dec 23, 2020

Make explicit-length-check rule work for Set#size

We can't tell foo in foo.size is a Set, but it seems safe to assume .size is an integer.

Ref: #952 (comment)

@0-Arngerdur-1
Copy link

I am new with JavaScript, but i would like to help with this issue. I can?

@fisker
Copy link
Collaborator Author

fisker commented Jan 18, 2021

Go ahead.

@0-Arngerdur-1
Copy link

Thanks, I have a question, where is the set#size rule? I already looked for it in the comment file and I can't find it.

@fisker
Copy link
Collaborator Author

fisker commented Jan 18, 2021

explicit-length-check

@0-Arngerdur-1
Copy link

I am working on the issue, I would like to ask some questions, can I?

@fisker
Copy link
Collaborator Author

fisker commented Feb 16, 2021

Shot

@0-Arngerdur-1
Copy link

As I understand, in base of the comment in the #952, you tell two improvements for the rule "explicit-length-check" , located in the file 'eslint-plugin-unicorn/rules/explicit-length-check.js', one of these is remove the option >=1 and the other is make the rule work for Set#size. The first one I understand, if I'm not wrong, is only remove the option 'greater-than-or-equal' in the Map and in the function getLengthCheckNode. The second improve I don't understand completely well, but after analyzing it I concluded that you mean is that based on a given Set then instead of just checking non-zero, also check according of the Set values, for example, greater than 5, greater than 6 and so on. I'm right?

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

Successfully merging a pull request may close this issue.

3 participants