Skip to content
This repository has been archived by the owner on Oct 13, 2018. It is now read-only.

Commit

Permalink
Lint ALL lib/*.js files
Browse files Browse the repository at this point in the history
  • Loading branch information
Shane Osbourne committed Feb 4, 2015
1 parent 3468f56 commit e1ae160
Show file tree
Hide file tree
Showing 19 changed files with 79 additions and 151 deletions.
3 changes: 2 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"curly": true,
"eqeqeq": true,
"immed": true,
"laxbreak": false,
"laxbreak": true,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
Expand All @@ -18,6 +18,7 @@
"browser": true,
"mocha": true,
"jasmine": true,
"esnext": true,
"globals": {
"browser": false,
"sinon": false,
Expand Down
1 change: 1 addition & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ gulp.task("lint", function () {
return gulp.src([
"test/client/specs/**/*.js",
"test/server/**/*.js",
"lib/**/*.js",
"public/js/scripts/*.js",
"index.js",
"server/*.js",
Expand Down
1 change: 0 additions & 1 deletion lib/UI.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var config = require("./config");
var Immutable = require("immutable");
var eachSeries = require("async-each-series");
var asyncTasks = require("./async-tasks");
var hooks = require("./hooks");
Expand Down
2 changes: 1 addition & 1 deletion lib/client-elements.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function enableElement (clients, ui, bs) {
* @param bs
* @returns {Function}
*/
function disableElement (clients, ui, bs) {
function disableElement (clients, ui) {

return function (file) {
var item = ui.getOptionIn([CLIENT_FILES_OPT, file.name]).toJS();
Expand Down
8 changes: 5 additions & 3 deletions lib/client-js.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

var socket = bs.socket;

socket.on("cp:connection", function (options) {
socket.on("cp:connection", function () {

bs.socket.emit("cp:history:connected", {
href: window.location.href,
Expand All @@ -30,7 +30,7 @@
}
});

socket.on("highlight", function (data) {
socket.on("highlight", function () {
var id = "__browser-sync-highlight__";
var elem = document.getElementById(id);
if (elem) {
Expand Down Expand Up @@ -85,7 +85,9 @@
}

function removeElement(element) {
element && element.parentNode && element.parentNode.removeChild(element);
if (element && element.parentNode) {
element.parentNode.removeChild(element);
}
}

})(window, document, ___browserSync___);
2 changes: 1 addition & 1 deletion lib/hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = {
* @param cp
* @param cb
*/
"page": function (hooks, cp, cb) {
"page": function (hooks, cp) {

var config = hooks
.map(transformConfig)
Expand Down
8 changes: 2 additions & 6 deletions lib/plugins/connections/connections.plugin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
var urls = require("../../urls");
var url = require("url");
var path = require("path");
var fs = require("fs");
var Immutable = require("immutable");

const PLUGIN_NAME = "Connections";
Expand Down Expand Up @@ -79,7 +76,6 @@ module.exports = {

var registry;
var temp;
var count = 0;
var initialSent;

setInterval(function () {
Expand Down Expand Up @@ -141,8 +137,8 @@ module.exports = {
* @param data
*/
function highlightClient (clients, data) {
var socket;
if (socket = getClientById(clients, data.id)) {
var socket = getClientById(clients, data.id);
if (socket) {
socket.emit("highlight");
}
}
Expand Down
10 changes: 2 additions & 8 deletions lib/plugins/help/help.plugin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
var urls = require("../../urls");
var url = require("url");
var path = require("path");
var fs = require("fs");
var Immutable = require("immutable");

const PLUGIN_NAME = "Help / About";

Expand All @@ -11,12 +8,9 @@ const PLUGIN_NAME = "Help / About";
*/
module.exports = {
/**
* @param cp
* @param bs
* Plugin init
*/
"plugin": function (cp, bs) {
/* noop */
},
"plugin": function () {},
/**
* Hooks
*/
Expand Down
21 changes: 2 additions & 19 deletions lib/plugins/history/history.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
var urls = require("../../urls");
var url = require("url");
var path = require("path");
var fs = require("fs");
var Immutable = require("immutable");

module.exports.init = function (ui, bs) {
Expand Down Expand Up @@ -79,7 +76,7 @@ module.exports.init = function (ui, bs) {
cpClient.on("urls:browser:url", methods.sendToUrl);
cpClient.on("cp:get:visited", methods.getVisited);
cpClient.on("cp:history:remove", methods.removePath);
cpClient.on("cp:history:clear", function (data) {
cpClient.on("cp:history:clear", function () {
validUrls = Immutable.OrderedSet([]);
methods.sendUpdatedUrls(validUrls);
});
Expand All @@ -94,7 +91,7 @@ module.exports.init = function (ui, bs) {
*/
function decorateUrls (urls) {
var count = 0;
return urls.map(function (value, i) {
return urls.map(function (value) {
count += 1;
return {
path: value,
Expand All @@ -103,20 +100,6 @@ function decorateUrls (urls) {
}).toJS().reverse();
}

/**
* Send all browsers to a URL
*/
function sendToUrl (cp, bs, clients, data) {

var parsed = url.parse(data.path);

data.override = true;
data.path = parsed.path;
data.url = parsed.href;

clients.emit("browser:location", data);
}

/**
* If snippet mode, add the full URL
* if server/proxy, add JUST the path
Expand Down
11 changes: 4 additions & 7 deletions lib/plugins/history/history.plugin.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
var urls = require("../../urls");
var url = require("url");
var path = require("path");
var fs = require("fs");
var Immutable = require("immutable");
var history = require("./history");
var path = require("path");
var fs = require("fs");
var historyPlugin = require("./history");

const PLUGIN_NAME = "History";

Expand All @@ -16,7 +13,7 @@ module.exports = {
* @param bs
*/
"plugin": function (ui, bs) {
ui.history = history.init(ui, bs);
ui.history = historyPlugin.init(ui, bs);
},
/**
* Hooks
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/overview/overview.client.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"options": "="
},
templateUrl: "snippet-info.html",
controller: ["$scope", function snippetInfoController($scope) {/*noop*/}]
controller: ["$scope", function snippetInfoController() {/*noop*/}]
};
});

Expand Down
5 changes: 2 additions & 3 deletions lib/plugins/overview/overview.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ const PLUGIN_NAME = "Overview";
*/
module.exports = {
/**
* @param cp
* @param bs
* Plugin init
*/
"plugin": function (cp, bs) { /* noop */ },
"plugin": function () { /* noop */ },

/**
* Hooks
Expand Down
2 changes: 1 addition & 1 deletion lib/plugins/remote-debug/latency.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module.exports.init = function (ui, bs) {
}
},
event: function (event) {
methods[event.event](event.data)
methods[event.event](event.data);
}
};

Expand Down
5 changes: 1 addition & 4 deletions lib/plugins/remote-debug/remote-debug.plugin.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
var urls = require("../../urls");
var url = require("url");
var path = require("path");
var fs = require("fs");
var Immutable = require("immutable");
var weinre = require("./weinre");
var latencyPlugin = require("./latency");
var clientFiles = require("./client-files");
Expand Down Expand Up @@ -87,7 +84,7 @@ function throttleMiddleware () {
setTimeout(function () {
next();
}, timeout);
}
};
}

module.exports.throttleMiddleware = throttleMiddleware;
16 changes: 1 addition & 15 deletions lib/plugins/remote-debug/weinre.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,19 +76,6 @@ function setWeinreClientUrl(ui, weinreClientUrl) {
});
}

/**
* If it's snippet mode, create a url that contains host
* @param targetPath
* @param ui
* @param bs
*/
function getRemoteUrl(targetPath, ui, bs) {
if (bs.options.get("mode") === "snippet") {
return ["//", getHostUrl(ui, bs).host, targetPath].join("");
}
return targetPath;
}

/**
* @param socket
* @param clients
Expand Down Expand Up @@ -187,10 +174,9 @@ function enableWeinre (ui, bs) {

/**
* @param ui
* @param bs
* @returns {any|*}
*/
function disableWeinre (ui, bs) {
function disableWeinre (ui) {
if (weinreApp) {
weinreApp.close();
weinreApp = false;
Expand Down
2 changes: 1 addition & 1 deletion lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ function packageDir (path) {
* @param opts
* @returns {*}
*/
function startServer(controlPanel, opts) {
function startServer(controlPanel) {

var connect = controlPanel.bs.utils.connect;
var serveStatic = controlPanel.bs.utils.serveStatic;
Expand Down
3 changes: 1 addition & 2 deletions public/css/components.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ svg {
height: 100%;
opacity: 1;
fill: currentColor !important;
-webkit-transition: .3s;
transition: .3s; }
transition: .3s; }
svg.icon-hidden {
opacity: 0; }

Expand Down
Loading

0 comments on commit e1ae160

Please sign in to comment.