Eslint no-lonely-if

v1.18.x
Peter Jaszkowiak 8 years ago
parent 57f89663aa
commit 144fa8698c

@ -51,6 +51,7 @@
"no-script-url": "off",
"no-use-before-define": "off",
"default-case": "off",
"new-cap": "off",
// "linebreak-style": "off",
// "one-var": "off",
@ -67,9 +68,8 @@
"eqeqeq": "off",
"camelcase": "off",
"no-negated-condition": "off",
"one-var-declaration-per-line": "off",
"new-cap": "off",
"no-lonely-if": "off",
// "one-var-declaration-per-line": "off",
// "no-lonely-if": "off",
// "radix": "off",
// "no-else-return": "off",
// "no-useless-escape": "off",

@ -351,11 +351,9 @@ $(document).ready(function () {
// Special handling for urls with hashes
if (window.location.pathname === this.pathname && this.hash.length) {
window.location.hash = this.hash;
} else {
if (ajaxify.go(pathname)) {
} else if (ajaxify.go(pathname)) {
e.preventDefault();
}
}
} else if (window.location.pathname !== '/outgoing') {
if (config.openOutgoingLinksInNewTab && $.contains(contentEl, this)) {
window.open(this.href, '_blank');

@ -311,8 +311,7 @@ define('forum/chats', [
data.message.self = data.self;
messages.appendChatMessage($('.expanded-chat .chat-content'), data.message);
} else {
if (ajaxify.currentPage.startsWith('chats')) {
} else if (ajaxify.currentPage.startsWith('chats')) {
var roomEl = $('[data-roomid=' + data.roomId + ']');
if (roomEl.length > 0) {
@ -328,7 +327,6 @@ define('forum/chats', [
});
}
}
}
});
socket.on('event:user_status_change', function (data) {

@ -510,8 +510,7 @@ define('settings', function () {
if (typeof callback === 'function') {
callback(err);
} else {
if (err) {
} else if (err) {
app.alert({
title: 'Error while saving settings',
type: 'error',
@ -524,7 +523,6 @@ define('settings', function () {
timeout: 2500,
});
}
}
});
}
},

@ -38,15 +38,13 @@ helpers.notAllowed = function (req, res, error) {
title: '[[global:403.title]]',
});
}
} else {
if (res.locals.isAPI) {
} else if (res.locals.isAPI) {
req.session.returnTo = nconf.get('relative_path') + req.url.replace(/^\/api/, '');
res.status(401).json('not-authorized');
} else {
req.session.returnTo = nconf.get('relative_path') + req.url;
res.redirect(nconf.get('relative_path') + '/login');
}
}
});
};

@ -241,13 +241,11 @@ module.exports = function (Groups) {
}
if (Groups.isPrivilegeGroup(groupName) && parseInt(groupData.memberCount, 10) === 0) {
Groups.destroy(groupName, next);
} else {
if (parseInt(groupData.hidden, 10) !== 1) {
} else if (parseInt(groupData.hidden, 10) !== 1) {
db.sortedSetAdd('groups:visible:memberCount', groupData.memberCount, groupName, next);
} else {
next();
}
}
},
function (next) {
plugins.fireHook('action:group.leave', {

@ -18,11 +18,9 @@ module.exports = function (Meta) {
Meta.sounds.init = function (callback) {
if (nconf.get('isPrimary') === 'true') {
setupSounds(callback);
} else {
if (typeof callback === 'function') {
} else if (typeof callback === 'function') {
callback();
}
}
};
Meta.sounds.getFiles = function (callback) {

@ -190,13 +190,11 @@ var middleware;
winston.warn('[plugins] Skipping ' + pluginTemplate + ' by plugin ' + plugin.id);
}
});
} else {
if (err) {
} else if (err) {
winston.error(err);
} else {
winston.warn('[plugins/' + plugin.id + '] A templates directory was defined for this plugin, but was not found.');
}
}
next(false);
});

@ -28,13 +28,11 @@ module.exports = function (privileges) {
privileges.users.isModerator = function (uid, cid, callback) {
if (Array.isArray(cid)) {
isModeratorOfCategories(cid, uid, callback);
} else {
if (Array.isArray(uid)) {
} else if (Array.isArray(uid)) {
isModeratorsOfCategory(cid, uid, callback);
} else {
isModeratorOfCategory(cid, uid, callback);
}
}
};
function isModeratorOfCategories(cids, uid, callback) {

@ -133,15 +133,13 @@ function resetPlugin(pluginId, callback) {
], function (err) {
if (err) {
winston.error('[reset] Could not disable plugin: %s encountered error %s', pluginId, err.message);
} else {
if (active) {
} else if (active) {
winston.info('[reset] Plugin `%s` disabled', pluginId);
} else {
winston.warn('[reset] Plugin `%s` was not active on this forum', pluginId);
winston.info('[reset] No action taken.');
err = new Error('plugin-not-active');
}
}
callback(err);
});

@ -46,13 +46,11 @@ module.exports = function (SocketTopics) {
if (reverse) {
start = results.topic.postcount - start;
}
} else {
if (reverse) {
} else if (reverse) {
start = results.topic.postcount - start - infScrollPostsPerPage - 1;
} else {
start = start - infScrollPostsPerPage - 1;
}
}
var stop = start + (infScrollPostsPerPage - 1);

Loading…
Cancel
Save