Skip to content

Commit 50a6cf1

Browse files
committed
Fix remaining lint errors
1 parent 39c1b92 commit 50a6cf1

File tree

12 files changed

+43
-57
lines changed

12 files changed

+43
-57
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@ export class AppSettingBridge {
2222
async getAll(appId) {
2323
console.log(`The App ${ appId } is getting all the settings.`);
2424

25-
return RocketChat.models.Settings.find({ _id: { $nin: this.disallowedSettings } }).fetch().map((s) => {
26-
this.orch.getConverters().get('settings').convertToApp(s);
27-
});
25+
return RocketChat.models.Settings.find({ _id: { $nin: this.disallowedSettings } })
26+
.fetch()
27+
.map((s) => this.orch.getConverters().get('settings').convertToApp(s));
2828
}
2929

3030
async getOneById(id, appId) {

packages/rocketchat-channel-settings/client/views/channelSettings.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,13 +150,15 @@ Template.channelSettingsEditing.events({
150150
value: 'disabled',
151151
}];
152152

153-
const value = this.value.get() ? 'enabled' : this.value.get() === false ? 'disabled' : 'default';
153+
const falseOrDisabled = this.value.get() === false ? 'disabled' : 'default';
154+
const value = this.value.get() ? 'enabled' : falseOrDisabled;
154155
const config = {
155156
popoverClass: 'notifications-preferences',
156157
template: 'pushNotificationsPopover',
157158
data: {
158159
change : (value) => {
159-
const realValue = value === 'enabled' ? true : value === 'disabled' ? false : undefined;
160+
const falseOrUndefined = value === 'disabled' ? false : undefined;
161+
const realValue = value === 'enabled' ? true : falseOrUndefined;
160162
return this.value.set(realValue);
161163
},
162164
value,

packages/rocketchat-cors/cors.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ const oldHttpServerListeners = WebApp.httpServer.listeners('request').slice(0);
8787
WebApp.httpServer.removeAllListeners('request');
8888

8989
WebApp.httpServer.addListener('request', function(req, res) {
90-
const next = () => {
90+
const next = (...args) => {
9191
for (const oldListener of oldHttpServerListeners) {
92-
oldListener.apply(WebApp.httpServer, arguments);
92+
oldListener.apply(WebApp.httpServer, args);
9393
}
9494
};
9595

packages/rocketchat-crowd/client/loginHelper.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
Meteor.loginWithCrowd = function(username, password, callback) {
2-
// Retrieve arguments as array
3-
const args = [];
4-
for (let i = 0; i < arguments.length; i++) {
5-
args.push(arguments[i]);
6-
}
1+
Meteor.loginWithCrowd = function(...args) {
72
// Pull username and password
8-
username = args.shift();
9-
password = args.shift();
3+
const username = args.shift();
4+
const password = args.shift();
5+
const callback = args.shift();
6+
107
const loginRequest = {
118
crowd: true,
129
username,
@@ -15,12 +12,11 @@ Meteor.loginWithCrowd = function(username, password, callback) {
1512
Accounts.callLoginMethod({
1613
methodArguments: [loginRequest],
1714
userCallback(error) {
18-
if (error) {
19-
if (callback) {
20-
callback(error);
15+
if (callback) {
16+
if (error) {
17+
return callback(error);
2118
}
22-
} else if (callback) {
23-
callback();
19+
return callback();
2420
}
2521
},
2622
});

packages/rocketchat-ldap/client/loginHelper.js

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,17 @@
22
// customLdapOptions should be passed in if you want to override LDAP_DEFAULTS
33
// on any particular call (if you have multiple ldap servers you'd like to connect to)
44
// You'll likely want to set the dn value here {dn: "..."}
5-
Meteor.loginWithLDAP = function(username, password, customLdapOptions, callback) {
6-
// Retrieve arguments as array
7-
const args = [];
8-
for (let i = 0; i < arguments.length; i++) {
9-
args.push(arguments[i]);
10-
}
5+
Meteor.loginWithLDAP = function(...args) {
116
// Pull username and password
12-
username = args.shift();
13-
password = args.shift();
7+
const username = args.shift();
8+
const password = args.shift();
149

1510
// Check if last argument is a function
1611
// if it is, pop it off and set callback to it
17-
if (typeof args[args.length - 1] === 'function') {
18-
callback = args.pop();
19-
} else {
20-
callback = null;
21-
}
12+
const callback = typeof args[args.length - 1] === 'function' ? args.pop() : null;
2213

2314
// if args still holds options item, grab it
24-
if (args.length > 0) {
25-
customLdapOptions = args.shift();
26-
} else {
27-
customLdapOptions = {};
28-
}
15+
const customLdapOptions = args.length > 0 ? args.shift() : {};
2916

3017
// Set up loginRequest object
3118
const loginRequest = {

packages/rocketchat-markdown/parser/original/code.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,8 @@ const codeblocks = (message) => {
4545
// Process highlight if this part is code
4646
const singleLine = codeMatch[0].indexOf('\n') === -1;
4747
const lang = !singleLine && Array.from(hljs.listLanguages()).includes(s.trim(codeMatch[1])) ? s.trim(codeMatch[1]) : '';
48-
const code =
49-
singleLine ?
50-
s.unescapeHTML(codeMatch[1]) :
51-
lang === '' ?
52-
s.unescapeHTML(codeMatch[1] + codeMatch[2]) :
53-
s.unescapeHTML(codeMatch[2]);
48+
const emptyLanguage = lang === '' ? s.unescapeHTML(codeMatch[1] + codeMatch[2]) : s.unescapeHTML(codeMatch[2]);
49+
const code = singleLine ? s.unescapeHTML(codeMatch[1]) : emptyLanguage;
5450

5551
const result = lang === '' ? hljs.highlightAuto((lang + code)) : hljs.highlight(lang, code);
5652
const token = `=!=${ Random.id() }=!=`;

packages/rocketchat-push-notifications/client/views/pushNotificationsFlexTab.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ Template.pushNotificationsFlexTab.onCreated(function() {
158158
}
159159
let value = this.form[field].get();
160160

161-
value = typeof value === 'boolean' ? value ? '1' : '0' : value;
161+
if (typeof value === 'boolean') {
162+
value = value ? '1' : '0';
163+
}
162164
const rid = Session.get('openedRoom');
163165
switch (field) {
164166
case 'desktopNotificationDuration':

packages/rocketchat-search/server/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import './model/provider';
1+
import SearchProvider from './model/provider';
22
import './service/providerService.js';
33
import './service/validationService.js';
44
import './events/events.js';
55
import './provider/defaultProvider.js';
66

77
import { searchProviderService } from './service/providerService';
8-
import SearchProvider from './model/provider';
98

109
export {
1110
searchProviderService,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ function firefoxPasteUpload(fn) {
287287
if (!user || user[1] > 49) {
288288
return fn;
289289
}
290-
return function(event, instance) {
290+
return function(event, instance, ...args) {
291291
if ((event.originalEvent.ctrlKey || event.originalEvent.metaKey) && (event.keyCode === 86)) {
292292
const textarea = instance.find('textarea');
293293
const { selectionStart, selectionEnd } = textarea;
@@ -328,7 +328,7 @@ function firefoxPasteUpload(fn) {
328328
}
329329
}, 150);
330330
}
331-
return fn && fn.apply(this, arguments);
331+
return fn && fn.apply(this, [event, instance, ...args]);
332332
};
333333
}
334334

@@ -401,15 +401,15 @@ Template.messageBox.events({
401401
return;
402402
}
403403
const items = [...e.originalEvent.clipboardData.items];
404-
const files = items.map((item) => {
405-
if (item.kind === 'file' && item.type.indexOf('image/') !== -1) {
404+
const files = items
405+
.filter((item) => (item.kind === 'file' && item.type.indexOf('image/') !== -1))
406+
.map((item) => {
406407
e.preventDefault();
407408
return {
408409
file: item.getAsFile(),
409410
name: `Clipboard - ${ moment().format(RocketChat.settings.get('Message_TimeAndDateFormat')) }`,
410411
};
411-
}
412-
}).filter((e) => e);
412+
});
413413
if (files.length) {
414414
return fileUpload(files);
415415
} else {

packages/rocketchat-ui/client/lib/tapi18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ this.tr = function(key, options, ...replaces) {
2323
};
2424

2525
this.isRtl = (lang) => {
26-
const language = lang ? lang : localStorage.getItem('userLanguage') ? localStorage.getItem('userLanguage') : 'en-US';
26+
const language = lang || localStorage.getItem('userLanguage') || 'en-US';
2727
return ['ar', 'dv', 'fa', 'he', 'ku', 'ps', 'sd', 'ug', 'ur', 'yi'].includes(language.split('-').shift().toLowerCase());
2828
};

0 commit comments

Comments
 (0)