diff --git a/.eslintrc b/.eslintrc index a6229e5bda..e04ea21d3b 100644 --- a/.eslintrc +++ b/.eslintrc @@ -70,7 +70,7 @@ "one-var-declaration-per-line": "off", "new-cap": "off", "no-lonely-if": "off", - "radix": "off", + // "radix": "off", // "no-else-return": "off", // "no-useless-escape": "off", // "block-scoped-var": "off", diff --git a/public/src/client/chats/messages.js b/public/src/client/chats/messages.js index 4c804643a7..ee68e8c88e 100644 --- a/public/src/client/chats/messages.js +++ b/public/src/client/chats/messages.js @@ -111,7 +111,7 @@ define('forum/chats/messages', ['components', 'sounds', 'translator'], function messages.onChatMessageEdit = function () { socket.on('event:chats.edit', function (data) { data.messages.forEach(function (message) { - var self = parseInt(message.fromuid, 10) === parseInt(app.user.uid); + var self = parseInt(message.fromuid, 10) === parseInt(app.user.uid, 10); message.self = self ? 1 : 0; messages.parseMessage(message, function (html) { var body = components.get('chat/message', message.messageId); diff --git a/src/categories/recentreplies.js b/src/categories/recentreplies.js index fa5a6cab7f..d516f4f035 100644 --- a/src/categories/recentreplies.js +++ b/src/categories/recentreplies.js @@ -130,7 +130,7 @@ module.exports = function (Categories) { results.teasers.forEach(function (teaser, index) { if (teaser) { teaser.cid = topicData[index].cid; - teaser.parentCid = parseInt(parentCids[teaser.cid]) || 0; + teaser.parentCid = parseInt(parentCids[teaser.cid], 10) || 0; teaser.tid = teaser.uid = teaser.user.uid = undefined; teaser.topic = { slug: topicData[index].slug, diff --git a/src/controllers/accounts/edit.js b/src/controllers/accounts/edit.js index 740980ae8e..7006672853 100644 --- a/src/controllers/accounts/edit.js +++ b/src/controllers/accounts/edit.js @@ -25,7 +25,7 @@ editController.get = function (req, res, callback) { userData.maximumSignatureLength = parseInt(meta.config.maximumSignatureLength, 10) || 255; userData.maximumAboutMeLength = parseInt(meta.config.maximumAboutMeLength, 10) || 1000; userData.maximumProfileImageSize = parseInt(meta.config.maximumProfileImageSize, 10); - userData.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads) === 1; + userData.allowProfileImageUploads = parseInt(meta.config.allowProfileImageUploads, 10) === 1; userData.allowAccountDelete = parseInt(meta.config.allowAccountDelete, 10) === 1; userData.groups = userData.groups.filter(function (group) { diff --git a/src/groups.js b/src/groups.js index 5ac3116db7..863a61016c 100644 --- a/src/groups.js +++ b/src/groups.js @@ -406,7 +406,7 @@ var utils = require('../public/src/utils'); group.hidden = parseInt(group.hidden, 10) === 1; group.system = parseInt(group.system, 10) === 1; group.private = (group.private === null || group.private === undefined) ? true : !!parseInt(group.private, 10); - group.disableJoinRequests = parseInt(group.disableJoinRequests) === 1; + group.disableJoinRequests = parseInt(group.disableJoinRequests, 10) === 1; group['cover:url'] = group['cover:url'] || require('./coverPhoto').getDefaultGroupCover(group.name); group['cover:thumb:url'] = group['cover:thumb:url'] || group['cover:url']; diff --git a/src/messaging.js b/src/messaging.js index 9f939564dd..e141adff4f 100644 --- a/src/messaging.js +++ b/src/messaging.js @@ -218,7 +218,7 @@ Messaging.getTeaser = function (uid, roomId, callback) { }; Messaging.canMessageUser = function (uid, toUid, callback) { - if (parseInt(meta.config.disableChat) === 1 || !uid || uid === toUid) { + if (parseInt(meta.config.disableChat, 10) === 1 || !uid || uid === toUid) { return callback(new Error('[[error:chat-disabled]]')); } @@ -262,7 +262,7 @@ Messaging.canMessageUser = function (uid, toUid, callback) { }; Messaging.canMessageRoom = function (uid, roomId, callback) { - if (parseInt(meta.config.disableChat) === 1 || !uid) { + if (parseInt(meta.config.disableChat, 10) === 1 || !uid) { return callback(new Error('[[error:chat-disabled]]')); } diff --git a/src/messaging/notifications.js b/src/messaging/notifications.js index 8578eb6425..3a333b2ffd 100644 --- a/src/messaging/notifications.js +++ b/src/messaging/notifications.js @@ -25,7 +25,7 @@ module.exports = function (Messaging) { message: messageObj, }; uids.forEach(function (uid) { - data.self = parseInt(uid, 10) === parseInt(fromUid) ? 1 : 0; + data.self = parseInt(uid, 10) === parseInt(fromUid, 10) ? 1 : 0; Messaging.pushUnreadCount(uid); sockets.in('uid_' + uid).emit('event:chats.receive', data); }); diff --git a/src/posts/votes.js b/src/posts/votes.js index 97f88b3820..ddc860f5b6 100644 --- a/src/posts/votes.js +++ b/src/posts/votes.js @@ -153,7 +153,7 @@ module.exports = function (Posts) { return callback(new Error('self-vote')); } - if (command === 'downvote' && parseInt(results.reputation) < parseInt(meta.config['privileges:downvote'], 10)) { + if (command === 'downvote' && parseInt(results.reputation, 10) < parseInt(meta.config['privileges:downvote'], 10)) { return callback(new Error('[[error:not-enough-reputation-to-downvote]]')); } diff --git a/src/search.js b/src/search.js index 15ebb88184..8cf54c86be 100644 --- a/src/search.js +++ b/src/search.js @@ -294,7 +294,7 @@ function filterByPostcount(posts, postCount, repliesFilter) { } function filterByTimerange(posts, timeRange, timeFilter) { - timeRange = parseInt(timeRange) * 1000; + timeRange = parseInt(timeRange, 10) * 1000; if (timeRange) { var time = Date.now() - timeRange; if (timeFilter === 'newer') { diff --git a/src/socket.io/posts/edit.js b/src/socket.io/posts/edit.js index c7ca9dc1e8..4d5602effe 100644 --- a/src/socket.io/posts/edit.js +++ b/src/socket.io/posts/edit.js @@ -50,7 +50,7 @@ module.exports = function (SocketPosts) { }); } - if (parseInt(result.post.deleted) !== 1) { + if (parseInt(result.post.deleted, 10) !== 1) { websockets.in('topic_' + result.topic.tid).emit('event:post_edited', result); return callback(null, result.post); } diff --git a/src/user/picture.js b/src/user/picture.js index 32d91d6877..4467fcd7e0 100644 --- a/src/user/picture.js +++ b/src/user/picture.js @@ -26,7 +26,7 @@ module.exports = function (User) { var keepAllVersions = parseInt(meta.config['profile:keepAllUserImages'], 10) === 1; var uploadedImage; - if (parseInt(meta.config.allowProfileImageUploads) !== 1) { + if (parseInt(meta.config.allowProfileImageUploads, 10) !== 1) { return callback(new Error('[[error:profile-image-uploads-disabled]]')); }