Closed
Bug 1328800
Opened 8 years ago
Closed 8 years ago
Enable the no-sparse-arrays rule for eslint
Categories
(Toolkit :: General, defect)
Toolkit
General
Tracking
()
RESOLVED
FIXED
mozilla53
Tracking | Status | |
---|---|---|
firefox53 | --- | fixed |
People
(Reporter: jaws, Assigned: jaws)
Details
Attachments
(1 file)
There are only two errors reported with this rule enabled and they are explicitly using sparse arrays for error testing. Enabling this rule may prevent unintended bugs from being created.
c:\fx\toolkit\components\places\tests\unit\test_tagging.js
122:26 error Unexpected comma in middle of array. no-sparse-arrays (eslint)
128:28 error Unexpected comma in middle of array. no-sparse-arrays (eslint)
Comment hidden (mozreview-request) |
Comment 2•8 years ago
|
||
mozreview-review |
Comment on attachment 8823950 [details]
Bug 1328800 - Enable the no-sparse-arrays rule for eslint and change the two instances of it to use 'undefined' instead of a sparse array since the test will still be fine either way.
https://reviewboard.mozilla.org/r/102426/#review102956
::: toolkit/components/places/tests/unit/test_tagging.js:119
(Diff revision 1)
> do_check_true(uri4Tags.includes(tagTitle));
> do_check_true(uri4Tags.includes("tag 3"));
> do_check_true(uri4Tags.includes("456"));
>
> // Test sparse arrays.
> + /* eslint-disable no-sparse-arrays */
Based on the code, you can just put undefined instead of the empty entries, and the test will still be fine, without the need to special-case it.
It's basically the same:
[,][0] === undefined
Attachment #8823950 -
Flags: review?(mak77) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Pushed by jwein@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/579916ba9456
Enable the no-sparse-arrays rule for eslint and change the two instances of it to use 'undefined' instead of a sparse array since the test will still be fine either way. r=mak
Comment 6•8 years ago
|
||
bugherder |
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
status-firefox53:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in
before you can comment on or make changes to this bug.
Description
•