eslint: Fix unicorn/prefer-array-find.

https://github.com/sindresorhus/eslint-plugin-unicorn/blob/master/docs/rules/prefer-array-find.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-10-07 02:24:24 -07:00 committed by Tim Abbott
parent 72cc78dfa3
commit 2694f5caed
3 changed files with 4 additions and 4 deletions

View File

@ -878,7 +878,7 @@ run_test("updates", () => {
const all_people = get_all_persons();
assert.equal(all_people.length, 2);
person = all_people.filter((p) => p.email === new_email)[0];
person = all_people.find((p) => p.email === new_email);
assert.equal(person.full_name, "Foo Barson");
// Test shim where we can still retrieve user info using the

View File

@ -454,7 +454,7 @@ run_test("add_and_remove_reaction", () => {
const result = reactions.get_message_reactions(message);
assert(reaction_element.hasClass("reacted"));
const realm_emoji_data = result.filter((v) => v.emoji_name === "realm_emoji")[0];
const realm_emoji_data = result.find((v) => v.emoji_name === "realm_emoji");
assert.equal(realm_emoji_data.count, 2);
assert.equal(realm_emoji_data.is_realm_emoji, true);

View File

@ -50,9 +50,9 @@ exports.schedule_message = function (request) {
const command_line = raw_message[0];
const message = raw_message.slice(1).join("\n");
const deferred_message_type = deferred_message_types.filter(
const deferred_message_type = deferred_message_types.find(
(props) => command_line.match(props.test) !== null,
)[0];
);
const command = command_line.match(deferred_message_type.test)[0];
const deliver_at = command_line.slice(command.length + 1);