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
--- 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"]);