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: Ignore .length || number #1977

Merged

Conversation

fisker
Copy link
Collaborator

@fisker fisker commented Nov 18, 2022

Fixes #1933

Ideally, we should only ignore when right side is a number, but not sure worth the effort.

@fisker fisker marked this pull request as ready for review November 18, 2022 12:24
@sindresorhus
Copy link
Owner

Ideally, we should only ignore when right side is a number, but not sure worth the effort.

Can't we just place a simple isLiteralNumber(…) || !isLiteral(…) check in there?

@fisker fisker marked this pull request as draft November 19, 2022 06:46
@sindresorhus
Copy link
Owner

Can't we just place a simple isLiteralNumber(…) || !isLiteral(…) check in there?

If this is too difficult, I'm happy to just open an issue for that as a future improvement.

@yoyo837
Copy link

yoyo837 commented Feb 2, 2023

Hello, Why is this still in draft?

@fisker
Copy link
Collaborator Author

fisker commented Feb 2, 2023

I haven't got time to finish it. Will get back to this soon.

@fisker fisker force-pushed the explicit-length-check-length-or branch from acfb24d to f50a154 Compare May 18, 2023 09:35
@fisker
Copy link
Collaborator Author

fisker commented May 18, 2023

Added check, only ignores when || number. Sorry for the long delay.

@fisker fisker marked this pull request as ready for review May 18, 2023 09:39
@fisker fisker changed the title explicit-length-check: Ignore .length || foo explicit-length-check: Ignore .length || number May 18, 2023
@sindresorhus sindresorhus merged commit b9b8794 into sindresorhus:main May 18, 2023
21 checks passed
@fisker fisker deleted the explicit-length-check-length-or branch May 18, 2023 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

explicit-length-check rule should not be triggered when length is part of a numeric expression
3 participants