You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ka...@apache.org on 2014/06/19 04:10:04 UTC

git commit: CB-6973: Fix more JSHint errors

Repository: cordova-lib
Updated Branches:
  refs/heads/master f7f92e831 -> 5e4f8655c


CB-6973: Fix more JSHint errors


Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/5e4f8655
Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/5e4f8655
Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/5e4f8655

Branch: refs/heads/master
Commit: 5e4f8655cb265e4119b9ec9386988bfbadd0399c
Parents: f7f92e8
Author: Mark Koudritsky <ka...@gmail.com>
Authored: Wed Jun 18 17:07:28 2014 -0400
Committer: Mark Koudritsky <ka...@gmail.com>
Committed: Wed Jun 18 22:02:13 2014 -0400

----------------------------------------------------------------------
 cordova-lib/src/CordovaError.js                 |  4 ++
 cordova-lib/src/PluginInfo.js                   |  9 +--
 cordova-lib/src/plugman/install.js              | 58 ++++++++++----------
 cordova-lib/src/plugman/util/action-stack.js    | 11 +++-
 cordova-lib/src/plugman/util/android-project.js | 27 +++++----
 cordova-lib/src/plugman/util/default-engines.js |  7 ++-
 cordova-lib/src/plugman/util/dependencies.js    | 18 ++++--
 cordova-lib/src/plugman/util/metadata.js        |  5 ++
 cordova-lib/src/plugman/util/plist-helpers.js   | 50 +++++++++--------
 cordova-lib/src/plugman/util/plugins.js         | 10 ++--
 .../src/plugman/util/prepare-namespace.js       | 35 +++++++-----
 .../src/plugman/util/search-and-replace.js      | 11 +++-
 cordova-lib/src/util/windows/csproj.js          | 31 ++++++-----
 cordova-lib/src/util/windows/jsproj.js          | 27 +++++----
 cordova-lib/src/util/xml-helpers.js             | 22 +++++---
 15 files changed, 194 insertions(+), 131 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/CordovaError.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/CordovaError.js b/cordova-lib/src/CordovaError.js
index 5576e06..bd075d7 100644
--- a/cordova-lib/src/CordovaError.js
+++ b/cordova-lib/src/CordovaError.js
@@ -17,6 +17,10 @@
     under the License.
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          proto:true
+*/
 
 // A derived exception class. See usage example in cli.js
 // Based on:

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/PluginInfo.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/PluginInfo.js b/cordova-lib/src/PluginInfo.js
index 9b8f43a..20fa58e 100644
--- a/cordova-lib/src/PluginInfo.js
+++ b/cordova-lib/src/PluginInfo.js
@@ -17,6 +17,11 @@
     under the License.
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          sub:true, laxcomma:true, laxbreak:true
+*/
+
 /*
 A class for holidng the information currently stored in plugin.xml
 It should also be able to answer questions like whether the plugin
@@ -25,10 +30,6 @@ is compatible with a given engine version.
 TODO (kamrik): refactor this to use no fs sync fnctions and return promises.
 */
 
-/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
-          indent:4, unused:vars, latedef:nofunc,
-          sub:true, laxcomma:true, laxbreak:true
-*/
 
 var path = require('path')
   , fs = require('fs')

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/install.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/install.js b/cordova-lib/src/plugman/install.js
index 2948130..8e6205f 100644
--- a/cordova-lib/src/plugman/install.js
+++ b/cordova-lib/src/plugman/install.js
@@ -19,7 +19,7 @@
 
 /* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
           indent:4, unused:vars, latedef:nofunc,
-          laxcomma:true, sub:true, expr:true, asi:true, quotmark:false
+          laxcomma:true, sub:true, expr:true
 */
 
 var path = require('path'),
