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
Fix: yoda left string fix for exceptRange (fixes #12883) #13052
Fix: yoda left string fix for exceptRange (fixes #12883) #13052
Conversation
@mdjermanovic I would like to apologize as I forgot to comment on the issue that I am picking this! my bad ! |
No problem, thanks for the PR! |
@anikethsaha |
@yeonjuan can you point those false positive. It would be better for me to solve them |
will it help for reviewing if I comment along with the |
Yes :) /*eslint yoda: ["error", "never", { "exceptRange": true }]*/
if (x < -1n || 1n <= x) {}
if (x < -1 || 1 <= x) {} In my understanding, those cases should not be warned because they using the option
And, we can find about the proper behavior of the option |
@yeonjuan , thanks for pointing.
I think the docs is wrong about this, cause this is not a let me know if I am wrong about this. ! |
@mdjermanovic @yeonjuan I have added a comment for why some code should be invalid which is currently showing valid (in |
This isn't an error with |
@anikethsaha
I don't think so. I think the documentation is right.
Yes, this is not a yoda condition but its range test is valid. so when the option
No. I don't think so. As you mentioned it enforce non-yoda with the |
let me clarify if I get this rule correctly !
So, from above, we can see that range condition is only allowed for
After these checks, the rule can still show a linting error if the condition does not returns like this
Please let me know if any of this wrong ! Please check the latest commit, I think those false negatives are fixed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes! This looks good, just needs some small modifications.
It seems that this PR will fix both 1.
and 2.
from #12883 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for keep working on! 👍 In addition to other's reviews, I left a comment.
f61875a
to
7fef15d
Compare
test for |
cc @mdjermanovic @yeonjuan any suggestion for fixing this? I think its not related to this changes. |
It looks like you don't have the new version of CI is failing for a different reason (#13076) |
cc @mdjermanovic I was behind upstream master ! CI is clean |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for changing. 👍 I left some minor suggestions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
Prerequisites checklist
What is the purpose of this pull request? (put an "X" next to an item)
[ ] Documentation update
[X] Bug fix (template)
[ ] New rule (template)
[ ] Changes an existing rule (template)
[ ] Add autofixing to a rule
[ ] Add a CLI option
[ ] Add something to the core
[ ] Other, please explain:
fixing the second issue in #12883
What changes did you make? (Give an overview)
as mentioned in #12883, when having a string in
exceptRange
in left, it was throwing error. So, I added a string check inisBetwwenTest
method forleftLiteral.value
Is there anything you'd like reviewers to focus on?
fixes #12883