fix linting errors
diff --git a/src/browser.js b/src/browser.js
index aca1127..07a93ac 100644
--- a/src/browser.js
+++ b/src/browser.js
@@ -19,10 +19,10 @@
 
 /* globals Promise: true */
 
-var child_process = require('child_process'),
-    fs = require('fs'),
-    open = require('open'),
-    exec = require('./exec');
+var child_process = require('child_process');
+var fs = require('fs');
+var open = require('open');
+var exec = require('./exec');
 
 var NOT_INSTALLED = 'The browser target is not installed: %target%';
 var NOT_SUPPORTED = 'The browser target is not supported: %target%';
@@ -43,60 +43,65 @@
     var url = opts.url || '';
 
     target = target.toLowerCase();
-    if(target === 'default') {
+    if (target === 'default') {
         open(url);
         return Promise.resolve();
-    }
-    else {
+    } else {
         return getBrowser(target, opts.dataDir).then(function (browser) {
             var args;
             var urlAdded = false;
 
             switch (process.platform) {
-                case 'darwin':
-                    args = ['open'];
-                    if (target == 'chrome') {
-                        // Chrome needs to be launched in a new window. Other browsers, particularly, opera does not work with this.
-                        args.push('-n');
-                    }
-                    args.push('-a', browser);
-                    break;
-                case 'win32':
-                    // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and
-                    // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the
-                    // responsibility to "cmd /c", which has that logic built in.
-                    //
-                    // Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title,
-                    // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
+            case 'darwin':
+                args = ['open'];
+                if (target === 'chrome') {
+                    // Chrome needs to be launched in a new window. Other browsers, particularly, opera does not work with this.
+                    args.push('-n');
+                }
+                args.push('-a', browser);
+                break;
+            case 'win32':
+                // On Windows, we really want to use the "start" command. But, the rules regarding arguments with spaces, and
+                // escaping them with quotes, can get really arcane. So the easiest way to deal with this is to pass off the
+                // responsibility to "cmd /c", which has that logic built in.
+                //
+                // Furthermore, if "cmd /c" double-quoted the first parameter, then "start" will interpret it as a window title,
+                // so we need to add a dummy empty-string window title: http://stackoverflow.com/a/154090/3191
 
-                    if (target === 'edge') {
-                        browser += ':' + url;
-                        urlAdded = true;
-                    }
+                if (target === 'edge') {
+                    browser += ':' + url;
+                    urlAdded = true;
+                }
 
-                    args = ['cmd /c start ""', browser];
-                    break;
-                case 'linux':
-                    // if a browser is specified, launch it with the url as argument
-                    // otherwise, use xdg-open.
-                    args = [browser];
-                    break;
+                args = ['cmd /c start ""', browser];
+                break;
+            case 'linux':
+                // if a browser is specified, launch it with the url as argument
+                // otherwise, use xdg-open.
+                args = [browser];
+                break;
             }
 
             if (!urlAdded) {
                 args.push(url);
             }
             var command = args.join(' ');
-
-            return exec(command).catch(function (error) {
+            var result = exec(command);
+            result.catch(function () {
                 // Assume any error means that the browser is not installed and display that as a more friendly error.
                 throw new Error(NOT_INSTALLED.replace('%target%', target));
             });
+            return result;
+
+            // return exec(command).catch(function (error) {
+            //     // Assume any error means that the browser is not installed and display that as a more friendly error.
+            //     throw new Error(NOT_INSTALLED.replace('%target%', target));
+            // });
         });
     }
 };
 
-function getBrowser(target, dataDir) {
+function getBrowser (target, dataDir) {
     dataDir = dataDir || 'temp_chrome_user_data_dir_for_cordova';
 
     var chromeArgs = ' --user-data-dir=/tmp/' + dataDir;
@@ -128,35 +133,46 @@
         return checkBrowserExistsWindows(browser, target).then(function () {
             return Promise.resolve(browser);
         });
-    }
-    else {
+    } else {
         return Promise.reject(NOT_SUPPORTED.replace('%target%', target));
     }
 
 }
 
-function checkBrowserExistsWindows(browser, target) {
-    var promise = new Promise(function (resolve, reject){
+// err might be null, in which case defaultMsg is used.
+// target MUST be defined or an error is thrown.
+function getErrorMessage (err, target, defaultMsg) {
+    var errMessage;
+    if (err) {
+        errMessage = err.toString();
+    } else {
+        errMessage = defaultMsg;
+    }
+    return errMessage.replace('%target%', target);
+}
+
+function checkBrowserExistsWindows (browser, target) {
+    var promise = new Promise(function (resolve, reject) {
         // Windows displays a dialog if the browser is not installed. We'd prefer to avoid that.
         if (process.platform === 'win32') {
-            if(target === 'edge') {
+            if (target === 'edge') {
                 edgeSupported().then(function () {
                     resolve();
                 })
-                .catch(function(err){
-                    reject((err && err.toString() || NOT_INSTALLED).replace('%target%', target));
-                });
-            }
-            else {
-                browserInstalled(browser).then(function() {
+                    .catch(function (err) {
+                        var errMessage = getErrorMessage(err, target, NOT_INSTALLED);
+                        reject(errMessage);
+                    });
+            } else {
+                browserInstalled(browser).then(function () {
                     resolve();
                 })
-                .catch(function(err) {
-                    reject((err && err.toString() || NOT_INSTALLED).replace('%target%', target));
-                });
+                    .catch(function (err) {
+                        var errMessage = getErrorMessage(err, target, NOT_INSTALLED);
+                        reject(errMessage);
+                    });
             }
-        }
-        else {
+        } else {
             resolve();
         }
 
@@ -164,15 +180,15 @@
     return promise;
 }
 
-function edgeSupported() {
-    var prom = new Promise(function(resolve,reject){
+function edgeSupported () {
+    var prom = new Promise(function (resolve, reject) {
         child_process.exec('ver', function (err, stdout, stderr) {
             if (err || stderr) {
                 reject(err || stderr);
             } else {
                 var windowsVersion = stdout.match(/([0-9.])+/g)[0];
                 if (parseInt(windowsVersion) < 10) {
-                    reject('The browser target is not supported on this version of Windows: %target%');
+                    reject(new Error('The browser target is not supported on this version of Windows: %target%'));
                 } else {
                     resolve();
                 }
@@ -183,43 +199,31 @@
 }
 
 var regItemPattern = /\s*\(Default\)\s+(REG_SZ)\s+([^\s].*)\s*/;
-function browserInstalled(browser) {
+function browserInstalled (browser) {
     // On Windows, the 'start' command searches the path then 'App Paths' in the registry.
     // We do the same here. Note that the start command uses the PATHEXT environment variable
     // for the list of extensions to use if no extension is provided. We simplify that to just '.EXE'
     // since that is what all the supported browsers use. Check path (simple but usually won't get a hit)
 
-    var promise = new Promise(function(resolve,reject) {
+    var promise = new Promise(function (resolve, reject) {
         if (require('shelljs').which(browser)) {
             return resolve();
-        }
-        else {
-            var regQPre  = 'reg QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\';
+        } else {
+            var regQPre = 'reg QUERY "HKLM\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\';
             var regQPost = '.EXE" /v ""';
             var regQuery = regQPre + browser.split(' ')[0] + regQPost;
 
-            child_process.exec(regQuery , function (err, stdout, stderr) {
+            child_process.exec(regQuery, function (err, stdout, stderr) {
                 if (err) {
                     // The registry key does not exist, which just means the app is not installed.
-                    reject();
-                }
-                else {
+                    reject(err);
+                } else {
                     var result = regItemPattern.exec(stdout);
-                    if (!result) {
-                        // The registry key exists, but has no default value, which means the app is not
-                        // installed (note that we don't expect to hit this, since we'll just get a default
-                        //  value of '(value not set)', but that will fail the fs.existsSync() test below
-                        // to give us the expected result).
-                        reject();
-                    }
-                    else {
-                        if(fs.existsSync(trimRegPath(result[2]))) {
-                            resolve();
-                        }
-                        else {
-                            // The default value is not a file that exists, which means the app is not installed.
-                            reject();
-                        }
+                    if (fs.existsSync(trimRegPath(result[2]))) {
+                        resolve();
+                    } else {
+                        // The default value is not a file that exists, which means the app is not installed.
+                        reject(new Error(NOT_INSTALLED));
                     }
                 }
             });
@@ -228,7 +232,7 @@
     return promise;
 }
 
-function trimRegPath(path) {
+function trimRegPath (path) {
     // Trim quotes and whitespace
     return path.replace(/^[\s"]+|[\s"]+$/g, '');
 }
diff --git a/src/exec.js b/src/exec.js
index 9f3a625..76d4d0c 100644
--- a/src/exec.js
+++ b/src/exec.js
@@ -28,29 +28,26 @@
  * @return {Promise} a promise that either resolves with the stdout, or rejects with an error message and the stderr.
  */
 module.exports = function (cmd, opt_cwd) {
-    return new Promise(function(resolve,reject){
+    return new Promise(function (resolve, reject) {
         try {
             var opt = {cwd: opt_cwd, maxBuffer: 1024000};
             var timerID = 0;
-            if(process.platform === 'linux') {
-                timerID = setTimeout(function(){
+            if (process.platform === 'linux') {
+                timerID = setTimeout(function () {
                     resolve('linux-timeout');
-                },5000);
+                }, 5000);
             }
-            child_process.exec(cmd,opt,function (err, stdout, stderr) {
+            child_process.exec(cmd, opt, function (err, stdout, stderr) {
                 clearTimeout(timerID);
                 if (err) {
                     reject(new Error('Error executing "' + cmd + '": ' + stderr));
-                }
-                else {
+                } else {
                     resolve(stdout);
                 }
             });
-        }
-        catch (e) {
+        } catch (e) {
             console.error('error caught: ' + e);
             reject(e);
         }
     });
 };
-
diff --git a/src/main.js b/src/main.js
index 01c5add..d8b41bd 100644
--- a/src/main.js
+++ b/src/main.js
@@ -17,21 +17,21 @@
  under the License.
  */
 
-var chalk = require('chalk'),
-    compression = require('compression'),
-    express = require('express');
+var chalk = require('chalk');
+var compression = require('compression');
+var express = require('express');
 
 module.exports = function () {
     return new CordovaServe();
 };
 
-function CordovaServe() {
+function CordovaServe () {
     this.app = express();
 
     // Attach this before anything else to provide status output
     this.app.use(function (req, res, next) {
         res.on('finish', function () {
-            var color = this.statusCode == '404' ? chalk.red : chalk.green;
+            var color = this.statusCode === '404' ? chalk.red : chalk.green;
             var msg = color(this.statusCode) + ' ' + this.req.originalUrl;
             var encoding = this._headers && this._headers['content-encoding'];
             if (encoding) {
diff --git a/src/platform.js b/src/platform.js
index 26f9c4b..99a4f87 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -19,8 +19,8 @@
 
 /* globals Promise: true */
 
-var fs     = require('fs'),
-    util   = require('./util');
+var fs = require('fs');
+var util = require('./util');
 
 /**
  * Launches a server where the root points to the specified platform in a Cordova project.
@@ -35,20 +35,18 @@
     // note: `this` is actually an instance of main.js CordovaServe
     // this module is a mixin
     var that = this;
-    var retPromise = new Promise(function(resolve,reject){
+    var retPromise = new Promise(function (resolve, reject) {
         if (!platform) {
-            reject('Error: A platform must be specified');
-        }
-        else {
+            reject(new Error('Error: A platform must be specified'));
+        } else {
             opts = opts || {};
             var projectRoot = findProjectRoot(opts.root);
             that.projectRoot = projectRoot;
             opts.root = util.getPlatformWwwRoot(projectRoot, platform);
 
             if (!fs.existsSync(opts.root)) {
-                reject('Error: Project does not include the specified platform: ' + platform);
-            }
-            else {
+                reject(new Error('Error: Project does not include the specified platform: ' + platform));
+            } else {
                 return that.launchServer(opts);
             }
         }
@@ -57,7 +55,7 @@
     return retPromise;
 };
 
-function findProjectRoot(path) {
+function findProjectRoot (path) {
     var projectRoot = util.cordovaProjectRoot(path);
     if (!projectRoot) {
         if (!path) {
diff --git a/src/server.js b/src/server.js
index f423f2e..8f4e9ee 100644
--- a/src/server.js
+++ b/src/server.js
@@ -19,8 +19,8 @@
 
 /* globals Promise: true */
 
-var chalk   = require('chalk'),
-    express = require('express');
+var chalk = require('chalk');
+var express = require('express');
 
 /**
  * @desc Launches a server with the specified options and optional custom handlers.
@@ -29,8 +29,8 @@
  */
 module.exports = function (opts) {
 
-   var that = this;
-   var promise = new Promise(function(resolve,reject){
+    var that = this;
+    var promise = new Promise(function (resolve, reject) {
 
         opts = opts || {};
         var port = opts.port || 8000;
@@ -39,8 +39,7 @@
             if (!opts.noLogOutput) {
                 if (opts.events) {
                     opts.events.emit('log', msg);
-                }
-                else {
+                } else {
                     console.log(msg);
                 }
             }
@@ -79,8 +78,7 @@
             if (e && e.toString().indexOf('EADDRINUSE') > -1) {
                 port++;
                 server.listen(port);
-            }
-            else {
+            } else {
                 reject(e);
             }
         });
diff --git a/src/util.js b/src/util.js
index 8fb076b..242e96f 100644
--- a/src/util.js
+++ b/src/util.js
@@ -17,8 +17,8 @@
  under the License.
  */
 
-var fs   = require('fs'),
-    path = require('path');
+var fs = require('fs');
+var path = require('path');
 
 // Some helpful utility stuff copied from cordova-lib. This is a bit nicer than taking a dependency on cordova-lib just
 // to get this minimal stuff. Hopefully we won't need the platform stuff (finding platform www_dir) once it is moved
@@ -41,12 +41,12 @@
  * @param {string=} dir - the directory to start from (we check this directory then work up), or CWD if none specified.
  * @returns {string} - the Cordova project's root directory, or null if not found.
  */
-function cordovaProjectRoot(dir) {
+function cordovaProjectRoot (dir) {
     if (!dir) {
         // Prefer PWD over cwd so that symlinked dirs within your PWD work correctly.
         var pwd = process.env.PWD;
         var cwd = process.cwd();
-        if (pwd && pwd != cwd && pwd != 'undefined') {
+        if (pwd && pwd !== cwd && pwd !== 'undefined') {
             return cordovaProjectRoot(pwd) || cordovaProjectRoot(cwd);
         }
         return cordovaProjectRoot(cwd);
@@ -63,7 +63,7 @@
         }
         var parentDir = path.normalize(path.join(dir, '..'));
         // Detect fs root.
-        if (parentDir == dir) {
+        if (parentDir === dir) {
             return bestReturnValueSoFar;
         }
         dir = parentDir;
@@ -71,15 +71,15 @@
     return null;
 }
 
-function getPlatformWwwRoot(cordovaProjectRoot, platformName) {
+function getPlatformWwwRoot (cordovaProjectRoot, platformName) {
     var platform = platforms[platformName];
     if (!platform) {
-        throw new Error ('Unrecognized platform: ' + platformName);
+        throw new Error('Unrecognized platform: ' + platformName);
     }
     return path.join(cordovaProjectRoot, 'platforms', platformName, platform.www_dir);
 }
 
-function isRootDir(dir) {
+function isRootDir (dir) {
     if (fs.existsSync(path.join(dir, 'www'))) {
         if (fs.existsSync(path.join(dir, 'config.xml'))) {
             // For sure is.