@@ -69,7 +69,7 @@ module.exports = function installPlugin(platform, project_dir, id, plugins_dir,
     plugins_dir = plugins_dir || path.join(project_dir, 'cordova', 'plugins');
 
     if (!platform_modules[platform]) {
-        return Q.reject(new CordovaError(platform + " not supported."));
+        return Q.reject(new CordovaError(platform + ' not supported.'));
     }
 
     var current_stack = new action_stack();
@@ -108,10 +108,10 @@ function checkEngines(engines) {
     for(var i = 0; i < engines.length; i++) {
         var engine = engines[i];
 
-        if(semver.satisfies(engine.currentVersion, engine.minVersion) || engine.currentVersion === null){
+        if ( semver.satisfies(engine.currentVersion, engine.minVersion) || engine.currentVersion === null ) {
             // engine ok!
-        }else{
-            var msg = "Plugin doesn't support this project's " + engine.name + ' version. ' +
+        } else {
+            var msg = 'Plugin doesn\'t support this project\'s ' + engine.name + ' version. ' +
                       engine.name + ': ' + engine.currentVersion +
                       ', failed version requirement: ' + engine.minVersion;
             return Q.reject(new CordovaError(msg));
@@ -132,7 +132,7 @@ function cleanVersionOutput(version, name){
     // put a warning about using the dev branch
     if (dev_index > -1) {
         // some platform still lists dev branches as just dev, set to null and continue
-        if(out=="dev"){
+        if(out=='dev'){
             out = null;
         }
         events.emit('verbose', name+' has been detected as using a development branch. Attemping to install anyways.');
@@ -186,7 +186,7 @@ function callEngineScripts(engines) {
             } else {
 
                 if(engine.currentVersion) {
-                    engine.currentVersion = cleanVersionOutput(engine.currentVersion, engine.name)
+                    engine.currentVersion = cleanVersionOutput(engine.currentVersion, engine.name);
                 } else {
                     events.emit('warn', engine.name +' version not detected (lacks script '+ scriptPath +' ), continuing.');
                 }
@@ -206,14 +206,14 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
     // load in known defaults and update when necessary
 
     engines.forEach(function(engine){
-        theName = engine.attrib["name"];
+        theName = engine.attrib['name'];
 
         // check to see if the engine is listed as a default engine
         if(defaultEngines[theName]){
             // make sure engine is for platform we are installing on
             defaultPlatformIndex = defaultEngines[theName].platform.indexOf(platform);
             if(defaultPlatformIndex > -1 || defaultEngines[theName].platform === '*'){
-                defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.attrib["version"];
+                defaultEngines[theName].minVersion = defaultEngines[theName].minVersion ? defaultEngines[theName].minVersion : engine.attrib['version'];
                 defaultEngines[theName].currentVersion = defaultEngines[theName].currentVersion ? defaultEngines[theName].currentVersion : null;
                 defaultEngines[theName].scriptSrc = defaultEngines[theName].scriptSrc ? defaultEngines[theName].scriptSrc : null;
                 defaultEngines[theName].name = theName;
@@ -226,9 +226,9 @@ function getEngines(pluginElement, platform, project_dir, plugin_dir){
             }
         // check for other engines
         }else{
-            platformIndex = engine.attrib["platform"].indexOf(platform);
-            if(platformIndex > -1 || engine.attrib["platform"] === '*'){
-                uncheckedEngines.push({ 'name': theName, 'platform': engine.attrib["platform"], 'scriptSrc':path.resolve(plugin_dir, engine.attrib["scriptSrc"]), 'minVersion' :  engine.attrib["version"]});
+            platformIndex = engine.attrib['platform'].indexOf(platform);
+            if(platformIndex > -1 || engine.attrib['platform'] === '*'){
+                uncheckedEngines.push({ 'name': theName, 'platform': engine.attrib['platform'], 'scriptSrc':path.resolve(plugin_dir, engine.attrib['scriptSrc']), 'minVersion' :  engine.attrib['version']});
             }
         }
     });
@@ -284,7 +284,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
         plugins_dir: plugins_dir,
         top_plugin_id: pluginInfo.id,
         top_plugin_dir: plugin_dir
-    }
+    };
 
     return callEngineScripts(theEngines)
     .then(checkEngines)
@@ -298,7 +298,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
             install.filtered_variables = filtered_variables;
 
             if (missing_vars.length > 0) {
-                throw new Error('Variable(s) missing: ' + missing_vars.join(", "));
+                throw new Error('Variable(s) missing: ' + missing_vars.join(', '));
             }
 
             // Check for dependencies
@@ -321,7 +321,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
         }
     ).fail(
         function (error) {
-            events.emit('warn', "Failed to install '" + pluginInfo.id + "':" + error.stack);
+            events.emit('warn', 'Failed to install \'' + pluginInfo.id + '\':' + error.stack);
             throw error;
         }
     );
@@ -330,7 +330,7 @@ function runInstall(actions, platform, project_dir, plugin_dir, plugins_dir, opt
 function installDependencies(install, dependencies, options) {
     events.emit('verbose', 'Dependencies detected, iterating through them...');
 
-    var top_plugins = path.join(options.plugin_src_dir || install.top_plugin_dir, '..')
+    var top_plugins = path.join(options.plugin_src_dir || install.top_plugin_dir, '..');
 
     // Add directory of top-level plugin to search path
     options.searchpath = options.searchpath || [];
@@ -345,7 +345,7 @@ function installDependencies(install, dependencies, options) {
     return dependencies.reduce(function(soFar, dep) {
         return soFar.then(
             function() {
-                dep.git_ref = dep.commit
+                dep.git_ref = dep.commit;
 
                 if (dep.subdir) {
                     dep.subdir = path.normalize(dep.subdir);
@@ -409,7 +409,7 @@ function tryFetchDependency(dep, install, options) {
             return d.promise.then(function(git_repo) {
                 //Clear out the subdir since the url now contains it
                 var url = path.join(git_repo, dep.subdir);
-                dep.subdir = "";
+                dep.subdir = '';
                 return Q(url);
             }).fail(function(error){
 //console.log("Failed to resolve url='.': " + error);
@@ -520,37 +520,37 @@ function handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir,
 
         // queue up native stuff
         sourceFiles && sourceFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler["source-file"].install,
+            actions.push(actions.createAction(handler['source-file'].install,
                                               [item, plugin_dir, project_dir, pluginInfo.id],
-                                              handler["source-file"].uninstall,
+                                              handler['source-file'].uninstall,
                                               [item, project_dir, pluginInfo.id]));
         });
 
         headerFiles && headerFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler["header-file"].install,
+            actions.push(actions.createAction(handler['header-file'].install,
                                              [item, plugin_dir, project_dir, pluginInfo.id],
-                                             handler["header-file"].uninstall,
+                                             handler['header-file'].uninstall,
                                              [item, project_dir, pluginInfo.id]));
         });
 
         resourceFiles && resourceFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler["resource-file"].install,
+            actions.push(actions.createAction(handler['resource-file'].install,
                                               [item, plugin_dir, project_dir, pluginInfo.id],
-                                              handler["resource-file"].uninstall,
+                                              handler['resource-file'].uninstall,
                                               [item, project_dir, pluginInfo.id]));
         });
         // CB-5238 custom frameworks only
         frameworkFiles && frameworkFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler["framework"].install,
+            actions.push(actions.createAction(handler['framework'].install,
                                              [item, plugin_dir, project_dir, pluginInfo.id],
-                                             handler["framework"].uninstall,
+                                             handler['framework'].uninstall,
                                              [item, project_dir, pluginInfo.id]));
         });
 
         libFiles && libFiles.forEach(function(item) {
-            actions.push(actions.createAction(handler["lib-file"].install,
+            actions.push(actions.createAction(handler['lib-file'].install,
                                                 [item, plugin_dir, project_dir, pluginInfo.id],
-                                                handler["lib-file"].uninstall,
+                                                handler['lib-file'].uninstall,
                                                 [item, project_dir, pluginInfo.id]));
 
         });
@@ -576,7 +576,7 @@ function handleInstall(actions, pluginInfo, platform, project_dir, plugins_dir,
 
 function interp_vars(vars, text) {
     vars && Object.keys(vars).forEach(function(key) {
-        var regExp = new RegExp("\\$" + key, "g");
+        var regExp = new RegExp('\\$' + key, 'g');
         text = text.replace(regExp, vars[key]);
     });
     return text;

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/action-stack.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/action-stack.js b/cordova-lib/src/plugman/util/action-stack.js
index 0df86dc..376b397 100644
--- a/cordova-lib/src/plugman/util/action-stack.js
+++ b/cordova-lib/src/plugman/util/action-stack.js
@@ -16,10 +16,15 @@
     specific language governing permissions and limitations
     under the License.
 */
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          quotmark:false
+*/
+
 var platforms = require("../platforms"),
     events = require('../../events'),
-    Q = require('q'),
-    fs = require('fs');
+    Q = require('q');
 
 function ActionStack() {
     this.stack = [];
@@ -65,7 +70,7 @@ ActionStack.prototype = {
                 handler.apply(null, action_params);
             } catch(e) {
                 events.emit('warn', 'Error during processing of action! Attempting to revert...');
-                var incomplete = this.stack.unshift(action);
+                this.stack.unshift(action);
                 var issue = 'Uh oh!\n';
                 // revert completed tasks
                 while(this.completed.length) {

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/android-project.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/android-project.js b/cordova-lib/src/plugman/util/android-project.js
index a6c2028..1654019 100644
--- a/cordova-lib/src/plugman/util/android-project.js
+++ b/cordova-lib/src/plugman/util/android-project.js
@@ -20,6 +20,11 @@
     Helper for Android projects configuration
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          boss:true
+*/
+
 var fs = require('fs'),
     path = require('path'),
     properties_parser = require('properties-parser'),
@@ -28,22 +33,22 @@ var fs = require('fs'),
 
 function addLibraryReference(projectProperties, libraryPath) {
     var i = 1;
-    while (projectProperties.get("android.library.reference." + i))
+    while (projectProperties.get('android.library.reference.' + i))
         i++;
 
-    projectProperties.set("android.library.reference." + i, libraryPath);
+    projectProperties.set('android.library.reference.' + i, libraryPath);
 }
 
 function removeLibraryReference(projectProperties, libraryPath) {
     var i = 1;
     var currentLib;
-    while (currentLib = projectProperties.get("android.library.reference." + i)) {
+    while (currentLib = projectProperties.get('android.library.reference.' + i)) {
         if (currentLib === libraryPath) {
-            while (currentLib = projectProperties.get("android.library.reference." + (i + 1))) {
-                projectProperties.set("android.library.reference." + i, currentLib);
+            while (currentLib = projectProperties.get('android.library.reference.' + (i + 1))) {
+                projectProperties.set('android.library.reference.' + i, currentLib);
                 i++;
             }
-            projectProperties.set("android.library.reference." + i);
+            projectProperties.set('android.library.reference.' + i);
             break;
         }
         i++;
@@ -60,21 +65,21 @@ function AndroidProject() {
 
 AndroidProject.prototype = {
     addSubProject: function(parentDir, subDir) {
-        var subProjectFile = path.resolve(subDir, "project.properties");
+        var subProjectFile = path.resolve(subDir, 'project.properties');
         if (!fs.existsSync(subProjectFile)) throw new Error('cannot find "' + subProjectFile + '" referenced in <framework>');
 
-        var parentProjectFile = path.resolve(parentDir, "project.properties");
+        var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
         addLibraryReference(parentProperties, module.exports.getRelativeLibraryPath(parentDir, subDir));
 
         var subProperties = this._getPropertiesFile(subProjectFile);
-        subProperties.set("target", parentProperties.get("target"));
+        subProperties.set('target', parentProperties.get('target'));
 
         this._subProjectDirs[subDir] = true;
         this._dirty = true;
     },
     removeSubProject: function(parentDir, subDir) {
-        var parentProjectFile = path.resolve(parentDir, "project.properties");
+        var parentProjectFile = path.resolve(parentDir, 'project.properties');
         var parentProperties = this._getPropertiesFile(parentProjectFile);
         removeLibraryReference(parentProperties, module.exports.getRelativeLibraryPath(parentDir, subDir));
         delete this._subProjectDirs[subDir];
@@ -89,7 +94,7 @@ AndroidProject.prototype = {
 
         for (var sub_dir in this._subProjectDirs)
         {
-            shell.exec("android update lib-project --path " + sub_dir);
+            shell.exec('android update lib-project --path ' + sub_dir);
         }
         this._dirty = false;
     },

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/default-engines.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/default-engines.js b/cordova-lib/src/plugman/util/default-engines.js
index b7d0b34..a9cb24d 100644
--- a/cordova-lib/src/plugman/util/default-engines.js
+++ b/cordova-lib/src/plugman/util/default-engines.js
@@ -16,6 +16,11 @@
     specific language governing permissions and limitations
     under the License.
 */
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc
+*/
+
 var path = require('path');
 
 module.exports = function(project_dir){
@@ -48,5 +53,5 @@ module.exports = function(project_dir){
             { 'platform':'wp8|windows8', 'scriptSrc': path.join(project_dir,'cordova','win_os_version') },
         'windows-sdk' :
             { 'platform':'wp8|windows8', 'scriptSrc': path.join(project_dir,'cordova','win_sdk_version') }
-    }
+    };
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/dependencies.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/dependencies.js b/cordova-lib/src/plugman/util/dependencies.js
index d2715ca..ce9128b 100644
--- a/cordova-lib/src/plugman/util/dependencies.js
+++ b/cordova-lib/src/plugman/util/dependencies.js
@@ -16,10 +16,14 @@
     specific language governing permissions and limitations
     under the License.
 */
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          expr:true
+*/
+
 var dep_graph = require('dep-graph'),
     path = require('path'),
-    fs = require('fs'),
-    plugman = require('../plugman'),
     config_changes = require('./config-changes'),
     underscore = require('underscore'),
     xml_helpers = require('../../util/xml-helpers'),
@@ -70,10 +74,11 @@ module.exports = package = {
 
     // Returns a list of top-level plugins which are (transitively) dependent on the given plugin.
     dependents: function(plugin_id, plugins_dir, platform) {
+        var depsInfo;
         if(typeof plugins_dir == 'object')
-            var depsInfo = plugins_dir;
+            depsInfo = plugins_dir;
         else
-            var depsInfo = package.generate_dependency_info(plugins_dir, platform);
+            depsInfo = package.generate_dependency_info(plugins_dir, platform);
 
         var graph = depsInfo.graph;
         var tlps = depsInfo.top_level_plugins;
@@ -87,10 +92,11 @@ module.exports = package = {
     // Returns a list of plugins which the given plugin depends on, for which it is the only dependent.
     // In other words, if the given plugin were deleted, these dangling dependencies should be deleted too.
     danglers: function(plugin_id, plugins_dir, platform) {
+        var depsInfo;
         if(typeof plugins_dir == 'object')
-            var depsInfo = plugins_dir;
+            depsInfo = plugins_dir;
         else
-            var depsInfo = package.generate_dependency_info(plugins_dir, platform);
+            depsInfo = package.generate_dependency_info(plugins_dir, platform);
 
         var graph = depsInfo.graph;
         var dependencies = graph.getChain(plugin_id);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/metadata.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/metadata.js b/cordova-lib/src/plugman/util/metadata.js
index 3e2a340..bf88f41 100644
--- a/cordova-lib/src/plugman/util/metadata.js
+++ b/cordova-lib/src/plugman/util/metadata.js
@@ -16,6 +16,11 @@
     specific language governing permissions and limitations
     under the License.
 */
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc
+*/
+
 var fs = require('fs'),
     path = require('path');
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/plist-helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/plist-helpers.js b/cordova-lib/src/plugman/util/plist-helpers.js
index e1dfbd9..b8d93f2 100644
--- a/cordova-lib/src/plugman/util/plist-helpers.js
+++ b/cordova-lib/src/plugman/util/plist-helpers.js
@@ -17,39 +17,43 @@
  *
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc
+*/
+
 // contains PLIST utility functions
 
-var et = require('elementtree'),
-    plist = require('plist-with-patches');
+var plist = require('plist-with-patches');
 
 // adds node to doc at selector
-module.exports = {
-    graftPLIST:function (doc, xml, selector) {
-        var obj = plist.parseStringSync("<plist>"+xml+"</plist>");
+module.exports.graftPLIST = graftPLIST;
+function graftPLIST(doc, xml, selector) {
+    var obj = plist.parseStringSync('<plist>'+xml+'</plist>');
 
-        var node = doc[selector];
-        if (node && Array.isArray(node) && Array.isArray(obj))
-            doc[selector] = node.concat(obj);
-        else
-            doc[selector] = obj;
+    var node = doc[selector];
+    if (node && Array.isArray(node) && Array.isArray(obj))
+        doc[selector] = node.concat(obj);
+    else
+        doc[selector] = obj;
 
-        return true;
-    },
-    // removes node from doc at selector
-    prunePLIST:function(doc, xml, selector) {
-        var obj = plist.parseStringSync("<plist>"+xml+"</plist>");
+    return true;
+}
 
-        pruneOBJECT(doc, selector, obj);
+// removes node from doc at selector
+module.exports.prunePLIST = prunePLIST;
+function prunePLIST(doc, xml, selector) {
+    var obj = plist.parseStringSync('<plist>'+xml+'</plist>');
 
-        return true;
-    }
+    pruneOBJECT(doc, selector, obj);
+
+    return true;
 }
 
 function pruneOBJECT(doc, selector, fragment) {
     if (Array.isArray(fragment) && Array.isArray(doc[selector])) {
         var empty = true;
-        for (i in fragment) {
-            for (j in doc[selector]) {
+        for (var i in fragment) {
+            for (var j in doc[selector]) {
                 empty = pruneOBJECT(doc[selector], j, fragment[i]) && empty;
             }
         }
@@ -71,7 +75,7 @@ function nodeEqual(node1, node2) {
     if (typeof node1 != typeof node2)
         return false;
     else if (typeof node1 == 'string') {
-        node2 = escapeRE(node2).replace(new RegExp("\\$[a-zA-Z0-9-_]+","gm"),"(.*?)");
+        node2 = escapeRE(node2).replace(new RegExp('\\$[a-zA-Z0-9-_]+','gm'),'(.*?)');
         return new RegExp('^' + node2 + '$').test(node1);
     }
     else {
@@ -84,5 +88,5 @@ function nodeEqual(node1, node2) {
 
 // escape string for use in regex
 function escapeRE(str) {
-     return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, "\$&");
-};
+    return str.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '$&');
+}

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/plugins.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/plugins.js b/cordova-lib/src/plugman/util/plugins.js
index 471d8b0..01894eb 100644
--- a/cordova-lib/src/plugman/util/plugins.js
+++ b/cordova-lib/src/plugman/util/plugins.js
@@ -17,10 +17,12 @@
  *
 */
 
-var http = require('http'),
-    os = require('os'),
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc
+*/
+
+var os = require('os'),
     path = require('path'),
-    fs = require('fs'),
     util = require('util'),
     shell = require('shelljs'),
     child_process = require('child_process'),
@@ -49,7 +51,7 @@ module.exports = {
         if(!shell.which('git')) {
             return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'));
         }
-        tmp_dir = path.join(os.tmpdir(), 'plugman', 'git', String((new Date).valueOf()));
+        tmp_dir = path.join(os.tmpdir(), 'plugman', 'git', String((new Date()).valueOf()));
 
         shell.rm('-rf', tmp_dir);
 

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/prepare-namespace.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/prepare-namespace.js b/cordova-lib/src/plugman/util/prepare-namespace.js
index eac973e..0202e7e 100644
--- a/cordova-lib/src/plugman/util/prepare-namespace.js
+++ b/cordova-lib/src/plugman/util/prepare-namespace.js
@@ -1,40 +1,45 @@
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          quotmark:false
+*/
+
 var util = require('util');
 
 // FIXME this is extremely guettho
-module.exports = function(target, method) {
+module.exports = prepare_namespace;
+function prepare_namespace(target, method) {
     var old = target;
-    var target = target.replace(/^window(\.)?/, '');
+    target = target.replace(/^window(\.)?/, '');
 
     var lastDot = target.lastIndexOf('.');
-    var namespace = target.substr(0, lastDot);
     var lastName = target.substr(lastDot + 1);
-    var props = target.split(".");
-    var code = "";
+    var props = target.split('.');
+    var code = '';
 
-    if(target !== "") {
+    if(target !== '') {
         for(var i = 1, len = props.length ; i <= len ; i++) {
-            var sub = props.slice(0, i).join(".");
-            code += util.format("window.%s = window.%s || {};\n", sub, sub);
+            var sub = props.slice(0, i).join('.');
+            code += util.format('window.%s = window.%s || {};\n', sub, sub);
         }
     }
 
-    props.unshift('window');  
+    props.unshift('window');
     var object = props.slice(0, props.length - 1).join('.');
-    //  code = "\n";
-    if(method === "c") {
+    //  code = '\n';
+    if(method === 'c') {
         return util.format(
-                "%s\nrequire('cordova/builder').assignOrWrapInDeprecateGetter(%s, '%s', module.exports);", 
+                "%s\nrequire('cordova/builder').assignOrWrapInDeprecateGetter(%s, '%s', module.exports);",
                 code,
                 object,
                 lastName
                 );
-    } else if(method === "m" && old !== "") {
+    } else if(method === 'm' && old !== '') {
         return util.format(
-                "%s\n;require('cordova/builder').recursiveMerge(%s, module.exports);", 
+                "%s\n;require('cordova/builder').recursiveMerge(%s, module.exports);",
                 code,
                 old
                 );
     } else {
-        return "// no clobber or merges";
+        return '// no clobber or merges';
     }
 }

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/plugman/util/search-and-replace.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/plugman/util/search-and-replace.js b/cordova-lib/src/plugman/util/search-and-replace.js
index 39bd9c3..ece556d 100644
--- a/cordova-lib/src/plugman/util/search-and-replace.js
+++ b/cordova-lib/src/plugman/util/search-and-replace.js
@@ -18,17 +18,22 @@
  *
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc
+*/
+
 var glob = require('glob'),
     fs = require('fs');
 
-module.exports = function searchAndReplace(srcGlob, variables) {
+module.exports = searchAndReplace;
+function searchAndReplace(srcGlob, variables) {
     var files = glob.sync(srcGlob);
     for (var i in files) {
         var file = files[i];
         if (fs.lstatSync(file).isFile()) {
-            var contents = fs.readFileSync(file, "utf-8");
+            var contents = fs.readFileSync(file, 'utf-8');
             for (var key in variables) {
-                var regExp = new RegExp("\\$" + key, "g");
+                var regExp = new RegExp('\\$' + key, 'g');
                 contents = contents.replace(regExp, variables[key]);
             }
             fs.writeFileSync(file, contents);

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/util/windows/csproj.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/csproj.js b/cordova-lib/src/util/windows/csproj.js
index 762c291..90f84da 100644
--- a/cordova-lib/src/util/windows/csproj.js
+++ b/cordova-lib/src/util/windows/csproj.js
@@ -16,6 +16,11 @@
     specific language governing permissions and limitations
     under the License.
 */
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc
+*/
+
 var xml_helpers = require('../../util/xml-helpers'),
     et = require('elementtree'),
     fs = require('fs'),
@@ -44,9 +49,9 @@ csproj.prototype = {
         hint_path.text = relPath;
         elem.append(hint_path);
 
-        if(extName == ".winmd") {
-            var mdFileTag = new et.Element("IsWinMDFile");
-                mdFileTag.text = "true";
+        if(extName == '.winmd') {
+            var mdFileTag = new et.Element('IsWinMDFile');
+            mdFileTag.text = 'true';
             elem.append(mdFileTag);
         }
 
@@ -56,7 +61,6 @@ csproj.prototype = {
     },
 
     removeReference:function(relPath) {
-        var item = new et.Element('ItemGroup');
         var extName = path.extname(relPath);
         var includeText = path.basename(relPath,extName);
         // <ItemGroup>
@@ -69,33 +73,34 @@ csproj.prototype = {
     },
 
     addSourceFile:function(relative_path) {
+        var compile;
         relative_path = relative_path.split('/').join('\\');
         // make ItemGroup to hold file.
         var item = new et.Element('ItemGroup');
 
         var extName = path.extname(relative_path);
         // check if it's a .xaml page
-        if(extName == ".xaml") {
+        if(extName == '.xaml') {
             var page = new et.Element('Page');
             var sub_type = new et.Element('SubType');
 
-            sub_type.text = "Designer";
+            sub_type.text = 'Designer';
             page.append(sub_type);
             page.attrib.Include = relative_path;
 
             var gen = new et.Element('Generator');
-            gen.text = "MSBuild:Compile";
+            gen.text = 'MSBuild:Compile';
             page.append(gen);
 
             var item_groups = this.xml.findall('ItemGroup');
-            if(item_groups.length == 0) {
+            if(item_groups.length === 0) {
                 item.append(page);
             } else {
                 item_groups[0].append(page);
             }
         }
-        else if (extName == ".cs") {
-            var compile = new et.Element('Compile');
+        else if (extName == '.cs') {
+            compile = new et.Element('Compile');
             compile.attrib.Include = relative_path;
             // check if it's a .xaml.cs page that would depend on a .xaml of the same name
             if (relative_path.indexOf('.xaml.cs', relative_path.length - 8) > -1) {
@@ -108,7 +113,7 @@ csproj.prototype = {
             item.append(compile);
         }
         else { // otherwise add it normally
-            var compile = new et.Element('Content');
+            compile = new et.Element('Content');
             compile.attrib.Include = relative_path;
             item.append(compile);
         }
@@ -132,7 +137,7 @@ csproj.prototype = {
                     if (!item.attrib.Include) return false;
                     return isRegexp ? item.attrib.Include.match(relative_path) :
                         item.attrib.Include == relative_path;
-            });
+                });
 
             // nothing to remove, skip..
             if (filesToRemove.length < 1) return;
@@ -145,7 +150,7 @@ csproj.prototype = {
             // remove ItemGroup if empty
             if(group.findall('*').length < 1) {
                 root.remove(0, group);
-            };
+            }
         });
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/util/windows/jsproj.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/windows/jsproj.js b/cordova-lib/src/util/windows/jsproj.js
index b9773f9..6cac1cf 100644
--- a/cordova-lib/src/util/windows/jsproj.js
+++ b/cordova-lib/src/util/windows/jsproj.js
@@ -16,6 +16,12 @@
     specific language governing permissions and limitations
     under the License.
 */
+
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          quotmark:false, unused:false
+*/
+
 /*
   Helper for dealing with Windows Store JS app .jsproj files
 */
@@ -28,10 +34,10 @@ var xml_helpers = require('../../util/xml-helpers'),
     events = require('../../events'),
     path = require('path');
 
-var WindowsStoreProjectTypeGUID = "{BC8A1FFA-BEE3-4634-8014-F334798102B3}";  // any of the below, subtype
-var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";    // .csproj
-var WinVBnetProjectTypeGUID = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";     // who the ef cares?
-var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}"; // .vcxproj
+var WindowsStoreProjectTypeGUID = "{BC8A1FFA-BEE3-4634-8014-F334798102B3}";  //any of the below, subtype
+var WinCSharpProjectTypeGUID = "{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}";  // .csproj
+var WinVBnetProjectTypeGUID = "{F184B08F-C81C-45F6-A57F-5ABD9991F28F}";  // who the ef cares?
+var WinCplusplusProjectTypeGUID = "{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}";  // .vcxproj
 
 
 function jsproj(location) {
@@ -80,13 +86,13 @@ jsproj.prototype = {
 
         // add hint path with full path
         var hint_path = new et.Element('HintPath');
-            hint_path.text = relPath;
+        hint_path.text = relPath;
 
         elem.append(hint_path);
 
         if(extName == ".winmd") {
             var mdFileTag = new et.Element("IsWinMDFile");
-                mdFileTag.text = "true";
+            mdFileTag.text = "true";
             elem.append(mdFileTag);
         }
 
@@ -115,7 +121,7 @@ jsproj.prototype = {
         var item = new et.Element('ItemGroup');
 
         var content = new et.Element('Content');
-            content.attrib.Include = relative_path;
+        content.attrib.Include = relative_path;
         item.append(content);
 
         this.xml.getroot().append(item);
@@ -149,7 +155,7 @@ jsproj.prototype = {
             // remove ItemGroup if empty
             if(group.findall('*').length < 1) {
                 root.remove(0, group);
-            };
+            }
         });
     },
 
@@ -203,10 +209,9 @@ jsproj.prototype = {
         // Add the ItemGroup/ProjectReference to the cordova project :
         // <ItemGroup><ProjectReference Include="blahblah.csproj"/></ItemGroup>
         var item = new et.Element('ItemGroup');
-
         var projRef = new et.Element('ProjectReference');
-            projRef.attrib.Include = relative_path;
-            item.append(projRef);
+        projRef.attrib.Include = relative_path;
+        item.append(projRef);
         this.xml.getroot().append(item);
 
     },

http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/5e4f8655/cordova-lib/src/util/xml-helpers.js
----------------------------------------------------------------------
diff --git a/cordova-lib/src/util/xml-helpers.js b/cordova-lib/src/util/xml-helpers.js
index 6371b2a..befd4cb 100644
--- a/cordova-lib/src/util/xml-helpers.js
+++ b/cordova-lib/src/util/xml-helpers.js
@@ -17,6 +17,11 @@
  *
 */
 
+/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
+          indent:4, unused:vars, latedef:nofunc,
+          sub:true, laxcomma:true
+*/
+
 /**
  * contains XML utility functions, some of which are specific to elementtree
  */
@@ -24,7 +29,8 @@
 var fs = require('fs')
   , path = require('path')
   , _ = require('underscore')
-  , et = require('elementtree');
+  , et = require('elementtree')
+  ;
 
 module.exports = {
     // compare two et.XML nodes, see if they match
@@ -69,7 +75,7 @@ module.exports = {
         if (!parent) {
             //Try to create the parent recursively if necessary
             try {
-                var parentToCreate = et.XML("<" + path.basename(selector) + ">"),
+                var parentToCreate = et.XML('<' + path.basename(selector) + '>'),
                     parentSelector = path.dirname(selector);
 
                 this.graftXML(doc, [parentToCreate], parentSelector);
@@ -101,7 +107,7 @@ module.exports = {
 
         nodes.forEach(function (node) {
             var matchingKid = null;
-            if ((matchingKid = findChild(node, parent)) != null) {
+            if ((matchingKid = findChild(node, parent)) !== null) {
                 // stupid elementtree takes an index argument it doesn't use
                 // and does not conform to the python lib
                 parent.remove(0, matchingKid);
@@ -115,7 +121,7 @@ module.exports = {
         var contents = fs.readFileSync(filename, 'utf-8');
         if(contents) {
             //Windows is the BOM. Skip the Byte Order Mark.
-            contents = contents.substring(contents.indexOf("<"));
+            contents = contents.substring(contents.indexOf('<'));
         }
         return new et.ElementTree(et.XML(contents));
     }
@@ -137,7 +143,7 @@ function uniqueChild(node, parent) {
     var matchingKids = parent.findall(node.tag)
       , i = 0;
 
-    if (matchingKids.length == 0) {
+    if (matchingKids.length === 0) {
         return true;
     } else  {
         for (i; i < matchingKids.length; i++) {
@@ -165,13 +171,13 @@ function resolveParent(doc, selector) {
             // could be an absolute path, but not selecting the root
             if (ABSOLUTE.test(selector)) {
                 subSelector = selector.match(ABSOLUTE)[2];
-                parent = parent.find(subSelector)
+                parent = parent.find(subSelector);
             }
         } else {
             return false;
         }
     } else {
-        parent = doc.find(selector)
+        parent = doc.find(selector);
     }
     return parent;
 }
@@ -182,7 +188,7 @@ function resolveParent(doc, selector) {
 // As, Bs, Cs. After will be equal to "C;B;A".
 function findInsertIdx(children, after) {
     var childrenTags = children.map(function(child) { return child.tag; });
-    var afters = after.split(";");
+    var afters = after.split(';');
     var afterIndexes = afters.map(function(current) { return childrenTags.lastIndexOf(current); });
     var foundIndex = _.find(afterIndexes, function(index) { return index != -1; });