Bug 1372427 - add semi-colon rule. r=mattn draft
authorJonathan Guillotte-Blouin <jguillotteblouin@mozilla.com>
Tue, 13 Jun 2017 09:51:07 -0700
changeset 597770 2f15e53dda068ffb868ca38ae97f94e53b5c9d8d
parent 597769 e9ee40a532f2d37ce57837015926dcb6a7c7455e
child 597771 656e3db0ec3ca3818e787e07b15e3aed24f17468
push id65025
push userbmo:jguillotteblouin@mozilla.com
push dateTue, 20 Jun 2017 23:10:16 +0000
reviewersmattn
bugs1372427
milestone56.0a1
Bug 1372427 - add semi-colon rule. r=mattn auto --fix MozReview-Commit-ID: F9GvxcghPkt
toolkit/components/satchel/.eslintrc.js
toolkit/components/satchel/AutoCompletePopup.jsm
toolkit/components/satchel/FormHistory.jsm
toolkit/components/satchel/formSubmitListener.js
toolkit/components/satchel/nsFormAutoComplete.js
toolkit/components/satchel/nsFormAutoCompleteResult.jsm
toolkit/components/satchel/test/parent_utils.js
toolkit/components/satchel/test/test_form_autocomplete.html
toolkit/components/satchel/test/test_form_autocomplete_with_list.html
toolkit/components/satchel/test/test_password_autocomplete.html
toolkit/components/satchel/test/test_popup_enter_event.html
toolkit/components/satchel/test/unit/test_async_expire.js
toolkit/components/satchel/test/unit/test_autocomplete.js
toolkit/components/satchel/test/unit/test_db_update_v999a.js
toolkit/components/satchel/test/unit/test_db_update_v999b.js
toolkit/components/satchel/test/unit/test_history_api.js
toolkit/components/satchel/test/unit/test_notify.js
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -13,10 +13,11 @@ module.exports = {
       },
       FunctionDeclaration: {
         parameters: "first",
       },
       // XXX: following line is used in eslint v4 to not throw an error when chaining methods
       //MemberExpression: "off",
       outerIIFEBody: 0,
     }],
+    semi: ["error", "always"],
   },
 };
\ No newline at end of file
--- a/toolkit/components/satchel/AutoCompletePopup.jsm
+++ b/toolkit/components/satchel/AutoCompletePopup.jsm
@@ -315,9 +315,9 @@ this.AutoCompletePopup = {
    * Sends a message to the browser requesting that the input
    * that the AutoCompletePopup is open for be focused.
    */
   requestFocus() {
     if (this.openedPopup) {
       this.sendMessageToBrowser("FormAutoComplete:Focus");
     }
   },
-}
+};
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -653,17 +653,17 @@ function updateFormHistoryWrite(aChanges
         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
+          change.guid = change.newGuid;
           delete change.newGuid;
         }
         stmt = makeUpdateStatement(guid, change, bindingArrays);
         notifications.push([ "formhistory-update", guid ]);
         break;
       case "bump":
         log("Bump form history " + change);
         if (change.guid) {
@@ -974,17 +974,17 @@ this.FormHistory = {
       // We don't have to wait for any statements to return.
       updateFormHistoryWrite(aChanges, aCallbacks);
     }
   },
 
   getAutoCompleteResults(searchString, params, aCallbacks) {
     // only do substring matching when the search string contains more than one character
     let searchTokens;
-    let where = ""
+    let where = "";
     let boundaryCalc = "";
     if (searchString.length > 1) {
       searchTokens = searchString.split(/\s+/);
 
       // build up the word boundary and prefix match bonus calculation
       boundaryCalc = "MAX(1, :prefixWeight * (value LIKE :valuePrefix ESCAPE '/') + (";
       // for each word, calculate word boundary weights for the SELECT clause and
       // add word to the WHERE clause of the query
--- a/toolkit/components/satchel/formSubmitListener.js
+++ b/toolkit/components/satchel/formSubmitListener.js
@@ -136,17 +136,17 @@ var satchelFormListener = {
         }
 
         let name = input.name || input.id;
         if (!name) {
           continue;
         }
 
         if (name == "searchbar-history") {
-          this.log('addEntry for input name "' + name + '" is denied')
+          this.log('addEntry for input name "' + name + '" is denied');
           continue;
         }
 
         // Limit stored data to 200 characters.
         if (name.length > 200 || value.length > 200) {
           this.log("skipping input that has a name/value too large");
           continue;
         }
--- a/toolkit/components/satchel/nsFormAutoComplete.js
+++ b/toolkit/components/satchel/nsFormAutoComplete.js
@@ -425,17 +425,17 @@ FormAutoComplete.prototype = {
 
         if (aDatalistResult && aDatalistResult.matchCount > 0) {
           result = this.mergeResults(result, aDatalistResult);
         }
 
         if (aListener) {
           aListener.onSearchCompletion(result);
         }
-      }
+      };
 
       this.getAutoCompleteValues(client, aInputName, searchString, processEntry);
     }
   },
 
   mergeResults(historyResult, datalistResult) {
     let values = datalistResult.wrappedJSObject._values;
     let labels = datalistResult.wrappedJSObject._labels;
@@ -491,17 +491,17 @@ FormAutoComplete.prototype = {
       agedWeight:         this._agedWeight,
       bucketSize:         this._bucketSize,
       expiryDate:         1000 * (Date.now() - this._expireDays * 24 * 60 * 60 * 1000),
       fieldname:          fieldName,
       maxTimeGroupings:   this._maxTimeGroupings,
       timeGroupingSize:   this._timeGroupingSize,
       prefixWeight:       this._prefixWeight,
       boundaryWeight:     this._boundaryWeight
-    }
+    };
 
     this.stopAutoCompleteSearch();
     client.requestAutoCompleteResults(searchString, params, (entries) => {
       this._pendingClient = null;
       callback(entries);
     });
     this._pendingClient = client;
   },
