refactor: transform var to let/const (#115)

Applied `lebab --replace src --transform let` to the code with minimal manual
changes afterwards.
diff --git a/src/ActionStack.js b/src/ActionStack.js
index 70b6269..9b582ea 100644
--- a/src/ActionStack.js
+++ b/src/ActionStack.js
@@ -17,8 +17,8 @@
     under the License.
 */
 
-var events = require('./events');
-var Q = require('q');
+const events = require('./events');
+const Q = require('q');
 
 function ActionStack () {
     this.stack = [];
@@ -46,21 +46,21 @@
         events.emit('verbose', 'Beginning processing of action stack for ' + platform + ' project...');
 
         while (this.stack.length) {
-            var action = this.stack.shift();
-            var handler = action.handler.run;
-            var action_params = action.handler.params;
+            const action = this.stack.shift();
+            const handler = action.handler.run;
+            const action_params = action.handler.params;
 
             try {
                 handler.apply(null, action_params);
             } catch (e) {
                 events.emit('warn', 'Error during processing of action! Attempting to revert...');
                 this.stack.unshift(action);
-                var issue = 'Uh oh!\n';
+                let issue = 'Uh oh!\n';
                 // revert completed tasks
                 while (this.completed.length) {
-                    var undo = this.completed.shift();
-                    var revert = undo.reverter.run;
-                    var revert_params = undo.reverter.params;
+                    const undo = this.completed.shift();
+                    const revert = undo.reverter.run;
+                    const revert_params = undo.reverter.params;
 
                     try {
                         revert.apply(null, revert_params);
diff --git a/src/ConfigChanges/ConfigChanges.js b/src/ConfigChanges/ConfigChanges.js
index 2c800c0..1724c43 100644
--- a/src/ConfigChanges/ConfigChanges.js
+++ b/src/ConfigChanges/ConfigChanges.js
@@ -29,18 +29,18 @@
  * reference counts.
  */
 
-var path = require('path');
-var et = require('elementtree');
-var ConfigKeeper = require('./ConfigKeeper');
-var events = require('../events');
+const path = require('path');
+const et = require('elementtree');
+const ConfigKeeper = require('./ConfigKeeper');
+const events = require('../events');
 
-var mungeutil = require('./munge-util');
-var xml_helpers = require('../util/xml-helpers');
+const mungeutil = require('./munge-util');
+const xml_helpers = require('../util/xml-helpers');
 
 exports.PlatformMunger = PlatformMunger;
 
 exports.process = (plugins_dir, project_dir, platform, platformJson, pluginInfoProvider) => {
-    var munger = new PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider);
+    const munger = new PlatformMunger(platform, project_dir, platformJson, pluginInfoProvider);
     munger.process(plugins_dir);
     munger.save_all();
 };
@@ -70,10 +70,10 @@
 // The remove parameter tells whether to add the change or remove it.
 PlatformMunger.prototype.apply_file_munge = PlatformMunger_apply_file_munge;
 function PlatformMunger_apply_file_munge (file, munge, remove) {
-    for (var selector in munge.parents) {
-        for (var xml_child in munge.parents[selector]) {
+    for (const selector in munge.parents) {
+        for (const xml_child in munge.parents[selector]) {
             // this xml child is new, graft it (only if config file exists)
-            var config_file = this.config_keeper.get(this.project_dir, this.platform, file);
+            const config_file = this.config_keeper.get(this.project_dir, this.platform, file);
             if (config_file.exists) {
                 if (remove) config_file.prune_child(selector, munge.parents[selector][xml_child]);
                 else config_file.graft_child(selector, munge.parents[selector][xml_child]);
@@ -86,22 +86,22 @@
 
 PlatformMunger.prototype.remove_plugin_changes = remove_plugin_changes;
 function remove_plugin_changes (pluginInfo, is_top_level) {
-    var platform_config = this.platformJson.root;
-    var plugin_vars = is_top_level
+    const platform_config = this.platformJson.root;
+    const plugin_vars = is_top_level
         ? platform_config.installed_plugins[pluginInfo.id]
         : platform_config.dependent_plugins[pluginInfo.id];
-    var edit_config_changes = null;
+    let edit_config_changes = null;
     if (pluginInfo.getEditConfigs) {
         edit_config_changes = pluginInfo.getEditConfigs(this.platform);
     }
 
     // get config munge, aka how did this plugin change various config files
-    var config_munge = this.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
+    const config_munge = this.generate_plugin_config_munge(pluginInfo, plugin_vars, edit_config_changes);
     // global munge looks at all plugins' changes to config files
-    var global_munge = platform_config.config_munge;
-    var munge = mungeutil.decrement_munge(global_munge, config_munge);
+    const global_munge = platform_config.config_munge;
+    const munge = mungeutil.decrement_munge(global_munge, config_munge);
 
-    for (var file in munge.files) {
+    for (const file in munge.files) {
         this.apply_file_munge(file, munge.files[file], /* remove = */ true);
     }
 
@@ -112,20 +112,20 @@
 
 PlatformMunger.prototype.add_plugin_changes = add_plugin_changes;
 function add_plugin_changes (pluginInfo, plugin_vars, is_top_level, should_increment, plugin_force) {
-    var platform_config = this.platformJson.root;
+    const platform_config = this.platformJson.root;
 
-    var edit_config_changes = null;
+    let edit_config_changes = null;
     if (pluginInfo.getEditConfigs) {
         edit_config_changes = pluginInfo.getEditConfigs(this.platform);
     }
 
-    var config_munge;
+    let config_munge;
 
     if (!edit_config_changes || edit_config_changes.length === 0) {
         // get config munge, aka how should this plugin change various config files
         config_munge = this.generate_plugin_config_munge(pluginInfo, plugin_vars);
     } else {
-        var isConflictingInfo = this._is_conflicting(edit_config_changes, platform_config.config_munge, plugin_force);
+        const isConflictingInfo = this._is_conflicting(edit_config_changes, platform_config.config_munge, plugin_force);
 
         if (isConflictingInfo.conflictWithConfigxml) {
             throw new Error(pluginInfo.id +
@@ -135,8 +135,8 @@
             events.emit('warn', '--force is used. edit-config will overwrite conflicts if any. Conflicting plugins may not work as expected.');
 
             // remove conflicting munges
-            var conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.conflictingMunge);
-            for (var conflict_file in conflict_munge.files) {
+            const conflict_munge = mungeutil.decrement_munge(platform_config.config_munge, isConflictingInfo.conflictingMunge);
+            for (const conflict_file in conflict_munge.files) {
                 this.apply_file_munge(conflict_file, conflict_munge.files[conflict_file], /* remove = */ true);
             }
 
@@ -162,30 +162,29 @@
 // Handle edit-config changes from config.xml
 PlatformMunger.prototype.add_config_changes = add_config_changes;
 function add_config_changes (config, should_increment) {
-    var platform_config = this.platformJson.root;
+    const platform_config = this.platformJson.root;
 
-    var config_munge;
-    var changes = [];
+    let changes = [];
 
     if (config.getEditConfigs) {
-        var edit_config_changes = config.getEditConfigs(this.platform);
+        const edit_config_changes = config.getEditConfigs(this.platform);
         if (edit_config_changes) {
             changes = changes.concat(edit_config_changes);
         }
     }
 
     if (config.getConfigFiles) {
-        var config_files_changes = config.getConfigFiles(this.platform);
+        const config_files_changes = config.getConfigFiles(this.platform);
         if (config_files_changes) {
             changes = changes.concat(config_files_changes);
         }
     }
 
     if (changes && changes.length > 0) {
-        var isConflictingInfo = this._is_conflicting(changes, platform_config.config_munge, true /* always force overwrite other edit-config */);
+        const isConflictingInfo = this._is_conflicting(changes, platform_config.config_munge, true /* always force overwrite other edit-config */);
         if (isConflictingInfo.conflictFound) {
-            var conflict_munge;
-            var conflict_file;
+            let conflict_munge;
+            let conflict_file;
 
             if (Object.keys(isConflictingInfo.configxmlMunge.files).length !== 0) {
                 // silently remove conflicting config.xml munges so new munges can be added
@@ -207,7 +206,7 @@
     }
 
     // Add config.xml edit-config and config-file munges
-    config_munge = this.generate_config_xml_munge(config, changes, 'config.xml');
+    const config_munge = this.generate_config_xml_munge(config, changes, 'config.xml');
     this._munge_helper(should_increment, platform_config, config_munge);
 
     // Move to installed/dependent_plugins
@@ -221,7 +220,7 @@
     // TODO: The should_increment param is only used by cordova-cli and is going away soon.
     // If should_increment is set to false, avoid modifying the global_munge (use clone)
     // and apply the entire config_munge because it's already a proper subset of the global_munge.
-    var munge, global_munge;
+    let munge, global_munge;
     if (should_increment) {
         global_munge = platform_config.config_munge;
         munge = mungeutil.increment_munge(global_munge, config_munge);
@@ -230,7 +229,7 @@
         munge = config_munge;
     }
 
-    for (var file in munge.files) {
+    for (const file in munge.files) {
         this.apply_file_munge(file, munge.files[file]);
     }
 
@@ -242,9 +241,9 @@
 // defaults and the global munge.
 PlatformMunger.prototype.reapply_global_munge = reapply_global_munge;
 function reapply_global_munge () {
-    var platform_config = this.platformJson.root;
-    var global_munge = platform_config.config_munge;
-    for (var file in global_munge.files) {
+    const platform_config = this.platformJson.root;
+    const global_munge = platform_config.config_munge;
+    for (const file in global_munge.files) {
         this.apply_file_munge(file, global_munge.files[file]);
     }
 
@@ -255,8 +254,8 @@
 // Generate the munge object from config.xml
 PlatformMunger.prototype.generate_config_xml_munge = generate_config_xml_munge;
 function generate_config_xml_munge (config, config_changes, type) {
-    var munge = { files: {} };
-    var id;
+    const munge = { files: {} };
+    let id;
 
     if (!config_changes) {
         return munge;
@@ -271,7 +270,7 @@
     config_changes.forEach(change => {
         change.xmls.forEach(xml => {
             // 1. stringify each xml
-            var stringified = (new et.ElementTree(xml)).write({ xml_declaration: false });
+            const stringified = (new et.ElementTree(xml)).write({ xml_declaration: false });
             // 2. add into munge
             if (change.mode) {
                 mungeutil.deep_add(munge, change.file, change.target, { xml: stringified, count: 1, mode: change.mode, id: id });
@@ -288,8 +287,8 @@
 PlatformMunger.prototype.generate_plugin_config_munge = generate_plugin_config_munge;
 function generate_plugin_config_munge (pluginInfo, vars, edit_config_changes) {
     vars = vars || {};
-    var munge = { files: {} };
-    var changes = pluginInfo.getConfigFiles(this.platform);
+    const munge = { files: {} };
+    const changes = pluginInfo.getConfigFiles(this.platform);
 
     if (edit_config_changes) {
         Array.prototype.push.apply(changes, edit_config_changes);
@@ -298,11 +297,11 @@
     changes.forEach(change => {
         change.xmls.forEach(xml => {
             // 1. stringify each xml
-            var stringified = (new et.ElementTree(xml)).write({ xml_declaration: false });
+            let stringified = (new et.ElementTree(xml)).write({ xml_declaration: false });
             // interp vars
             if (vars) {
                 Object.keys(vars).forEach(key => {
-                    var regExp = new RegExp('\\$' + key, 'g');
+                    const regExp = new RegExp('\\$' + key, 'g');
                     stringified = stringified.replace(regExp, vars[key]);
                 });
             }
@@ -321,27 +320,27 @@
 
 /** @private */
 PlatformMunger.prototype._is_conflicting = function (editchanges, config_munge, force) {
-    var files = config_munge.files;
-    var conflictFound = false;
-    var conflictWithConfigxml = false;
-    var conflictingMunge = { files: {} };
-    var configxmlMunge = { files: {} };
-    var conflictingParent;
-    var conflictingPlugin;
+    const files = config_munge.files;
+    let conflictFound = false;
+    let conflictWithConfigxml = false;
+    const conflictingMunge = { files: {} };
+    const configxmlMunge = { files: {} };
+    let conflictingParent;
+    let conflictingPlugin;
 
     editchanges.forEach(editchange => {
         if (files[editchange.file]) {
-            var parents = files[editchange.file].parents;
-            var target = parents[editchange.target];
+            const parents = files[editchange.file].parents;
+            let target = parents[editchange.target];
 
             // Check if the edit target will resolve to an existing target
             if (!target || target.length === 0) {
-                var file_xml = this.config_keeper.get(this.project_dir, this.platform, editchange.file).data;
-                var resolveEditTarget = xml_helpers.resolveParent(file_xml, editchange.target);
-                var resolveTarget;
+                const file_xml = this.config_keeper.get(this.project_dir, this.platform, editchange.file).data;
+                const resolveEditTarget = xml_helpers.resolveParent(file_xml, editchange.target);
+                let resolveTarget;
 
                 if (resolveEditTarget) {
-                    for (var parent in parents) {
+                    for (const parent in parents) {
                         resolveTarget = xml_helpers.resolveParent(file_xml, parent);
                         if (resolveEditTarget === resolveTarget) {
                             conflictingParent = parent;
@@ -398,17 +397,17 @@
 // that has been (un)installed.
 PlatformMunger.prototype.process = PlatformMunger_process;
 function PlatformMunger_process (plugins_dir) {
-    var platform_config = this.platformJson.root;
+    const platform_config = this.platformJson.root;
 
     // Uninstallation first
     platform_config.prepare_queue.uninstalled.forEach(u => {
-        var pluginInfo = this.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
+        const pluginInfo = this.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
         this.remove_plugin_changes(pluginInfo, u.topLevel);
     });
 
     // Now handle installation
     platform_config.prepare_queue.installed.forEach(u => {
-        var pluginInfo = this.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
+        const pluginInfo = this.pluginInfoProvider.get(path.join(plugins_dir, u.plugin));
         this.add_plugin_changes(pluginInfo, u.vars, u.topLevel, true, u.force);
     });
 
diff --git a/src/ConfigChanges/ConfigFile.js b/src/ConfigChanges/ConfigFile.js
index c0fb89a..57ecdcf 100644
--- a/src/ConfigChanges/ConfigFile.js
+++ b/src/ConfigChanges/ConfigFile.js
@@ -14,8 +14,8 @@
  *
 */
 
-var fs = require('fs-extra');
-var path = require('path');
+const fs = require('fs-extra');
+const path = require('path');
 
 // Use delay loading to ensure plist and other node modules to not get loaded
 // on Android, Windows platforms
@@ -54,7 +54,7 @@
 ConfigFile.prototype.load = ConfigFile_load;
 function ConfigFile_load () {
     // config file may be in a place not exactly specified in the target
-    var filepath = this.filepath = resolveConfigFilePath(this.project_dir, this.platform, this.file_tag);
+    const filepath = this.filepath = resolveConfigFilePath(this.project_dir, this.platform, this.file_tag);
 
     if (!filepath || !fs.existsSync(filepath)) {
         this.exists = false;
@@ -63,7 +63,7 @@
     this.exists = true;
     this.mtime = fs.statSync(this.filepath).mtime;
 
-    var ext = path.extname(filepath);
+    const ext = path.extname(filepath);
     // Windows8 uses an appxmanifest, and wp8 will likely use
     // the same in a future release
     if (ext === '.xml' || ext === '.appxmanifest' || ext === '.storyboard' || ext === '.jsproj') {
@@ -87,17 +87,17 @@
         fs.writeFileSync(this.filepath, this.data.write({ indent: 4 }), 'utf-8');
     } else {
         // plist
-        var regExp = /<string>[ \t\r\n]+?<\/string>/g;
+        const regExp = /<string>[ \t\r\n]+?<\/string>/g;
         fs.writeFileSync(this.filepath, modules.plist.build(this.data, { indent: '\t', offset: -1 }).replace(regExp, '<string></string>'));
     }
     this.is_changed = false;
 };
 
 ConfigFile.prototype.graft_child = function ConfigFile_graft_child (selector, xml_child) {
-    var filepath = this.filepath;
-    var result;
+    const filepath = this.filepath;
+    let result;
     if (this.type === 'xml') {
-        var xml_to_graft = [modules.et.XML(xml_child.xml)];
+        const xml_to_graft = [modules.et.XML(xml_child.xml)];
         switch (xml_child.mode) {
         case 'merge':
             result = modules.xml_helpers.graftXMLMerge(this.data, xml_to_graft, selector, xml_child);
@@ -125,10 +125,10 @@
 };
 
 ConfigFile.prototype.prune_child = function ConfigFile_prune_child (selector, xml_child) {
-    var filepath = this.filepath;
-    var result;
+    const filepath = this.filepath;
+    let result;
     if (this.type === 'xml') {
-        var xml_to_graft = [modules.et.XML(xml_child.xml)];
+        const xml_to_graft = [modules.et.XML(xml_child.xml)];
         switch (xml_child.mode) {
         case 'merge':
         case 'overwrite':
@@ -145,7 +145,7 @@
         result = modules.plist_helpers.prunePLIST(this.data, xml_child.xml, selector);
     }
     if (!result) {
-        var err_msg = 'Pruning at selector "' + selector + '" from "' + filepath + '" went bad.';
+        const err_msg = 'Pruning at selector "' + selector + '" from "' + filepath + '" went bad.';
         throw new Error(err_msg);
     }
     this.is_changed = true;
@@ -155,8 +155,8 @@
 // Resolve to a real path in this function.
 // TODO: getIOSProjectname is slow because of glob, try to avoid calling it several times per project.
 function resolveConfigFilePath (project_dir, platform, file) {
-    var filepath = path.join(project_dir, file);
-    var matches;
+    let filepath = path.join(project_dir, file);
+    let matches;
 
     file = path.normalize(file);
 
@@ -167,8 +167,8 @@
 
         // [CB-5989] multiple Info.plist files may exist. default to $PROJECT_NAME-Info.plist
         if (matches.length > 1 && file.includes('-Info.plist')) {
-            var plistName = getIOSProjectname(project_dir) + '-Info.plist';
-            for (var i = 0; i < matches.length; i++) {
+            const plistName = getIOSProjectname(project_dir) + '-Info.plist';
+            for (let i = 0; i < matches.length; i++) {
                 if (matches[i].includes(plistName)) {
                     filepath = matches[i];
                     break;
@@ -182,7 +182,7 @@
     // only if none of the options above are satisfied does this get called
     // TODO: Move this out of cordova-common and into the platforms somehow
     if (platform === 'android' && !fs.existsSync(filepath)) {
-        var config_file;
+        let config_file;
 
         if (file === 'AndroidManifest.xml') {
             filepath = path.join(project_dir, 'app', 'src', 'main', 'AndroidManifest.xml');
@@ -226,12 +226,12 @@
 // Find out the real name of an iOS or OSX project
 // TODO: glob is slow, need a better way or caching, or avoid using more than once.
 function getIOSProjectname (project_dir) {
-    var matches = modules.glob.sync(path.join(project_dir, '*.xcodeproj'));
-    var iospath;
+    const matches = modules.glob.sync(path.join(project_dir, '*.xcodeproj'));
+    let iospath;
     if (matches.length === 1) {
         iospath = path.basename(matches[0], '.xcodeproj');
     } else {
-        var msg;
+        let msg;
         if (matches.length === 0) {
             msg = 'Does not appear to be an xcode project, no xcode project file in ' + project_dir;
         } else {
@@ -246,7 +246,7 @@
 function isBinaryPlist (filename) {
     // I wish there was a synchronous way to read only the first 6 bytes of a
     // file. This is wasteful :/
-    var buf = '' + fs.readFileSync(filename, 'utf8');
+    const buf = '' + fs.readFileSync(filename, 'utf8');
     // binary plists start with a magic header, "bplist"
     return buf.substring(0, 6) === 'bplist';
 }
diff --git a/src/ConfigChanges/ConfigKeeper.js b/src/ConfigChanges/ConfigKeeper.js
index ac7f88b..ce8b45b 100644
--- a/src/ConfigChanges/ConfigKeeper.js
+++ b/src/ConfigChanges/ConfigKeeper.js
@@ -14,8 +14,8 @@
  *
 */
 
-var path = require('path');
-var ConfigFile = require('./ConfigFile');
+const path = require('path');
+const ConfigFile = require('./ConfigFile');
 
 /******************************************************************************
 * ConfigKeeper class
@@ -39,20 +39,20 @@
     if (file === 'config.xml' && platform === 'android') {
         file = 'res/xml/config.xml';
     }
-    var fake_path = path.join(project_dir, platform, file);
+    const fake_path = path.join(project_dir, platform, file);
 
     if (this._cached[fake_path]) {
         return this._cached[fake_path];
     }
     // File was not cached, need to load.
-    var config_file = new ConfigFile(project_dir, platform, file);
+    const config_file = new ConfigFile(project_dir, platform, file);
     this._cached[fake_path] = config_file;
     return config_file;
 };
 
 ConfigKeeper.prototype.save_all = function ConfigKeeper_save_all () {
     Object.keys(this._cached).forEach(fake_path => {
-        var config_file = this._cached[fake_path];
+        const config_file = this._cached[fake_path];
         if (config_file.is_changed) config_file.save();
     });
 };
diff --git a/src/ConfigChanges/munge-util.js b/src/ConfigChanges/munge-util.js
index 3e89103..c3eb95a 100644
--- a/src/ConfigChanges/munge-util.js
+++ b/src/ConfigChanges/munge-util.js
@@ -14,7 +14,7 @@
  *
 */
 
-var _ = require('underscore');
+const _ = require('underscore');
 
 // add the count of [key1][key2]...[keyN] to obj
 // return true if it didn't exist before
@@ -24,7 +24,7 @@
     }
 
     return exports.process_munge(obj, true/* createParents */, (parentArray, k) => {
-        var found = _.find(parentArray, element => element.xml === k.xml);
+        const found = _.find(parentArray, element => element.xml === k.xml);
         if (found) {
             found.after = found.after || k.after;
             found.count += k.count;
@@ -42,9 +42,9 @@
         keys = Array.prototype.slice.call(arguments, 1);
     }
 
-    var result = exports.process_munge(obj, false/* createParents */, (parentArray, k) => {
-        var index = -1;
-        var found = _.find(parentArray, element => {
+    const result = exports.process_munge(obj, false/* createParents */, (parentArray, k) => {
+        let index = -1;
+        const found = _.find(parentArray, element => {
             index++;
             return element.xml === k.xml;
         });
@@ -85,7 +85,7 @@
     if (!Array.isArray(keys)) {
         keys = Array.prototype.slice.call(arguments, 1);
     }
-    var k = keys[0];
+    const k = keys[0];
     if (keys.length === 1) {
         return func(obj, k);
     } else if (keys.length === 2) {
@@ -110,15 +110,15 @@
 // Returns a munge object containing values that exist in munge
 // but not in base.
 exports.increment_munge = function increment_munge (base, munge) {
-    var diff = { files: {} };
+    const diff = { files: {} };
 
-    for (var file in munge.files) {
-        for (var selector in munge.files[file].parents) {
-            for (var xml_child in munge.files[file].parents[selector]) {
-                var val = munge.files[file].parents[selector][xml_child];
+    for (const file in munge.files) {
+        for (const selector in munge.files[file].parents) {
+            for (const xml_child in munge.files[file].parents[selector]) {
+                const val = munge.files[file].parents[selector][xml_child];
                 // if node not in base, add it to diff and base
                 // else increment it's value in base without adding to diff
-                var newlyAdded = exports.deep_add(base, [file, selector, val]);
+                const newlyAdded = exports.deep_add(base, [file, selector, val]);
                 if (newlyAdded) {
                     exports.deep_add(diff, file, selector, val);
                 }
@@ -133,15 +133,15 @@
 // nodes that reached zero value are removed from base and added to the returned munge
 // object.
 exports.decrement_munge = function decrement_munge (base, munge) {
-    var zeroed = { files: {} };
+    const zeroed = { files: {} };
 
-    for (var file in munge.files) {
-        for (var selector in munge.files[file].parents) {
-            for (var xml_child in munge.files[file].parents[selector]) {
-                var val = munge.files[file].parents[selector][xml_child];
+    for (const file in munge.files) {
+        for (const selector in munge.files[file].parents) {
+            for (const xml_child in munge.files[file].parents[selector]) {
+                const val = munge.files[file].parents[selector][xml_child];
                 // if node not in base, add it to diff and base
                 // else increment it's value in base without adding to diff
-                var removed = exports.deep_remove(base, [file, selector, val]);
+                const removed = exports.deep_remove(base, [file, selector, val]);
                 if (removed) {
                     exports.deep_add(zeroed, file, selector, val);
                 }
diff --git a/src/ConfigParser/ConfigParser.js b/src/ConfigParser/ConfigParser.js
index 97f3251..dffca45 100644
--- a/src/ConfigParser/ConfigParser.js
+++ b/src/ConfigParser/ConfigParser.js
@@ -17,11 +17,11 @@
     under the License.
 */
 
-var et = require('elementtree');
-var xml = require('../util/xml-helpers');
-var CordovaError = require('../CordovaError');
-var fs = require('fs-extra');
-var events = require('../events');
+const et = require('elementtree');
+const xml = require('../util/xml-helpers');
+const CordovaError = require('../CordovaError');
+const fs = require('fs-extra');
+const events = require('../events');
 
 /** Wraps a config.xml file */
 function ConfigParser (path) {
@@ -34,7 +34,7 @@
         events.emit('error', 'Parsing ' + path + ' failed');
         throw e;
     }
-    var r = this.doc.getroot();
+    const r = this.doc.getroot();
     if (r.tag !== 'widget') {
         throw new CordovaError(path + ' has incorrect root node name (expected "widget", was "' + r.tag + '")');
     }
@@ -45,7 +45,7 @@
 }
 
 function findOrCreate (doc, name) {
-    var ret = doc.find(name);
+    let ret = doc.find(name);
     if (!ret) {
         ret = new et.Element(name);
         doc.getroot().append(ret);
@@ -54,12 +54,12 @@
 }
 
 function getCordovaNamespacePrefix (doc) {
-    var rootAtribs = Object.getOwnPropertyNames(doc.getroot().attrib);
-    var prefix = 'cdv';
-    for (var j = 0; j < rootAtribs.length; j++) {
+    const rootAtribs = Object.getOwnPropertyNames(doc.getroot().attrib);
+    let prefix = 'cdv';
+    for (let j = 0; j < rootAtribs.length; j++) {
         if (rootAtribs[j].startsWith('xmlns:') &&
             doc.getroot().attrib[rootAtribs[j]] === 'http://cordova.apache.org/ns/1.0') {
-            var strings = rootAtribs[j].split(':');
+            const strings = rootAtribs[j].split(':');
             prefix = strings[1];
             break;
         }
@@ -76,7 +76,7 @@
 function findElementAttributeValue (attributeName, elems) {
     elems = Array.isArray(elems) ? elems : [elems];
 
-    var value = elems.filter(elem =>
+    const value = elems.filter(elem =>
         elem.attrib.name.toLowerCase() === attributeName.toLowerCase()
     ).map(filteredElems =>
         filteredElems.attrib.value
@@ -114,14 +114,14 @@
         return getNodeTextSafe(this.doc.find('name'));
     },
     setName: function (name) {
-        var el = findOrCreate(this.doc, 'name');
+        const el = findOrCreate(this.doc, 'name');
         el.text = name;
     },
     shortName: function () {
         return this.doc.find('name').attrib.short || this.name();
     },
     setShortName: function (shortname) {
-        var el = findOrCreate(this.doc, 'name');
+        const el = findOrCreate(this.doc, 'name');
         if (!el.text) {
             el.text = shortname;
         }
@@ -131,7 +131,7 @@
         return getNodeTextSafe(this.doc.find('description'));
     },
     setDescription: function (text) {
-        var el = findOrCreate(this.doc, 'description');
+        const el = findOrCreate(this.doc, 'description');
         el.text = text;
     },
     version: function () {
@@ -156,7 +156,7 @@
         return findElementAttributeValue(name, this.doc.findall('preference'));
     },
     setGlobalPreference: function (name, value) {
-        var pref = this.doc.find('preference[@name="' + name + '"]');
+        let pref = this.doc.find('preference[@name="' + name + '"]');
         if (!pref) {
             pref = new et.Element('preference');
             pref.attrib.name = name;
@@ -185,7 +185,7 @@
         pref.attrib.value = value;
     },
     getPreference: function (name, platform) {
-        var platformPreference = '';
+        let platformPreference = '';
 
         if (platform) {
             platformPreference = this.getPlatformPreference(name, platform);
@@ -213,8 +213,8 @@
      * @return {Array}               Resources for the platform specified.
      */
     getStaticResources: function (platform, resourceName) {
-        var ret = [];
-        var staticResources = [];
+        const ret = [];
+        let staticResources = [];
         if (platform) { // platform specific icons
             this.doc.findall('./platform[@name="' + platform + '"]/' + resourceName).forEach(elt => {
                 elt.platform = platform; // mark as platform specific resource
@@ -225,7 +225,7 @@
         staticResources = staticResources.concat(this.doc.findall(resourceName));
         // parse resource elements
         staticResources.forEach(elt => {
-            var res = {};
+            const res = {};
             res.src = elt.attrib.src;
             res.target = elt.attrib.target || undefined;
             res.density = elt.attrib.density || elt.attrib[this.cdvNamespacePrefix + ':density'] || elt.attrib['gap:density'];
@@ -299,7 +299,7 @@
      * @return {Resource[]}      Array of resource file objects.
      */
     getFileResources: function (platform, includeGlobal) {
-        var fileResources = [];
+        let fileResources = [];
 
         if (platform) { // platform specific resources
             fileResources = this.doc.findall('./platform[@name="' + platform + '"]/resource-file').map(tag => ({
@@ -335,7 +335,7 @@
      * @return {Array}               Script elements.
      */
     getHookScripts: function (hook, platforms) {
-        var scriptElements = this.doc.findall('./hook');
+        let scriptElements = this.doc.findall('./hook');
 
         if (platforms) {
             platforms.forEach(platform => {
@@ -357,11 +357,11 @@
     * @return {string[]} Array of plugin IDs
     */
     getPluginIdList: function () {
-        var plugins = this.doc.findall('plugin');
-        var result = plugins.map(plugin => plugin.attrib.name);
-        var features = this.doc.findall('feature');
+        const plugins = this.doc.findall('plugin');
+        const result = plugins.map(plugin => plugin.attrib.name);
+        const features = this.doc.findall('feature');
         features.forEach(element => {
-            var idTag = element.find('./param[@name="id"]');
+            const idTag = element.find('./param[@name="id"]');
             if (idTag) {
                 result.push(idTag.attrib.value);
             }
@@ -382,7 +382,7 @@
      */
     addPlugin: function (attributes, variables) {
         if (!attributes && !attributes.name) return;
-        var el = new et.Element('plugin');
+        const el = new et.Element('plugin');
         el.attrib.name = attributes.name;
         if (attributes.spec) {
             el.attrib.spec = attributes.spec;
@@ -417,24 +417,24 @@
         if (!id) {
             return undefined;
         }
-        var pluginElement = this.doc.find('./plugin/[@name="' + id + '"]');
+        const pluginElement = this.doc.find('./plugin/[@name="' + id + '"]');
         if (pluginElement === null) {
-            var legacyFeature = this.doc.find('./feature/param[@name="id"][@value="' + id + '"]/..');
+            const legacyFeature = this.doc.find('./feature/param[@name="id"][@value="' + id + '"]/..');
             if (legacyFeature) {
                 events.emit('log', 'Found deprecated feature entry for ' + id + ' in config.xml.');
                 return featureToPlugin(legacyFeature);
             }
             return undefined;
         }
-        var plugin = {};
+        const plugin = {};
 
         plugin.name = pluginElement.attrib.name;
         plugin.spec = pluginElement.attrib.spec || pluginElement.attrib.src || pluginElement.attrib.version;
         plugin.variables = {};
-        var variableElements = pluginElement.findall('variable');
+        const variableElements = pluginElement.findall('variable');
         variableElements.forEach(varElement => {
-            var name = varElement.attrib.name;
-            var value = varElement.attrib.value;
+            const name = varElement.attrib.name;
+            const value = varElement.attrib.value;
             if (name) {
                 plugin.variables[name] = value;
             }
@@ -459,8 +459,8 @@
 
     // Add any element to the root
     addElement: function (name, attributes) {
-        var el = et.Element(name);
-        for (var a in attributes) {
+        const el = et.Element(name);
+        for (const a in attributes) {
             el.attrib[a] = attributes[a];
         }
         this.doc.getroot().append(el);
@@ -473,7 +473,7 @@
      */
     addEngine: function (name, spec) {
         if (!name) return;
-        var el = et.Element('engine');
+        const el = et.Element('engine');
         el.attrib.name = name;
         if (spec) {
             el.attrib.spec = spec;
@@ -488,9 +488,9 @@
         removeChildren(this.doc.getroot(), `./engine/[@name="${name}"]`);
     },
     getEngines: function () {
-        var engines = this.doc.findall('./engine');
+        const engines = this.doc.findall('./engine');
         return engines.map(engine => {
-            var spec = engine.attrib.spec || engine.attrib.version;
+            const spec = engine.attrib.spec || engine.attrib.version;
             return {
                 name: engine.attrib.name,
                 spec: spec || null
@@ -499,15 +499,15 @@
     },
     /* Get all the access tags */
     getAccesses: function () {
-        var accesses = this.doc.findall('./access');
+        const accesses = this.doc.findall('./access');
         return accesses.map(access => {
-            var minimum_tls_version = access.attrib['minimum-tls-version']; /* String */
-            var requires_forward_secrecy = access.attrib['requires-forward-secrecy']; /* Boolean */
-            var requires_certificate_transparency = access.attrib['requires-certificate-transparency']; /* Boolean */
-            var allows_arbitrary_loads_in_web_content = access.attrib['allows-arbitrary-loads-in-web-content']; /* Boolean */
-            var allows_arbitrary_loads_in_media = access.attrib['allows-arbitrary-loads-in-media']; /* Boolean (DEPRECATED) */
-            var allows_arbitrary_loads_for_media = access.attrib['allows-arbitrary-loads-for-media']; /* Boolean */
-            var allows_local_networking = access.attrib['allows-local-networking']; /* Boolean */
+            const minimum_tls_version = access.attrib['minimum-tls-version']; /* String */
+            const requires_forward_secrecy = access.attrib['requires-forward-secrecy']; /* Boolean */
+            const requires_certificate_transparency = access.attrib['requires-certificate-transparency']; /* Boolean */
+            const allows_arbitrary_loads_in_web_content = access.attrib['allows-arbitrary-loads-in-web-content']; /* Boolean */
+            const allows_arbitrary_loads_in_media = access.attrib['allows-arbitrary-loads-in-media']; /* Boolean (DEPRECATED) */
+            const allows_arbitrary_loads_for_media = access.attrib['allows-arbitrary-loads-for-media']; /* Boolean */
+            const allows_local_networking = access.attrib['allows-local-networking']; /* Boolean */
 
             return {
                 origin: access.attrib.origin,
@@ -523,11 +523,11 @@
     },
     /* Get all the allow-navigation tags */
     getAllowNavigations: function () {
-        var allow_navigations = this.doc.findall('./allow-navigation');
+        const allow_navigations = this.doc.findall('./allow-navigation');
         return allow_navigations.map(allow_navigation => {
-            var minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */
-            var requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */
-            var requires_certificate_transparency = allow_navigation.attrib['requires-certificate-transparency']; /* Boolean */
+            const minimum_tls_version = allow_navigation.attrib['minimum-tls-version']; /* String */
+            const requires_forward_secrecy = allow_navigation.attrib['requires-forward-secrecy']; /* Boolean */
+            const requires_certificate_transparency = allow_navigation.attrib['requires-certificate-transparency']; /* Boolean */
 
             return {
                 href: allow_navigation.attrib.href,
@@ -539,18 +539,18 @@
     },
     /* Get all the allow-intent tags */
     getAllowIntents: function () {
-        var allow_intents = this.doc.findall('./allow-intent');
+        const allow_intents = this.doc.findall('./allow-intent');
         return allow_intents.map(allow_intent => ({
             href: allow_intent.attrib.href
         }));
     },
     /* Get all edit-config tags */
     getEditConfigs: function (platform) {
-        var platform_edit_configs = this.doc.findall('./platform[@name="' + platform + '"]/edit-config');
-        var edit_configs = this.doc.findall('edit-config').concat(platform_edit_configs);
+        const platform_edit_configs = this.doc.findall('./platform[@name="' + platform + '"]/edit-config');
+        const edit_configs = this.doc.findall('edit-config').concat(platform_edit_configs);
 
         return edit_configs.map(tag => {
-            var editConfig = {
+            const editConfig = {
                 file: tag.attrib.file,
                 target: tag.attrib.target,
                 mode: tag.attrib.mode,
@@ -563,11 +563,11 @@
 
     /* Get all config-file tags */
     getConfigFiles: function (platform) {
-        var platform_config_files = this.doc.findall('./platform[@name="' + platform + '"]/config-file');
-        var config_files = this.doc.findall('config-file').concat(platform_config_files);
+        const platform_config_files = this.doc.findall('./platform[@name="' + platform + '"]/config-file');
+        const config_files = this.doc.findall('config-file').concat(platform_config_files);
 
         return config_files.map(tag => {
-            var configFile = {
+            const configFile = {
                 target: tag.attrib.target,
                 parent: tag.attrib.parent,
                 after: tag.attrib.after,
@@ -586,15 +586,14 @@
 };
 
 function featureToPlugin (featureElement) {
-    var plugin = {};
+    const plugin = {};
     plugin.variables = [];
-    var pluginVersion,
-        pluginSrc;
+    let pluginVersion, pluginSrc;
 
-    var nodes = featureElement.findall('param');
+    const nodes = featureElement.findall('param');
     nodes.forEach(element => {
-        var n = element.attrib.name;
-        var v = element.attrib.value;
+        const n = element.attrib.name;
+        const v = element.attrib.value;
         if (n === 'id') {
             plugin.name = v;
         } else if (n === 'version') {
@@ -606,7 +605,7 @@
         }
     });
 
-    var spec = pluginSrc || pluginVersion;
+    const spec = pluginSrc || pluginVersion;
     if (spec) {
         plugin.spec = spec;
     }
diff --git a/src/CordovaCheck.js b/src/CordovaCheck.js
index 5b20ade..d434f33 100644
--- a/src/CordovaCheck.js
+++ b/src/CordovaCheck.js
@@ -17,8 +17,8 @@
     under the License.
 */
 
-var fs = require('fs-extra');
-var path = require('path');
+const fs = require('fs-extra');
+const path = require('path');
 
 function isRootDir (dir) {
     if (fs.existsSync(path.join(dir, 'www'))) {
@@ -44,23 +44,23 @@
 function isCordova (dir) {
     if (!dir) {
         // Prefer PWD over cwd so that symlinked dirs within your PWD work correctly (CB-5687).
-        var pwd = process.env.PWD;
-        var cwd = process.cwd();
+        const pwd = process.env.PWD;
+        const cwd = process.cwd();
         if (pwd && pwd !== cwd && pwd !== 'undefined') {
             return isCordova(pwd) || isCordova(cwd);
         }
         return isCordova(cwd);
     }
-    var bestReturnValueSoFar = false;
-    for (var i = 0; i < 1000; ++i) {
-        var result = isRootDir(dir);
+    let bestReturnValueSoFar = false;
+    for (let i = 0; i < 1000; ++i) {
+        const result = isRootDir(dir);
         if (result === 2) {
             return dir;
         }
         if (result === 1) {
             bestReturnValueSoFar = dir;
         }
-        var parentDir = path.normalize(path.join(dir, '..'));
+        const parentDir = path.normalize(path.join(dir, '..'));
         // Detect fs root.
         if (parentDir === dir) {
             return bestReturnValueSoFar;
diff --git a/src/CordovaLogger.js b/src/CordovaLogger.js
index 85cd3a9..405d3be 100644
--- a/src/CordovaLogger.js
+++ b/src/CordovaLogger.js
@@ -109,15 +109,15 @@
             return this;
         }
 
-        var isVerbose = this.logLevel === CordovaLogger.VERBOSE;
-        var cursor = this.stdoutCursor;
+        const isVerbose = this.logLevel === CordovaLogger.VERBOSE;
+        let cursor = this.stdoutCursor;
 
         if (message instanceof Error || logLevel === CordovaLogger.ERROR) {
             message = formatError(message, isVerbose);
             cursor = this.stderrCursor;
         }
 
-        var color = this.colors[logLevel];
+        const color = this.colors[logLevel];
         if (color) {
             cursor.bold().fg[color]();
         }
diff --git a/src/FileUpdater.js b/src/FileUpdater.js
index b3da56d..1a2c60f 100644
--- a/src/FileUpdater.js
+++ b/src/FileUpdater.js
@@ -19,9 +19,9 @@
 
 'use strict';
 
-var fs = require('fs-extra');
-var path = require('path');
-var minimatch = require('minimatch');
+const fs = require('fs-extra');
+const path = require('path');
+const minimatch = require('minimatch');
 
 /**
  * Logging callback used in the FileUpdater methods.
@@ -55,15 +55,15 @@
  *     and everything was up to date
  */
 function updatePathWithStats (sourcePath, sourceStats, targetPath, targetStats, options, log) {
-    var updated = false;
+    let updated = false;
 
-    var rootDir = (options && options.rootDir) || '';
-    var copyAll = (options && options.all) || false;
+    const rootDir = (options && options.rootDir) || '';
+    const copyAll = (options && options.all) || false;
 
-    var targetFullPath = path.join(rootDir || '', targetPath);
+    const targetFullPath = path.join(rootDir || '', targetPath);
 
     if (sourceStats) {
-        var sourceFullPath = path.join(rootDir || '', sourcePath);
+        const sourceFullPath = path.join(rootDir || '', sourcePath);
 
         if (targetStats && (targetStats.isDirectory() !== sourceStats.isDirectory())) {
             // The target exists. But if the directory status doesn't match the source, delete it.
@@ -120,14 +120,14 @@
  * and ensures target directory exists before copying a file.
  */
 function updatePathInternal (sourcePath, targetPath, options, log) {
-    var rootDir = (options && options.rootDir) || '';
-    var targetFullPath = path.join(rootDir, targetPath);
-    var targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null;
-    var sourceStats = null;
+    const rootDir = (options && options.rootDir) || '';
+    const targetFullPath = path.join(rootDir, targetPath);
+    const targetStats = fs.existsSync(targetFullPath) ? fs.statSync(targetFullPath) : null;
+    let sourceStats = null;
 
     if (sourcePath) {
         // A non-null source path was specified. It should exist.
-        var sourceFullPath = path.join(rootDir, sourcePath);
+        const sourceFullPath = path.join(rootDir, sourcePath);
         if (!fs.existsSync(sourceFullPath)) {
             throw new Error('Source path does not exist: ' + sourcePath);
         }
@@ -135,7 +135,7 @@
         sourceStats = fs.statSync(sourceFullPath);
 
         // Create the target's parent directory if it doesn't exist.
-        var parentDir = path.dirname(targetFullPath);
+        const parentDir = path.dirname(targetFullPath);
         if (!fs.existsSync(parentDir)) {
             fs.ensureDirSync(parentDir);
         }
@@ -202,11 +202,11 @@
 
     log = log || (() => { });
 
-    var updated = false;
+    let updated = false;
 
     // Iterate in sorted order to ensure directories are created before files under them.
     Object.keys(pathMap).sort().forEach(targetPath => {
-        var sourcePath = pathMap[targetPath];
+        const sourcePath = pathMap[targetPath];
         updated = updatePathInternal(sourcePath, targetPath, options, log) || updated;
     });
 
@@ -255,16 +255,16 @@
 
     log = log || (() => { });
 
-    var rootDir = (options && options.rootDir) || '';
+    const rootDir = (options && options.rootDir) || '';
 
-    var include = (options && options.include) || ['**'];
+    let include = (options && options.include) || ['**'];
     if (typeof include === 'string') {
         include = [include];
     } else if (!Array.isArray(include)) {
         throw new Error('Include parameter must be a glob string or array of glob strings.');
     }
 
-    var exclude = (options && options.exclude) || [];
+    let exclude = (options && options.exclude) || [];
     if (typeof exclude === 'string') {
         exclude = [exclude];
     } else if (!Array.isArray(exclude)) {
@@ -272,7 +272,7 @@
     }
 
     // Scan the files in each of the source directories.
-    var sourceMaps = sourceDirs.map(sourceDir =>
+    const sourceMaps = sourceDirs.map(sourceDir =>
         path.join(rootDir, sourceDir)
     ).map(sourcePath => {
         if (!fs.existsSync(sourcePath)) {
@@ -282,19 +282,19 @@
     });
 
     // Scan the files in the target directory, if it exists.
-    var targetMap = {};
-    var targetFullPath = path.join(rootDir, targetDir);
+    let targetMap = {};
+    const targetFullPath = path.join(rootDir, targetDir);
     if (fs.existsSync(targetFullPath)) {
         targetMap = mapDirectory(rootDir, targetDir, include, exclude);
     }
 
-    var pathMap = mergePathMaps(sourceMaps, targetMap, targetDir);
+    const pathMap = mergePathMaps(sourceMaps, targetMap, targetDir);
 
-    var updated = false;
+    let updated = false;
 
     // Iterate in sorted order to ensure directories are created before files under them.
     Object.keys(pathMap).sort().forEach(subPath => {
-        var entry = pathMap[subPath];
+        const entry = pathMap[subPath];
         updated = updatePathWithStats(
             entry.sourcePath,
             entry.sourceStats,
@@ -311,22 +311,22 @@
  * Creates a dictionary map of all files and directories under a path.
  */
 function mapDirectory (rootDir, subDir, include, exclude) {
-    var dirMap = { '': { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
+    const dirMap = { '': { subDir: subDir, stats: fs.statSync(path.join(rootDir, subDir)) } };
     mapSubdirectory(rootDir, subDir, '', include, exclude, dirMap);
     return dirMap;
 
     function mapSubdirectory (rootDir, subDir, relativeDir, include, exclude, dirMap) {
-        var itemMapped = false;
-        var items = fs.readdirSync(path.join(rootDir, subDir, relativeDir));
+        let itemMapped = false;
+        const items = fs.readdirSync(path.join(rootDir, subDir, relativeDir));
 
         items.forEach(item => {
-            var relativePath = path.join(relativeDir, item);
+            const relativePath = path.join(relativeDir, item);
             if (!matchGlobArray(relativePath, exclude)) {
                 // Stats obtained here (required at least to know where to recurse in directories)
                 // are saved for later, where the modified times may also be used. This minimizes
                 // the number of file I/O operations performed.
-                var fullPath = path.join(rootDir, subDir, relativePath);
-                var stats = fs.statSync(fullPath);
+                const fullPath = path.join(rootDir, subDir, relativePath);
+                const stats = fs.statSync(fullPath);
 
                 if (stats.isDirectory()) {
                     // Directories are included if either something under them is included or they
@@ -361,10 +361,10 @@
     // Merge multiple source maps together, along with target path info.
     // Entries in later source maps override those in earlier source maps.
     // Target stats will be filled in below for targets that exist.
-    var pathMap = {};
+    const pathMap = {};
     sourceMaps.forEach(sourceMap => {
         Object.keys(sourceMap).forEach(sourceSubPath => {
-            var sourceEntry = sourceMap[sourceSubPath];
+            const sourceEntry = sourceMap[sourceSubPath];
             pathMap[sourceSubPath] = {
                 targetPath: path.join(targetDir, sourceSubPath),
                 targetStats: null,
@@ -377,7 +377,7 @@
     // Fill in target stats for targets that exist, and create entries
     // for targets that don't have any corresponding sources.
     Object.keys(targetMap).forEach(subPath => {
-        var entry = pathMap[subPath];
+        const entry = pathMap[subPath];
         if (entry) {
             entry.targetStats = targetMap[subPath].stats;
         } else {
diff --git a/src/PlatformJson.js b/src/PlatformJson.js
index 2a0a515..ffd9c9f 100644
--- a/src/PlatformJson.js
+++ b/src/PlatformJson.js
@@ -14,10 +14,10 @@
  *
 */
 
-var fs = require('fs-extra');
-var path = require('path');
-var endent = require('endent');
-var mungeutil = require('./ConfigChanges/munge-util');
+const fs = require('fs-extra');
+const path = require('path');
+const endent = require('endent');
+const mungeutil = require('./ConfigChanges/munge-util');
 
 function PlatformJson (filePath, platform, root) {
     this.filePath = filePath;
@@ -26,8 +26,8 @@
 }
 
 PlatformJson.load = (plugins_dir, platform) => {
-    var filePath = path.join(plugins_dir, platform + '.json');
-    var root = null;
+    const filePath = path.join(plugins_dir, platform + '.json');
+    let root = null;
     if (fs.existsSync(filePath)) {
         root = JSON.parse(fs.readFileSync(filePath, 'utf-8'));
     }
@@ -72,7 +72,7 @@
 };
 
 PlatformJson.prototype.addPlugin = function (pluginId, variables, isTopLevel) {
-    var pluginsList = isTopLevel
+    const pluginsList = isTopLevel
         ? this.root.installed_plugins
         : this.root.dependent_plugins;
 
@@ -89,11 +89,11 @@
  * @returns {this} Current PlatformJson instance to allow calls chaining
  */
 PlatformJson.prototype.addPluginMetadata = function (pluginInfo) {
-    var installedModules = this.root.modules || [];
+    const installedModules = this.root.modules || [];
 
-    var installedPaths = installedModules.map(m => m.file);
+    const installedPaths = installedModules.map(m => m.file);
 
-    var modulesToInstall = pluginInfo.getJsModules(this.platform)
+    const modulesToInstall = pluginInfo.getJsModules(this.platform)
         .map(module => new ModuleMetadata(pluginInfo.id, module))
         // Filter out modules which are already added to metadata
         .filter(metadata => !installedPaths.includes(metadata.file));
@@ -107,7 +107,7 @@
 };
 
 PlatformJson.prototype.removePlugin = function (pluginId, isTopLevel) {
-    var pluginsList = isTopLevel
+    const pluginsList = isTopLevel
         ? this.root.installed_plugins
         : this.root.dependent_plugins;
 
@@ -126,10 +126,10 @@
  * @returns {this} Current PlatformJson instance to allow calls chaining
  */
 PlatformJson.prototype.removePluginMetadata = function (pluginInfo) {
-    var modulesToRemove = pluginInfo.getJsModules(this.platform)
+    const modulesToRemove = pluginInfo.getJsModules(this.platform)
         .map(jsModule => ['plugins', pluginInfo.id, jsModule.src].join('/'));
 
-    var installedModules = this.root.modules || [];
+    const installedModules = this.root.modules || [];
     this.root.modules = installedModules
         // Leave only those metadatas which 'file' is not in removed modules
         .filter(m => !modulesToRemove.includes(m.file));
@@ -157,7 +157,7 @@
  * @return {PlatformJson} PlatformJson instance.
  */
 PlatformJson.prototype.makeTopLevel = function (pluginId) {
-    var plugin = this.root.dependent_plugins[pluginId];
+    const plugin = this.root.dependent_plugins[pluginId];
     if (plugin) {
         delete this.root.dependent_plugins[pluginId];
         this.root.installed_plugins[pluginId] = plugin;
@@ -201,14 +201,14 @@
     root.installed_plugins = root.installed_plugins || {};
     root.dependent_plugins = root.dependent_plugins || {};
 
-    var munge = root.config_munge;
+    const munge = root.config_munge;
     if (!munge.files) {
-        var new_munge = { files: {} };
-        for (var file in munge) {
-            for (var selector in munge[file]) {
-                for (var xml_child in munge[file][selector]) {
-                    var val = parseInt(munge[file][selector][xml_child]);
-                    for (var i = 0; i < val; i++) {
+        const new_munge = { files: {} };
+        for (const file in munge) {
+            for (const selector in munge[file]) {
+                for (const xml_child in munge[file][selector]) {
+                    const val = parseInt(munge[file][selector][xml_child]);
+                    for (let i = 0; i < val; i++) {
                         mungeutil.deep_add(new_munge, [file, selector, { xml: xml_child, count: val }]);
                     }
                 }
diff --git a/src/PluginInfo/PluginInfo.js b/src/PluginInfo/PluginInfo.js
index 7a0f7d6..d75e370 100644
--- a/src/PluginInfo/PluginInfo.js
+++ b/src/PluginInfo/PluginInfo.js
@@ -25,10 +25,10 @@
 TODO (kamrik): refactor this to not use sync functions and return promises.
 */
 
-var path = require('path');
-var fs = require('fs-extra');
-var xml_helpers = require('../util/xml-helpers');
-var CordovaError = require('../CordovaError');
+const path = require('path');
+const fs = require('fs-extra');
+const xml_helpers = require('../util/xml-helpers');
+const CordovaError = require('../CordovaError');
 
 function PluginInfo (dirname) {
     // METHODS
@@ -48,32 +48,31 @@
     }
 
     function _parsePreference (prefTag) {
-        var name = prefTag.attrib.name.toUpperCase();
-        var def = prefTag.attrib.default || null;
+        const name = prefTag.attrib.name.toUpperCase();
+        const def = prefTag.attrib.default || null;
         return { preference: name, default: def };
     }
 
     // <asset>
     this.getAssets = getAssets;
     function getAssets (platform) {
-        var assets = _getTags(this._et, 'asset', platform, _parseAsset);
+        const assets = _getTags(this._et, 'asset', platform, _parseAsset);
         return assets;
     }
 
     function _parseAsset (tag) {
-        var src = tag.attrib.src;
-        var target = tag.attrib.target;
+        const src = tag.attrib.src;
+        const target = tag.attrib.target;
 
         if (!src || !target) {
-            var msg =
+            const msg =
                 'Malformed <asset> tag. Both "src" and "target" attributes' +
                 'must be specified in\n' +
-                this.filepath
-                ;
+                this.filepath;
             throw new Error(msg);
         }
 
-        var asset = {
+        const asset = {
             itemType: 'asset',
             src: src,
             target: target
@@ -89,7 +88,7 @@
     //     subdir="some/path/here" />
     this.getDependencies = getDependencies;
     function getDependencies (platform) {
-        var deps = _getTags(
+        const deps = _getTags(
             this._et,
             'dependency',
             platform,
@@ -99,7 +98,7 @@
     }
 
     function _parseDependency (tag) {
-        var dep = {
+        const dep = {
             id: tag.attrib.id,
             version: tag.attrib.version || '',
             url: tag.attrib.url || '',
@@ -110,10 +109,9 @@
         dep.git_ref = dep.commit;
 
         if (!dep.id) {
-            var msg =
+            const msg =
                 '<dependency> tag is missing id attribute in ' +
-                this.filepath
-                ;
+                this.filepath;
             throw new CordovaError(msg);
         }
         return dep;
@@ -122,12 +120,12 @@
     // <config-file> tag
     this.getConfigFiles = getConfigFiles;
     function getConfigFiles (platform) {
-        var configFiles = _getTags(this._et, 'config-file', platform, _parseConfigFile);
+        const configFiles = _getTags(this._et, 'config-file', platform, _parseConfigFile);
         return configFiles;
     }
 
     function _parseConfigFile (tag) {
-        var configFile = {
+        const configFile = {
             target: tag.attrib.target,
             parent: tag.attrib.parent,
             after: tag.attrib.after,
@@ -141,12 +139,12 @@
 
     this.getEditConfigs = getEditConfigs;
     function getEditConfigs (platform) {
-        var editConfigs = _getTags(this._et, 'edit-config', platform, _parseEditConfigs);
+        const editConfigs = _getTags(this._et, 'edit-config', platform, _parseEditConfigs);
         return editConfigs;
     }
 
     function _parseEditConfigs (tag) {
-        var editConfig = {
+        const editConfig = {
             file: tag.attrib.file,
             target: tag.attrib.target,
             mode: tag.attrib.mode,
@@ -159,7 +157,7 @@
     // TODO (kamrik): Do we ever use <info> under <platform>? Example wanted.
     this.getInfo = getInfo;
     function getInfo (platform) {
-        var infos = _getTags(
+        let infos = _getTags(
             this._et,
             'info',
             platform,
@@ -176,7 +174,7 @@
     // <source-file src="src/ios/someLib.a" compiler-flags="-fno-objc-arc" />
     this.getSourceFiles = getSourceFiles;
     function getSourceFiles (platform) {
-        var sourceFiles = _getTagsInPlatform(this._et, 'source-file', platform, _parseSourceFile);
+        const sourceFiles = _getTagsInPlatform(this._et, 'source-file', platform, _parseSourceFile);
         return sourceFiles;
     }
 
@@ -196,7 +194,7 @@
     // <header-file src="CDVFoo.h" />
     this.getHeaderFiles = getHeaderFiles;
     function getHeaderFiles (platform) {
-        var headerFiles = _getTagsInPlatform(this._et, 'header-file', platform, tag => ({
+        const headerFiles = _getTagsInPlatform(this._et, 'header-file', platform, tag => ({
             itemType: 'header-file',
             src: tag.attrib.src,
             targetDir: tag.attrib['target-dir'],
@@ -210,7 +208,7 @@
     // <resource-file src="FooPluginStrings.xml" target="res/values/FooPluginStrings.xml" device-target="win" arch="x86" versions="&gt;=8.1" />
     this.getResourceFiles = getResourceFiles;
     function getResourceFiles (platform) {
-        var resourceFiles = _getTagsInPlatform(this._et, 'resource-file', platform, tag => ({
+        const resourceFiles = _getTagsInPlatform(this._et, 'resource-file', platform, tag => ({
             itemType: 'resource-file',
             src: tag.attrib.src,
             target: tag.attrib.target,
@@ -227,7 +225,7 @@
     // <lib-file src="src/BlackBerry10/native/device/libfoo.so" arch="device" />
     this.getLibFiles = getLibFiles;
     function getLibFiles (platform) {
-        var libFiles = _getTagsInPlatform(this._et, 'lib-file', platform, tag => ({
+        const libFiles = _getTagsInPlatform(this._et, 'lib-file', platform, tag => ({
             itemType: 'lib-file',
             src: tag.attrib.src,
             arch: tag.attrib.arch,
@@ -256,12 +254,12 @@
     // </podspec>
     this.getPodSpecs = getPodSpecs;
     function getPodSpecs (platform) {
-        var podSpecs = _getTagsInPlatform(this._et, 'podspec', platform, tag => {
-            var declarations = null;
-            var sources = null;
-            var libraries = null;
-            var config = tag.find('config');
-            var pods = tag.find('pods');
+        const podSpecs = _getTagsInPlatform(this._et, 'podspec', platform, tag => {
+            let declarations = null;
+            let sources = null;
+            let libraries = null;
+            const config = tag.find('config');
+            const pods = tag.find('pods');
             if (config != null) {
                 sources = config.findall('source').map(t => ({
                     url: t.attrib.url
@@ -295,7 +293,7 @@
     // <hook type="before_build" src="scripts/beforeBuild.js" />
     this.getHookScripts = getHookScripts;
     function getHookScripts (hook, platforms) {
-        var scriptElements = this._et.findall('./hook');
+        let scriptElements = this._et.findall('./hook');
 
         if (platforms) {
             platforms.forEach(platform => {
@@ -312,12 +310,12 @@
 
     this.getJsModules = getJsModules;
     function getJsModules (platform) {
-        var modules = _getTags(this._et, 'js-module', platform, _parseJsModule);
+        const modules = _getTags(this._et, 'js-module', platform, _parseJsModule);
         return modules;
     }
 
     function _parseJsModule (tag) {
-        var ret = {
+        const ret = {
             itemType: 'js-module',
             name: tag.attrib.name,
             src: tag.attrib.src,
@@ -350,15 +348,15 @@
 
     this.getFrameworks = function (platform, options) {
         return _getTags(this._et, 'framework', platform, el => {
-            var src = el.attrib.src;
+            let src = el.attrib.src;
             if (options) {
-                var vars = options.cli_variables || {};
+                let vars = options.cli_variables || {};
 
                 if (Object.keys(vars).length === 0) {
                     // get variable defaults from plugin.xml for removal
                     vars = this.getPreferences(platform);
                 }
-                var regExp;
+                let regExp;
                 // Iterate over plugin variables.
                 // Replace them in framework src if they exist
                 Object.keys(vars).forEach(name => {
@@ -368,7 +366,7 @@
                     }
                 });
             }
-            var ret = {
+            const ret = {
                 itemType: 'framework',
                 type: el.attrib.type,
                 parent: el.attrib.parent,
@@ -391,7 +389,7 @@
     function getFilesAndFrameworks (platform, options) {
         // Please avoid changing the order of the calls below, files will be
         // installed in this order.
-        var items = [].concat(
+        const items = [].concat(
             this.getSourceFiles(platform),
             this.getHeaderFiles(platform),
             this.getResourceFiles(platform),
@@ -409,8 +407,8 @@
     }
 
     this.dir = dirname;
-    var et = this._et = xml_helpers.parseElementtreeSync(this.filepath);
-    var pelem = et.getroot();
+    const et = this._et = xml_helpers.parseElementtreeSync(this.filepath);
+    const pelem = et.getroot();
     this.id = pelem.attrib.id;
     this.version = pelem.attrib.version;
 
@@ -426,7 +424,7 @@
         this.keywords = this.keywords.split(',').map(s => s.trim());
     }
     this.getKeywordsAndPlatforms = () => {
-        var ret = this.keywords || [];
+        const ret = this.keywords || [];
         return ret.concat('ecosystem:cordova').concat(addCordova(this.getPlatformsArray()));
     };
 } // End of PluginInfo constructor.
@@ -434,7 +432,7 @@
 // Helper function used to prefix every element of an array with cordova-
 // Useful when we want to modify platforms to be cordova-platform
 function addCordova (someArray) {
-    var newArray = someArray.map(element => 'cordova-' + element);
+    const newArray = someArray.map(element => 'cordova-' + element);
     return newArray;
 }
 
@@ -443,11 +441,11 @@
 // for the given platform. If transform is given and is a function, it is
 // applied to each element.
 function _getTags (pelem, tag, platform, transform) {
-    var platformTag = pelem.find('./platform[@name="' + platform + '"]');
-    var tagsInRoot = pelem.findall(tag);
+    const platformTag = pelem.find('./platform[@name="' + platform + '"]');
+    let tagsInRoot = pelem.findall(tag);
     tagsInRoot = tagsInRoot || [];
-    var tagsInPlatform = platformTag ? platformTag.findall(tag) : [];
-    var tags = tagsInRoot.concat(tagsInPlatform);
+    const tagsInPlatform = platformTag ? platformTag.findall(tag) : [];
+    let tags = tagsInRoot.concat(tagsInPlatform);
     if (typeof transform === 'function') {
         tags = tags.map(transform);
     }
@@ -456,8 +454,8 @@
 
 // Same as _getTags() but only looks inside a platform section.
 function _getTagsInPlatform (pelem, tag, platform, transform) {
-    var platformTag = pelem.find('./platform[@name="' + platform + '"]');
-    var tags = platformTag ? platformTag.findall(tag) : [];
+    const platformTag = pelem.find('./platform[@name="' + platform + '"]');
+    let tags = platformTag ? platformTag.findall(tag) : [];
     if (typeof transform === 'function') {
         tags = tags.map(transform);
     }
@@ -473,6 +471,6 @@
 // Backwards compat:
 PluginInfo.PluginInfo = PluginInfo;
 PluginInfo.loadPluginsDir = dir => {
-    var PluginInfoProvider = require('./PluginInfoProvider');
+    const PluginInfoProvider = require('./PluginInfoProvider');
     return new PluginInfoProvider().getAllWithinSearchPath(dir);
 };
diff --git a/src/PluginInfo/PluginInfoProvider.js b/src/PluginInfo/PluginInfoProvider.js
index 53665f4..e2969d7 100644
--- a/src/PluginInfo/PluginInfoProvider.js
+++ b/src/PluginInfo/PluginInfoProvider.js
@@ -17,10 +17,10 @@
     under the License.
 */
 
-var fs = require('fs-extra');
-var path = require('path');
-var PluginInfo = require('./PluginInfo');
-var events = require('../events');
+const fs = require('fs-extra');
+const path = require('path');
+const PluginInfo = require('./PluginInfo');
+const events = require('../events');
 const glob = require('glob');
 
 function PluginInfoProvider () {
@@ -29,7 +29,7 @@
 }
 
 PluginInfoProvider.prototype.get = function (dirName) {
-    var absPath = path.resolve(dirName);
+    const absPath = path.resolve(dirName);
     if (!this._cache[absPath]) {
         this._cache[absPath] = new PluginInfo(dirName);
     }
@@ -39,7 +39,7 @@
 // Normally you don't need to put() entries, but it's used
 // when copying plugins, and in unit tests.
 PluginInfoProvider.prototype.put = function (pluginInfo) {
-    var absPath = path.resolve(pluginInfo.dir);
+    const absPath = path.resolve(pluginInfo.dir);
     this._cache[absPath] = pluginInfo;
 };
 
@@ -48,7 +48,7 @@
 // each of them and return as array.
 // Should load them all in parallel and return a promise, but not yet.
 PluginInfoProvider.prototype.getAllWithinSearchPath = function (dirName) {
-    var absPath = path.resolve(dirName);
+    const absPath = path.resolve(dirName);
     if (!this._getAllCache[absPath]) {
         this._getAllCache[absPath] = getAllHelper(absPath, this);
     }
diff --git a/src/PluginManager.js b/src/PluginManager.js
index 96c4359..1c06fe4 100644
--- a/src/PluginManager.js
+++ b/src/PluginManager.js
@@ -17,15 +17,15 @@
        under the License.
 */
 
-var Q = require('q');
-var fs = require('fs-extra');
-var path = require('path');
+const Q = require('q');
+const fs = require('fs-extra');
+const path = require('path');
 
-var ActionStack = require('./ActionStack');
-var PlatformJson = require('./PlatformJson');
-var CordovaError = require('./CordovaError');
-var PlatformMunger = require('./ConfigChanges/ConfigChanges').PlatformMunger;
-var PluginInfoProvider = require('./PluginInfo/PluginInfoProvider');
+const ActionStack = require('./ActionStack');
+const PlatformJson = require('./PlatformJson');
+const CordovaError = require('./CordovaError');
+const PlatformMunger = require('./ConfigChanges/ConfigChanges').PlatformMunger;
+const PluginInfoProvider = require('./PluginInfo/PluginInfoProvider');
 
 /**
  * @constructor
@@ -41,7 +41,7 @@
     this.locations = locations;
     this.project = ideProject;
 
-    var platformJson = PlatformJson.load(locations.root, platform);
+    const platformJson = PlatformJson.load(locations.root, platform);
     this.munger = new PlatformMunger(platform, locations.root, platformJson, new PluginInfoProvider());
 }
 
@@ -88,7 +88,7 @@
     // Set default to empty object to play safe when accesing properties
     options = options || {};
 
-    var actions = new ActionStack();
+    const actions = new ActionStack();
 
     // gather all files need to be handled during operation ...
     plugin.getFilesAndFrameworks(this.platform, options)
@@ -96,11 +96,11 @@
         .concat(plugin.getJsModules(this.platform))
         // ... put them into stack ...
         .forEach(item => {
-            var installer = this.project.getInstaller(item.itemType);
-            var uninstaller = this.project.getUninstaller(item.itemType);
-            var actionArgs = [item, plugin, this.project, options];
+            const installer = this.project.getInstaller(item.itemType);
+            const uninstaller = this.project.getUninstaller(item.itemType);
+            const actionArgs = [item, plugin, this.project, options];
 
-            var action;
+            let action;
             if (operation === PluginManager.INSTALL) {
                 action = actions.createAction(installer, actionArgs, uninstaller, actionArgs);
             } else /* op === PluginManager.UNINSTALL */{
@@ -129,7 +129,7 @@
             // Save everything (munge and plugin/modules metadata)
             this.munger.save_all();
 
-            var metadata = this.munger.platformJson.generateMetadata();
+            const metadata = this.munger.platformJson.generateMetadata();
             fs.writeFileSync(path.join(this.locations.www, 'cordova_plugins.js'), metadata, 'utf-8');
 
             // CB-11022 save plugin metadata to both www and platform_www if options.usePlatformWww is specified
diff --git a/src/superspawn.js b/src/superspawn.js
index a87d4ef..4387f22 100644
--- a/src/superspawn.js
+++ b/src/superspawn.js
@@ -17,12 +17,12 @@
     under the License.
 */
 
-var crossSpawn = require('cross-spawn');
-var fs = require('fs-extra');
-var _ = require('underscore');
-var Q = require('q');
-var events = require('./events');
-var iswin32 = process.platform === 'win32';
+const crossSpawn = require('cross-spawn');
+const fs = require('fs-extra');
+const _ = require('underscore');
+const Q = require('q');
+const events = require('./events');
+const iswin32 = process.platform === 'win32';
 
 /**
  * A special implementation for child_process.spawn that handles
@@ -60,8 +60,8 @@
 exports.spawn = (cmd, args, opts) => {
     args = args || [];
     opts = opts || {};
-    var spawnOpts = {};
-    var d = Q.defer();
+    const spawnOpts = {};
+    const d = Q.defer();
 
     if (opts.stdio !== 'default') {
         // Ignore 'default' value for stdio because it corresponds to child_process's default 'pipe' option
@@ -90,14 +90,15 @@
     // At least until Node.js 8, child_process.spawn will throw exceptions
     // instead of emitting error events in certain cases (like EACCES), Thus we
     // have to wrap the execution in try/catch to convert them into rejections.
+    let child;
     try {
-        var child = crossSpawn.spawn(cmd, args, spawnOpts);
+        child = crossSpawn.spawn(cmd, args, spawnOpts);
     } catch (e) {
         whenDone(e);
         return d.promise;
     }
-    var capturedOut = '';
-    var capturedErr = '';
+    let capturedOut = '';
+    let capturedErr = '';
 
     if (child.stdout) {
         child.stdout.setEncoding('utf8');
@@ -122,17 +123,17 @@
             child.removeListener('close', whenDone);
             child.removeListener('error', whenDone);
         }
-        var code = typeof arg === 'number' ? arg : arg && arg.code;
+        const code = typeof arg === 'number' ? arg : arg && arg.code;
 
         events.emit('verbose', 'Command finished with error code ' + code + ': ' + cmd + ' ' + args);
         if (code === 0) {
             d.resolve(capturedOut.trim());
         } else {
-            var errMsg = cmd + ': Command failed with exit code ' + code;
+            let errMsg = cmd + ': Command failed with exit code ' + code;
             if (capturedErr) {
                 errMsg += ' Error output:\n' + capturedErr.trim();
             }
-            var err = new Error(errMsg);
+            const err = new Error(errMsg);
             if (capturedErr) {
                 err.stderr = capturedErr;
             }
diff --git a/src/util/formatError.js b/src/util/formatError.js
index 0b5c099..f2d22c1 100644
--- a/src/util/formatError.js
+++ b/src/util/formatError.js
@@ -29,7 +29,7 @@
  * @returns {string} The formatted error message.
  */
 module.exports = function formatError (error, isVerbose) {
-    var message = '';
+    let message = '';
 
     if (error instanceof CordovaError) {
         message = error.toString(isVerbose);
diff --git a/src/util/plist-helpers.js b/src/util/plist-helpers.js
index 9e50dbf..08f61ed 100644
--- a/src/util/plist-helpers.js
+++ b/src/util/plist-helpers.js
@@ -18,19 +18,19 @@
 */
 
 // contains PLIST utility functions
-var __ = require('underscore');
-var plist = require('plist');
+const __ = require('underscore');
+const plist = require('plist');
 
 // adds node to doc at selector
 module.exports.graftPLIST = graftPLIST;
 function graftPLIST (doc, xml, selector) {
-    var obj = plist.parse('<plist>' + xml + '</plist>');
+    const obj = plist.parse('<plist>' + xml + '</plist>');
 
-    var node = doc[selector];
+    let node = doc[selector];
     if (node && Array.isArray(node) && Array.isArray(obj)) {
         node = node.concat(obj);
-        for (var i = 0; i < node.length; i++) {
-            for (var j = i + 1; j < node.length; ++j) {
+        for (let i = 0; i < node.length; i++) {
+            for (let j = i + 1; j < node.length; ++j) {
                 if (nodeEqual(node[i], node[j])) { node.splice(j--, 1); }
             }
         }
@@ -50,7 +50,7 @@
 // removes node from doc at selector
 module.exports.prunePLIST = prunePLIST;
 function prunePLIST (doc, xml, selector) {
-    var obj = plist.parse('<plist>' + xml + '</plist>');
+    const obj = plist.parse('<plist>' + xml + '</plist>');
 
     pruneOBJECT(doc, selector, obj);
 
@@ -59,9 +59,9 @@
 
 function pruneOBJECT (doc, selector, fragment) {
     if (Array.isArray(fragment) && Array.isArray(doc[selector])) {
-        var empty = true;
-        for (var i in fragment) {
-            for (var j in doc[selector]) {
+        let empty = true;
+        for (const i in fragment) {
+            for (const j in doc[selector]) {
                 empty = pruneOBJECT(doc[selector], j, fragment[i]) && empty;
             }
         }
@@ -82,7 +82,7 @@
         node2 = escapeRE(node2).replace(/\\\$\(\S+\)/gm, '(.*?)');
         return new RegExp('^' + node2 + '$').test(node1);
     } else {
-        for (var key in node2) {
+        for (const key in node2) {
             if (!nodeEqual(node1[key], node2[key])) return false;
         }
         return true;
diff --git a/src/util/xml-helpers.js b/src/util/xml-helpers.js
index 6133090..f1ede58 100644
--- a/src/util/xml-helpers.js
+++ b/src/util/xml-helpers.js
@@ -21,14 +21,14 @@
  * contains XML utility functions, some of which are specific to elementtree
  */
 
-var fs = require('fs-extra');
-var path = require('path');
-var _ = require('underscore');
-var et = require('elementtree');
-var stripBom = require('strip-bom');
+const fs = require('fs-extra');
+const path = require('path');
+const _ = require('underscore');
+const et = require('elementtree');
+const stripBom = require('strip-bom');
 
-var ROOT = /^\/([^/]*)/;
-var ABSOLUTE = /^\/([^/]*)\/(.*)/;
+const ROOT = /^\/([^/]*)/;
+const ABSOLUTE = /^\/([^/]*)\/(.*)/;
 
 module.exports = {
     // compare two et.XML nodes, see if they match
@@ -44,7 +44,7 @@
 
         if (!attribMatch(one, two)) return false;
 
-        for (var i = 0; i < one._children.length; i++) {
+        for (let i = 0; i < one._children.length; i++) {
             if (!module.exports.equalNodes(one._children[i], two._children[i])) {
                 return false;
             }
@@ -55,12 +55,12 @@
 
     // adds node to doc at selector, creating parent if it doesn't exist
     graftXML: function (doc, nodes, selector, after) {
-        var parent = module.exports.resolveParent(doc, selector);
+        let parent = module.exports.resolveParent(doc, selector);
         if (!parent) {
             // Try to create the parent recursively if necessary
             try {
-                var parentToCreate = et.XML('<' + path.basename(selector) + '/>');
-                var parentSelector = path.dirname(selector);
+                const parentToCreate = et.XML('<' + path.basename(selector) + '/>');
+                const parentSelector = path.dirname(selector);
 
                 this.graftXML(doc, [parentToCreate], parentSelector);
             } catch (e) {
@@ -73,8 +73,8 @@
         nodes.forEach(node => {
             // check if child is unique first
             if (uniqueChild(node, parent)) {
-                var children = parent.getchildren();
-                var insertIdx = after ? findInsertIdx(children, after) : children.length;
+                const children = parent.getchildren();
+                const insertIdx = after ? findInsertIdx(children, after) : children.length;
 
                 // TODO: replace with parent.insert after the bug in ElementTree is fixed
                 parent.getchildren().splice(insertIdx, 0, node);
@@ -87,15 +87,15 @@
     // adds new attributes to doc at selector
     // Will only merge if attribute has not been modified already or --force is used
     graftXMLMerge: function (doc, nodes, selector, xml) {
-        var target = module.exports.resolveParent(doc, selector);
+        const target = module.exports.resolveParent(doc, selector);
         if (!target) return false;
 
         // saves the attributes of the original xml before making changes
         xml.oldAttrib = _.extend({}, target.attrib);
 
         nodes.forEach(node => {
-            var attributes = node.attrib;
-            for (var attribute in attributes) {
+            const attributes = node.attrib;
+            for (const attribute in attributes) {
                 target.attrib[attribute] = node.attrib[attribute];
             }
         });
@@ -106,22 +106,22 @@
     // overwrite all attributes to doc at selector with new attributes
     // Will only overwrite if attribute has not been modified already or --force is used
     graftXMLOverwrite: function (doc, nodes, selector, xml) {
-        var target = module.exports.resolveParent(doc, selector);
+        const target = module.exports.resolveParent(doc, selector);
         if (!target) return false;
 
         // saves the attributes of the original xml before making changes
         xml.oldAttrib = _.extend({}, target.attrib);
 
         // remove old attributes from target
-        var targetAttributes = target.attrib;
-        for (var targetAttribute in targetAttributes) {
+        const targetAttributes = target.attrib;
+        for (const targetAttribute in targetAttributes) {
             delete targetAttributes[targetAttribute];
         }
 
         // add new attributes to target
         nodes.forEach(node => {
-            var attributes = node.attrib;
-            for (var attribute in attributes) {
+            const attributes = node.attrib;
+            for (const attribute in attributes) {
                 target.attrib[attribute] = node.attrib[attribute];
             }
         });
@@ -131,11 +131,11 @@
 
     // removes node from doc at selector
     pruneXML: function (doc, nodes, selector) {
-        var parent = module.exports.resolveParent(doc, selector);
+        const parent = module.exports.resolveParent(doc, selector);
         if (!parent) return false;
 
         nodes.forEach(node => {
-            var matchingKid = findChild(node, parent);
+            const matchingKid = findChild(node, parent);
             if (matchingKid !== undefined) {
                 // stupid elementtree takes an index argument it doesn't use
                 // and does not conform to the python lib
@@ -148,7 +148,7 @@
 
     // restores attributes from doc at selector
     pruneXMLRestore: function (doc, selector, xml) {
-        var target = module.exports.resolveParent(doc, selector);
+        const target = module.exports.resolveParent(doc, selector);
         if (!target) return false;
 
         if (xml.oldAttrib) {
@@ -159,12 +159,12 @@
     },
 
     pruneXMLRemove: function (doc, selector, nodes) {
-        var target = module.exports.resolveParent(doc, selector);
+        const target = module.exports.resolveParent(doc, selector);
         if (!target) return false;
 
         nodes.forEach(node => {
-            var attributes = node.attrib;
-            for (var attribute in attributes) {
+            const attributes = node.attrib;
+            for (const attribute in attributes) {
                 if (target.attrib[attribute]) {
                     delete target.attrib[attribute];
                 }
@@ -175,12 +175,12 @@
     },
 
     parseElementtreeSync: function (filename) {
-        var contents = stripBom(fs.readFileSync(filename, 'utf-8'));
+        const contents = stripBom(fs.readFileSync(filename, 'utf-8'));
         return new et.ElementTree(et.XML(contents));
     },
 
     resolveParent: function (doc, selector) {
-        var parent, tagName, subSelector;
+        let parent, tagName, subSelector;
 
         // handle absolute selector (which elementtree doesn't like)
         if (ROOT.test(selector)) {
@@ -218,17 +218,17 @@
 // insert an element C, and the rule is that the order of children has to be
 // As, Bs, Cs. After will be equal to "C;B;A".
 function findInsertIdx (children, after) {
-    var childrenTags = children.map(child => child.tag);
-    var afters = after.split(';');
-    var afterIndexes = afters.map(current => childrenTags.lastIndexOf(current));
-    var foundIndex = _.find(afterIndexes, index => index !== -1);
+    const childrenTags = children.map(child => child.tag);
+    const afters = after.split(';');
+    const afterIndexes = afters.map(current => childrenTags.lastIndexOf(current));
+    const foundIndex = _.find(afterIndexes, index => index !== -1);
 
     // add to the beginning if no matching nodes are found
     return typeof foundIndex === 'undefined' ? 0 : foundIndex + 1;
 }
 
-var BLACKLIST = ['platform', 'feature', 'plugin', 'engine'];
-var SINGLETONS = ['content', 'author', 'name'];
+const BLACKLIST = ['platform', 'feature', 'plugin', 'engine'];
+const SINGLETONS = ['content', 'author', 'name'];
 function mergeXml (src, dest, platform, clobber) {
     // Do nothing for blacklisted tags.
     if (BLACKLIST.includes(src.tag)) return;
@@ -257,11 +257,11 @@
     removeDuplicatePreferences(dest);
 
     function mergeChild (srcChild) {
-        var srcTag = srcChild.tag;
-        var destChild = new et.Element(srcTag);
-        var foundChild;
-        var query = srcTag + '';
-        var shouldMerge = true;
+        const srcTag = srcChild.tag;
+        let destChild = new et.Element(srcTag);
+        let foundChild;
+        const query = srcTag + '';
+        let shouldMerge = true;
 
         if (BLACKLIST.includes(srcTag)) return;
 
@@ -273,7 +273,7 @@
             }
         } else {
             // Check for an exact match and if you find one don't add
-            var mergeCandidates = dest.findall(query)
+            const mergeCandidates = dest.findall(query)
                 .filter(foundChild =>
                     foundChild && textMatch(srcChild, foundChild) && attribMatch(srcChild, foundChild)
                 );
@@ -291,7 +291,7 @@
 
     function removeDuplicatePreferences (xml) {
         // reduce preference tags to a hashtable to remove dupes
-        var prefHash = xml.findall('preference[@name][@value]').reduce((previousValue, currentValue) => {
+        const prefHash = xml.findall('preference[@name][@value]').reduce((previousValue, currentValue) => {
             previousValue[currentValue.attrib.name] = currentValue.attrib.value;
             return previousValue;
         }, {});
@@ -303,7 +303,7 @@
 
         // write new preferences
         Object.keys(prefHash).forEach(function (key) {
-            var element = et.SubElement(xml, 'preference');
+            const element = et.SubElement(xml, 'preference');
             element.set('name', key);
             element.set('value', this[key]);
         }, prefHash);
@@ -314,21 +314,21 @@
 module.exports.mergeXml = mergeXml;
 
 function textMatch (elm1, elm2) {
-    var text1 = elm1.text ? elm1.text.replace(/\s+/, '') : '';
-    var text2 = elm2.text ? elm2.text.replace(/\s+/, '') : '';
+    const text1 = elm1.text ? elm1.text.replace(/\s+/, '') : '';
+    const text2 = elm2.text ? elm2.text.replace(/\s+/, '') : '';
     return (text1 === '' || text1 === text2);
 }
 
 function attribMatch (one, two) {
-    var oneAttribKeys = Object.keys(one.attrib);
-    var twoAttribKeys = Object.keys(two.attrib);
+    const oneAttribKeys = Object.keys(one.attrib);
+    const twoAttribKeys = Object.keys(two.attrib);
 
     if (oneAttribKeys.length !== twoAttribKeys.length) {
         return false;
     }
 
-    for (var i = 0; i < oneAttribKeys.length; i++) {
-        var attribName = oneAttribKeys[i];
+    for (let i = 0; i < oneAttribKeys.length; i++) {
+        const attribName = oneAttribKeys[i];
 
         if (one.attrib[attribName] !== two.attrib[attribName]) {
             return false;