Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
js: Use inside variant of IIFE wrappers.
Anders Kaseorga20c12366fb8
diff --git a/.eslintrc.json b/.eslintrc.jsonindex 87cb1461bca..a230004cbe2 100644--- a/.eslintrc.json+++ b/.eslintrc.json@@ -136,7 +136,7 @@"strict": "off","template-curly-spacing": "error","valid-typeof": [ "error", { "requireStringLiterals": true } ],- "wrap-iife": "error",+ "wrap-iife": ["error", "inside"],"yoda": "error"},"overrides": [diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.jsindex a6ff1b420b4..03967137527 100644--- a/frontend_tests/node_tests/activity.js+++ b/frontend_tests/node_tests/activity.js@@ -336,7 +336,7 @@ run_test("handlers", () => {activity.user_cursor.go_to(alice.user_id);filter_key_handlers.down_arrow();filter_key_handlers.up_arrow();- }());+ })();(function test_click_filter() {init();@@ -346,7 +346,7 @@ run_test("handlers", () => {const handler = $(".user-list-filter").get_on_handler("focus");handler(e);- }());+ })();(function test_click_header_filter() {init();@@ -358,7 +358,7 @@ run_test("handlers", () => {handler(e);// and click againhandler(e);- }());+ })();(function test_enter_key() {init();@@ -378,7 +378,7 @@ run_test("handlers", () => {// get line coverage for cleared caseactivity.user_cursor.clear();filter_key_handlers.enter_key();- }());+ })();(function test_click_handler() {init();@@ -393,14 +393,14 @@ run_test("handlers", () => {activity.narrow_for_user({li: alice_li});assert(narrowed);- }());+ })();(function test_blur_filter() {init();const e = {};const handler = $(".user-list-filter").get_on_handler("blur");handler(e);- }());+ })();});presence.presence_info = new Map();diff --git a/frontend_tests/node_tests/bot_data.js b/frontend_tests/node_tests/bot_data.jsindex 2d7adfe9f77..85df95b71e1 100644--- a/frontend_tests/node_tests/bot_data.js+++ b/frontend_tests/node_tests/bot_data.js@@ -65,7 +65,7 @@ run_test("test_basics", () => {assert.equal("http://bar.com", services[0].base_url);assert.equal(1, services[0].interface);assert.equal(undefined, bot.extra);- }());+ })();(function test_update() {bot_data.add(test_bot);@@ -88,7 +88,7 @@ run_test("test_basics", () => {bot = bot_data.get(43);assert.equal(bot.owner_id, fred.user_id);- }());+ })();(function test_embedded_bot_update() {bot_data.add(test_embedded_bot);@@ -97,7 +97,7 @@ run_test("test_basics", () => {assert.equal("12345678", services[0].config_data.key);bot_data.update(bot_id, {services: [{config_data: {key: "87654321"}}]});assert.equal("87654321", services[0].config_data.key);- }());+ })();(function test_remove() {let bot;@@ -110,13 +110,13 @@ run_test("test_basics", () => {bot_data.deactivate(43);bot = bot_data.get(43);assert.equal(bot.is_active, false);- }());+ })();(function test_all_user_ids() {const all_ids = bot_data.all_user_ids();all_ids.sort();assert.deepEqual(all_ids, [143, 314, 42, 43]);- }());+ })();(function test_delete() {let bot;@@ -129,7 +129,7 @@ run_test("test_basics", () => {bot_data.del(43);bot = bot_data.get(43);assert.equal(bot, undefined);- }());+ })();(function test_get_editable() {@@ -139,7 +139,7 @@ run_test("test_basics", () => {const editable_bots = bot_data.get_editable().map((bot) => bot.email);assert.deepEqual(["[email protected]", "[email protected]"], editable_bots);- }());+ })();(function test_get_all_bots_for_current_user() {const bots = bot_data.get_all_bots_for_current_user();@@ -147,5 +147,5 @@ run_test("test_basics", () => {assert.equal(bots.length, 2);assert.equal(bots[0].email, "[email protected]");assert.equal(bots[1].email, "[email protected]");- }());+ })();});diff --git a/frontend_tests/node_tests/components.js b/frontend_tests/node_tests/components.jsindex 9c26af50d0d..d807d300930 100644--- a/frontend_tests/node_tests/components.js+++ b/frontend_tests/node_tests/components.js@@ -76,7 +76,7 @@ run_test("basics", () => {};return self;- }());+ })();const switcher = (function () {const self = {};@@ -106,7 +106,7 @@ run_test("basics", () => {};return self;- }());+ })();set_global("$", (sel) => {if (sel.stub) {diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.jsindex 4beebb3c56e..68fcc4a50d4 100644--- a/frontend_tests/node_tests/compose.js+++ b/frontend_tests/node_tests/compose.js@@ -684,7 +684,7 @@ run_test("send_message", () => {assert(!$("#compose-send-status").visible());assert.equal($("#compose-send-button").prop("disabled"), false);assert(!$("#sending-indicator").visible());- }());+ })();// This is the additional setup which is common to both the tests below.transmit.send_message = function (payload, success, error) {@@ -713,7 +713,7 @@ run_test("send_message", () => {};assert.deepEqual(stub_state, state);assert(echo_error_msg_checked);- }());+ })();(function test_error_codepath_local_id_undefined() {stub_state = initialize_state_stub_dict();@@ -749,7 +749,7 @@ run_test("send_message", () => {assert($("#compose-send-status").visible());assert.equal($("#compose-send-button").prop("disabled"), false);assert(!$("#sending-indicator").visible());- }());+ })();});set_global("document", "document-stub");@@ -806,7 +806,7 @@ run_test("finish", () => {assert(!$("#compose-send-button").is_focused());assert.equal($("#compose-send-button").prop("disabled"), false);assert.equal($("#compose-error-msg").html(), i18n.t("You have nothing to send!"));- }());+ })();(function test_when_compose_validation_succeed() {$("#compose-textarea").hide();@@ -835,7 +835,7 @@ run_test("finish", () => {assert($("#markdown_preview").visible());assert(send_message_called);assert(compose_finished_event_checked);- }());+ })();});run_test("warn_if_private_stream_is_linked", () => {@@ -875,7 +875,7 @@ run_test("warn_if_private_stream_is_linked", () => {return "fake-compose_private_stream_alert-template";});return function () { assert(called); };- }()),+ })(),(function () {let called;@@ -884,7 +884,7 @@ run_test("warn_if_private_stream_is_linked", () => {assert.equal(html, "fake-compose_private_stream_alert-template");};return function () { assert(called); };- }()),+ })(),];denmark = {@@ -988,7 +988,7 @@ run_test("initialize", () => {compose.initialize();assert(compose_actions_start_checked);- }());+ })();(function test_page_params_narrow_topic() {page_params.narrow_topic = "testing";@@ -1000,7 +1000,7 @@ run_test("initialize", () => {compose.initialize();assert(compose_actions_start_checked);- }());+ })();(function test_abort_xhr() {$("#compose-send-button").attr("disabled", "disabled");@@ -1013,7 +1013,7 @@ run_test("initialize", () => {assert.equal($("#compose-send-button").attr(), undefined);assert(uppy_cancel_all_called);- }());+ })();});run_test("update_fade", () => {@@ -1150,7 +1150,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {return true;};return function () { assert(called); };- }()),+ })(),(function () {let called;@@ -1163,7 +1163,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {return "fake-compose-invite-user-template";});return function () { assert(called); };- }()),+ })(),(function () {let called;@@ -1172,7 +1172,7 @@ run_test("warn_if_mentioning_unsubscribed_user", () => {assert.equal(html, "fake-compose-invite-user-template");};return function () { assert(called); };- }()),+ })(),];mentioned = {@@ -1266,7 +1266,7 @@ run_test("on_events", () => {assert(compose_finish_checked);assert(!$("#compose-all-everyone").visible());assert(!$("#compose-send-status").visible());- }());+ })();(function test_compose_invite_users_clicked() {const handler = $("#compose_invite_users")@@ -1323,7 +1323,7 @@ run_test("on_events", () => {assert(!$("#compose_invite_users").visible());assert(invite_user_to_stream_called);assert(all_invite_children_called);- }());+ })();(function test_compose_invite_close_clicked() {const handler = $("#compose_invite_users")@@ -1347,7 +1347,7 @@ run_test("on_events", () => {assert(helper.container_was_removed());assert(all_invite_children_called);assert(!$("#compose_invite_users").visible());- }());+ })();(function test_compose_not_subscribed_clicked() {const handler = $("#compose-send-status")@@ -1379,7 +1379,7 @@ run_test("on_events", () => {handler(helper.event);assert(!$("#compose-send-status").visible());- }());+ })();(function test_compose_not_subscribed_close_clicked() {const handler = $("#compose-send-status")@@ -1396,7 +1396,7 @@ run_test("on_events", () => {handler(helper.event);assert(!$("#compose-send-status").visible());- }());+ })();(function test_attach_files_compose_clicked() {const handler = $("#compose")@@ -1416,7 +1416,7 @@ run_test("on_events", () => {handler(event);assert(compose_file_input_clicked);- }());+ })();(function test_video_link_compose_clicked() {page_params.jitsi_server_url = "https://meet.jit.si";@@ -1489,7 +1489,7 @@ run_test("on_events", () => {video_link_regex = /\[Click to join video call\]\(\/calls\/bigbluebutton\/join\?meeting_id=%22zulip-1%22&password=%22AAAAAAAAAA%22&checksum=%2232702220bff2a22a44aee72e96cfdb4c4091752e%22\)/;assert(video_link_regex.test(syntax_to_insert));- }());+ })();(function test_markdown_preview_compose_clicked() {// Tests setup@@ -1612,7 +1612,7 @@ run_test("on_events", () => {assert_visibilities();assert.equal($("#preview_content").html(),"Server: foobarfoobar");- }());+ })();(function test_undo_markdown_preview_clicked() {const handler = $("#compose")@@ -1633,7 +1633,7 @@ run_test("on_events", () => {assert(!$("#undo_markdown_preview").visible());assert(!$("#preview_message_area").visible());assert($("#markdown_preview").visible());- }());+ })();});diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.jsindex 8e496058761..8337924dc80 100644--- a/frontend_tests/node_tests/compose_actions.js+++ b/frontend_tests/node_tests/compose_actions.js@@ -45,7 +45,7 @@ compose_state.private_message_recipient = (function () {recipient = arg;};-}());+})();set_global("reload_state", {is_in_progress: return_false,diff --git a/frontend_tests/node_tests/compose_pm_pill.js b/frontend_tests/node_tests/compose_pm_pill.jsindex 995775718b3..f9195e11e84 100644--- a/frontend_tests/node_tests/compose_pm_pill.js+++ b/frontend_tests/node_tests/compose_pm_pill.js@@ -102,7 +102,7 @@ run_test("pills", () => {const item = handler(othello.email, pills.items());assert(get_by_email_called);assert.equal(item, undefined);- }());+ })();(function test_success_path() {get_by_email_called = false;@@ -111,7 +111,7 @@ run_test("pills", () => {assert.equal(typeof res, "object");assert.equal(res.user_id, iago.user_id);assert.equal(res.display_value, iago.full_name);- }());+ })();}function input_pill_stub(opts) {diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.jsindex 3601bdb46c5..8fb88629a5f 100644--- a/frontend_tests/node_tests/drafts.js+++ b/frontend_tests/node_tests/drafts.js@@ -107,7 +107,7 @@ run_test("draft_model", () => {ls.set("drafts", expected);assert.deepEqual(draft_model.get(), expected);- }());+ })();localStorage.clear();(function test_get() {@@ -115,7 +115,7 @@ run_test("draft_model", () => {assert.deepEqual(draft_model.getDraft("id1"), draft_1);assert.equal(draft_model.getDraft("id2"), false);- }());+ })();localStorage.clear();(function test_addDraft() {@@ -126,7 +126,7 @@ run_test("draft_model", () => {assert.deepEqual(ls.get("drafts")[id], expected);});- }());+ })();localStorage.clear();(function test_editDraft() {@@ -138,7 +138,7 @@ run_test("draft_model", () => {assert.deepEqual(ls.get("drafts").id1, expected);});- }());+ })();localStorage.clear();(function test_deleteDraft() {@@ -146,7 +146,7 @@ run_test("draft_model", () => {draft_model.deleteDraft("id1");assert.deepEqual(ls.get("drafts"), {});- }());+ })();});run_test("snapshot_message", () => {diff --git a/frontend_tests/node_tests/general.js b/frontend_tests/node_tests/general.jsindex 750aa696c37..69969b0cca2 100644--- a/frontend_tests/node_tests/general.js+++ b/frontend_tests/node_tests/general.js@@ -531,7 +531,7 @@ run_test("unread_ops", () => {message_list.all = {};message_list.all.show_message_as_read = noop;notifications.close_notification = noop;- }());+ })();// Set up a way to capture the options passed in to channel.post.let channel_post_opts;diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.jsindex 5654871da77..cb1e76f5172 100644--- a/frontend_tests/node_tests/message_fetch.js+++ b/frontend_tests/node_tests/message_fetch.js@@ -398,7 +398,7 @@ run_test("loading_newer", () => {// since the last message event's data had been discarded.// This fetch goes on until the newest message has been found.assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), false);- }());+ })();(function test_home() {reset_lists();@@ -455,6 +455,6 @@ run_test("loading_newer", () => {assert.equal(msg_list.data.fetch_status.can_load_newer_messages(), false);- }());+ })();});diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.jsindex 36f23e4310a..72ad43822d2 100644--- a/frontend_tests/node_tests/message_list_view.js+++ b/frontend_tests/node_tests/message_list_view.js@@ -120,7 +120,7 @@ run_test("msg_edited_vars", () => {assert_alongside_sender(result[0]);assert_left_col(result[1]);assert_status_msg(result[2]);- }());+ })();});run_test("merge_message_groups", () => {@@ -204,7 +204,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, []);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();(function test_append_message_same_subject() {@@ -229,7 +229,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, []);assert_message_list_equal(result.append_messages, [message2]);assert_message_list_equal(result.rerender_messages_next_same_sender, [message1]);- }());+ })();(function test_append_message_different_subject() {@@ -255,7 +255,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, []);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();(function test_append_message_different_subject_and_days() {@@ -284,7 +284,7 @@ run_test("merge_message_groups", () => {assert.equal(message_group2.group_date_divider_html,"900000000 - 1000000");- }());+ })();(function test_append_message_different_day() {@@ -308,7 +308,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.append_messages, [message2]);assert.deepEqual(result.rerender_messages_next_same_sender, [message1]);assert(list._message_groups[0].message_containers[1].want_date_divider);- }());+ })();(function test_append_message_historical() {@@ -334,7 +334,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, []);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();(function test_append_message_same_subject_me_message() {@@ -360,7 +360,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, []);assert_message_list_equal(result.append_messages, [message2]);assert_message_list_equal(result.rerender_messages_next_same_sender, [message1]);- }());+ })();(function test_prepend_message_same_subject() {@@ -386,7 +386,7 @@ run_test("merge_message_groups", () => {[build_message_group([message2, message1])]);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();(function test_prepend_message_different_subject() {@@ -411,7 +411,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, []);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();(function test_prepend_message_different_subject_and_day() {@@ -441,7 +441,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, [message_group1]);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();(function test_prepend_message_different_day() {@@ -470,7 +470,7 @@ run_test("merge_message_groups", () => {assert_message_groups_list_equal(result.rerender_groups, [message_group2]);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();(function test_prepend_message_historical() {@@ -496,7 +496,7 @@ run_test("merge_message_groups", () => {assert.deepEqual(result.rerender_groups, []);assert.deepEqual(result.append_messages, []);assert.deepEqual(result.rerender_messages_next_same_sender, []);- }());+ })();});@@ -533,7 +533,7 @@ run_test("render_windows", () => {view.rerender_preserving_scrolltop = noop;return view;- }());+ })();const list = view.list;@@ -541,7 +541,7 @@ run_test("render_windows", () => {// The function should early exit here.const rendered = view.maybe_rerender();assert.equal(rendered, false);- }());+ })();let messages;diff --git a/frontend_tests/node_tests/password.js b/frontend_tests/node_tests/password.jsindex 19c3a86c0dc..8c5449ce459 100644--- a/frontend_tests/node_tests/password.js+++ b/frontend_tests/node_tests/password.js@@ -25,7 +25,7 @@ run_test("basics", () => {};return self;- }());+ })();function password_field(min_length, min_guesses) {const self = {};diff --git a/frontend_tests/node_tests/scroll_util.js b/frontend_tests/node_tests/scroll_util.jsindex 6b66536c0f8..45eb700df54 100644--- a/frontend_tests/node_tests/scroll_util.js+++ b/frontend_tests/node_tests/scroll_util.js@@ -69,7 +69,7 @@ run_test("scroll_element_into_container", () => {top = arg;},};- }());+ })();const elem1 = {innerHeight: () => 25,diff --git a/frontend_tests/node_tests/settings_bots.js b/frontend_tests/node_tests/settings_bots.jsindex 59bee7b7d33..a158e6f33de 100644--- a/frontend_tests/node_tests/settings_bots.js+++ b/frontend_tests/node_tests/settings_bots.js@@ -170,7 +170,7 @@ run_test("test tab clicks", () => {assert(forms.add.visible());assert(!forms.active.visible());assert(!forms.inactive.visible());- }());+ })();(function () {click_on_tab(tabs.active);@@ -181,7 +181,7 @@ run_test("test tab clicks", () => {assert(!forms.add.visible());assert(forms.active.visible());assert(!forms.inactive.visible());- }());+ })();(function () {click_on_tab(tabs.inactive);@@ -192,7 +192,7 @@ run_test("test tab clicks", () => {assert(!forms.add.visible());assert(!forms.active.visible());assert(forms.inactive.visible());- }());+ })();});run_test("can_create_new_bots", () => {diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.jsindex 415bae5ee67..16bb2c2e8d3 100644--- a/frontend_tests/node_tests/settings_user_groups.js+++ b/frontend_tests/node_tests/settings_user_groups.js@@ -198,7 +198,7 @@ run_test("populate_user_groups", () => {return fake_person;};assert.equal(config.highlighter(), fake_person);- }());+ })();const fake_context = {query: "ali",@@ -212,7 +212,7 @@ run_test("populate_user_groups", () => {const result = config.source.call(fake_context, iago);const emails = result.map((user) => user.email).sort();assert.deepEqual(emails, [alice.email, bob.email]);- }());+ })();(function test_matcher() {/* Here the query doesn't begin with an '@' because typeahead is triggered@@ -232,7 +232,7 @@ run_test("populate_user_groups", () => {page_params.is_admin = true;result = config.matcher.call(fake_context_for_email, bob);assert(result);- }());+ })();(function test_sorter() {let sort_recipientbox_typeahead_called = false;@@ -241,7 +241,7 @@ run_test("populate_user_groups", () => {};config.sorter.call(fake_context);assert(sort_recipientbox_typeahead_called);- }());+ })();(function test_updater() {input_field_stub.text("@ali");@@ -287,7 +287,7 @@ run_test("populate_user_groups", () => {assert(cancel_fade_to_called);assert(instructions_fade_to_called);assert.equal(text_cleared, true);- }());+ })();input_typeahead_called = true;};@@ -313,7 +313,7 @@ run_test("populate_user_groups", () => {const item = handler(iago.email, pills.items());assert(get_by_email_called);assert.equal(item, undefined);- }());+ })();(function test_success_path() {get_by_email_called = false;@@ -322,7 +322,7 @@ run_test("populate_user_groups", () => {assert.equal(typeof res, "object");assert.equal(res.user_id, bob.user_id);assert.equal(res.display_value, bob.full_name);- }());+ })();}pills.onPillRemove = function (handler) {@@ -572,7 +572,7 @@ run_test("on_events", () => {assert(!$("#admin-user-group-status").visible());assert.equal($("form.admin-user-group-form input[type='text']").val(), "");- }());+ })();(function test_post_error() {$("#admin-user-group-status").show();@@ -590,11 +590,11 @@ run_test("on_events", () => {opts.error(xhr);assert(!$("#admin-user-group-status").visible());- }());+ })();};handler.call(fake_this, event);- }());+ })();(function test_user_groups_delete_click_triggered() {const handler = $("#user-groups").get_on_handler("click", ".delete");@@ -626,7 +626,7 @@ run_test("on_events", () => {};handler.call(fake_this);- }());+ })();(function test_user_groups_keypress_enter_triggered() {const handler = $("#user-groups").get_on_handler("keypress", ".user-group h4 > span");@@ -639,7 +639,7 @@ run_test("on_events", () => {};handler(event);assert(default_action_for_enter_stopped);- }());+ })();(function test_do_not_blur() {const blur_event_classes = [".name", ".description", ".input"];@@ -697,7 +697,7 @@ run_test("on_events", () => {assert(!api_endpoint_called);assert(settings_user_groups_reload_called);}- }());+ })();(function test_update_cancel_button() {const handler_name = $(user_group_selector).get_on_handler("input", ".name");@@ -745,7 +745,7 @@ run_test("on_events", () => {handler_desc.call(fake_this);assert(cancel_fade_out_called);assert(instructions_fade_out_called);- }());+ })();(function test_user_groups_save_group_changes_triggered() {const handler_name = $(user_group_selector).get_on_handler("blur", ".name");@@ -796,7 +796,7 @@ run_test("on_events", () => {assert(cancel_fade_out_called);assert(instructions_fade_out_called);assert(saved_fade_to_called);- }());+ })();(function test_post_error() {const user_group_error = $(user_group_selector + " .user-group-status");user_group_error.show();@@ -814,7 +814,7 @@ run_test("on_events", () => {opts.error(xhr);assert(user_group_error.visible());- }());+ })();};const fake_this = $.create("fake-#user-groups_blur_name");@@ -841,7 +841,7 @@ run_test("on_events", () => {api_endpoint_called = false;handler_desc.call(fake_this, event);assert(!api_endpoint_called);- }());+ })();(function test_user_groups_save_member_changes_triggered() {const handler = $(user_group_selector).get_on_handler("blur", ".input");@@ -886,7 +886,7 @@ run_test("on_events", () => {assert(cancel_fade_out_called);assert(instructions_fade_out_called);assert(saved_fade_to_called);- }());+ })();};const fake_this = $.create("fake-#user-groups_blur_input");@@ -901,5 +901,5 @@ run_test("on_events", () => {api_endpoint_called = false;handler.call(fake_this, event);assert(api_endpoint_called);- }());+ })();});diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.jsindex b60658a4a92..7b4418e0df0 100644--- a/frontend_tests/node_tests/stream_list.js+++ b/frontend_tests/node_tests/stream_list.js@@ -76,7 +76,7 @@ run_test("create_sidebar_row", () => {stream_list.create_sidebar_row(devel);assert.equal(devel_value.text(), "42");- }());+ })();(function create_social_sidebar_row() {const social_value = $.create("social-value");@@ -95,7 +95,7 @@ run_test("create_sidebar_row", () => {stream_list.create_sidebar_row(social);assert.equal(social_value.text(), "42");- }());+ })();const split = '<hr class="stream-split">';const devel_sidebar = $("<devel sidebar row>");diff --git a/frontend_tests/node_tests/stream_search.js b/frontend_tests/node_tests/stream_search.jsindex edee4552f4c..4f70fb806ce 100644--- a/frontend_tests/node_tests/stream_search.js+++ b/frontend_tests/node_tests/stream_search.js@@ -125,7 +125,7 @@ run_test("basics", () => {verify_collapsed();assert.deepEqual(cursor_helper.events, ["reset", "clear"]);- }());+ })();// Expand the widget.toggle_filter();diff --git a/frontend_tests/zjsunit/stub.js b/frontend_tests/zjsunit/stub.jsindex dc9cc30d3e0..727a7ee5faf 100644--- a/frontend_tests/zjsunit/stub.js+++ b/frontend_tests/zjsunit/stub.js@@ -39,4 +39,4 @@ exports.with_stub = function (f) {assert.equal(args.color, "blue");assert.equal(args.n, 42);});-}());+})();diff --git a/static/js/blueslip.js b/static/js/blueslip.jsindex bf6cf4cf0f4..300b03960aa 100644--- a/static/js/blueslip.js+++ b/static/js/blueslip.js@@ -68,7 +68,7 @@ Logger.prototype = (function () {}return proto;-}());+})();const logger = new Logger();diff --git a/static/js/click_handlers.js b/static/js/click_handlers.jsindex 016a1925fd2..05d7934c271 100644--- a/static/js/click_handlers.js+++ b/static/js/click_handlers.js@@ -571,7 +571,7 @@ exports.initialize = function () {$(sel).on("click", "a", function () {this.blur();});- }());+ })();popovers.register_click_handlers();emoji_picker.register_click_handlers();@@ -826,7 +826,7 @@ exports.initialize = function () {$("[data-make-editable='" + selector + "']").html("");}});- }());+ })();// HOTSPOTSdiff --git a/static/js/components.js b/static/js/components.jsindex 5a1ce9304db..86f86dbdf35 100644--- a/static/js/components.js+++ b/static/js/components.js@@ -35,7 +35,7 @@ exports.toggle = function (opts) {_component.append(tab);});return _component;- }(opts));+ })(opts);const meta = {$ind_tab: component.find(".ind-tab"),@@ -96,7 +96,7 @@ exports.toggle = function (opts) {if (typeof opts.selected === "number") {select_tab(opts.selected);}- }());+ })();const prototype = {maybe_go_left: maybe_go_left,diff --git a/static/js/drafts.js b/static/js/drafts.jsindex c322a2d8ef1..69119f8be4d 100644--- a/static/js/drafts.js+++ b/static/js/drafts.js@@ -65,7 +65,7 @@ const draft_model = (function () {};return exports;-}());+})();exports.draft_model = draft_model;diff --git a/static/js/fenced_code.js b/static/js/fenced_code.jsindex 1d45e4d1bd7..401ec360c07 100644--- a/static/js/fenced_code.js+++ b/static/js/fenced_code.js@@ -167,7 +167,7 @@ exports.process_fenced_code = function (content) {handler_stack.pop();},};- }());+ })();}function default_hander() {diff --git a/static/js/input_pill.js b/static/js/input_pill.jsindex 8dfd64f0c4f..14ddef37e26 100644--- a/static/js/input_pill.js+++ b/static/js/input_pill.js@@ -364,7 +364,7 @@ exports.create = function (opts) {e.originalEvent.clipboardData.setData("text/plain", store.get_text_from_item(data.item));e.preventDefault();});- }());+ })();// the external, user-accessible prototype.const prototype = {diff --git a/static/js/local_message.js b/static/js/local_message.jsindex e1bbcb43cd4..3d1b1d8a60d 100644--- a/static/js/local_message.js+++ b/static/js/local_message.js@@ -51,6 +51,6 @@ exports.get_next_id_float = (function () {return local_id_float;};-}());+})();window.local_message = exports;diff --git a/static/js/message_flags.js b/static/js/message_flags.jsindex b2bceec5927..7cef4fca8c4 100644--- a/static/js/message_flags.js+++ b/static/js/message_flags.js@@ -59,7 +59,7 @@ exports.send_read = (function () {}return add;-}());+})();exports.save_collapsed = function (message) {send_flag_update(message, "collapsed", "add");diff --git a/static/js/narrow.js b/static/js/narrow.jsindex 0aa6ffad152..58306fce858 100644--- a/static/js/narrow.js+++ b/static/js/narrow.js@@ -291,7 +291,7 @@ exports.activate = function (raw_operators, opts) {maybe_report_narrow_time(msg_list);},});- }());+ })();if (select_immediately) {exports.update_selection({diff --git a/static/js/pm_conversations.js b/static/js/pm_conversations.jsindex 2da978153b2..ec831fe442b 100644--- a/static/js/pm_conversations.js+++ b/static/js/pm_conversations.js@@ -75,6 +75,6 @@ exports.recent = (function () {};return self;-}());+})();window.pm_conversations = exports;diff --git a/static/js/popovers.js b/static/js/popovers.jsindex 3de0b803c8c..918759255f8 100644--- a/static/js/popovers.js+++ b/static/js/popovers.js@@ -43,7 +43,7 @@ function elem_to_user_id(elem) {// add back all shallow properties of $.fn.popover to the new proxied version.Object.assign($.fn.popover, popover);-}($.fn.popover));+})($.fn.popover);function copy_email_handler(e) {const email_el = $(e.trigger.parentElement);@@ -1088,7 +1088,7 @@ exports.register_click_handlers = function () {// retrigger `hide_all` while still scrolling.last_scroll = date;});- }());+ })();};exports.any_active = function () {diff --git a/static/js/resize.js b/static/js/resize.jsindex a5968acb3bd..ab0295bf247 100644--- a/static/js/resize.js+++ b/static/js/resize.js@@ -144,12 +144,12 @@ exports.watch_manual_resize = function (element) {document.body.addEventListener("mouseup", body_handler);return [box_handler, body_handler];- }((height) => {+ })((height) => {// This callback disables autosize on the textarea. It// will be re-enabled when this component is next opened.autosize.destroy($(element)).height(height + "px");- }));+ });};exports.resize_bottom_whitespace = function (h) {diff --git a/static/js/settings_user_groups.js b/static/js/settings_user_groups.jsindex d81e97a4b82..d68df88a831 100644--- a/static/js/settings_user_groups.js+++ b/static/js/settings_user_groups.js@@ -256,7 +256,7 @@ exports.populate_user_groups = function () {input.focus();}, 100);});- }());+ })();}};diff --git a/static/js/stream_create.js b/static/js/stream_create.jsindex 79c0e89d538..da68a355365 100644--- a/static/js/stream_create.js+++ b/static/js/stream_create.js@@ -35,7 +35,7 @@ const stream_subscription_error = (function () {return self;-}());+})();const stream_name_error = (function () {const self = {};@@ -95,7 +95,7 @@ const stream_name_error = (function () {};return self;-}());+})();// Within the new stream modal...function update_announce_stream_state() {@@ -374,7 +374,7 @@ exports.create_handlers_for_users = function (container) {const display = user_checked ? "block" : "none";elem.css({display: display});});- }());+ })();e.preventDefault();});diff --git a/static/js/stream_list.js b/static/js/stream_list.jsindex 8ece8f32d78..43b5cf08220 100644--- a/static/js/stream_list.js+++ b/static/js/stream_list.js@@ -53,7 +53,7 @@ exports.stream_sidebar = (function () {};return self;-}());+})();function get_search_term() {const search_box = $(".stream-list-filter");diff --git a/static/js/subs.js b/static/js/subs.jsindex aab54f80785..d721b172366 100644--- a/static/js/subs.js+++ b/static/js/subs.js@@ -925,7 +925,7 @@ exports.initialize = function () {stream_edit.open_edit_panel_empty();}});- }());+ })();};diff --git a/static/js/timerender.js b/static/js/timerender.jsindex dfa50185b83..5c5701c2b29 100644--- a/static/js/timerender.js+++ b/static/js/timerender.js@@ -289,7 +289,7 @@ exports.absolute_time = (function () {str += " " + fmt_time(date, H_24);return str;};-}());+})();exports.get_full_datetime = function (time) {// Convert to number of hours ahead/behind UTC.diff --git a/static/js/unread.js b/static/js/unread.jsindex 96296e94d31..a86eba93e7b 100644--- a/static/js/unread.js+++ b/static/js/unread.js@@ -179,7 +179,7 @@ exports.unread_pm_counter = (function () {};return self;-}());+})();function make_per_stream_bucketer() {return make_bucketer({@@ -372,7 +372,7 @@ exports.unread_topic_counter = (function () {};return self;-}());+})();exports.unread_mentions_counter = new Set();