From 799c8817633f6afa0b731fc3b5434e463bd850e3 Mon Sep 17 00:00:00 2001 From: Daniel Gasienica Date: Thu, 15 Feb 2018 17:12:18 -0500 Subject: [PATCH] Enable ESLint `function-paren-newline` `multiline` Per discussion. --- .eslintrc.js | 2 +- js/background.js | 33 ++++++++++++++++++--------------- js/models/conversations.js | 23 ++++++++++------------- 3 files changed, 29 insertions(+), 29 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 2eea27ec8..4671b5c24 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -21,7 +21,7 @@ module.exports = { }], // putting params on their own line helps stay within line length limit - 'function-paren-newline': ['error', 'consistent'], + 'function-paren-newline': ['error', 'multiline'], // 90 characters allows three+ side-by-side screens on a standard-size monitor 'max-len': ['error', { diff --git a/js/background.js b/js/background.js index 7e84cb9e4..885ac6a03 100644 --- a/js/background.js +++ b/js/background.js @@ -497,18 +497,19 @@ /* eslint-enable */ /* jshint ignore:start */ - function createMessageHandler( - { createMessage, getMessageDescriptor, handleProfileUpdate } - ) { + function createMessageHandler({ + createMessage, + getMessageDescriptor, + handleProfileUpdate, + }) { return async (event) => { const { data, confirm } = event; const messageDescriptor = getMessageDescriptor(data); - const isProfileUpdate = Boolean( - // eslint-disable-next-line no-bitwise - data.message.flags & textsecure.protobuf.DataMessage.Flags.PROFILE_KEY_UPDATE - ); + const { PROFILE_KEY_UPDATE } = textsecure.protobuf.DataMessage.Flags; + // eslint-disable-next-line no-bitwise + const isProfileUpdate = Boolean(data.message.flags & PROFILE_KEY_UPDATE); if (isProfileUpdate) { return handleProfileUpdate({ data, confirm, messageDescriptor }); } @@ -522,7 +523,8 @@ const upgradedMessage = await Message.upgradeSchema(data.message); await ConversationController.getOrCreateAndWait( - messageDescriptor.id, messageDescriptor.type + messageDescriptor.id, + messageDescriptor.type ); return message.handleDataMessage( upgradedMessage, @@ -533,9 +535,11 @@ } // Received: - async function handleMessageReceivedProfileUpdate( - { data, confirm, messageDescriptor } - ) { + async function handleMessageReceivedProfileUpdate({ + data, + confirm, + messageDescriptor, + }) { const profileKey = data.message.profileKey.toArrayBuffer(); const sender = await ConversationController.getOrCreateAndWait( messageDescriptor.id, @@ -552,11 +556,10 @@ }); // Sent: - async function handleMessageSentProfileUpdate( - { confirm, messageDescriptor } - ) { + async function handleMessageSentProfileUpdate({ confirm, messageDescriptor }) { const conversation = await ConversationController.getOrCreateAndWait( - messageDescriptor.id, messageDescriptor.type + messageDescriptor.id, + messageDescriptor.type ); await conversation.save({ profileSharing: true }); return confirm(); diff --git a/js/models/conversations.js b/js/models/conversations.js index a50f962aa..45bc96c94 100644 --- a/js/models/conversations.js +++ b/js/models/conversations.js @@ -617,9 +617,8 @@ now ); - const upgradedAttachments = await Promise.all( - attachments.map(Attachment.upgradeSchema) - ); + const upgradedAttachments = + await Promise.all(attachments.map(Attachment.upgradeSchema)); const message = this.messageCollection.add({ body, conversationId: this.id, @@ -658,16 +657,14 @@ profileKey = storage.get('profileKey'); } - message.send( - sendFunc( - this.get('id'), - body, - upgradedAttachments, - now, - this.get('expireTimer'), - profileKey - ) - ); + message.send(sendFunc( + this.get('id'), + body, + upgradedAttachments, + now, + this.get('expireTimer'), + profileKey + )); }); }, /* jshint ignore:end */