Closed epreston closed 1 year ago
Are you up for a PR?
Almost, 11 more hours of testing. So many new goodies.
Wait a minute, as I see this case already handled:
And it has tests:
How did you trap on it?
I was getting conversions in 2 cases. The normal one and when the operands reversed.
test != null
null != test
Will update with test cases.
I may have started with null != test
that got corrected to test != null
but then the transform was applied.
I have this habit of doing that because assigning to null by mistake triggers instant error. It also ensures that I can not assign null to the variable by missing a character. It's a habit from another language at the cost of readability.
May the yoda
rule of ESLint help you with this.
Confirmed, I had statements like null != test
that got reversed then snuck through.
The updated issue description would be:
yoda expressions are reversed but continue to be evaluated in the original order. This causes rule exclusions to be bypassed.
Retesting for 29.4.0 update
Retesting for 29.4.0 update
What purpose of this retest? I don't think it will be fixed if you don't send PR.
Oh.. ok. This is just a quick note to say that I'm not leaving old issues open from previous versions.
I'll get to work on it.
Closed due to a long time of inactivity 🏝. Fee free to reopen when you have chance to work on this.
Package: conditions/convert-equal-to-strict-equal Issue: Comparisons to null not safe to transform
Example:
This is not safe to transform into strict compare with
!==
whennull
is the right hand side of the expression. Often, the "loose equality comparison that performs type coercion if necessary" is desired to catch both null and undefined.Detailed reference on the issue: https://stackoverflow.com/a/15992131/900263
Update:
Version: Version: 29.3
Description: yoda expressions are reversed but continue to be evaluated in the original order. This causes rule exclusions to be bypassed.