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,10 +351,8 @@ $(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)) {
e.preventDefault();
}
} else if (ajaxify.go(pathname)) {
e.preventDefault();
}
} else if (window.location.pathname !== '/outgoing') {
if (config.openOutgoingLinksInNewTab && $.contains(contentEl, this)) {

@ -311,22 +311,20 @@ define('forum/chats', [
data.message.self = data.self;
messages.appendChatMessage($('.expanded-chat .chat-content'), data.message);
} else {
if (ajaxify.currentPage.startsWith('chats')) {
var roomEl = $('[data-roomid=' + data.roomId + ']');
if (roomEl.length > 0) {
roomEl.addClass('unread');
} else {
var recentEl = components.get('chat/recent');
templates.parse('partials/chats/recent_room', {
rooms: { roomId: data.roomId, lastUser: data.message.fromUser, usernames: data.message.fromUser.username, unread: true },
}, function (html) {
translator.translate(html, function (translated) {
} else if (ajaxify.currentPage.startsWith('chats')) {
var roomEl = $('[data-roomid=' + data.roomId + ']');
if (roomEl.length > 0) {
roomEl.addClass('unread');
} else {
var recentEl = components.get('chat/recent');
templates.parse('partials/chats/recent_room', {
rooms: { roomId: data.roomId, lastUser: data.message.fromUser, usernames: data.message.fromUser.username, unread: true },
}, function (html) {
translator.translate(html, function (translated) {
recentEl.prepend(translated);
});
});
}
});
}
}
});

@ -510,20 +510,18 @@ define('settings', function () {
if (typeof callback === 'function') {
callback(err);
} else if (err) {
app.alert({
title: 'Error while saving settings',
type: 'error',
timeout: 2500,
});
} else {
if (err) {
app.alert({
title: 'Error while saving settings',
type: 'error',
timeout: 2500,
});
} else {
app.alert({
title: 'Settings Saved',
type: 'success',
timeout: 2500,
});
}
app.alert({
title: 'Settings Saved',
type: 'success',
timeout: 2500,
});
}
});
}

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

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

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

@ -190,12 +190,10 @@ var middleware;
winston.warn('[plugins] Skipping ' + pluginTemplate + ' by plugin ' + plugin.id);
}
});
} else if (err) {
winston.error(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.');
}
winston.warn('[plugins/' + plugin.id + '] A templates directory was defined for this plugin, but was not found.');
}
next(false);

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

@ -133,14 +133,12 @@ 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) {
winston.info('[reset] Plugin `%s` disabled', pluginId);
} 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');
}
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,12 +46,10 @@ module.exports = function (SocketTopics) {
if (reverse) {
start = results.topic.postcount - start;
}
} else if (reverse) {
start = results.topic.postcount - start - infScrollPostsPerPage - 1;
} else {
if (reverse) {
start = results.topic.postcount - start - infScrollPostsPerPage - 1;
} else {
start = start - infScrollPostsPerPage - 1;
}
start = start - infScrollPostsPerPage - 1;
}
var stop = start + (infScrollPostsPerPage - 1);

Loading…
Cancel
Save