diff --git a/.eslintrc.json b/.eslintrc.json index e4570046b7..0c324d9ddc 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -310,7 +310,7 @@ "asyncArrow": "always" } ], - "space-in-parens": 0, + "space-in-parens": 2, "space-infix-ops": 0, "spaced-comment": 0, "strict": 0, diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js index b50eaca1b5..3ee25cfc17 100644 --- a/frontend_tests/node_tests/composebox_typeahead.js +++ b/frontend_tests/node_tests/composebox_typeahead.js @@ -885,7 +885,7 @@ global.people.add(deactivated_user); assert.deepEqual(item, { primary: 'py' }); th_render_typeahead_item_called = true; }; - ct.content_highlighter.call(fake_this, 'py' ); + ct.content_highlighter.call(fake_this, 'py'); fake_this = { completing: 'something-else' }; assert(!ct.content_highlighter.call(fake_this)); diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js index c97ade5695..539ee47552 100644 --- a/frontend_tests/node_tests/drafts.js +++ b/frontend_tests/node_tests/drafts.js @@ -80,7 +80,7 @@ var draft_2 = { localStorage.clear(); (function test_editDraft() { stub_timestamp(2, function () { - ls.set("drafts", { id1: draft_1 } ); + ls.set("drafts", { id1: draft_1 }); var expected = _.clone(draft_2); expected.updatedAt = 2; draft_model.editDraft("id1", _.clone(draft_2)); @@ -91,7 +91,7 @@ var draft_2 = { localStorage.clear(); (function test_deleteDraft() { - ls.set("drafts", { id1: draft_1 } ); + ls.set("drafts", { id1: draft_1 }); draft_model.deleteDraft("id1"); assert.deepEqual(ls.get("drafts"), {}); diff --git a/frontend_tests/zjsunit/output.js b/frontend_tests/zjsunit/output.js index 1d8730be19..abb5c90818 100644 --- a/frontend_tests/zjsunit/output.js +++ b/frontend_tests/zjsunit/output.js @@ -10,7 +10,7 @@ function mkdir_p(path) { try { fs.mkdirSync(path); } catch (e) { - if ( e.code !== 'EEXIST' ) { + if (e.code !== 'EEXIST') { throw e; } } diff --git a/static/js/compose.js b/static/js/compose.js index 62545b79ab..0a0eaa1f66 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -646,7 +646,7 @@ exports.initialize = function () { clone_file_input = $('#file_input').clone(true); } $("#compose #file_input").trigger("click"); - } ); + }); function show_preview(rendered_content) { var preview_html; diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index 6aa3a28ad6..6005a2f3fd 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -53,15 +53,15 @@ function query_matches_person(query, person) { // Case-insensitive. query = query.toLowerCase(); - return ( person.email .toLowerCase().indexOf(query) !== -1 - || person.full_name.toLowerCase().indexOf(query) !== -1); + return (person.email.toLowerCase().indexOf(query) !== -1 + || person.full_name.toLowerCase().indexOf(query) !== -1); } function query_matches_stream(query, stream) { query = query.toLowerCase(); - return ( stream.name .toLowerCase().indexOf(query) !== -1 - || stream.description.toLowerCase().indexOf(query) !== -1); + return (stream.name.toLowerCase().indexOf(query) !== -1 + || stream.description.toLowerCase().indexOf(query) !== -1); } // Case-insensitive @@ -493,7 +493,7 @@ exports.initialize = function () { } // limit number of items so the list doesn't fall off the screen - $( "#stream" ).typeahead({ + $("#stream").typeahead({ source: function () { return stream_data.subscribed_streams(); }, @@ -510,7 +510,7 @@ exports.initialize = function () { }, }); - $( "#subject" ).typeahead({ + $("#subject").typeahead({ source: function () { var stream_name = $("#stream").val(); return exports.topics_seen_for(stream_name); @@ -529,7 +529,7 @@ exports.initialize = function () { }, }); - $( "#private_message_recipient" ).typeahead({ + $("#private_message_recipient").typeahead({ source: people.get_all_persons, // This is a function. items: 5, dropup: true, @@ -572,7 +572,7 @@ exports.initialize = function () { exports.initialize_compose_typeahead("#new_message_content", {mention: true, emoji: true, stream: true, syntax: true}); - $( "#private_message_recipient" ).blur(function () { + $("#private_message_recipient").blur(function () { var val = $(this).val(); var recipients = typeahead_helper.get_cleaned_pm_recipients(val); $(this).val(recipients.join(", ")); diff --git a/static/js/invite.js b/static/js/invite.js index d2a40c6968..2ccc4d51f1 100644 --- a/static/js/invite.js +++ b/static/js/invite.js @@ -70,7 +70,8 @@ exports.initialize = function () { }, success: function () { $('#submit-invitation').button('reset'); - invite_status.text(i18n.t('User invited successfully.', {count: (invitee_emails.val().match(/@/g) || [] ).length})) + invite_status.text(i18n.t('User invited successfully.', + {count: (invitee_emails.val().match(/@/g) || []).length})) .addClass('alert-success') .show(); invitee_emails.val(''); diff --git a/static/js/message_edit.js b/static/js/message_edit.js index 5576a6ea98..ae1cf4e554 100644 --- a/static/js/message_edit.js +++ b/static/js/message_edit.js @@ -305,7 +305,7 @@ function edit_message(row, raw_content) { if (feature_flags.propagate_topic_edits && !message.locally_echoed) { var original_topic = message.subject; - message_edit_topic.keyup( function () { + message_edit_topic.keyup(function () { var new_topic = message_edit_topic.val(); message_edit_topic_propagate.toggle(new_topic !== original_topic && new_topic !== ""); }); diff --git a/static/js/message_list.js b/static/js/message_list.js index 352d30174c..655526d642 100644 --- a/static/js/message_list.js +++ b/static/js/message_list.js @@ -666,7 +666,7 @@ exports.MessageList.prototype = { var index = self._items.indexOf(current_message); if (index === -1) { - if ( !self.muting_enabled && current_msg_list === self) { + if (!self.muting_enabled && current_msg_list === self) { blueslip.error("Trying to re-order message but can't find message with new_id in _items!"); } return; diff --git a/static/js/narrow.js b/static/js/narrow.js index 9005b0f6d8..533f507a81 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -69,9 +69,9 @@ exports.activate = function (raw_operators, opts) { } } else if (filter.has_operator("is")) { exports.narrow_title = filter.operands("is")[0]; - } else if (filter.has_operator("pm-with") ) { + } else if (filter.has_operator("pm-with")) { exports.narrow_title = "private"; - } else if (filter.has_operator("group-pm-with") ) { + } else if (filter.has_operator("group-pm-with")) { exports.narrow_title = "private group"; } diff --git a/static/js/overlays.js b/static/js/overlays.js index cb771198de..33352357e4 100644 --- a/static/js/overlays.js +++ b/static/js/overlays.js @@ -104,7 +104,7 @@ exports.open_modal = function (name) { exports.close_overlay = function (name) { if (name !== open_overlay_name) { - blueslip.error("Trying to close " + name + " when " + open_overlay_name + " is open." ); + blueslip.error("Trying to close " + name + " when " + open_overlay_name + " is open."); return; } @@ -123,7 +123,7 @@ exports.close_overlay = function (name) { $('.header').attr("aria-hidden", "false"); if (!close_handler) { - blueslip.error("Overlay close handler for " + name + " not properly setup." ); + blueslip.error("Overlay close handler for " + name + " not properly setup."); return; } @@ -152,7 +152,7 @@ exports.close_modal = function (name) { if (exports.active_modal() !== name) { blueslip.error("Trying to close " + name + - " modal when " + exports.active_modal() + " is open." ); + " modal when " + exports.active_modal() + " is open."); return; } diff --git a/static/js/rtl.js b/static/js/rtl.js index 67575c86bc..f341c2e5a8 100644 --- a/static/js/rtl.js +++ b/static/js/rtl.js @@ -26,7 +26,7 @@ var exports = {}; */ function convert_from_raw(digits, part_length, raw) { var result = ''; - for (var i = 0; i < raw.length; ) { + for (var i = 0; i < raw.length;) { var t = 0; for (var j = 0; j < part_length; j += 1) { t = t * digits.length + digits.indexOf(raw.charAt(i)); diff --git a/static/js/search.js b/static/js/search.js index 40736ae549..18af0a6128 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -45,7 +45,7 @@ exports.initialize = function () { // just represents the key of the hash, so it's redundant.) var search_object = {}; - $( "#search_query" ).typeahead({ + $("#search_query").typeahead({ source: function (query) { var suggestions = search_suggestion.get_suggestions(query); // Update our global search_object hash diff --git a/static/js/search_suggestion.js b/static/js/search_suggestion.js index ddfeda05c7..34aa75626d 100644 --- a/static/js/search_suggestion.js +++ b/static/js/search_suggestion.js @@ -111,7 +111,7 @@ function get_stream_suggestions(last, operators) { } function get_group_suggestions(all_persons, last, operators) { - if (last.operator !== 'pm-with' ) { + if (last.operator !== 'pm-with') { return []; } diff --git a/static/js/ui_init.js b/static/js/ui_init.js index 5e96547827..79c968854d 100644 --- a/static/js/ui_init.js +++ b/static/js/ui_init.js @@ -94,8 +94,8 @@ $(function () { var max_scroll = this.scrollHeight - self.innerHeight() - 1; e.stopPropagation(); - if ( ((delta < 0) && (scroll <= 0)) - || ((delta > 0) && (scroll >= max_scroll))) { + if (((delta < 0) && (scroll <= 0)) || + ((delta > 0) && (scroll >= max_scroll))) { e.preventDefault(); } });