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
authorJared Wein <jwein@mozilla.com>
Thu, 05 Jan 2017 00:25:58 -0500
changeset 456703 579916ba9456e7be844a36cadf89261cc3cac702
parent 456702 b33b0cfdf1380f1f2d433c801df8c6fce4aa2ce3
child 456704 3d43f110b88c7b0e4ac3fa5453b2053bf9af77aa
push id40575
push userjwwang@mozilla.com
push dateFri, 06 Jan 2017 02:27:46 +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"]);