Open
Bug 1925856
Opened 1 year ago
Updated 1 year ago
prefer-boolean-length-check incorrect example
Categories
(Developer Infrastructure :: Firefox Source Docs: Content, enhancement)
Developer Infrastructure
Firefox Source Docs: Content
Tracking
(Not tracked)
UNCONFIRMED
People
(Reporter: kernp25, Unassigned)
Details
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:131.0) Gecko/20100101 Firefox/131.0
Steps to reproduce:
Actual results:
The first example if (foo.length && foo.length) {} I think is wrong. Should this not be if (foo.length) {}?
Or should this be:
if (foo?.length) {}
or
if (foo && foo.length) {}
?
Comment 2•1 year ago
|
||
Redirecting to the JS coding style owner
Flags: needinfo?(standard8)
Flags: needinfo?(sledru)
Flags: needinfo?(dtownsend)
Comment 3•1 year ago
|
||
(In reply to kernp25 from comment #0)
The first example
if (foo.length && foo.length) {}I think is wrong. Should this not beif (foo.length) {}?
This does indeed look strange. I think if (foo.length) {} would be good enough to replace it, since that reflects the first line of the incorrect code (though the two lists don't strictly match up).
Flags: needinfo?(standard8)
Flags: needinfo?(dtownsend)
You need to log in
before you can comment on or make changes to this bug.
Description
•