Node.js based forum software built for the modern web
ESlint space-in-parens, block-spacing
Peter Jaszkowiak532951c24f67
diff --git a/.eslintrc b/.eslintrcindex 2a6f9e3368..296ff1e04f 100644--- a/.eslintrc+++ b/.eslintrc@@ -100,8 +100,8 @@// "no-multiple-empty-lines": "off","spaced-comment": "off","prefer-rest-params": "off",- "space-in-parens": "off",- "block-spacing": "off",+ // "space-in-parens": "off",+ // "block-spacing": "off",// "quote-props": "off",// "space-unary-ops": "off",// "no-plusplus": "off",diff --git a/public/src/admin/appearance/skins.js b/public/src/admin/appearance/skins.jsindex e6651551f4..c946faa2da 100644--- a/public/src/admin/appearance/skins.js+++ b/public/src/admin/appearance/skins.js@@ -73,7 +73,7 @@ define('admin/appearance/skins', ['translator'], function (translator) {if (config['theme:src']) {var skin = config['theme:src'].match(/latest\/(\S+)\/bootstrap.min.css/)[1]- .replace(/(^|\s)([a-z])/g , function (m,p1,p2) {return p1 + p2.toUpperCase();});+ .replace(/(^|\s)([a-z])/g , function (m,p1,p2) { return p1 + p2.toUpperCase(); });highlightSelectedTheme(skin);}diff --git a/public/src/admin/extend/widgets.js b/public/src/admin/extend/widgets.jsindex 4576e6d72b..0b9707a5a5 100644--- a/public/src/admin/extend/widgets.js+++ b/public/src/admin/extend/widgets.js@@ -67,7 +67,7 @@ define('admin/extend/widgets', ['jqueryui'], function (jqueryui) {}});}).on('mouseup', '> .panel > .panel-heading', function (evt) {- if ( !( $(this).parent().is('.ui-sortable-helper') || $(evt.target).closest('.delete-widget').length ) ) {+ if (!($(this).parent().is('.ui-sortable-helper') || $(evt.target).closest('.delete-widget').length)) {$(this).parent().children('.panel-body').toggleClass('hidden');}});diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.jsindex 7c1529f12b..88eb4940c1 100644--- a/public/src/client/topic/threadTools.js+++ b/public/src/client/topic/threadTools.js@@ -236,7 +236,7 @@ define('forum/topic/threadTools', [components.get('topic/not-following/check').toggleClass('fa-check', state === 'unfollow');menu = components.get('topic/ignoring/menu');- menu.toggleClass('hidden', state !== 'ignore' );+ menu.toggleClass('hidden', state !== 'ignore');components.get('topic/ignoring/check').toggleClass('fa-check', state === 'ignore');}diff --git a/public/src/utils.js b/public/src/utils.jsindex 1d74b53b38..9016b8da65 100644--- a/public/src/utils.js+++ b/public/src/utils.js@@ -424,7 +424,7 @@return undefined;}var i = props.indexOf('.');- if( i == -1 ) {+ if(i == -1) {if(value !== undefined) {obj[props] = value;}@@ -433,7 +433,7 @@var prop = props.slice(0, i);var newProps = props.slice(i + 1);- if(props !== undefined && !(obj[prop] instanceof Object) ) {+ if(props !== undefined && !(obj[prop] instanceof Object)) {obj[prop] = {};}diff --git a/src/categories.js b/src/categories.jsindex 650723f46d..ea795320bb 100644--- a/src/categories.js+++ b/src/categories.js@@ -214,7 +214,7 @@ var privileges = require('./privileges');});if (!parentCids.length) {- return callback(null, cids.map(function () {return null;}));+ return callback(null, cids.map(function () { return null; }));}Categories.getCategoriesData(parentCids, next);diff --git a/src/categories/create.js b/src/categories/create.jsindex 26c4e45240..0673e7929c 100644--- a/src/categories/create.js+++ b/src/categories/create.js@@ -40,7 +40,7 @@ module.exports = function (Categories) {order: order,link: '',numRecentReplies: 1,- class: ( data.class ? data.class : 'col-md-3 col-xs-6' ),+ class: (data.class ? data.class : 'col-md-3 col-xs-6'),imageClass: 'cover',};diff --git a/src/groups/membership.js b/src/groups/membership.jsindex d28ad927f2..d3908b135e 100644--- a/src/groups/membership.js+++ b/src/groups/membership.js@@ -355,7 +355,7 @@ module.exports = function (Groups) {}if (!groupName || !uids.length) {- return callback(null, uids.map(function () {return false;}));+ return callback(null, uids.map(function () { return false; }));}var nonCachedUids = uids.filter(function (uid) {@@ -388,7 +388,7 @@ module.exports = function (Groups) {}if (!uid || parseInt(uid, 10) <= 0 || !groups.length) {- return callback(null, groups.map(function () {return false;}));+ return callback(null, groups.map(function () { return false; }));}var nonCachedGroups = groups.filter(function (groupName) {diff --git a/src/plugins.js b/src/plugins.jsindex 10183f5d79..f6b27f8ec7 100644--- a/src/plugins.js+++ b/src/plugins.js@@ -312,9 +312,9 @@ var middleware;}pluginArray.sort(function (a, b) {- if (a.name > b.name ) {+ if (a.name > b.name) {return 1;- } else if (a.name < b.name ) {+ } else if (a.name < b.name) {return -1;} else {return 0;diff --git a/src/posts/user.js b/src/posts/user.jsindex 933b972759..644ee5fe11 100644--- a/src/posts/user.js+++ b/src/posts/user.js@@ -95,7 +95,7 @@ module.exports = function (Posts) {uid = parseInt(uid, 10);if (Array.isArray(pid)) {if (!uid) {- return callback(null, pid.map(function () {return false;}));+ return callback(null, pid.map(function () { return false; }));}Posts.getPostsFields(pid, ['uid'], function (err, posts) {if (err) {@@ -118,7 +118,7 @@ module.exports = function (Posts) {Posts.isModerator = function (pids, uid, callback) {if (!parseInt(uid, 10)) {- return callback(null, pids.map(function () {return false;}));+ return callback(null, pids.map(function () { return false; }));}Posts.getCidsByPids(pids, function (err, cids) {if (err) {diff --git a/src/privileges/users.js b/src/privileges/users.jsindex a91175ecb1..94426d154c 100644--- a/src/privileges/users.js+++ b/src/privileges/users.js@@ -40,7 +40,7 @@ module.exports = function (privileges) {function isModeratorOfCategories(cids, uid, callback) {if (!parseInt(uid, 10)) {- return filterIsModerator(cids, uid, cids.map(function () {return false;}), callback);+ return filterIsModerator(cids, uid, cids.map(function () { return false; }), callback);}privileges.users.isGlobalModerator(uid, function (err, isGlobalModerator) {@@ -48,7 +48,7 @@ module.exports = function (privileges) {return callback(err);}if (isGlobalModerator) {- return filterIsModerator(cids, uid, cids.map(function () {return true;}), callback);+ return filterIsModerator(cids, uid, cids.map(function () { return true; }), callback);}diff --git a/src/socket.io/admin.js b/src/socket.io/admin.jsindex 7a86c725ed..f3266f0152 100644--- a/src/socket.io/admin.js+++ b/src/socket.io/admin.js@@ -232,7 +232,7 @@ SocketAdmin.analytics.get = function (socket, data, callback) {analytics.getMonthlyPageViews(next);},}, function (err, data) {- data.pastDay = data.pageviews.reduce(function (a, b) {return parseInt(a, 10) + parseInt(b, 10);});+ data.pastDay = data.pageviews.reduce(function (a, b) { return parseInt(a, 10) + parseInt(b, 10); });data.pageviews[data.pageviews.length - 1] = parseInt(data.pageviews[data.pageviews.length - 1], 10) + analytics.getUnwrittenPageviews();callback(err, data);});diff --git a/src/topics/fork.js b/src/topics/fork.jsindex 436096fa5b..ef62d65b1d 100644--- a/src/topics/fork.js+++ b/src/topics/fork.js@@ -56,7 +56,7 @@ module.exports = function (Topics) {Topics.create({uid: results.postData.uid, title: title, cid: cid}, next);},function (results, next) {- Topics.updateTopicBookmarks(fromTid, pids, function () { next( null, results );} );+ Topics.updateTopicBookmarks(fromTid, pids, function () { next(null, results); });},function (_tid, next) {function move(pid, next) {diff --git a/src/topics/tags.js b/src/topics/tags.jsindex 116b0e412d..99f6c49a44 100644--- a/src/topics/tags.js+++ b/src/topics/tags.js@@ -252,7 +252,7 @@ module.exports = function (Topics) {topicTags.forEach(function (tags, index) {if (Array.isArray(tags)) {- topicTags[index] = tags.map(function (tag) {return tagData[tag];});+ topicTags[index] = tags.map(function (tag) { return tagData[tag]; });}});diff --git a/test/controllers.js b/test/controllers.jsindex 8c426e24ea..057e20b2a0 100644--- a/test/controllers.js+++ b/test/controllers.js@@ -871,7 +871,7 @@ describe('Controllers', function () {});});- it('should return empty after unfollow', function (done ) {+ it('should return empty after unfollow', function (done) {socketUser.unfollow({uid: uid}, {uid: fooUid}, function (err) {assert.ifError(err);request(nconf.get('url') + '/api/user/foo/followers', {json: true}, function (err, res, body) {diff --git a/test/meta.js b/test/meta.jsindex cb231d9f39..1854cf3b53 100644--- a/test/meta.js+++ b/test/meta.js@@ -142,7 +142,7 @@ describe('meta', function () {});});- it('should set multiple values', function (done ) {+ it('should set multiple values', function (done) {socketAdmin.config.setMultiple({uid: fooUid}, {someField1: 'someValue1',someField2: 'someValue2',diff --git a/test/topics.js b/test/topics.jsindex 1341ab694b..15db5d1668 100644--- a/test/topics.js+++ b/test/topics.js@@ -471,7 +471,7 @@ describe('Topic\'s', function () {});},function (done) {- topics.markUnread( newTid, uid, done );+ topics.markUnread(newTid, uid, done);},],done);});@@ -479,14 +479,14 @@ describe('Topic\'s', function () {it('should not appear in the unread list', function (done) {async.waterfall([function (done) {- topics.ignore( newTid, uid, done );+ topics.ignore(newTid, uid, done);},function (done) {- topics.getUnreadTopics(0, uid, 0, -1, '', done );+ topics.getUnreadTopics(0, uid, 0, -1, '', done);},function (results, done) {var topics = results.topics;- var tids = topics.map( function (topic) { return topic.tid; } );+ var tids = topics.map(function (topic) { return topic.tid; });assert.equal(tids.indexOf(newTid), -1, 'The topic appeared in the unread list.');done();},@@ -496,10 +496,10 @@ describe('Topic\'s', function () {it('should not appear as unread in the recent list', function (done) {async.waterfall([function (done) {- topics.ignore( newTid, uid, done );+ topics.ignore(newTid, uid, done);},function (done) {- topics.getLatestTopics( uid, 0, -1, 'year', done );+ topics.getLatestTopics(uid, 0, -1, 'year', done);},function (results, done) {var topics = results.topics;@@ -520,17 +520,17 @@ describe('Topic\'s', function () {it('should appear as unread again when marked as reading', function (done) {async.waterfall([function (done) {- topics.ignore( newTid, uid, done );+ topics.ignore(newTid, uid, done);},function (done) {- topics.follow( newTid, uid, done );+ topics.follow(newTid, uid, done);},function (done) {- topics.getUnreadTopics(0, uid, 0, -1, '', done );+ topics.getUnreadTopics(0, uid, 0, -1, '', done);},function (results, done) {var topics = results.topics;- var tids = topics.map( function (topic) { return topic.tid; } );+ var tids = topics.map(function (topic) { return topic.tid; });assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.');done();},@@ -540,17 +540,17 @@ describe('Topic\'s', function () {it('should appear as unread again when marked as following', function (done) {async.waterfall([function (done) {- topics.ignore( newTid, uid, done );+ topics.ignore(newTid, uid, done);},function (done) {- topics.follow( newTid, uid, done );+ topics.follow(newTid, uid, done);},function (done) {- topics.getUnreadTopics(0, uid, 0, -1, '', done );+ topics.getUnreadTopics(0, uid, 0, -1, '', done);},function (results, done) {var topics = results.topics;- var tids = topics.map( function (topic) { return topic.tid; } );+ var tids = topics.map(function (topic) { return topic.tid; });assert.notEqual(tids.indexOf(newTid), -1, 'The topic did not appear in the unread list.');done();},@@ -578,34 +578,34 @@ describe('Topic\'s', function () {function (next) {groups.join('administrators', topic.userId, next);},- function ( next ) {+ function (next) {topics.post({uid: topic.userId, title: topic.title, content: topic.content, cid: topic.categoryId}, function (err, result) {- assert.ifError( err );+ assert.ifError(err);newTopic = result.topicData;next();});},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) { postReply( next );},- function ( next ) {- topicPids = replies.map( function ( reply ) { return reply.pid; } );- topics.setUserBookmark( newTopic.tid, topic.userId, originalBookmark, next );+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) { postReply(next); },+ function (next) {+ topicPids = replies.map(function (reply) { return reply.pid; });+ topics.setUserBookmark(newTopic.tid, topic.userId, originalBookmark, next);}],- done );+ done);});it('should have 12 replies', function (done) {- assert.equal( 12, replies.length );+ assert.equal(12, replies.length);done();});@@ -615,15 +615,15 @@ describe('Topic\'s', function () {topics.createTopicFromPosts(topic.userId,'Fork test, no bookmark update',- topicPids.slice( -2 ),+ topicPids.slice(-2),newTopic.tid,- next );+ next);},- function ( forkedTopicData, next) {- topics.getUserBookmark( newTopic.tid, topic.userId, next );+ function (forkedTopicData, next) {+ topics.getUserBookmark(newTopic.tid, topic.userId, next);},- function ( bookmark, next ) {- assert.equal( originalBookmark, bookmark );+ function (bookmark, next) {+ assert.equal(originalBookmark, bookmark);next();},],done);@@ -635,15 +635,15 @@ describe('Topic\'s', function () {topics.createTopicFromPosts(topic.userId,'Fork test, no bookmark update',- topicPids.slice( 1, 3 ),+ topicPids.slice(1, 3),newTopic.tid,- next );+ next);},- function ( forkedTopicData, next) {- topics.getUserBookmark( newTopic.tid, topic.userId, next );+ function (forkedTopicData, next) {+ topics.getUserBookmark(newTopic.tid, topic.userId, next);},- function ( bookmark, next ) {- assert.equal( originalBookmark - 2, bookmark );+ function (bookmark, next) {+ assert.equal(originalBookmark - 2, bookmark);next();},],done);