Bug 1372427 - enforce dot-notation over square-bracket-notation when possible. r=mattn draft
authorJonathan Guillotte-Blouin <jguillotteblouin@mozilla.com>
Wed, 14 Jun 2017 17:50:48 -0700
changeset 597798 a97aa13abfe0fe907ce6a0ec39f200faca1ac870
parent 597797 80a8aede3a903c4d3474162f4e479d2f4515316e
child 597799 06de2a7b088f284f1b8c89c1a75d33d877af0b5f
push id65027
push userbmo:jguillotteblouin@mozilla.com
push dateTue, 20 Jun 2017 23:30:25 +0000
reviewersmattn
bugs1372427
milestone56.0a1
Bug 1372427 - enforce dot-notation over square-bracket-notation when possible. r=mattn auto --fix MozReview-Commit-ID: LDwtCje2Sb0
toolkit/components/satchel/.eslintrc.js
toolkit/components/satchel/FormHistory.jsm
--- a/toolkit/components/satchel/.eslintrc.js
+++ b/toolkit/components/satchel/.eslintrc.js
@@ -49,10 +49,11 @@ module.exports = {
       max: 2,
     }],
     "no-throw-literal": "error",
     "padded-blocks": ["error", "never"],
     radix: "error",
     "array-bracket-spacing": ["error", "never"],
     "space-in-parens": ["error", "never"],
     "comma-dangle": ["error", "always-multiline"],
+    "dot-notation": "error",
   },
 };
--- a/toolkit/components/satchel/FormHistory.jsm
+++ b/toolkit/components/satchel/FormHistory.jsm
@@ -318,17 +318,17 @@ function makeUpdateStatement(aGuid, aNew
   let queryTerms = makeQueryPredicates(aNewData, ", ");
 
   if (!queryTerms) {
     throw Components.Exception("Update query must define fields to modify.",
                                Cr.NS_ERROR_ILLEGAL_VALUE);
   }
 
   query += queryTerms + " WHERE guid = :existing_guid";
-  aNewData["existing_guid"] = aGuid;
+  aNewData.existing_guid = aGuid;
 
   return dbCreateAsyncStatement(query, aNewData, aBindingArrays);
 }
 
 function makeMoveToDeletedStatement(aGuid, aNow, aData, aBindingArrays) {
   if (supportsDeletedTable) {
     let query = "INSERT INTO moz_deleted_formhistory (guid, timeDeleted)";
     let queryTerms = makeQueryPredicates(aData);
@@ -468,17 +468,17 @@ function dbInit() {
 
 var Migrators = {
   /*
    * Updates the DB schema to v3 (bug 506402).
    * Adds deleted form history table.
    */
   dbMigrateToVersion4() {
     if (!_dbConnection.tableExists("moz_deleted_formhistory")) {
-      let table = dbSchema.tables["moz_deleted_formhistory"];
+      let table = dbSchema.tables.moz_deleted_formhistory;
       let tSQL = Object.keys(table).map(col => [col, table[col]].join(" ")).join(", ");
       _dbConnection.createTable("moz_deleted_formhistory", tSQL);
     }
   },
 };
 
 function dbCreate() {
   log("Creating DB -- tables");
@@ -969,17 +969,17 @@ this.FormHistory = {
                 });
               }
 
               searchFailed = true;
               return;
             }
 
             this.foundResult = true;
-            changeToUpdate.guid = aResult["guid"];
+            changeToUpdate.guid = aResult.guid;
           },
 
           handleError(aError) {
             if (aCallbacks && aCallbacks.handleError) {
               aCallbacks.handleError(aError);
             }
           },