eslint: Enable arrow-parens.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg
2020-07-01 16:39:34 -07:00
committed by Tim Abbott
parent d51afcf485
commit b0253c5a2e
96 changed files with 240 additions and 238 deletions

View File

@@ -41,7 +41,7 @@ exports.init = function () {
exports.init();
function split_to_ints(lst) {
return lst.split(',').map(s => parseInt(s, 10));
return lst.split(',').map((s) => parseInt(s, 10));
}
@@ -151,7 +151,7 @@ exports.huddle_string = function (message) {
return;
}
let user_ids = message.display_recipient.map(recip => recip.id);
let user_ids = message.display_recipient.map((recip) => recip.id);
function is_huddle_recip(user_id) {
return user_id &&
@@ -173,7 +173,7 @@ exports.huddle_string = function (message) {
exports.user_ids_string_to_emails_string = function (user_ids_string) {
const user_ids = split_to_ints(user_ids_string);
let emails = user_ids.map(user_id => {
let emails = user_ids.map((user_id) => {
const person = people_by_user_id_dict.get(user_id);
return person && person.email;
});
@@ -183,7 +183,7 @@ exports.user_ids_string_to_emails_string = function (user_ids_string) {
return;
}
emails = emails.map(email => email.toLowerCase());
emails = emails.map((email) => email.toLowerCase());
emails.sort();
@@ -192,7 +192,7 @@ exports.user_ids_string_to_emails_string = function (user_ids_string) {
exports.user_ids_string_to_ids_array = function (user_ids_string) {
const user_ids = user_ids_string.split(',');
const ids = user_ids.map(id => Number(id));
const ids = user_ids.map((id) => Number(id));
return ids;
};
@@ -212,7 +212,7 @@ exports.reply_to_to_user_ids_string = function (emails_string) {
// invalid data.
const emails = emails_string.split(',');
let user_ids = emails.map(email => {
let user_ids = emails.map((email) => {
const person = exports.get_by_email(email);
return person && person.user_id;
});
@@ -261,7 +261,7 @@ exports.emails_strings_to_user_ids_string = function (emails_string) {
};
exports.email_list_to_user_ids_string = function (emails) {
let user_ids = emails.map(email => {
let user_ids = emails.map((email) => {
const person = exports.get_by_email(email);
return person && person.user_id;
});
@@ -277,7 +277,7 @@ exports.email_list_to_user_ids_string = function (emails) {
};
exports.safe_full_names = function (user_ids) {
let names = user_ids.map(user_id => {
let names = user_ids.map((user_id) => {
const person = people_by_user_id_dict.get(user_id);
return person && person.full_name;
});
@@ -295,7 +295,7 @@ exports.get_recipients = function (user_ids_string) {
// See message_store.get_pm_full_names() for a similar function.
const user_ids = split_to_ints(user_ids_string);
const other_ids = user_ids.filter(user_id => !exports.is_my_user_id(user_id));
const other_ids = user_ids.filter((user_id) => !exports.is_my_user_id(user_id));
if (other_ids.length === 0) {
// private message with oneself
@@ -323,7 +323,7 @@ exports.pm_reply_to = function (message) {
return;
}
const emails = user_ids.map(user_id => {
const emails = user_ids.map((user_id) => {
const person = people_by_user_id_dict.get(user_id);
if (!person) {
blueslip.error('Unknown user id in message: ' + user_id);
@@ -343,7 +343,7 @@ function sorted_other_user_ids(user_ids) {
// This excludes your own user id unless you're the only user
// (i.e. you sent a message to yourself).
const other_user_ids = user_ids.filter(user_id => !exports.is_my_user_id(user_id));
const other_user_ids = user_ids.filter((user_id) => !exports.is_my_user_id(user_id));
if (other_user_ids.length >= 1) {
user_ids = other_user_ids;
@@ -389,7 +389,7 @@ exports.all_user_ids_in_pm = function (message) {
return;
}
let user_ids = message.display_recipient.map(recip => recip.id);
let user_ids = message.display_recipient.map((recip) => recip.id);
user_ids = sort_numerically(user_ids);
return user_ids;
@@ -405,7 +405,7 @@ exports.pm_with_user_ids = function (message) {
return;
}
const user_ids = message.display_recipient.map(recip => recip.id);
const user_ids = message.display_recipient.map((recip) => recip.id);
return sorted_other_user_ids(user_ids);
};
@@ -420,8 +420,8 @@ exports.group_pm_with_user_ids = function (message) {
return;
}
const user_ids = message.display_recipient.map(recip => recip.id);
const is_user_present = user_ids.some(user_id => exports.is_my_user_id(user_id));
const user_ids = message.display_recipient.map((recip) => recip.id);
const is_user_present = user_ids.some((user_id) => exports.is_my_user_id(user_id));
if (is_user_present) {
user_ids.sort();
if (user_ids.length > 2) {
@@ -483,19 +483,19 @@ exports.update_email_in_reply_to = function (reply_to, user_id, new_email) {
// and we don't warn on any errors.
let emails = reply_to.split(',');
const persons = emails.map(email => people_dict.get(email.trim()));
const persons = emails.map((email) => people_dict.get(email.trim()));
if (!persons.every(Boolean)) {
return reply_to;
}
const needs_patch = persons.some(person => person.user_id === user_id);
const needs_patch = persons.some((person) => person.user_id === user_id);
if (!needs_patch) {
return reply_to;
}
emails = persons.map(person => {
emails = persons.map((person) => {
if (person.user_id === user_id) {
return new_email;
}
@@ -507,8 +507,8 @@ exports.update_email_in_reply_to = function (reply_to, user_id, new_email) {
exports.pm_with_operand_ids = function (operand) {
let emails = operand.split(',');
emails = emails.map(email => email.trim());
let persons = emails.map(email => people_dict.get(email));
emails = emails.map((email) => email.trim());
let persons = emails.map((email) => people_dict.get(email));
// If your email is included in a PM group with other people, just ignore it
if (persons.length > 1) {
@@ -519,7 +519,7 @@ exports.pm_with_operand_ids = function (operand) {
return;
}
let user_ids = persons.map(person => person.user_id);
let user_ids = persons.map((person) => person.user_id);
user_ids = sort_numerically(user_ids);
@@ -579,7 +579,7 @@ exports.exclude_me_from_string = function (user_ids_string) {
return user_ids.join(',');
}
user_ids = user_ids.filter(user_id => !exports.is_my_user_id(user_id));
user_ids = user_ids.filter((user_id) => !exports.is_my_user_id(user_id));
return user_ids.join(',');
};
@@ -700,7 +700,7 @@ exports.is_valid_email_for_compose = function (email) {
exports.is_valid_bulk_emails_for_compose = function (emails) {
// Returns false if at least one of the emails is invalid.
return emails.every(email => {
return emails.every((email) => {
if (!exports.is_valid_email_for_compose(email)) {
return false;
}
@@ -851,7 +851,7 @@ exports.get_message_people = function () {
semantics
*/
const message_people = message_store.user_ids().map(
user_id => people_by_user_id_dict.get(user_id)
(user_id) => people_by_user_id_dict.get(user_id)
).filter(Boolean);
return message_people;
@@ -892,7 +892,7 @@ exports.build_termlet_matcher = function (termlet) {
}
const names = full_name.toLowerCase().split(' ');
return names.some(name => name.startsWith(termlet));
return names.some((name) => name.startsWith(termlet));
};
};
@@ -909,7 +909,7 @@ exports.build_person_matcher = function (query) {
return true;
}
return termlet_matchers.every(matcher => matcher(user));
return termlet_matchers.every((matcher) => matcher(user));
};
};
@@ -918,7 +918,7 @@ exports.filter_people_by_search_terms = function (users, search_terms) {
// Build our matchers outside the loop to avoid some
// search overhead that is not user-specific.
const matchers = search_terms.map(search_term => exports.build_person_matcher(search_term));
const matchers = search_terms.map((search_term) => exports.build_person_matcher(search_term));
// Loop through users and populate filtered_users only
// if they include search_terms
@@ -930,7 +930,7 @@ exports.filter_people_by_search_terms = function (users, search_terms) {
}
// Return user emails that include search terms
const match = matchers.some(matcher => matcher(user));
const match = matchers.some((matcher) => matcher(user));
if (match) {
filtered_users.set(person.user_id, true);
@@ -1198,7 +1198,7 @@ exports.filter_for_user_settings_search = function (persons, query) {
See #13554 for more context.
*/
return persons.filter(person => exports.matches_user_settings_search(person, query));
return persons.filter((person) => exports.matches_user_settings_search(person, query));
};
exports.maybe_incr_recipient_count = function (message) {