Closed lumburr closed 1 year ago
So, I don't agree with this approach. I think the better way is to figure out what foo == null
was intended to check for. If it's just checking for a "falsey" value, it should just be !foo
.
That is, someone should log all these cases of == null
with a typeof during testing to see what exactly are the types of values getting loosely checked against null, and then re-write this in a way that is more clear. That's IMO a better approach rather than just adding a bunch of function wrappers, which possibly degrades performance.
currentDirectory
---- is related to the file, there are only two possible undefined, normal value
currentDirectory comes from the file information in the node
and will be given a default value of {}
.
Path: packages/less/src/less/environment/environment.js
Path: packages/less/src/ess/tree/node.js
v
has three possible values null, undefined, normal.
Path: packages/less/src/less/functions/default.js
unit
has only two possible values null, normal value.
Path: packages/less/src/less/functions/math-helper.js
MathHelper is only used in two places.
Path: packages/less/src/less/functions/math.js
It is normal.
Path: packages/less/src/less/functions/number.js
It is normal or null.value.value
has only two possible values undefined, normal value.
Path: packages/less/src/less/parser/paser.js
Path: packages/less/src/less/parser/paser.js
It is normal or undefind.
Path: packages/less/src/less/parser/paser.js
It is undefind.
Path: packages/less/src/less/parser/paser.js
It is undefind.
Path: packages/less/src/less/parser/paser.js
It is normal or undefind.this.visibilityBlocks
has only two possible values undefined, normal value
Path: packages/less/src/less/tree/node.js
Default value is undefind, Invalid information is filtered.nestedSelector
has only two possible values null, normal value.
Path: packages/less/src/less/tree/ruleset.js
Path: packages/less/src/less/tree/ruleset.js
nestedSelector
instanceof Selector or return null.evaldCondition
has three possible values null, undefined, normal.
Path: packages/less/src/less/tree/selector.js
Path: packages/less/src/less/tree/ruleset.js
It is undefind.
Path: packages/less/src/less/tree/atrule.js
It is null.Thanks for doing this research!
What: fix #3224
Why:
How:
Use a new utils function replace
v == null
to fix eslint warning. It's a code style issue. We also can chage ESlint config option "no-eq-null" to fix it. Which plan are we going to take? I will update my pr if it needs to change.Checklist: