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. r?mak draft
authorJared Wein <jwein@mozilla.com>
Thu, 05 Jan 2017 00:25:58 -0500
changeset 456452 54882c6dfcf9dc5f0d2b4d5cb363b7a337f08f8b
parent 456215 fd83a504c64b7df97b8c90632ab4d8418c584347
child 541228 247c823481bc6a634f4343540875e91f00cf1ffe
push id40498
push userbmo:jaws@mozilla.com
push dateThu, 05 Jan 2017 17:09:12 +0000
reviewersmak
bugs1328800
milestone53.0a1
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. r?mak MozReview-Commit-ID: 5oceKd1EJYR
toolkit/.eslintrc.js
toolkit/components/places/tests/unit/test_tagging.js
--- a/toolkit/.eslintrc.js
+++ b/toolkit/.eslintrc.js
@@ -151,16 +151,19 @@ module.exports = {
     "no-self-compare": "error",
 
     // No declaring variables from an outer scope
     // "no-shadow": "error",
 
     // No declaring variables that hide things like arguments
     "no-shadow-restricted-names": "error",
 
+    // Disallow sparse arrays
+    "no-sparse-arrays": "error",
+
     // No trailing whitespace
     "no-trailing-spaces": "error",
 
     // No using undeclared variables
     // "no-undef": "error",
 
     // Error on newline where a semicolon is needed
     "no-unexpected-multiline": "error",
--- a/toolkit/components/places/tests/unit/test_tagging.js
+++ b/toolkit/components/places/tests/unit/test_tagging.js
@@ -114,23 +114,23 @@ function run_test() {
   do_check_true(uri4Tags.includes(tagTitle));
   do_check_true(uri4Tags.includes("tag 3"));
   do_check_true(uri4Tags.includes("456"));
 
   // Test sparse arrays.
   let curChildCount = tagRoot.childCount;
 
   try {
-    tagssvc.tagURI(uri1, [, "tagSparse"]);
+    tagssvc.tagURI(uri1, [undefined, "tagSparse"]);
     do_check_eq(tagRoot.childCount, curChildCount + 1);
   } catch (ex) {
     do_throw("Passing a sparse array should not throw");
   }
   try {
-    tagssvc.untagURI(uri1, [, "tagSparse"]);
+    tagssvc.untagURI(uri1, [undefined, "tagSparse"]);
     do_check_eq(tagRoot.childCount, curChildCount);
   } catch (ex) {
     do_throw("Passing a sparse array should not throw");
   }
 
   // Test that the API throws for bad arguments.
   try {
     tagssvc.tagURI(uri1, ["", "test"]);