From 8d1462ffd83c70c3d020a3bee1a8f0272722ace1 Mon Sep 17 00:00:00 2001 From: Peter Jaszkowiak Date: Thu, 4 Feb 2021 00:13:32 -0700 Subject: [PATCH] chore: eslint object-curly-newline --- .eslintrc | 3 +- src/controllers/accounts/helpers.js | 6 ++-- src/controllers/osd.js | 44 +++++++++++++++++------------ src/database/mongo/sets.js | 10 ++++--- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/.eslintrc b/.eslintrc index 8f094ce324..dffb62726f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -54,8 +54,7 @@ "no-use-before-define": ["error", "nofunc"], // require consistent newlines before and after braces // if contents are multiline - // "object-curly-newline": ["error", { "consistent": true, "multiline": true }], - "object-curly-newline": "off", + "object-curly-newline": ["error", { "consistent": true, "multiline": true }], // require consistent linebreaks inline function parenthesis (arguments or params) "function-paren-newline": ["error", "consistent"], // only require const if all parts of destructuring can be const diff --git a/src/controllers/accounts/helpers.js b/src/controllers/accounts/helpers.js index a38d1659c3..f94b73095a 100644 --- a/src/controllers/accounts/helpers.js +++ b/src/controllers/accounts/helpers.js @@ -233,13 +233,15 @@ async function parseAboutMe(userData) { function filterLinks(links, states) { return links.filter((link, index) => { // Default visibility - link.visibility = { self: true, + link.visibility = { + self: true, other: true, moderator: true, globalMod: true, admin: true, canViewInfo: true, - ...link.visibility }; + ...link.visibility, + }; const permit = Object.keys(states).some(state => states[state] && link.visibility[state]); diff --git a/src/controllers/osd.js b/src/controllers/osd.js index 194734c26d..244f8326f4 100644 --- a/src/controllers/osd.js +++ b/src/controllers/osd.js @@ -17,28 +17,36 @@ module.exports.handle = function (req, res, next) { function generateXML() { return xml([{ OpenSearchDescription: [ - { _attr: { - xmlns: 'http://a9.com/-/spec/opensearch/1.1/', - 'xmlns:moz': 'http://www.mozilla.org/2006/browser/search/', - } }, + { + _attr: { + xmlns: 'http://a9.com/-/spec/opensearch/1.1/', + 'xmlns:moz': 'http://www.mozilla.org/2006/browser/search/', + }, + }, { ShortName: trimToLength(String(meta.config.title || meta.config.browserTitle || 'NodeBB'), 16) }, { Description: trimToLength(String(meta.config.description || ''), 1024) }, { InputEncoding: 'UTF-8' }, - { Image: [ - { _attr: { - width: '16', - height: '16', - type: 'image/x-icon', - } }, - `${nconf.get('url')}/favicon.ico`, - ] }, - { Url: { - _attr: { - type: 'text/html', - method: 'get', - template: `${nconf.get('url')}/search?term={searchTerms}&in=titlesposts`, + { + Image: [ + { + _attr: { + width: '16', + height: '16', + type: 'image/x-icon', + }, + }, + `${nconf.get('url')}/favicon.ico`, + ], + }, + { + Url: { + _attr: { + type: 'text/html', + method: 'get', + template: `${nconf.get('url')}/search?term={searchTerms}&in=titlesposts`, + }, }, - } }, + }, { 'moz:SearchForm': `${nconf.get('url')}/search` }, ], }], { declaration: true, indent: '\t' }); diff --git a/src/database/mongo/sets.js b/src/database/mongo/sets.js index 93c43c7529..a6433c5680 100644 --- a/src/database/mongo/sets.js +++ b/src/database/mongo/sets.js @@ -39,11 +39,13 @@ module.exports = function (module) { const bulk = module.client.collection('objects').initializeUnorderedBulkOp(); for (let i = 0; i < keys.length; i += 1) { - bulk.find({ _key: keys[i] }).upsert().updateOne({ $addToSet: { - members: { - $each: value, + bulk.find({ _key: keys[i] }).upsert().updateOne({ + $addToSet: { + members: { + $each: value, + }, }, - } }); + }); } try { await bulk.execute();