--- a/toolkit/components/satchel/nsFormAutoCompleteResult.jsm
+++ b/toolkit/components/satchel/nsFormAutoCompleteResult.jsm
@@ -20,17 +20,17 @@ this.FormAutoCompleteResult = function F
   this._searchResult = searchResult;
   this._defaultIndex = defaultIndex;
   this._errorDescription = errorDescription;
   this._values = values;
   this._labels = labels;
   this._comments = comments;
   this._formHistResult = prevResult;
   this.entries = prevResult ? prevResult.wrappedJSObject.entries : [];
-}
+};
 
 FormAutoCompleteResult.prototype = {
 
   // The user's query string
   searchString: "",
 
   // The result code of this result object, see |get searchResult| for possible values.
   _searchResult: 0,
--- a/toolkit/components/satchel/test/parent_utils.js
+++ b/toolkit/components/satchel/test/parent_utils.js
@@ -53,17 +53,17 @@ var ParentUtils = {
       obj.fieldname = name;
     }
     if (value) {
       obj.value = value;
     }
 
     let count = 0;
     let listener = {
-      handleResult(result) { count = result },
+      handleResult(result) { count = result; },
       handleError(error) {
         assert.ok(false, error);
         sendAsyncMessage("entriesCounted", { ok: false });
       },
       handleCompletion(reason) {
         if (!reason) {
           sendAsyncMessage("entriesCounted", { ok: true, count });
         }
--- a/toolkit/components/satchel/test/test_form_autocomplete.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete.html
@@ -486,17 +486,17 @@ function runTest() { // eslint-disable-l
                    function(num) {
                      ok(!num, testNum + " checking that f1/v3 was deleted");
                      runTest();
                    });
       break;
 
     case 56:
       doKey("return");
-      checkForm("value4")
+      checkForm("value4");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
       doKey("down");
       break;
 
     case 57:
--- a/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
+++ b/toolkit/components/satchel/test/test_form_autocomplete_with_list.html
@@ -183,17 +183,17 @@ function runTest() {
                    function(num) {
                      ok(!num, testNum + " checking that form history value was deleted");
                      runTest();
                    });
       break;
 
     case 8:
       doKey("return");
-      checkForm("Google")
+      checkForm("Google");
 
       // Trigger autocomplete popup
       expectPopup();
       restoreForm();
       doKey("down");
       break;
 
     case 9:
@@ -322,17 +322,17 @@ function runTest() {
     // For some reasons, when there is an update of the list, the selection is
     // lost so we need to go down like if we were at the beginning of the list
     // again.
     case 200:
       // Removing the second element while on the first then going down and
       // push enter. Value should be one from the third suggesion.
       doKey("down");
       var datalist = document.getElementById("suggest");
-      var toRemove = datalist.children[1]
+      var toRemove = datalist.children[1];
       datalist.removeChild(toRemove);
 
       SimpleTest.executeSoon(function() {
         doKey("down");
         doKey("down");
         doKey("return");
         checkForm("final");
 
--- a/toolkit/components/satchel/test/test_password_autocomplete.html
+++ b/toolkit/components/satchel/test/test_password_autocomplete.html
@@ -106,17 +106,17 @@ add_task(async function test_secure_noFo
     () => input.click(),
     () => doKey("down"),
     () => doKey("page_down"),
     () => doKey("return"),
     () => doKey("v"),
     () => doKey(" "),
     () => doKey("back_space"),
   ]) {
-    ok(true, "Testing: " + triggerFn.toString())
+    ok(true, "Testing: " + triggerFn.toString());
     // We must wait for the entire timeout for each individual test, because the
     // next event in the list might prevent the popup from opening.
     await expectPopupDoesNotOpen(triggerFn);
   }
 
   // Close the popup.
   input.blur();
 });
@@ -124,17 +124,17 @@ add_task(async function test_secure_noFo
 add_task(async function test_insecure_focusWarning() {
   // Form 2 has an insecure action so should show the warning even if password manager is disabled.
   let input = $_(2, "field1");
   let shownPromise = waitForNextPopup();
   input.focus();
   await shownPromise;
 
   ok(getMenuEntries()[0].includes("Logins entered here could be compromised"),
-     "Check warning is first")
+     "Check warning is first");
 
   // Close the popup
   input.blur();
 });
 </script>
 </pre>
 </body>
 </html>
--- a/toolkit/components/satchel/test/test_popup_enter_event.html
+++ b/toolkit/components/satchel/test/test_popup_enter_event.html
@@ -63,17 +63,17 @@ function runTest() {
     is(input.value, expectedValue, "Check input value in the submit handler");
     evt.preventDefault();
     SimpleTest.finish();
   });
 
   // Focus the input before adjusting.value so that the caret goes to the end
   // (since OS X doesn't show the dropdown otherwise).
   input.focus();
-  input.value = "value"
+  input.value = "value";
   input.focus();
   doKey("down");
 }
 
 function startTest() {
   setupFormHistory(function() {
     runTest();
   });
--- a/toolkit/components/satchel/test/unit/test_async_expire.js
+++ b/toolkit/components/satchel/test/unit/test_async_expire.js
@@ -7,18 +7,18 @@ var currentTestIndex = 0;
 
 function triggerExpiration() {
   // We can't easily fake a "daily idle" event, so for testing purposes form
   // history listens for another notification to trigger an immediate
   // expiration.
   Services.obs.notifyObservers(null, "formhistory-expire-now");
 }
 
-var checkExists = function(num) { do_check_true(num > 0); next_test(); }
-var checkNotExists = function(num) { do_check_true(!num); next_test(); }
+var checkExists = function(num) { do_check_true(num > 0); next_test(); };
+var checkNotExists = function(num) { do_check_true(!num); next_test(); };
 
 var TestObserver = {
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver, Ci.nsISupportsWeakReference]),
 
   observe(subject, topic, data) {
     do_check_eq(topic, "satchel-storage-changed");
 
     if (data == "formhistory-expireoldentries") {
@@ -85,17 +85,17 @@ function* tests() {
     let lastUsed = now - age * 24 * PR_HOURS;
 
     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);
   yield updateFormHistory(updateLastUsed(results, 181), next_test);
 
   results = yield searchEntries(["guid"], { lastUsed: 179 }, iter);
   yield updateFormHistory(updateLastUsed(results, 179), next_test);
 
   results = yield searchEntries(["guid"], { lastUsed: 31 }, iter);
--- a/toolkit/components/satchel/test/unit/test_autocomplete.js
+++ b/toolkit/components/satchel/test/unit/test_autocomplete.js
@@ -206,17 +206,17 @@ add_test(function test11() {
   fac.autoCompleteSearchAsync("field4", "", null, null, null, {
     onSearchCompletion(aResults) {
       do_check_eq(aResults.matchCount, 3);
       run_next_test();
     }
   });
 });
 
-var syncValues = ["sync1", "sync1a", "sync2", "sync3"]
+var syncValues = ["sync1", "sync1a", "sync2", "sync3"];
 
 add_test(function test12() {
   do_log_info("Check old synchronous api");
 
   let changes = [ ];
   for (let value of syncValues) {
     changes.push({ op: "add", fieldname: "field5", value });
   }
--- a/toolkit/components/satchel/test/unit/test_db_update_v999a.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v999a.js
@@ -35,18 +35,18 @@ function* tests() {
     destFile.append("formhistory.sqlite");
     if (destFile.exists()) {
       destFile.remove(false);
     }
 
     testfile.copyTo(profileDir, "formhistory.sqlite");
     do_check_eq(999, getDBVersion(testfile));
 
-    let checkZero = function(num) { do_check_eq(num, 0); next_test(); }
-    let checkOne = function(num) { do_check_eq(num, 1); next_test(); }
+    let checkZero = function(num) { do_check_eq(num, 0); next_test(); };
+    let checkOne = function(num) { do_check_eq(num, 1); next_test(); };
 
     // ===== 1 =====
     testnum++;
     // Check for expected contents.
     yield countEntries(null, null, function(num) { do_check_true(num > 0); next_test(); });
     yield countEntries("name-A", "value-A", checkOne);
     yield countEntries("name-B", "value-B", checkOne);
     yield countEntries("name-C", "value-C1", checkOne);
--- a/toolkit/components/satchel/test/unit/test_db_update_v999b.js
+++ b/toolkit/components/satchel/test/unit/test_db_update_v999b.js
@@ -41,18 +41,18 @@ function* tests() {
     bakFile.append("formhistory.sqlite.corrupt");
     if (bakFile.exists()) {
       bakFile.remove(false);
     }
 
     testfile.copyTo(profileDir, "formhistory.sqlite");
     do_check_eq(999, getDBVersion(testfile));
 
-    let checkZero = function(num) { do_check_eq(num, 0); next_test(); }
-    let checkOne = function(num) { do_check_eq(num, 1); next_test(); }
+    let checkZero = function(num) { do_check_eq(num, 0); next_test(); };
+    let checkOne = function(num) { do_check_eq(num, 1); next_test(); };
 
     // ===== 1 =====
     testnum++;
 
     // Open the DB, ensure that a backup of the corrupt DB is made.
     // DB init is done lazily so the DB shouldn't be created yet.
     do_check_false(bakFile.exists());
     // Doing any request to the DB should create it.
--- a/toolkit/components/satchel/test/unit/test_history_api.js
+++ b/toolkit/components/satchel/test/unit/test_history_api.js
@@ -171,17 +171,17 @@ add_task(async function() {
     deferred = Promise.defer();
     await FormHistory.count({ fieldname: null, value: null },
                             { handleResult: result => checkNotExists(result),
                               handleError(error) {
                                 do_throw("Error occurred searching form history: " + error);
                               },
                               handleCompletion(reason) {
                                 if (!reason) {
-                                  deferred.resolve()
+                                  deferred.resolve();
                                 }
                               }
                             });
     await deferred.promise;
 
     // ===== 3 =====
     // Test removeEntriesForName with a single matching value
     testnum++;
@@ -265,17 +265,17 @@ add_task(async function() {
 
     let processFirstResult = function processResults(results) {
       // Only handle the first result
       if (results.length > 0) {
         let result = results[0];
         return [result.timesUsed, result.firstUsed, result.lastUsed, result.guid];
       }
       return undefined;
-    }
+    };
 
     let results = await promiseSearchEntries(["timesUsed", "firstUsed", "lastUsed"],
                                              { fieldname: "field1", value: "value1" });
     let [timesUsed, firstUsed, lastUsed] = processFirstResult(results);
     do_check_eq(1, timesUsed);
     do_check_true(firstUsed > 0);
     do_check_true(lastUsed > 0);
     await promiseCountEntries(null, null, num => do_check_eq(num, 1));
--- a/toolkit/components/satchel/test/unit/test_notify.js
+++ b/toolkit/components/satchel/test/unit/test_notify.js
@@ -51,17 +51,17 @@ function* run_test_steps() {
 
     var testnum = 0;
     var testdesc = "Setup of test form history entries";
 
     var entry1 = ["entry1", "value1"];
 
     /* ========== 1 ========== */
     testnum = 1;
-    testdesc = "Initial connection to storage module"
+    testdesc = "Initial connection to storage module";
 
     yield updateEntry("remove", null, null, next_test);
     yield countEntries(null, null, function(num) {
       do_check_false(num, "Checking initial DB is empty");
       next_test();
     });
 
     // Add the observer
@@ -148,17 +148,17 @@ function* run_test_steps() {
     testdesc = "removeEntriesByTimeframe";
 
     expectedNotification = "formhistory-remove";
     expectedData = [10, 99999999999];
 
     yield FormHistory.update({ op: "remove", firstUsedStart: expectedData[0], firstUsedEnd: expectedData[1] },
                              { handleCompletion(reason) {
                                if (!reason) {
-                                 next_test()
+                                 next_test();
                                }
                              },
                              handleErrors(error) {
                                  do_throw("Error occurred updating form history: " + error);
                                }
                              });
 
     do_check_eq(expectedNotification, null);