From e75a8f40a6168dacf2292d5238691f060b44460b Mon Sep 17 00:00:00 2001 From: Pavel Djundik Date: Sun, 1 May 2016 12:41:17 +0300 Subject: [PATCH] Stricter eslint rule for curly brackets --- .eslintrc.yml | 3 ++- client/js/lounge.js | 14 ++++++++------ src/command-line/add.js | 4 +++- src/plugins/irc-events/link.js | 8 +++++--- src/server.js | 5 ++++- test/models/chan.js | 4 +++- 6 files changed, 25 insertions(+), 13 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 7274f1f6..68816521 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -9,8 +9,9 @@ env: rules: block-spacing: [2, always] + brace-style: [2, 1tbs] comma-dangle: 0 - curly: [2, multi-line] + curly: [2, all] eqeqeq: 2 indent: [2, tab] keyword-spacing: [2, {before: true, after: true}] diff --git a/client/js/lounge.js b/client/js/lounge.js index 27616c1a..de473868 100644 --- a/client/js/lounge.js +++ b/client/js/lounge.js @@ -46,7 +46,9 @@ $(function() { }; } - $("#play").on("click", function() { pop.play(); }); + $("#play").on("click", function() { + pop.play(); + }); $(".tse-scrollable").TrackpadScrollEmulator(); @@ -193,7 +195,9 @@ $(function() { ); renderChannel(data.chan); var chan = sidebar.find(".chan") - .sort(function(a, b) { return $(a).data("id") - $(b).data("id"); }) + .sort(function(a, b) { + return $(a).data("id") - $(b).data("id"); + }) .last(); if (!whois) { chan = chan.filter(":not(.query)"); @@ -422,8 +426,7 @@ $(function() { socket.emit("names", { target: data.chan }); - } - else { + } else { chan.data("needsNamesRefresh", true); } }); @@ -552,8 +555,7 @@ $(function() { text: target.text(), data: target.data("name") }); - } - else if (target.hasClass("chan")) { + } else if (target.hasClass("chan")) { output = render("contextmenu_item", { class: "chan", text: target.data("title"), diff --git a/src/command-line/add.js b/src/command-line/add.js index 24905c14..69410f09 100644 --- a/src/command-line/add.js +++ b/src/command-line/add.js @@ -36,7 +36,9 @@ program prompt: "[thelounge] Enter password: ", silent: true }, function(err, password) { - if (!err) add(manager, name, password); + if (!err) { + add(manager, name, password); + } }); }); diff --git a/src/plugins/irc-events/link.js b/src/plugins/irc-events/link.js index f663bec2..15ad92d4 100644 --- a/src/plugins/irc-events/link.js +++ b/src/plugins/irc-events/link.js @@ -79,8 +79,7 @@ function parse(msg, url, res, client) { case "image/jpeg": if (res.size < (config.prefetchMaxImageSize * 1024)) { toggle.type = "image"; - } - else { + } else { return; } break; @@ -122,7 +121,10 @@ function fetch(url, cb) { next(null, data); })) .pipe(es.wait(function(err, data) { - if (err) return; + if (err) { + return; + } + var body; var type; var size = req.response.headers["content-length"]; diff --git a/src/server.js b/src/server.js index 8d5e48de..6249a4c0 100644 --- a/src/server.js +++ b/src/server.js @@ -74,7 +74,10 @@ module.exports = function(options) { }; function index(req, res, next) { - if (req.url.split("?")[0] !== "/") return next(); + if (req.url.split("?")[0] !== "/") { + return next(); + } + return fs.readFile("client/index.html", "utf-8", function(err, file) { var data = _.merge( package, diff --git a/test/models/chan.js b/test/models/chan.js index 90f8c609..fe85f927 100644 --- a/test/models/chan.js +++ b/test/models/chan.js @@ -11,7 +11,9 @@ function makeUser(name) { } function getUserNames(chan) { - return chan.users.map(function(u) { return u.name; }); + return chan.users.map(function(u) { + return u.name; + }); } describe("Chan", function() {