From bda567ca01423cb1655f44326ccc6b29fce10743 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Mon, 5 Aug 2019 11:14:49 +0200 Subject: [PATCH] Fix linting errors --- spec/autocomplete.js | 20 ++++++++++---------- spec/chatbox.js | 4 ++-- spec/controlbox.js | 4 ++-- spec/messages.js | 36 ++++++++++++++++++------------------ spec/muc.js | 28 ++++++++++++++-------------- spec/omemo.js | 10 +++++----- spec/room_registration.js | 2 +- spec/spoilers.js | 4 ++-- src/converse-headline.js | 4 ++-- src/converse-oauth.js | 2 +- 10 files changed, 57 insertions(+), 57 deletions(-) diff --git a/spec/autocomplete.js b/spec/autocomplete.js index 6a46824cb..53105e116 100644 --- a/spec/autocomplete.js +++ b/spec/autocomplete.js @@ -41,8 +41,8 @@ const textarea = view.el.querySelector('textarea.chat-textarea'); const at_event = { 'target': textarea, - 'preventDefault': function noop () {}, - 'stopPropagation': function noop () {}, + 'preventDefault': function preventDefault () {}, + 'stopPropagation': function stopPropagation () {}, 'keyCode': 50, 'key': '@' }; @@ -84,8 +84,8 @@ // Press tab const tab_event = { 'target': textarea, - 'preventDefault': function noop () {}, - 'stopPropagation': function noop () {}, + 'preventDefault': function preventDefault () {}, + 'stopPropagation': function stopPropagation () {}, 'keyCode': 9, 'key': 'Tab' } @@ -97,7 +97,7 @@ const backspace_event = { 'target': textarea, - 'preventDefault': function noop () {}, + 'preventDefault': function preventDefault () {}, 'keyCode': 8 } for (var i=0; i<3; i++) { @@ -129,7 +129,7 @@ const up_arrow_event = { 'target': textarea, 'preventDefault': () => (up_arrow_event.defaultPrevented = true), - 'stopPropagation': function noop () {}, + 'stopPropagation': function stopPropagation () {}, 'keyCode': 38 } view.onKeyDown(up_arrow_event); @@ -140,8 +140,8 @@ view.onKeyDown({ 'target': textarea, - 'preventDefault': function noop () {}, - 'stopPropagation': function noop () {}, + 'preventDefault': function preventDefault () {}, + 'stopPropagation': function stopPropagation () {}, 'keyCode': 13 // Enter }); expect(textarea.value).toBe('hello s @some2 '); @@ -195,8 +195,8 @@ // Press backspace const backspace_event = { 'target': textarea, - 'preventDefault': function noop () {}, - 'stopPropagation': function noop () {}, + 'preventDefault': function preventDefault () {}, + 'stopPropagation': function stopPropagation () {}, 'keyCode': 8, 'key': 'Backspace' } diff --git a/spec/chatbox.js b/spec/chatbox.js index 273f4d1a2..bb18dbad4 100644 --- a/spec/chatbox.js +++ b/spec/chatbox.js @@ -497,7 +497,7 @@ const textarea = view.el.querySelector('.chat-textarea'); const ev = { target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }; view.onKeyDown(ev); @@ -1167,7 +1167,7 @@ view.el.querySelector('.chat-textarea').value = message; view.onKeyDown({ target: view.el.querySelector('textarea.chat-textarea'), - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(view.clearMessages).toHaveBeenCalled(); diff --git a/spec/controlbox.js b/spec/controlbox.js index 42d942f69..ec16c4089 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -267,7 +267,7 @@ async function (done, _converse) { const xhr = { - 'open': function noop () {}, + 'open': function open () {}, 'send': function () { xhr.responseText = JSON.stringify([ {"jid": "marty@mcfly.net", "fullname": "Marty McFly"}, @@ -328,7 +328,7 @@ test_utils.createContacts(_converse, 'all').openControlBox(); var modal; const xhr = { - 'open': function noop () {}, + 'open': function open () {}, 'send': function () { const value = modal.el.querySelector('input[name="name"]').value; if (value === 'existing') { diff --git a/spec/messages.js b/spec/messages.js index 860bc4d9b..ccdf181aa 100644 --- a/spec/messages.js +++ b/spec/messages.js @@ -27,7 +27,7 @@ textarea.value = 'But soft, what light through yonder airlock breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -55,7 +55,7 @@ textarea.value = 'But soft, what light through yonder window breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); expect(_converse.connection.send).toHaveBeenCalled(); @@ -161,7 +161,7 @@ textarea.value = 'But soft, what light through yonder airlock breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -184,7 +184,7 @@ textarea.value = 'But soft, what light through yonder window breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); expect(_converse.connection.send).toHaveBeenCalled(); @@ -237,7 +237,7 @@ textarea.value = 'It is the east, and Juliet is the one.'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -246,7 +246,7 @@ textarea.value = 'Arise, fair sun, and kill the envious moon'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -277,7 +277,7 @@ textarea.value = 'It is the east, and Juliet is the sun.'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.model.messages.once('rendered', resolve)); @@ -1331,7 +1331,7 @@ textarea.value = 'But soft, what light through yonder airlock breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await u.waitUntil(() => _converse.api.chats.get().length); @@ -1354,7 +1354,7 @@ textarea.value = 'Another message'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -2537,7 +2537,7 @@ textarea.value = 'But soft, what light through yonder airlock breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -2561,7 +2561,7 @@ textarea.value = 'But soft, what light through yonder window breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); expect(_converse.connection.send).toHaveBeenCalled(); @@ -2636,7 +2636,7 @@ textarea.value = 'But soft, what light through yonder airlock breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -2715,7 +2715,7 @@ textarea.value = 'But soft, what light through yonder airlock breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -2751,7 +2751,7 @@ textarea.value = 'But soft, what light through yonder airlock breaks?'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -2996,8 +2996,8 @@ textarea.value = 'hello @z3r0 @gibson @mr.robot, how are you?' const enter_event = { 'target': textarea, - 'preventDefault': function noop () {}, - 'stopPropagation': function noop () {}, + 'preventDefault': function preventDefault () {}, + 'stopPropagation': function stopPropagation () {}, 'keyCode': 13 // Enter } spyOn(_converse.connection, 'send'); @@ -3074,8 +3074,8 @@ textarea.value = 'hello @z3r0 @gibson @mr.robot, how are you?' const enter_event = { 'target': textarea, - 'preventDefault': function noop () {}, - 'stopPropagation': function noop () {}, + 'preventDefault': function preventDefault () {}, + 'stopPropagation': function stopPropagation () {}, 'keyCode': 13 // Enter } view.onKeyDown(enter_event); diff --git a/spec/muc.js b/spec/muc.js index 291219f6e..a608b305c 100644 --- a/spec/muc.js +++ b/spec/muc.js @@ -2011,7 +2011,7 @@ textarea.value = text; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -2864,7 +2864,7 @@ const textarea = view.el.querySelector('.chat-textarea'); textarea.value = '/clear'; - const enter = { 'target': textarea, 'preventDefault': function noop () {}, 'keyCode': 13 }; + const enter = { 'target': textarea, 'preventDefault': function preventDefault () {}, 'keyCode': 13 }; view.onKeyDown(enter); textarea.value = '/help'; view.onKeyDown(enter); @@ -2935,7 +2935,7 @@ await test_utils.openAndEnterChatRoom(_converse, 'lounge@montague.lit', 'romeo'); const view = _converse.chatboxviews.get('lounge@montague.lit'); var textarea = view.el.querySelector('.chat-textarea'); - const enter = { 'target': textarea, 'preventDefault': function noop () {}, 'keyCode': 13 }; + const enter = { 'target': textarea, 'preventDefault': function preventDefault () {}, 'keyCode': 13 }; spyOn(window, 'confirm').and.callFake(() => true); textarea.value = '/clear'; view.onKeyDown(enter); @@ -2999,7 +2999,7 @@ textarea.value = '/member chris Welcome to the club!'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(_converse.connection.send).not.toHaveBeenCalled(); @@ -3011,7 +3011,7 @@ textarea.value = '/member marc Welcome to the club!'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(_converse.connection.send).toHaveBeenCalled(); @@ -3126,7 +3126,7 @@ textarea.value = '/topic This is the groupchat subject'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(_converse.connection.send).toHaveBeenCalled(); @@ -3136,7 +3136,7 @@ textarea.value = '/subject This is a new subject'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); @@ -3150,7 +3150,7 @@ textarea.value = '/Subject This is yet another subject'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(sent_stanza.textContent).toBe('This is yet another subject'); @@ -3173,7 +3173,7 @@ textarea.value = '/clear'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(view.clearMessages).toHaveBeenCalled(); @@ -3215,7 +3215,7 @@ textarea.value = '/owner'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(view.validateRoleOrAffiliationChangeArgs).toHaveBeenCalled(); @@ -3303,7 +3303,7 @@ textarea.value = '/ban'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(view.validateRoleOrAffiliationChangeArgs).toHaveBeenCalled(); @@ -3404,7 +3404,7 @@ textarea.value = '/kick'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); expect(view.validateRoleOrAffiliationChangeArgs).toHaveBeenCalled(); @@ -3508,7 +3508,7 @@ textarea.value = '/op'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); @@ -3651,7 +3651,7 @@ textarea.value = '/mute'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); diff --git a/spec/omemo.js b/spec/omemo.js index d9ec39aea..284ecb3ca 100644 --- a/spec/omemo.js +++ b/spec/omemo.js @@ -126,7 +126,7 @@ textarea.value = 'This message will be encrypted'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); iq_stanza = await u.waitUntil(() => bundleFetched(_converse, contact_jid, '555')); @@ -310,7 +310,7 @@ textarea.value = 'This message will be encrypted'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); iq_stanza = await u.waitUntil(() => bundleFetched(_converse, contact_jid, '4e30f35051b7b8b42abe083742187228'), 1000); @@ -458,7 +458,7 @@ textarea.value = 'This is an encrypted message from this device'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); iq_stanza = await u.waitUntil(() => bundleFetched(_converse, _converse.bare_jid, '988349631')); @@ -515,7 +515,7 @@ textarea.value = 'This message will be encrypted'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 // Enter }); let iq_stanza = await u.waitUntil(() => deviceListFetched(_converse, contact_jid)); @@ -1251,7 +1251,7 @@ textarea.value = 'This message will be sent encrypted'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); diff --git a/spec/room_registration.js b/spec/room_registration.js index f229ea94a..8d7dded9d 100644 --- a/spec/room_registration.js +++ b/spec/room_registration.js @@ -24,7 +24,7 @@ textarea.value = '/register'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); let stanza = await u.waitUntil(() => _.filter( diff --git a/spec/spoilers.js b/spec/spoilers.js index c5d56d726..f8e10d9a9 100644 --- a/spec/spoilers.js +++ b/spec/spoilers.js @@ -111,7 +111,7 @@ textarea.value = 'This is the spoiler'; view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); @@ -188,7 +188,7 @@ view.onKeyDown({ target: textarea, - preventDefault: function noop () {}, + preventDefault: function preventDefault () {}, keyCode: 13 }); await new Promise((resolve, reject) => view.once('messageInserted', resolve)); diff --git a/src/converse-headline.js b/src/converse-headline.js index 623cd315d..93d86fb92 100644 --- a/src/converse-headline.js +++ b/src/converse-headline.js @@ -112,8 +112,8 @@ converse.plugins.add('converse-headline', { }, // Override to avoid the methods in converse-chatview.js - 'renderMessageForm': function noop () {}, - 'afterShown': function noop () {} + 'renderMessageForm': function renderMessageForm () {}, + 'afterShown': function afterShown () {} }); async function onHeadlineMessage (message) { diff --git a/src/converse-oauth.js b/src/converse-oauth.js index 128ad92c6..150493812 100644 --- a/src/converse-oauth.js +++ b/src/converse-oauth.js @@ -78,7 +78,7 @@ converse.plugins.add("converse-oauth", { }); _converse.OAuthProviders = _converse.Collection.extend({ - 'sync': _function noop () {}, + 'sync': function sync () {}, initialize () { _.each(_converse.user_settings.oauth_providers, (provider) => {