Node.js based forum software built for the modern web
chore: eslint function-paren-newline
Peter Jaszkowiak62869bae3dd1
diff --git a/.eslintrc b/.eslintrcindex 03ef98455c..8f094ce324 100644--- a/.eslintrc+++ b/.eslintrc@@ -57,8 +57,7 @@// "object-curly-newline": ["error", { "consistent": true, "multiline": true }],"object-curly-newline": "off",// require consistent linebreaks inline function parenthesis (arguments or params)- // "function-paren-newline": ["error", "consistent"],- "function-paren-newline": "off",+ "function-paren-newline": ["error", "consistent"],// only require const if all parts of destructuring can be const"prefer-const": ["error", { "destructuring": "all" }],// don't require destructuring when assigningdiff --git a/public/src/admin/manage/users.js b/public/src/admin/manage/users.jsindex a6f9c887d3..6df89761e5 100644--- a/public/src/admin/manage/users.js+++ b/public/src/admin/manage/users.js@@ -305,13 +305,15 @@ define('admin/manage/users', [bootbox.confirm(confirmMsg, function (confirm) {if (confirm) {- Promise.all(uids.map(uid => api.del(`/users/${uid}${path}`, {})- .then(() => {- if (path !== '/content') {- removeRow(uid);- }- })- )).then(() => {+ Promise.all(+ uids.map(+ uid => api.del(`/users/${uid}${path}`, {}).then(() => {+ if (path !== '/content') {+ removeRow(uid);+ }+ })+ )+ ).then(() => {if (path !== '/content') {app.alertSuccess('[[admin/manage/users:alerts.delete-success]]');} else {diff --git a/public/src/client/topic/threadTools.js b/public/src/client/topic/threadTools.jsindex dbe8d78e15..d0616ec773 100644--- a/public/src/client/topic/threadTools.js+++ b/public/src/client/topic/threadTools.js@@ -321,10 +321,11 @@ define('forum/topic/threadTools', [var icon = $('.topic-header [component="topic/pinned"]');icon.toggleClass('hidden', !data.pinned);if (data.pinned) {- icon.translateAttr('title', data.pinExpiry && data.pinExpiryISO ?- '[[topic:pinned-with-expiry, ' + data.pinExpiryISO + ']]' :- '[[topic:pinned]]'- );+ icon.translateAttr('title', (+ data.pinExpiry && data.pinExpiryISO ?+ '[[topic:pinned-with-expiry, ' + data.pinExpiryISO + ']]' :+ '[[topic:pinned]]'+ ));}ajaxify.data.pinned = data.pinned;diff --git a/public/src/modules/api.js b/public/src/modules/api.jsindex 7a0b2e91d9..076be3a655 100644--- a/public/src/modules/api.js+++ b/public/src/modules/api.js@@ -12,10 +12,11 @@ define('api', () => {function doAjax(cb) {$.ajax(options).done((res) => {- cb(null,- res && res.hasOwnProperty('status') && res.hasOwnProperty('response') ?- res.response : (res || {})- );+ cb(null, (+ res &&+ res.hasOwnProperty('status') &&+ res.hasOwnProperty('response') ? res.response : (res || {})+ ));}).fail((ev) => {let errMessage;diff --git a/src/api/posts.js b/src/api/posts.jsindex 9379385de5..1a01b87215 100644--- a/src/api/posts.js+++ b/src/api/posts.js@@ -137,7 +137,8 @@ async function deleteOrRestore(caller, data, params) {async function deleteOrRestoreTopicOf(command, pid, caller) {const topic = await posts.getTopicFields(pid, ['tid', 'cid', 'deleted']);// command: delete/restore- await apiHelpers.doTopicAction(command,+ await apiHelpers.doTopicAction(+ command,topic.deleted ? 'event:topic_restored' : 'event:topic_deleted',caller,{ tids: [topic.tid], cid: topic.cid }@@ -178,7 +179,9 @@ postsAPI.purge = async function (caller, data) {});if (isMainAndLast) {- await apiHelpers.doTopicAction('purge', 'event:topic_purged',+ await apiHelpers.doTopicAction(+ 'purge',+ 'event:topic_purged',caller,{ tids: [postData.tid], cid: topicData.cid });diff --git a/src/controllers/admin/groups.js b/src/controllers/admin/groups.jsindex 9368dba9f7..e3171fe3d2 100644--- a/src/controllers/admin/groups.js+++ b/src/controllers/admin/groups.js@@ -59,12 +59,13 @@ groupsController.get = async function (req, res, next) {async function getGroupNames() {const groupNames = await db.getSortedSetRange('groups:createtime', 0, -1);- return groupNames.filter(name => name !== 'registered-users' &&+ return groupNames.filter(name => (+ name !== 'registered-users' &&name !== 'verified-users' &&name !== 'unverified-users' &&name !== groups.BANNED_USERS &&!groups.isPrivilegeGroup(name)- );+ ));}groupsController.getCSV = async function (req, res) {diff --git a/src/database/postgres.js b/src/database/postgres.jsindex 276e74ff53..d4c0e00af4 100644--- a/src/database/postgres.js+++ b/src/database/postgres.js@@ -368,8 +368,8 @@ postgresModule.info = async function (db) {const res = await db.query(`SELECT true "postgres",current_setting('server_version') "version",- EXTRACT(EPOCH FROM NOW() - pg_postmaster_start_time()) * 1000 "uptime"`- );+ EXTRACT(EPOCH FROM NOW() - pg_postmaster_start_time()) * 1000 "uptime"+ `);return res.rows[0];};diff --git a/src/groups/delete.js b/src/groups/delete.jsindex df097d5c54..1fc8beef02 100644--- a/src/groups/delete.js+++ b/src/groups/delete.js@@ -18,7 +18,8 @@ module.exports = function (Groups) {}const keys = [];groupNames.forEach((groupName) => {- keys.push(`group:${groupName}`,+ keys.push(+ `group:${groupName}`,`group:${groupName}:members`,`group:${groupName}:pending`,`group:${groupName}:invited`,diff --git a/src/groups/join.js b/src/groups/join.jsindex d578b04841..7b7a68095e 100644--- a/src/groups/join.js+++ b/src/groups/join.js@@ -55,7 +55,8 @@ module.exports = function (Groups) {const visibleGroups = groupData.filter(groupData => groupData && !groupData.hidden);if (visibleGroups.length) {- await db.sortedSetAdd('groups:visible:memberCount',+ await db.sortedSetAdd(+ 'groups:visible:memberCount',visibleGroups.map(groupData => groupData.memberCount),visibleGroups.map(groupData => groupData.name));diff --git a/src/groups/leave.js b/src/groups/leave.jsindex 8e529b8868..14bfb2558c 100644--- a/src/groups/leave.js+++ b/src/groups/leave.js@@ -43,7 +43,9 @@ module.exports = function (Groups) {promises.push(Groups.destroy, emptyPrivilegeGroups);}if (visibleGroups.length) {- promises.push(db.sortedSetAdd, 'groups:visible:memberCount',+ promises.push(+ db.sortedSetAdd,+ 'groups:visible:memberCount',visibleGroups.map(groupData => groupData.memberCount),visibleGroups.map(groupData => groupData.name));diff --git a/src/upgrades/1.14.1/readd_deleted_recent_topics.js b/src/upgrades/1.14.1/readd_deleted_recent_topics.jsindex 6dc0cc42c5..75a088a8c1 100644--- a/src/upgrades/1.14.1/readd_deleted_recent_topics.js+++ b/src/upgrades/1.14.1/readd_deleted_recent_topics.js@@ -25,22 +25,26 @@ module.exports = {}});- await db.sortedSetAdd('topics:recent',+ await db.sortedSetAdd(+ 'topics:recent',topicData.map(t => t.lastposttime || 0),topicData.map(t => t.tid));- await db.sortedSetAdd('topics:views',+ await db.sortedSetAdd(+ 'topics:views',topicData.map(t => t.viewcount || 0),topicData.map(t => t.tid));- await db.sortedSetAdd('topics:posts',+ await db.sortedSetAdd(+ 'topics:posts',topicData.map(t => t.postcount || 0),topicData.map(t => t.tid));- await db.sortedSetAdd('topics:votes',+ await db.sortedSetAdd(+ 'topics:votes',topicData.map(t => t.votes || 0),topicData.map(t => t.tid));diff --git a/src/user/jobs/export-profile.js b/src/user/jobs/export-profile.jsindex 465400a280..4578d6bc23 100644--- a/src/user/jobs/export-profile.js+++ b/src/user/jobs/export-profile.js@@ -79,8 +79,10 @@ async function getRoomMessages(uid, roomId) {let data = [];await batch.processSortedSet(`uid:${uid}:chat:room:${roomId}:mids`, async (mids) => {const messageData = await db.getObjects(mids.map(mid => `message:${mid}`));- data = data.concat(messageData.filter(m => m && m.fromuid === uid && !m.system)- .map(m => ({ content: m.content, timestamp: m.timestamp }))+ data = data.concat(+ messageData+ .filter(m => m && m.fromuid === uid && !m.system)+ .map(m => ({ content: m.content, timestamp: m.timestamp })));}, { batch: 500, interval: 1000 });return data;