Skip to content

Commit 39c1b92

Browse files
committed
Fix no-confusing-arrow
1 parent 844151f commit 39c1b92

File tree

11 files changed

+25
-13
lines changed

11 files changed

+25
-13
lines changed

.eslintrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
"prefer-rest-params": 2,
6565
"arrow-spacing": 2,
6666
"arrow-body-style": [2, "as-needed"],
67-
"no-confusing-arrow": 2,
67+
"no-confusing-arrow": [2, { "allowParens": true }],
6868
"dot-notation": 2,
6969
"no-nested-ternary": 2,
7070
"no-unneeded-ternary": 2,

packages/rocketchat-2fa/client/accountSecurity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ Template.accountSecurity.onCreated(function() {
135135
this.codesRemaining = new ReactiveVar();
136136

137137
this.showBackupCodes = (userCodes) => {
138-
const backupCodes = userCodes.map((value, index) => (index + 1) % 4 === 0 && index < 11 ? `${ value }\n` : `${ value } `).join('');
138+
const backupCodes = userCodes.map((value, index) => ((index + 1) % 4 === 0 && index < 11 ? `${ value }\n` : `${ value } `)).join('');
139139
const codes = `<code class="text-center allow-text-selection">${ backupCodes }</code>`;
140140
modal.open({
141141
title: t('Backup_codes'),

packages/rocketchat-apps/server/bridges/http.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export class AppHttpBridge {
77
console.log(`The App ${ info.appId } is requesting from the outter webs:`, info);
88

99
return new Promise((resolve, reject) => {
10-
HTTP.call(info.method, info.url, info.request, (e, result) => e ? reject(e.response) : resolve(result));
10+
HTTP.call(info.method, info.url, info.request, (e, result) => (e ? reject(e.response) : resolve(result)));
1111
});
1212
}
1313
}

packages/rocketchat-autotranslate/server/autotranslate.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class AutoTranslate {
140140
deTokenize(message) {
141141
if (message.tokens && message.tokens.length > 0) {
142142
for (const { token, text, noHtml } of message.tokens) {
143-
message.msg = message.msg.replace(token, () => noHtml ? noHtml : text);
143+
message.msg = message.msg.replace(token, () => (noHtml ? noHtml : text));
144144
}
145145
}
146146
return message.msg;

packages/rocketchat-ldap/server/sync.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,12 @@ export function getDataToSyncUserData(ldapUser, user) {
129129
// TODO: Find a better solution.
130130
const dKeys = userField.split('.');
131131
const lastKey = _.last(dKeys);
132-
_.reduce(dKeys, (obj, currKey) =>
132+
_.reduce(dKeys, (obj, currKey) => (
133133
(currKey === lastKey)
134134
? obj[currKey] = tmpLdapField
135135
: obj[currKey] = obj[currKey] || {}
136-
, userData);
136+
, userData)
137+
);
137138
logger.debug(`user.${ userField } changed to: ${ tmpLdapField }`);
138139
}
139140
}

packages/rocketchat-markdown/markdown.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ class MarkdownClass {
4848
mountTokensBack(message, useHtml = true) {
4949
if (message.tokens && message.tokens.length > 0) {
5050
for (const { token, text, noHtml } of message.tokens) {
51-
message.html = message.html.replace(token, () => useHtml ? text : noHtml); // Uses lambda so doesn't need to escape $
51+
message.html = message.html.replace(token, () => (useHtml ? text : noHtml)); // Uses lambda so doesn't need to escape $
5252
}
5353
}
5454

packages/rocketchat-ui-flextab/client/tabs/membersList.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,9 @@ Template.membersList.events({
197197
user: this.user.user,
198198
hideAdminControls: RocketChat.roomTypes.roomTypes[room.t].userDetailShowAdmin(room) || false,
199199
directActions: RocketChat.roomTypes.roomTypes[room.t].userDetailShowAll(room) || false,
200-
}).map((action) => typeof action === 'function' ? action.call(this) : action).filter((action) => action && (!action.condition || action.condition.call(this)));
200+
})
201+
.map((action) => (typeof action === 'function' ? action.call(this) : action))
202+
.filter((action) => action && (!action.condition || action.condition.call(this)));
201203
const groups = [];
202204
const columns = [];
203205
const admin = _actions.filter((action) => action.group === 'admin');

packages/rocketchat-ui-flextab/client/tabs/userInfo.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import moment from 'moment';
66
import { getActions } from './userActions';
77

88
const more = function() {
9-
return Template.instance().actions.get().map((action) => typeof action === 'function' ? action.call(this) : action).filter((action) => action && (!action.condition || action.condition.call(this))).slice(2);
9+
return Template.instance().actions.get()
10+
.map((action) => (typeof action === 'function' ? action.call(this) : action))
11+
.filter((action) => action && (!action.condition || action.condition.call(this)))
12+
.slice(2);
1013
};
1114

1215

@@ -17,7 +20,10 @@ Template.userInfo.helpers({
1720
moreActions: more,
1821

1922
actions() {
20-
return Template.instance().actions.get().map((action) => typeof action === 'function' ? action.call(this) : action).filter((action) => action && (!action.condition || action.condition.call(this))).slice(0, 2);
23+
return Template.instance().actions.get()
24+
.map((action) => (typeof action === 'function' ? action.call(this) : action))
25+
.filter((action) => action && (!action.condition || action.condition.call(this)))
26+
.slice(0, 2);
2127
},
2228
customField() {
2329
const sCustomFieldsToShow = RocketChat.settings.get('Accounts_CustomFieldsToShowInUserInfo').trim();

packages/rocketchat-ui-message/client/message.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,10 @@ Template.message.helpers({
222222
return Object.keys(this.reactions || {}).map((emoji) => {
223223
const reaction = this.reactions[emoji];
224224
const total = reaction.usernames.length;
225-
let usernames = reaction.usernames.slice(0, 15).map((username) => username === userUsername ? t('You').toLowerCase() : `@${ username }`).join(', ');
225+
let usernames = reaction.usernames
226+
.slice(0, 15)
227+
.map((username) => (username === userUsername ? t('You').toLowerCase() : `@${ username }`))
228+
.join(', ');
226229
if (total > 15) {
227230
usernames = `${ usernames } ${ t('And_more', {
228231
length: total - 15,

packages/rocketchat-ui/client/components/tabs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Template.tabs.events({
1212

1313
Template.tabs.helpers({
1414
tabs() {
15-
return Template.instance().data.tabs.tabs.filter((tab) => tab.condition ? tab.condition() : tab);
15+
return Template.instance().data.tabs.tabs.filter((tab) => (tab.condition ? tab.condition() : tab));
1616
},
1717
isActive(value) {
1818
return Template.instance().activeTab.get() === value;

0 commit comments

Comments
 (0)