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 rule should not be triggered when length is part of a numeric expression #1933

Closed
broofa opened this issue Oct 21, 2022 · 1 comment · Fixed by #1977
Assignees

Comments

@broofa
Copy link

broofa commented Oct 21, 2022

The explicit-length-check rule is getting triggered in the following context where the length is actually being used for it's numeric value rather than as a boolean. Telling the user to convert it to a logical comparison expression is not appropriate.

CleanShot 2022-10-21 at 15 41 12@2x

explicit-length-check

  const x = [1,2].length || 1;

CleanShot 2022-10-21 at 15 44 20@2x

@broofa broofa changed the title explicit-length-check rule should not be triggered when length is part of a numeric expression explicit-length-check rule should not be triggered when length is part of a numeric expression Oct 21, 2022
@fisker fisker self-assigned this Nov 18, 2022
@yoyo837
Copy link

yoyo837 commented Jan 31, 2023

Same here.

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.

4 participants