diff --git a/.eslintrc b/.eslintrc
index d655626005..bbaa357442 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -40,6 +40,7 @@
"allowTemplateLiterals": true
}],
"no-else-return": [ "error", { "allowElseIf": true } ],
+ "operator-linebreak": [ "error", "after" ],
// ES6
"prefer-rest-params": "off",
diff --git a/public/src/admin/admin.js b/public/src/admin/admin.js
index db02c2e551..ee2432fa5c 100644
--- a/public/src/admin/admin.js
+++ b/public/src/admin/admin.js
@@ -99,9 +99,9 @@
} else {
var matches = url.match(/admin\/(.+?)\/(.+?)$/);
mainTitle = '[[admin/menu:' + matches[1] + '/' + matches[2] + ']]';
- pageTitle = '[[admin/menu:section-'
- + (matches[1] === 'development' ? 'advanced' : matches[1])
- + ']]' + (matches[2] ? (' > ' + mainTitle) : '');
+ pageTitle = '[[admin/menu:section-' +
+ (matches[1] === 'development' ? 'advanced' : matches[1]) +
+ ']]' + (matches[2] ? (' > ' + mainTitle) : '');
if (matches[2] === 'settings') {
mainTitle = translator.compile('admin/menu:settings.page-title', mainTitle);
}
diff --git a/public/src/admin/general/dashboard.js b/public/src/admin/general/dashboard.js
index 5a2f584dc0..8009d7c7f1 100644
--- a/public/src/admin/general/dashboard.js
+++ b/public/src/admin/general/dashboard.js
@@ -62,22 +62,22 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
graphData.rooms = data;
- var html = '
'
- + '
' + data.onlineRegisteredCount + ''
- + '
[[admin/general/dashboard:active-users.users]]
'
- + '
'
- + ''
- + '
' + data.onlineGuestCount + ''
- + '
[[admin/general/dashboard:active-users.guests]]
'
- + '
'
- + ''
- + '
' + (data.onlineRegisteredCount + data.onlineGuestCount) + ''
- + '
[[admin/general/dashboard:active-users.total]]
'
- + '
'
- + ''
- + '
' + data.socketCount + ''
- + '
[[admin/general/dashboard:active-users.connections]]
'
- + '
';
+ var html = '' +
+ '
' + data.onlineRegisteredCount + '' +
+ '
[[admin/general/dashboard:active-users.users]]
' +
+ '
' +
+ '' +
+ '
' + data.onlineGuestCount + '' +
+ '
[[admin/general/dashboard:active-users.guests]]
' +
+ '
' +
+ '' +
+ '
' + (data.onlineRegisteredCount + data.onlineGuestCount) + '' +
+ '
[[admin/general/dashboard:active-users.total]]
' +
+ '
' +
+ '' +
+ '
' + data.socketCount + '' +
+ '
[[admin/general/dashboard:active-users.connections]]
' +
+ '
';
updateRegisteredGraph(data.onlineRegisteredCount, data.onlineGuestCount);
updatePresenceGraph(data.users);
@@ -513,10 +513,10 @@ define('admin/general/dashboard', ['semver', 'Chart', 'translator', 'benchpress'
topics.forEach(function (topic, i) {
var label = topic.count === '0' ? topic.title : ' ' + topic.title + '';
- html += ''
- + ''
- + ' (' + topic.count + ') ' + label + ''
- + '';
+ html += '' +
+ '' +
+ ' (' + topic.count + ') ' + label + '' +
+ '';
});
legend.translateHtml(html);
}
diff --git a/public/src/admin/modules/search.js b/public/src/admin/modules/search.js
index 763a7fe80b..77aafe7bfd 100644
--- a/public/src/admin/modules/search.js
+++ b/public/src/admin/modules/search.js
@@ -32,15 +32,15 @@ define('admin/modules/search', ['mousetrap'], function (mousetrap) {
'$1$2$3'
);
- return ''
- + ''
- + title
- + '
' + (!results ? ''
- : (''
- + results
- + ''))
- + ''
- + '';
+ return '' +
+ '' +
+ title +
+ '
' + (!results ? '' :
+ ('' +
+ results +
+ '')) +
+ '' +
+ '';
}).join('');
return html;
}
diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js
index 6c52b1388e..e898b3a8d9 100644
--- a/public/src/client/chats/messages.js
+++ b/public/src/client/chats/messages.js
@@ -70,8 +70,8 @@ define('forum/chats/messages', ['components', 'sounds', 'translator', 'benchpres
var lastSpeaker = parseInt(chatContentEl.find('.chat-message').last().attr('data-uid'), 10);
var lasttimestamp = parseInt(chatContentEl.find('.chat-message').last().attr('data-timestamp'), 10);
if (!Array.isArray(data)) {
- data.newSet = lastSpeaker !== parseInt(data.fromuid, 10)
- || parseInt(data.timestamp, 10) > parseInt(lasttimestamp, 10) + (1000 * 60 * 3);
+ data.newSet = lastSpeaker !== parseInt(data.fromuid, 10) ||
+ parseInt(data.timestamp, 10) > parseInt(lasttimestamp, 10) + (1000 * 60 * 3);
}
messages.parseMessage(data, function (html) {
diff --git a/public/src/client/chats/search.js b/public/src/client/chats/search.js
index 61a0fb8673..e40551ed05 100644
--- a/public/src/client/chats/search.js
+++ b/public/src/client/chats/search.js
@@ -58,10 +58,10 @@ define('forum/chats/search', ['components'], function (components) {
function displayUser(chatsListEl, userObj) {
function createUserImage() {
- return (userObj.picture
- ? '
'
- : '' + userObj['icon:text'] + '
')
- + ' ' + userObj.username;
+ return (userObj.picture ?
+ '
' :
+ '' + userObj['icon:text'] + '
') +
+ ' ' + userObj.username;
}
var chatEl = $('')
diff --git a/public/src/client/topic/images.js b/public/src/client/topic/images.js
index cb8dd0fcfb..3be0303e43 100644
--- a/public/src/client/topic/images.js
+++ b/public/src/client/topic/images.js
@@ -23,9 +23,9 @@ define('forum/topic/images', [], function () {
var altExt = altFilename.split('.').slice(1).pop();
if (!$this.parent().is('a')) {
- $this.wrap('');
+ $this.wrap('');
}
});
};
diff --git a/public/src/client/topic/posts.js b/public/src/client/topic/posts.js
index ae8578a331..ffbc0a5ace 100644
--- a/public/src/client/topic/posts.js
+++ b/public/src/client/topic/posts.js
@@ -70,8 +70,8 @@ define('forum/topic/posts', [
ajaxify.data.pagination.pageCount = Math.max(1, Math.ceil(posts[0].topic.postcount / config.postsPerPage));
var direction = config.topicPostSort === 'oldest_to_newest' || config.topicPostSort === 'most_votes' ? 1 : -1;
- var isPostVisible = (ajaxify.data.pagination.currentPage === ajaxify.data.pagination.pageCount && direction === 1)
- || (ajaxify.data.pagination.currentPage === 1 && direction === -1);
+ var isPostVisible = (ajaxify.data.pagination.currentPage === ajaxify.data.pagination.pageCount && direction === 1) ||
+ (ajaxify.data.pagination.currentPage === 1 && direction === -1);
if (isPostVisible) {
createNewPosts(data, components.get('post').not('[data-index=0]'), direction, scrollToPost);
diff --git a/public/src/modules/helpers.js b/public/src/modules/helpers.js
index ad5862981d..210164b956 100644
--- a/public/src/modules/helpers.js
+++ b/public/src/modules/helpers.js
@@ -118,11 +118,11 @@
category.children.forEach(function (child) {
if (child && !child.isSection) {
var link = child.link ? child.link : (relative_path + '/category/' + child.slug);
- html += ''
- + ''
- + ''
- + '
'
- + '' + child.name + '';
+ html += '' +
+ '' +
+ '' +
+ '
' +
+ '' + child.name + '';
}
});
html = html ? ('' + html + '') : html;
diff --git a/public/src/modules/scrollStop.js b/public/src/modules/scrollStop.js
index fe410ac7e4..5e056f5fd9 100644
--- a/public/src/modules/scrollStop.js
+++ b/public/src/modules/scrollStop.js
@@ -19,8 +19,8 @@ define('scrollStop', function () {
var elementHeight = Math.round(this.getBoundingClientRect().height);
if (
- (e.originalEvent.deltaY < 0 && scrollTop === 0) // scroll up
- || (e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down
+ (e.originalEvent.deltaY < 0 && scrollTop === 0) || // scroll up
+ (e.originalEvent.deltaY > 0 && (elementHeight + scrollTop) >= scrollHeight) // scroll down
) {
return false;
}
diff --git a/public/src/modules/taskbar.js b/public/src/modules/taskbar.js
index b577efbe0a..5a1c0d886f 100644
--- a/public/src/modules/taskbar.js
+++ b/public/src/modules/taskbar.js
@@ -116,11 +116,11 @@ define('taskbar', ['benchpress', 'translator'], function (Benchpress, translator
var taskbarEl = $('')
.addClass(data.options.className)
- .html(''
- + (data.options.icon ? ' ' : '')
- + (data.options.image ? '
' : '')
- + '' + title + ''
- + '')
+ .html('' +
+ (data.options.icon ? ' ' : '') +
+ (data.options.image ? '
' : '') +
+ '' + title + '' +
+ '')
.attr({
title: title,
'data-module': data.module,
diff --git a/public/src/modules/topicList.js b/public/src/modules/topicList.js
index a8623f8d83..15db0a6476 100644
--- a/public/src/modules/topicList.js
+++ b/public/src/modules/topicList.js
@@ -74,9 +74,9 @@ define('topicList', [
};
function onNewTopic(data) {
- if ((ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(data.cid, 10)) === -1)
- || (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'watched')
- || (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(data.cid, 10))) {
+ if ((ajaxify.data.selectedCids && ajaxify.data.selectedCids.indexOf(parseInt(data.cid, 10)) === -1) ||
+ (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'watched') ||
+ (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(data.cid, 10))) {
return;
}
@@ -91,11 +91,13 @@ define('topicList', [
}
var post = data.posts[0];
- if ((!post || !post.topic)
- || (parseInt(post.topic.mainPid, 10) === parseInt(post.pid, 10))
- || (ajaxify.data.selectedCids && ajaxify.data.selectedCids.length && ajaxify.data.selectedCids.indexOf(parseInt(post.topic.cid, 10)) === -1)
- || (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'new')
- || (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(post.topic.cid, 10))) {
+ if (
+ (!post || !post.topic) ||
+ (parseInt(post.topic.mainPid, 10) === parseInt(post.pid, 10)) ||
+ (ajaxify.data.selectedCids && ajaxify.data.selectedCids.length && ajaxify.data.selectedCids.indexOf(parseInt(post.topic.cid, 10)) === -1) ||
+ (ajaxify.data.selectedFilter && ajaxify.data.selectedFilter.filter === 'new') ||
+ (ajaxify.data.template.category && parseInt(ajaxify.data.cid, 10) !== parseInt(post.topic.cid, 10))
+ ) {
return;
}
diff --git a/public/src/modules/translator.js b/public/src/modules/translator.js
index fb1110e947..65fd44df52 100644
--- a/public/src/modules/translator.js
+++ b/public/src/modules/translator.js
@@ -181,8 +181,8 @@
cursor += 1;
// a space or comma was found before the name
// this isn't a translation string, so back out
- } else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound)
- && invalidTextRegex.test(char0)) {
+ } else if (!(textBeforeColonFound && colonFound && textAfterColonFound && commaAfterNameFound) &&
+ invalidTextRegex.test(char0)) {
cursor += 1;
lastBreak -= 2;
// no longer in a token
diff --git a/public/src/sockets.js b/public/src/sockets.js
index 4407bb3b22..f80fdc157e 100644
--- a/public/src/sockets.js
+++ b/public/src/sockets.js
@@ -152,14 +152,14 @@ app.isConnected = false;
}
if (
- config.socketioOrigins
- && config.socketioOrigins !== '*'
- && config.socketioOrigins.indexOf(location.hostname) === -1
+ config.socketioOrigins &&
+ config.socketioOrigins !== '*' &&
+ config.socketioOrigins.indexOf(location.hostname) === -1
) {
console.error(
- 'You are accessing the forum from an unknown origin. This will likely result in websockets failing to connect. \n'
- + 'To fix this, set the `"url"` value in `config.json` to the URL at which you access the site. \n'
- + 'For more information, see this FAQ topic: https://community.nodebb.org/topic/13388'
+ 'You are accessing the forum from an unknown origin. This will likely result in websockets failing to connect. \n' +
+ 'To fix this, set the `"url"` value in `config.json` to the URL at which you access the site. \n' +
+ 'For more information, see this FAQ topic: https://community.nodebb.org/topic/13388'
);
}
}());
diff --git a/public/src/utils.js b/public/src/utils.js
index 65ca2f8819..05e069ed14 100644
--- a/public/src/utils.js
+++ b/public/src/utils.js
@@ -625,10 +625,10 @@
var rect = el.getBoundingClientRect();
return (
- rect.top >= 0
- && rect.left >= 0
- && rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) /* or $(window).height() */
- && rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
+ rect.top >= 0 &&
+ rect.left >= 0 &&
+ rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) && /* or $(window).height() */
+ rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */
);
},
@@ -731,10 +731,10 @@
},
isInternalURI: function (targetLocation, referenceLocation, relative_path) {
- return targetLocation.host === '' // Relative paths are always internal links
- || (
- targetLocation.host === referenceLocation.host && targetLocation.protocol === referenceLocation.protocol // Otherwise need to check if protocol and host match
- && (relative_path.length > 0 ? targetLocation.pathname.indexOf(relative_path) === 0 : true) // Subfolder installs need this additional check
+ return targetLocation.host === '' || // Relative paths are always internal links
+ (
+ targetLocation.host === referenceLocation.host && targetLocation.protocol === referenceLocation.protocol && // Otherwise need to check if protocol and host match
+ (relative_path.length > 0 ? targetLocation.pathname.indexOf(relative_path) === 0 : true) // Subfolder installs need this additional check
);
},
diff --git a/src/admin/search.js b/src/admin/search.js
index a49e6ea1ff..33c9b437d5 100644
--- a/src/admin/search.js
+++ b/src/admin/search.js
@@ -18,10 +18,10 @@ function filterDirectories(directories) {
// exclude partials
// only include subpaths
// exclude category.tpl, group.tpl, category-analytics.tpl
- return !dir.endsWith('.js')
- && !dir.includes('/partials/')
- && /\/.*\//.test(dir)
- && !/manage\/(category|group|category-analytics)$/.test(dir);
+ return !dir.endsWith('.js') &&
+ !dir.includes('/partials/') &&
+ /\/.*\//.test(dir) &&
+ !/manage\/(category|group|category-analytics)$/.test(dir);
});
}
@@ -139,10 +139,10 @@ function initDict(language, callback) {
title = '[[admin/menu:general/dashboard]]';
} else {
title = title.match(/admin\/(.+?)\/(.+?)$/);
- title = '[[admin/menu:section-'
- + (title[1] === 'development' ? 'advanced' : title[1])
- + ']]' + (title[2] ? (' > [[admin/menu:'
- + title[1] + '/' + title[2] + ']]') : '');
+ title = '[[admin/menu:section-' +
+ (title[1] === 'development' ? 'advanced' : title[1]) +
+ ']]' + (title[2] ? (' > [[admin/menu:' +
+ title[1] + '/' + title[2] + ']]') : '');
}
translator.translate(title).then(function (title) {
diff --git a/src/cli/colors.js b/src/cli/colors.js
index df0f0961cd..bb2648e1d5 100644
--- a/src/cli/colors.js
+++ b/src/cli/colors.js
@@ -65,9 +65,9 @@ Command.prototype.usage = function () {
return humanReadableArgName(arg);
});
- var usage = '[options]'[optionColor]
- + (this.commands.length ? ' [command]' : '')[subCommandColor]
- + (this._args.length ? ' ' + args.join(' ') : '')[argColor];
+ var usage = '[options]'[optionColor] +
+ (this.commands.length ? ' [command]' : '')[subCommandColor] +
+ (this._args.length ? ' ' + args.join(' ') : '')[argColor];
return usage;
};
@@ -90,10 +90,10 @@ Command.prototype.commandHelp = function () {
}).join(' ');
return [
- cmd._name[subCommandColor]
- + (cmd._alias ? ' | ' + cmd._alias : '')[subCommandColor]
- + (cmd.options.length ? ' [options]' : '')[subOptionColor]
- + ' ' + args[subArgColor],
+ cmd._name[subCommandColor] +
+ (cmd._alias ? ' | ' + cmd._alias : '')[subCommandColor] +
+ (cmd.options.length ? ' [options]' : '')[subOptionColor] +
+ ' ' + args[subArgColor],
cmd._description,
];
});
diff --git a/src/cli/manage.js b/src/cli/manage.js
index dd908c7377..9d360494ec 100644
--- a/src/cli/manage.js
+++ b/src/cli/manage.js
@@ -27,10 +27,10 @@ function buildTargets() {
return ' ' + _.padEnd('"' + tuple[0] + '"', length + 2).magenta + ' | ' + tuple[1];
}).join('\n');
console.log(
- '\n\n Build targets:\n'
- + ('\n ' + _.padEnd('Target', length + 2) + ' | Aliases').green
- + '\n ------------------------------------------------------\n'.blue
- + output + '\n'
+ '\n\n Build targets:\n' +
+ ('\n ' + _.padEnd('Target', length + 2) + ' | Aliases').green +
+ '\n ------------------------------------------------------\n'.blue +
+ output + '\n'
);
}
diff --git a/src/cli/upgrade.js b/src/cli/upgrade.js
index 046e8539df..618183111e 100644
--- a/src/cli/upgrade.js
+++ b/src/cli/upgrade.js
@@ -88,8 +88,8 @@ function runUpgrade(upgrades, options) {
if (upgrades === true) {
var tasks = Object.keys(steps);
- if (options.package || options.install
- || options.plugins || options.schema || options.build) {
+ if (options.package || options.install ||
+ options.plugins || options.schema || options.build) {
tasks = tasks.filter(function (key) {
return options[key];
});
diff --git a/src/controllers/admin/uploads.js b/src/controllers/admin/uploads.js
index d0af465347..4a63d33ba8 100644
--- a/src/controllers/admin/uploads.js
+++ b/src/controllers/admin/uploads.js
@@ -88,9 +88,9 @@ function buildBreadcrumbs(currentFolder) {
var dir = path.join(currentPath, part);
crumbs.push({
text: part || 'Uploads',
- url: part
- ? (nconf.get('relative_path') + '/admin/manage/uploads?dir=' + dir)
- : nconf.get('relative_path') + '/admin/manage/uploads',
+ url: part ?
+ (nconf.get('relative_path') + '/admin/manage/uploads?dir=' + dir) :
+ nconf.get('relative_path') + '/admin/manage/uploads',
});
currentPath = dir;
});
diff --git a/src/controllers/index.js b/src/controllers/index.js
index eddc1132d5..ed94cd4713 100644
--- a/src/controllers/index.js
+++ b/src/controllers/index.js
@@ -249,10 +249,10 @@ Controllers.robots = function (req, res) {
if (meta.config['robots:txt']) {
res.send(meta.config['robots:txt']);
} else {
- res.send('User-agent: *\n'
- + 'Disallow: ' + nconf.get('relative_path') + '/admin/\n'
- + 'Disallow: ' + nconf.get('relative_path') + '/reset/\n'
- + 'Sitemap: ' + nconf.get('url') + '/sitemap.xml');
+ res.send('User-agent: *\n' +
+ 'Disallow: ' + nconf.get('relative_path') + '/admin/\n' +
+ 'Disallow: ' + nconf.get('relative_path') + '/reset/\n' +
+ 'Sitemap: ' + nconf.get('url') + '/sitemap.xml');
}
};
diff --git a/src/groups/create.js b/src/groups/create.js
index 20b4f0bee8..a5b60e68b5 100644
--- a/src/groups/create.js
+++ b/src/groups/create.js
@@ -77,9 +77,9 @@ module.exports = function (Groups) {
};
function isSystemGroup(data) {
- return data.system === true || parseInt(data.system, 10) === 1
- || data.name === 'administrators' || data.name === 'registered-users' || data.name === 'Global Moderators'
- || Groups.isPrivilegeGroup(data.name);
+ return data.system === true || parseInt(data.system, 10) === 1 ||
+ data.name === 'administrators' || data.name === 'registered-users' || data.name === 'Global Moderators' ||
+ Groups.isPrivilegeGroup(data.name);
}
function validateGroupName(name, callback) {
diff --git a/src/messaging/data.js b/src/messaging/data.js
index 1d689ced7d..84ac7e8c19 100644
--- a/src/messaging/data.js
+++ b/src/messaging/data.js
@@ -134,8 +134,8 @@ module.exports = function (Messaging) {
Messaging.getMessageFields(mid, ['fromuid', 'timestamp'], next);
},
function (fields, next) {
- if ((messages[0].timestamp > fields.timestamp + Messaging.newMessageCutoff)
- || (messages[0].fromuid !== fields.fromuid)) {
+ if ((messages[0].timestamp > fields.timestamp + Messaging.newMessageCutoff) ||
+ (messages[0].fromuid !== fields.fromuid)) {
// If it's been 5 minutes, this is a new set of messages
messages[0].newSet = true;
}
diff --git a/src/meta/blacklist.js b/src/meta/blacklist.js
index bcf3c57816..eced8ea413 100644
--- a/src/meta/blacklist.js
+++ b/src/meta/blacklist.js
@@ -80,9 +80,9 @@ Blacklist.test = function (clientIp, callback) {
}
if (
- !Blacklist._rules.ipv4.includes(clientIp) // not explicitly specified in ipv4 list
- && !Blacklist._rules.ipv6.includes(clientIp) // not explicitly specified in ipv6 list
- && !Blacklist._rules.cidr.some(function (subnet) {
+ !Blacklist._rules.ipv4.includes(clientIp) && // not explicitly specified in ipv4 list
+ !Blacklist._rules.ipv6.includes(clientIp) && // not explicitly specified in ipv6 list
+ !Blacklist._rules.cidr.some(function (subnet) {
var cidr = ipaddr.parseCIDR(subnet);
if (addr.kind() !== cidr[0].kind()) {
return false;
diff --git a/src/middleware/render.js b/src/middleware/render.js
index 34e58fafa2..4d6476dc34 100644
--- a/src/middleware/render.js
+++ b/src/middleware/render.js
@@ -89,11 +89,11 @@ module.exports = function (middleware) {
}, next);
},
function (results, next) {
- var str = results.header
- + (res.locals.postHeader || '')
- + results.content + ''
- + (res.locals.preFooter || '')
- + results.footer;
+ var str = results.header +
+ (res.locals.postHeader || '') +
+ results.content + '' +
+ (res.locals.preFooter || '') +
+ results.footer;
translate(str, req, res, next);
},
diff --git a/src/plugins/data.js b/src/plugins/data.js
index 31cd2c402c..0dd7fa3a67 100644
--- a/src/plugins/data.js
+++ b/src/plugins/data.js
@@ -106,16 +106,16 @@ function getStaticDirectories(pluginData, callback) {
async.each(dirs, function (route, next) {
if (!validMappedPath.test(route)) {
- winston.warn('[plugins/' + pluginData.id + '] Invalid mapped path specified: '
- + route + '. Path must adhere to: ' + validMappedPath.toString());
+ winston.warn('[plugins/' + pluginData.id + '] Invalid mapped path specified: ' +
+ route + '. Path must adhere to: ' + validMappedPath.toString());
return next();
}
var dirPath = path.join(pluginData.path, pluginData.staticDirs[route]);
fs.stat(dirPath, function (err, stats) {
if (err && err.code === 'ENOENT') {
- winston.warn('[plugins/' + pluginData.id + '] Mapped path \''
- + route + ' => ' + dirPath + '\' not found.');
+ winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' +
+ route + ' => ' + dirPath + '\' not found.');
return next();
}
if (err) {
@@ -123,8 +123,8 @@ function getStaticDirectories(pluginData, callback) {
}
if (!stats.isDirectory()) {
- winston.warn('[plugins/' + pluginData.id + '] Mapped path \''
- + route + ' => ' + dirPath + '\' is not a directory.');
+ winston.warn('[plugins/' + pluginData.id + '] Mapped path \'' +
+ route + ' => ' + dirPath + '\' is not a directory.');
return next();
}
@@ -135,8 +135,8 @@ function getStaticDirectories(pluginData, callback) {
if (err) {
return callback(err);
}
- winston.verbose('[plugins] found ' + Object.keys(staticDirs).length
- + ' static directories for ' + pluginData.id);
+ winston.verbose('[plugins] found ' + Object.keys(staticDirs).length +
+ ' static directories for ' + pluginData.id);
callback(null, staticDirs);
});
}
diff --git a/src/plugins/hooks.js b/src/plugins/hooks.js
index 6a5a161d33..d5f268a80e 100644
--- a/src/plugins/hooks.js
+++ b/src/plugins/hooks.js
@@ -34,10 +34,10 @@ module.exports = function (Plugins) {
var method;
if (Object.keys(Plugins.deprecatedHooks).includes(data.hook)) {
- winston.warn('[plugins/' + id + '] Hook `' + data.hook + '` is deprecated, '
- + (Plugins.deprecatedHooks[data.hook]
- ? 'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.'
- : 'there is no alternative.'
+ winston.warn('[plugins/' + id + '] Hook `' + data.hook + '` is deprecated, ' +
+ (Plugins.deprecatedHooks[data.hook] ?
+ 'please use `' + Plugins.deprecatedHooks[data.hook] + '` instead.' :
+ 'there is no alternative.'
));
}
diff --git a/src/privileges/categories.js b/src/privileges/categories.js
index 80a8b56f7c..d680e43f83 100644
--- a/src/privileges/categories.js
+++ b/src/privileges/categories.js
@@ -141,8 +141,8 @@ module.exports = function (privileges) {
},
function (results, next) {
cids = cids.filter(function (cid, index) {
- return !results.categories[index].disabled
- && (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
+ return !results.categories[index].disabled &&
+ (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
});
next(null, cids.filter(Boolean));
diff --git a/src/privileges/posts.js b/src/privileges/posts.js
index df19b3397f..a28a12378b 100644
--- a/src/privileges/posts.js
+++ b/src/privileges/posts.js
@@ -115,15 +115,15 @@ module.exports = function (privileges) {
var isModOf = {};
cids = cids.filter(function (cid, index) {
isModOf[cid] = results.isModerators[index];
- return !results.categories[index].disabled
- && (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
+ return !results.categories[index].disabled &&
+ (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
});
const cidsSet = new Set(cids);
pids = postData.filter(function (post) {
- return post.topic && cidsSet.has(post.topic.cid)
- && ((!post.topic.deleted && !post.deleted) || results.isAdmin || isModOf[post.cid]);
+ return post.topic && cidsSet.has(post.topic.cid) &&
+ ((!post.topic.deleted && !post.deleted) || results.isAdmin || isModOf[post.cid]);
}).map(post => post.pid);
plugins.fireHook('filter:privileges.posts.filter', {
diff --git a/src/privileges/topics.js b/src/privileges/topics.js
index 7f14041b1f..4b56f22fad 100644
--- a/src/privileges/topics.js
+++ b/src/privileges/topics.js
@@ -96,15 +96,15 @@ module.exports = function (privileges) {
var isModOf = {};
cids = cids.filter(function (cid, index) {
isModOf[cid] = results.isModerators[index];
- return !results.categories[index].disabled
- && (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
+ return !results.categories[index].disabled &&
+ (results.allowedTo[index] || results.isAdmin || results.isModerators[index]);
});
const cidsSet = new Set(cids);
tids = topicsData.filter(function (topic) {
- return cidsSet.has(topic.cid)
- && (!topic.deleted || results.isAdmin || isModOf[topic.cid]);
+ return cidsSet.has(topic.cid) &&
+ (!topic.deleted || results.isAdmin || isModOf[topic.cid]);
}).map(topic => topic.tid);
plugins.fireHook('filter:privileges.topics.filter', {
@@ -148,8 +148,8 @@ module.exports = function (privileges) {
},
function (results, next) {
uids = uids.filter(function (uid, index) {
- return !results.disabled
- && ((results.allowedTo[index] && !topicData.deleted) || results.isAdmins[index] || results.isModerators[index]);
+ return !results.disabled &&
+ ((results.allowedTo[index] && !topicData.deleted) || results.isAdmins[index] || results.isModerators[index]);
});
next(null, uids);
@@ -197,9 +197,9 @@ module.exports = function (privileges) {
var preventTopicDeleteAfterReplies = meta.config.preventTopicDeleteAfterReplies;
if (preventTopicDeleteAfterReplies && (topicData.postcount - 1) >= preventTopicDeleteAfterReplies) {
- var langKey = preventTopicDeleteAfterReplies > 1
- ? '[[error:cant-delete-topic-has-replies, ' + meta.config.preventTopicDeleteAfterReplies + ']]'
- : '[[error:cant-delete-topic-has-reply]]';
+ var langKey = preventTopicDeleteAfterReplies > 1 ?
+ '[[error:cant-delete-topic-has-replies, ' + meta.config.preventTopicDeleteAfterReplies + ']]' :
+ '[[error:cant-delete-topic-has-reply]]';
return next(new Error(langKey));
}
diff --git a/src/routes/index.js b/src/routes/index.js
index a7e92da3ff..5775f1c62c 100644
--- a/src/routes/index.js
+++ b/src/routes/index.js
@@ -173,8 +173,8 @@ module.exports = function (app, middleware, callback) {
// DEPRECATED (v1.12.0)
app.use(relativePath + '/assets/stylesheet.css', function (req, res) {
if (!warned.has(req.path)) {
- winston.warn('[deprecated] Accessing `/assets/stylesheet.css` is deprecated to be REMOVED in NodeBB v1.12.0. '
- + 'Use `/assets/client.css` to access this file');
+ winston.warn('[deprecated] Accessing `/assets/stylesheet.css` is deprecated to be REMOVED in NodeBB v1.12.0. ' +
+ 'Use `/assets/client.css` to access this file');
warned.add(req.path);
}
res.redirect(relativePath + '/assets/client.css?' + meta.config['cache-buster']);
diff --git a/src/sitemap.js b/src/sitemap.js
index 38f29a3d9c..663f7da08e 100644
--- a/src/sitemap.js
+++ b/src/sitemap.js
@@ -42,8 +42,8 @@ sitemap.render = function (callback) {
sitemap.getPages = function (callback) {
if (
- sitemap.maps.pages
- && Date.now() < parseInt(sitemap.maps.pages.cacheSetTimestamp, 10) + parseInt(sitemap.maps.pages.cacheResetPeriod, 10)
+ sitemap.maps.pages &&
+ Date.now() < parseInt(sitemap.maps.pages.cacheSetTimestamp, 10) + parseInt(sitemap.maps.pages.cacheResetPeriod, 10)
) {
return sitemap.maps.pages.toXML(callback);
}
@@ -82,8 +82,8 @@ sitemap.getPages = function (callback) {
sitemap.getCategories = function (callback) {
if (
- sitemap.maps.categories
- && Date.now() < parseInt(sitemap.maps.categories.cacheSetTimestamp, 10) + parseInt(sitemap.maps.categories.cacheResetPeriod, 10)
+ sitemap.maps.categories &&
+ Date.now() < parseInt(sitemap.maps.categories.cacheSetTimestamp, 10) + parseInt(sitemap.maps.categories.cacheResetPeriod, 10)
) {
return sitemap.maps.categories.toXML(callback);
}
@@ -124,8 +124,8 @@ sitemap.getTopicPage = function (page, callback) {
var max = min + numTopics;
if (
- sitemap.maps.topics[page - 1]
- && Date.now() < parseInt(sitemap.maps.topics[page - 1].cacheSetTimestamp, 10) + parseInt(sitemap.maps.topics[page - 1].cacheResetPeriod, 10)
+ sitemap.maps.topics[page - 1] &&
+ Date.now() < parseInt(sitemap.maps.topics[page - 1].cacheSetTimestamp, 10) + parseInt(sitemap.maps.topics[page - 1].cacheResetPeriod, 10)
) {
return sitemap.maps.topics[page - 1].toXML(callback);
}
diff --git a/src/socket.io/groups.js b/src/socket.io/groups.js
index 05db6e486a..e4f7a0a985 100644
--- a/src/socket.io/groups.js
+++ b/src/socket.io/groups.js
@@ -249,10 +249,10 @@ SocketGroups.create = function (socket, data, callback) {
};
SocketGroups.delete = isOwner(function (socket, data, callback) {
- if (data.groupName === 'administrators'
- || data.groupName === 'registered-users'
- || data.groupName === 'guests'
- || data.groupName === 'Global Moderators') {
+ if (data.groupName === 'administrators' ||
+ data.groupName === 'registered-users' ||
+ data.groupName === 'guests' ||
+ data.groupName === 'Global Moderators') {
return callback(new Error('[[error:not-allowed]]'));
}
diff --git a/src/socket.io/helpers.js b/src/socket.io/helpers.js
index 76e128e044..256389cac6 100644
--- a/src/socket.io/helpers.js
+++ b/src/socket.io/helpers.js
@@ -70,8 +70,8 @@ function filterTidCidIgnorers(uids, tid, cid, callback) {
},
function (results, next) {
uids = uids.filter(function (uid, index) {
- return results.topicFollowed[index]
- || (!results.topicFollowed[index] && !results.topicIgnored[index] && !results.categoryIgnored[index]);
+ return results.topicFollowed[index] ||
+ (!results.topicFollowed[index] && !results.topicIgnored[index] && !results.categoryIgnored[index]);
});
next(null, uids);
},
diff --git a/src/topics/unread.js b/src/topics/unread.js
index 8e1466145b..5610b46a65 100644
--- a/src/topics/unread.js
+++ b/src/topics/unread.js
@@ -464,9 +464,9 @@ module.exports = function (Topics) {
function (results, next) {
var cutoff = Topics.unreadCutoff();
var result = tids.map(function (tid, index) {
- var read = !results.tids_unread[index]
- && (results.topicScores[index] < cutoff
- || !!(results.userScores[index] && results.userScores[index] >= results.topicScores[index]));
+ var read = !results.tids_unread[index] &&
+ (results.topicScores[index] < cutoff ||
+ !!(results.userScores[index] && results.userScores[index] >= results.topicScores[index]));
return { tid: tid, read: read, index: index };
});
diff --git a/src/user/approval.js b/src/user/approval.js
index c890c4abf4..f3a9712aa3 100644
--- a/src/user/approval.js
+++ b/src/user/approval.js
@@ -240,11 +240,11 @@ module.exports = function (User) {
function (next) {
request({
method: 'get',
- url: 'http://api.stopforumspam.org/api'
- + '?ip=' + encodeURIComponent(user.ip)
- + '&email=' + encodeURIComponent(user.email)
- + '&username=' + encodeURIComponent(user.username)
- + '&f=json',
+ url: 'http://api.stopforumspam.org/api' +
+ '?ip=' + encodeURIComponent(user.ip) +
+ '&email=' + encodeURIComponent(user.email) +
+ '&username=' + encodeURIComponent(user.username) +
+ '&f=json',
json: true,
}, next);
},
diff --git a/src/user/auth.js b/src/user/auth.js
index 40a9ad7d58..ec17711cc9 100644
--- a/src/user/auth.js
+++ b/src/user/auth.js
@@ -109,9 +109,9 @@ module.exports = function (User) {
var expired;
sessions = sessions.filter(function (sessionObj, idx) {
- expired = !sessionObj || !sessionObj.hasOwnProperty('passport')
- || !sessionObj.passport.hasOwnProperty('user')
- || parseInt(sessionObj.passport.user, 10) !== parseInt(uid, 10);
+ expired = !sessionObj || !sessionObj.hasOwnProperty('passport') ||
+ !sessionObj.passport.hasOwnProperty('user') ||
+ parseInt(sessionObj.passport.user, 10) !== parseInt(uid, 10);
if (expired) {
expiredSids.push(_sids[idx]);
diff --git a/test/build.js b/test/build.js
index 460249608b..0b40b28aa4 100644
--- a/test/build.js
+++ b/test/build.js
@@ -41,16 +41,16 @@ describe('minifier', function () {
assert.strictEqual(
fs.readFileSync(destPath).toString().replace(/\r\n/g, '\n'),
- '(function (window, document) {'
- + '\n\twindow.doStuff = function () {'
- + '\n\t\tdocument.body.innerHTML = \'Stuff has been done\';'
- + '\n\t};'
- + '\n})(window, document);'
- + '\n'
- + '\n;function foo(name, age) {'
- + '\n\treturn \'The person known as "\' + name + \'" is \' + age + \' years old\';'
- + '\n}'
- + '\n'
+ '(function (window, document) {' +
+ '\n\twindow.doStuff = function () {' +
+ '\n\t\tdocument.body.innerHTML = \'Stuff has been done\';' +
+ '\n\t};' +
+ '\n})(window, document);' +
+ '\n' +
+ '\n;function foo(name, age) {' +
+ '\n\treturn \'The person known as "\' + name + \'" is \' + age + \' years old\';' +
+ '\n}' +
+ '\n'
);
done();
});
@@ -69,8 +69,8 @@ describe('minifier', function () {
assert.strictEqual(
fs.readFileSync(destPath).toString(),
- '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);function foo(n,o){return\'The person known as "\'+n+\'" is \'+o+" years old"}'
- + '\n//# sourceMappingURL=minified.js.map'
+ '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);function foo(n,o){return\'The person known as "\'+n+\'" is \'+o+" years old"}' +
+ '\n//# sourceMappingURL=minified.js.map'
);
done();
});
@@ -87,8 +87,8 @@ describe('minifier', function () {
assert.ifError(err);
assert.strictEqual(
buffer.toString(),
- '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);'
- + '\n//# sourceMappingURL=1.js.map'
+ '(function(n,o){n.doStuff=function(){o.body.innerHTML="Stuff has been done"}})(window,document);' +
+ '\n//# sourceMappingURL=1.js.map'
);
done();
});
diff --git a/test/mocks/databasemock.js b/test/mocks/databasemock.js
index fc293529e5..c5c3726dd7 100644
--- a/test/mocks/databasemock.js
+++ b/test/mocks/databasemock.js
@@ -45,47 +45,47 @@ var productionDbConfig = nconf.get(dbType);
if (!testDbConfig) {
const errorText = 'test_database is not defined';
winston.info(
- '\n===========================================================\n'
- + 'Please, add parameters for test database in config.json\n'
- + 'For example (redis):\n'
- + '"test_database": {\n'
- + ' "host": "127.0.0.1",\n'
- + ' "port": "6379",\n'
- + ' "password": "",\n'
- + ' "database": "1"\n'
- + '}\n'
- + ' or (mongo):\n'
- + '"test_database": {\n'
- + ' "host": "127.0.0.1",\n'
- + ' "port": "27017",\n'
- + ' "password": "",\n'
- + ' "database": "1"\n'
- + '}\n'
- + ' or (mongo) in a replicaset\n'
- + '"test_database": {\n'
- + ' "host": "127.0.0.1,127.0.0.1,127.0.0.1",\n'
- + ' "port": "27017,27018,27019",\n'
- + ' "username": "",\n'
- + ' "password": "",\n'
- + ' "database": "nodebb_test"\n'
- + '}\n'
- + ' or (postgres):\n'
- + '"test_database": {\n'
- + ' "host": "127.0.0.1",\n'
- + ' "port": "5432",\n'
- + ' "username": "postgres",\n'
- + ' "password": "",\n'
- + ' "database": "nodebb_test"\n'
- + '}\n'
- + '==========================================================='
+ '\n===========================================================\n' +
+ 'Please, add parameters for test database in config.json\n' +
+ 'For example (redis):\n' +
+ '"test_database": {\n' +
+ ' "host": "127.0.0.1",\n' +
+ ' "port": "6379",\n' +
+ ' "password": "",\n' +
+ ' "database": "1"\n' +
+ '}\n' +
+ ' or (mongo):\n' +
+ '"test_database": {\n' +
+ ' "host": "127.0.0.1",\n' +
+ ' "port": "27017",\n' +
+ ' "password": "",\n' +
+ ' "database": "1"\n' +
+ '}\n' +
+ ' or (mongo) in a replicaset\n' +
+ '"test_database": {\n' +
+ ' "host": "127.0.0.1,127.0.0.1,127.0.0.1",\n' +
+ ' "port": "27017,27018,27019",\n' +
+ ' "username": "",\n' +
+ ' "password": "",\n' +
+ ' "database": "nodebb_test"\n' +
+ '}\n' +
+ ' or (postgres):\n' +
+ '"test_database": {\n' +
+ ' "host": "127.0.0.1",\n' +
+ ' "port": "5432",\n' +
+ ' "username": "postgres",\n' +
+ ' "password": "",\n' +
+ ' "database": "nodebb_test"\n' +
+ '}\n' +
+ '==========================================================='
);
winston.error(errorText);
throw new Error(errorText);
}
-if (testDbConfig.database === productionDbConfig.database
- && testDbConfig.host === productionDbConfig.host
- && testDbConfig.port === productionDbConfig.port) {
+if (testDbConfig.database === productionDbConfig.database &&
+ testDbConfig.host === productionDbConfig.host &&
+ testDbConfig.port === productionDbConfig.port) {
const errorText = 'test_database has the same config as production db';
winston.error(errorText);
throw new Error(errorText);
diff --git a/test/search-admin.js b/test/search-admin.js
index 5e3594d4b8..3c2620dfc1 100644
--- a/test/search-admin.js
+++ b/test/search-admin.js
@@ -46,19 +46,19 @@ describe('admin search', function () {
describe('sanitize', function () {
it('should strip out scripts', function (done) {
assert.equal(
- search.sanitize('Pellentesque tristique senectus'
- + ' habitant morbi'),
- 'Pellentesque tristique senectus'
- + ' habitant morbi'
+ search.sanitize('Pellentesque tristique senectus' +
+ ' habitant morbi'),
+ 'Pellentesque tristique senectus' +
+ ' habitant morbi'
);
done();
});
it('should remove all tags', function (done) {
assert.equal(
- search.sanitize('Pellentesque habitant morbi tristique senectus'
- + 'Aenean vitae est.Mauris eleifend leo.
'),
- 'Pellentesque habitant morbi tristique senectus'
- + 'Aenean vitae est.Mauris eleifend leo.'
+ search.sanitize('Pellentesque habitant morbi tristique senectus' +
+ 'Aenean vitae est.Mauris eleifend leo.
'),
+ 'Pellentesque habitant morbi tristique senectus' +
+ 'Aenean vitae est.Mauris eleifend leo.'
);
done();
});
@@ -67,19 +67,19 @@ describe('admin search', function () {
describe('simplify', function () {
it('should remove all mustaches', function (done) {
assert.equal(
- search.simplify('Pellentesque tristique {{senectus}}habitant morbi'
- + 'liquam tincidunt {mauris.eu}risus'),
- 'Pellentesque tristique habitant morbi'
- + 'liquam tincidunt risus'
+ search.simplify('Pellentesque tristique {{senectus}}habitant morbi' +
+ 'liquam tincidunt {mauris.eu}risus'),
+ 'Pellentesque tristique habitant morbi' +
+ 'liquam tincidunt risus'
);
done();
});
it('should collapse all whitespace', function (done) {
assert.equal(
- search.simplify('Pellentesque tristique habitant morbi'
- + ' \n\n liquam tincidunt mauris eu risus.'),
- 'Pellentesque tristique habitant morbi'
- + '\nliquam tincidunt mauris eu risus.'
+ search.simplify('Pellentesque tristique habitant morbi' +
+ ' \n\n liquam tincidunt mauris eu risus.'),
+ 'Pellentesque tristique habitant morbi' +
+ '\nliquam tincidunt mauris eu risus.'
);
done();
});