Bug 1372427 - add rule to not put spacing inside arrays. r=mattn
auto --fix
MozReview-Commit-ID: BiEzl4OawuU
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -46,10 +46,11 @@ module.exports = {
"max-len": ["error", 100],
"no-fallthrough": "error",
"no-multiple-empty-lines": ["error", {
max: 2,
}],
"no-throw-literal": "error",
"padded-blocks": ["error", "never"],
radix: "error",
+ "array-bracket-spacing": ["error", "never"],
},
};
--- a/toolkit/components/satchel/AutoCompletePopup.jsm
+++ b/toolkit/components/satchel/AutoCompletePopup.jsm
@@ -1,17 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
-this.EXPORTED_SYMBOLS = [ "AutoCompletePopup" ];
+this.EXPORTED_SYMBOLS = ["AutoCompletePopup"];
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/Services.jsm");
// AutoCompleteResultView is an abstraction around a list of results
// we got back up from browser-content.js. It implements enough of
// nsIAutoCompleteController and nsIAutoCompleteInput to make the
// richlistbox popup work.
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -166,25 +166,25 @@ const dbSchema = {
"id": "INTEGER PRIMARY KEY",
"timeDeleted": "INTEGER",
"guid": "TEXT"
}
},
indices: {
moz_formhistory_index: {
table: "moz_formhistory",
- columns: [ "fieldname" ]
+ columns: ["fieldname"]
},
moz_formhistory_lastused_index: {
table: "moz_formhistory",
- columns: [ "lastUsed" ]
+ columns: ["lastUsed"]
},
moz_formhistory_guid_index: {
table: "moz_formhistory",
- columns: [ "guid" ]
+ columns: ["guid"]
},
}
};
/**
* Validating and processing API querying data
*/
@@ -651,47 +651,47 @@ function updateFormHistoryWrite(aChanges
let delStmt = makeMoveToDeletedStatement(change.guid, now, change, bindingArrays);
if (delStmt && !stmts.includes(delStmt)) {
stmts.push(delStmt);
}
if ("timeDeleted" in change) {
delete change.timeDeleted;
}
stmt = makeRemoveStatement(change, bindingArrays);
- notifications.push([ "formhistory-remove", change.guid ]);
+ notifications.push(["formhistory-remove", change.guid]);
break;
case "update":
log("Update form history " + change);
let guid = change.guid;
delete change.guid;
// a special case for updating the GUID - the new value can be
// specified in newGuid.
if (change.newGuid) {
change.guid = change.newGuid;
delete change.newGuid;
}
stmt = makeUpdateStatement(guid, change, bindingArrays);
- notifications.push([ "formhistory-update", guid ]);
+ notifications.push(["formhistory-update", guid]);
break;
case "bump":
log("Bump form history " + change);
if (change.guid) {
stmt = makeBumpStatement(change.guid, now, bindingArrays);
- notifications.push([ "formhistory-update", change.guid ]);
+ notifications.push(["formhistory-update", change.guid]);
} else {
change.guid = generateGUID();
stmt = makeAddStatement(change, now, bindingArrays);
- notifications.push([ "formhistory-add", change.guid ]);
+ notifications.push(["formhistory-add", change.guid]);
}
break;
case "add":
log("Add to form history " + change);
change.guid = generateGUID();
stmt = makeAddStatement(change, now, bindingArrays);
- notifications.push([ "formhistory-add", change.guid ]);
+ notifications.push(["formhistory-add", change.guid]);
break;
default:
// We should've already guaranteed that change.op is one of the above
throw Components.Exception("Invalid operation " + operation,
Cr.NS_ERROR_ILLEGAL_VALUE);
}
// As identical statements are reused, only add statements if they aren't already present.
@@ -947,17 +947,17 @@ this.FormHistory = {
throw Components.Exception(
"update does not recognize op='" + change.op + "'",
Cr.NS_ERROR_ILLEGAL_VALUE);
}
numSearches++;
let changeToUpdate = change;
FormHistory.search(
- [ "guid" ],
+ ["guid"],
{
fieldname: change.fieldname,
value: change.value
}, {
foundResult: false,
handleResult(aResult) {
if (this.foundResult) {
log("Database contains multiple entries with the same fieldname/value pair.");
--- a/toolkit/components/satchel/nsFormAutoCompleteResult.jsm
+++ b/toolkit/components/satchel/nsFormAutoCompleteResult.jsm
@@ -1,13 +1,13 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-this.EXPORTED_SYMBOLS = [ "FormAutoCompleteResult" ];
+this.EXPORTED_SYMBOLS = ["FormAutoCompleteResult"];
const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
this.FormAutoCompleteResult = function FormAutoCompleteResult(searchString,
searchResult,
defaultIndex,
--- a/toolkit/components/satchel/test/unit/test_async_expire.js
+++ b/toolkit/components/satchel/test/unit/test_async_expire.js
@@ -79,17 +79,17 @@ function* tests() {
yield addEntry("name-C", "value-C", next_test);
yield countEntries("name-C", "value-C", checkExists);
// Update some existing entries to have ages relative to when the test runs.
let now = 1000 * Date.now();
let updateLastUsed = function updateLastUsedFn(results, age) {
let lastUsed = now - age * 24 * PR_HOURS;
- let changes = [ ];
+ let changes = [];
for (let r = 0; r < results.length; r++) {
changes.push({ op: "update", lastUsed, guid: results[r].guid });
}
return changes;
};
let results = yield searchEntries(["guid"], { lastUsed: 181 }, iter);
--- a/toolkit/components/satchel/test/unit/test_autocomplete.js
+++ b/toolkit/components/satchel/test/unit/test_autocomplete.js
@@ -53,17 +53,17 @@ add_test(function test0() {
let maxTimeGroupings = prefs.getIntPref("browser.formfill.maxTimeGroupings");
let bucketSize = prefs.getIntPref("browser.formfill.bucketSize");
// ===== Tests with constant timesUsed and varying lastUsed date =====
// insert 2 records per bucket to check alphabetical sort within
now = 1000 * Date.now();
numRecords = Math.ceil(maxTimeGroupings / bucketSize) * 2;
- let changes = [ ];
+ let changes = [];
for (let i = 0; i < numRecords; i += 2) {
let useDate = now - (i / 2 * bucketSize * timeGroupingSize);
changes.push({ op: "add", fieldname: "field1", value: "value" + padLeft(numRecords - 1 - i, 2),
timesUsed: 1, firstUsed: useDate, lastUsed: useDate });
changes.push({ op: "add", fieldname: "field1", value: "value" + padLeft(numRecords - 2 - i, 2),
timesUsed: 1, firstUsed: useDate, lastUsed: useDate });
}
@@ -166,17 +166,17 @@ add_test(function test7() {
});
});
add_test(function test8() {
do_log_info("Check that \"senior citizen\" entries get a bonus (browser.formfill.agedBonus)");
let agedDate = 1000 * (Date.now() - getFormExpiryDays() * 24 * 60 * 60 * 1000);
- let changes = [ ];
+ let changes = [];
changes.push({ op: "add", fieldname: "field3", value: "old but not senior",
timesUsed: 100, firstUsed: (agedDate + 60 * 1000 * 1000), lastUsed: now });
changes.push({ op: "add", fieldname: "field3", value: "senior citizen",
timesUsed: 100, firstUsed: (agedDate - 60 * 1000 * 1000), lastUsed: now });
updateFormHistory(changes, run_next_test);
});
add_test(function test9() {
@@ -187,17 +187,17 @@ add_test(function test9() {
run_next_test();
}
});
});
add_test(function test10() {
do_log_info("Check entries that are really old or in the future");
- let changes = [ ];
+ let changes = [];
changes.push({ op: "add", fieldname: "field4", value: "date of 0",
timesUsed: 1, firstUsed: 0, lastUsed: 0 });
changes.push({ op: "add", fieldname: "field4", value: "in the future 1",
timesUsed: 1, firstUsed: 0, lastUsed: now * 2 });
changes.push({ op: "add", fieldname: "field4", value: "in the future 2",
timesUsed: 1, firstUsed: now * 2, lastUsed: now * 2 });
updateFormHistory(changes, run_next_test);
});
@@ -211,17 +211,17 @@ add_test(function test11() {
});
});
var syncValues = ["sync1", "sync1a", "sync2", "sync3"];
add_test(function test12() {
do_log_info("Check old synchronous api");
- let changes = [ ];
+ let changes = [];
for (let value of syncValues) {
changes.push({ op: "add", fieldname: "field5", value });
}
updateFormHistory(changes, run_next_test);
});
add_test(function test_token_limit_DB() {
function test_token_limit_previousResult(previousResult) {
@@ -239,17 +239,17 @@ add_test(function test_token_limit_DB()
"previous results");
run_next_test();
}
});
}
do_log_info("Check that the number of tokens used in a search is capped to MAX_SEARCH_TOKENS " +
"for performance when querying the DB");
- let changes = [ ];
+ let changes = [];
changes.push({ op: "add", fieldname: "field_token_cap",
// value with 15 unique tokens
value: "a b c d e f g h i j k l m n o",
timesUsed: 1, firstUsed: 0, lastUsed: 0 });
updateFormHistory(changes, () => {
// Search for a string where the first 10 tokens match the value above but the 11th does not
// (which would prevent the result from being returned if the 11th term was used).
fac.autoCompleteSearchAsync("field_token_cap",