From 278c4ab32f20b68441d5132312ace82897160d84 Mon Sep 17 00:00:00 2001 From: ansuz Date: Mon, 15 Feb 2016 16:47:53 +0100 Subject: [PATCH] even more jshint compliance --- ChainPadSrv.js | 8 +++++--- config.js.dist | 3 +++ customize.dist/DecorateToolbar.js | 3 +++ customize.dist/pad.js | 3 +++ customize.dist/sheet.js | 3 +++ server.js | 3 +++ storage/amnesia.js | 2 +- 7 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChainPadSrv.js b/ChainPadSrv.js index 51e312540..4ed6ff840 100644 --- a/ChainPadSrv.js +++ b/ChainPadSrv.js @@ -14,7 +14,9 @@ * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see . */ -var WebSocket = require('ws'); + +// triggers jsh because we're not in a browser and WebSocket is a thing +var WebSocket = require('ws'); // jshint ignore:line var REGISTER = 0; var REGISTER_ACK = 1; @@ -60,7 +62,7 @@ var sendChannelMessage = function (ctx, channel, msg, cb) { try { user.socket.close(); } catch (e) { } } }); - cb && cb(); + if (cb) { cb(); } }); }; @@ -184,7 +186,7 @@ var create = module.exports.create = function (socketServer, store) { } }); socket.on('close', function (evt) { - for (client in ctx.registeredClients) { + for (var client in ctx.registeredClients) { if (ctx.registeredClients[client].socket === socket) { dropClient(ctx, client); } diff --git a/config.js.dist b/config.js.dist index f8de978a6..f61828e4c 100644 --- a/config.js.dist +++ b/config.js.dist @@ -1,3 +1,6 @@ +/* + globals module +*/ module.exports = { // the address you want to bind to, :: means all ipv4 and ipv6 addresses diff --git a/customize.dist/DecorateToolbar.js b/customize.dist/DecorateToolbar.js index 547cc7eff..4d2033d9c 100644 --- a/customize.dist/DecorateToolbar.js +++ b/customize.dist/DecorateToolbar.js @@ -1,3 +1,6 @@ +/* + globals define +*/ define([ '/bower_components/jquery/dist/jquery.min.js' ], function () { diff --git a/customize.dist/pad.js b/customize.dist/pad.js index a86e6e28f..cf3170706 100644 --- a/customize.dist/pad.js +++ b/customize.dist/pad.js @@ -1,3 +1,6 @@ +/* + globals define console +*/ require([ '/customize/DecorateToolbar.js', '/bower_components/jquery/dist/jquery.min.js' diff --git a/customize.dist/sheet.js b/customize.dist/sheet.js index a86e6e28f..38a14869f 100644 --- a/customize.dist/sheet.js +++ b/customize.dist/sheet.js @@ -1,3 +1,6 @@ +/* + globals require +*/ require([ '/customize/DecorateToolbar.js', '/bower_components/jquery/dist/jquery.min.js' diff --git a/server.js b/server.js index 6c912cfe4..3a7c49af4 100644 --- a/server.js +++ b/server.js @@ -1,3 +1,6 @@ +/* + globals require console +*/ var Express = require('express'); var Http = require('http'); var Https = require('https'); diff --git a/storage/amnesia.js b/storage/amnesia.js index c585dd83a..f068a5e75 100644 --- a/storage/amnesia.js +++ b/storage/amnesia.js @@ -34,7 +34,7 @@ module.exports.create = function(conf, cb){ return a.id - b.id; }); db.filter(function(val){ - return val.chan == channelName; + return val.chan === channelName; }).forEach(function(doc){ cb(doc.msg); });