diff --git a/.eslintrc.json b/.eslintrc.json index 7d1cf6ad91..e94d64e56b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,7 +7,7 @@ "parser": "babel-eslint", "parserOptions": { "warnOnUnsupportedTypeScriptVersion": false, - "sourceType": "module" + "sourceType": "unambiguous" }, "plugins": ["eslint-plugin-empty-returns"], "rules": { @@ -29,6 +29,7 @@ "newlines-between": "always" } ], + "import/unambiguous": "error", "new-cap": [ "error", { @@ -88,7 +89,7 @@ ], "radix": "error", "spaced-comment": "off", - "strict": "off", + "strict": "error", "valid-typeof": ["error", {"requireStringLiterals": true}], "yoda": "error" }, @@ -331,6 +332,12 @@ "@typescript-eslint/unified-signatures": "error" } }, + { + "files": ["**/*.d.ts"], + "rules": { + "import/unambiguous": "off" + } + }, { "files": ["frontend_tests/**"], "globals": { diff --git a/babel.config.js b/babel.config.js index 889341cc91..642e5ac477 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { presets: [ [ diff --git a/frontend_tests/casper_lib/common.js b/frontend_tests/casper_lib/common.js index 62b9c0cd52..b61d3634ca 100644 --- a/frontend_tests/casper_lib/common.js +++ b/frontend_tests/casper_lib/common.js @@ -1,3 +1,5 @@ +"use strict"; + var util = require("util"); var test_credentials = require("../../var/casper/test_credentials.js").test_credentials; diff --git a/frontend_tests/casper_lib/polyfill.js b/frontend_tests/casper_lib/polyfill.js index 62cd4a5047..35de4557bb 100644 --- a/frontend_tests/casper_lib/polyfill.js +++ b/frontend_tests/casper_lib/polyfill.js @@ -1,3 +1,5 @@ +"use strict"; + /* eslint-env browser */ // PhantomJS doesn’t support new DOMParser().parseFromString(…, "text/html"). diff --git a/frontend_tests/casper_tests/00-realm-creation.js b/frontend_tests/casper_tests/00-realm-creation.js index fb299ad3fc..5816df80c0 100644 --- a/frontend_tests/casper_tests/00-realm-creation.js +++ b/frontend_tests/casper_tests/00-realm-creation.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); var email = "alice@test.example.com"; diff --git a/frontend_tests/casper_tests/01-login.js b/frontend_tests/casper_tests/01-login.js index b10249c05c..6fca4a4d97 100644 --- a/frontend_tests/casper_tests/01-login.js +++ b/frontend_tests/casper_tests/01-login.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); var realm_url = "http://zulip.zulipdev.com:9981/"; diff --git a/frontend_tests/casper_tests/02-site.js b/frontend_tests/casper_tests/02-site.js index 37510c14cd..9f58ceae8c 100644 --- a/frontend_tests/casper_tests/02-site.js +++ b/frontend_tests/casper_tests/02-site.js @@ -1,3 +1,5 @@ +"use strict"; + /* Script for testing the web client. This runs under CasperJS. It's an end-to-end black-box sort of test. It diff --git a/frontend_tests/casper_tests/03-narrow.js b/frontend_tests/casper_tests/03-narrow.js index 180b305446..ecf8e464b3 100644 --- a/frontend_tests/casper_tests/03-narrow.js +++ b/frontend_tests/casper_tests/03-narrow.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/casper_tests/04-compose.js b/frontend_tests/casper_tests/04-compose.js index 3ffb1d51d7..cfe40f760a 100644 --- a/frontend_tests/casper_tests/04-compose.js +++ b/frontend_tests/casper_tests/04-compose.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/casper_tests/05-subscriptions.js b/frontend_tests/casper_tests/05-subscriptions.js index f30847a1ad..d4a4609764 100644 --- a/frontend_tests/casper_tests/05-subscriptions.js +++ b/frontend_tests/casper_tests/05-subscriptions.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); function stream_checkbox(stream_name) { diff --git a/frontend_tests/casper_tests/06-settings.js b/frontend_tests/casper_tests/06-settings.js index aca1fc473f..75b215513b 100644 --- a/frontend_tests/casper_tests/06-settings.js +++ b/frontend_tests/casper_tests/06-settings.js @@ -1,3 +1,5 @@ +"use strict"; + var test_credentials = require("../../var/casper/test_credentials.js").test_credentials; var common = require("../casper_lib/common.js"); diff --git a/frontend_tests/casper_tests/07-stars.js b/frontend_tests/casper_tests/07-stars.js index 79e05f474b..e3028116bc 100644 --- a/frontend_tests/casper_tests/07-stars.js +++ b/frontend_tests/casper_tests/07-stars.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); function star_count() { diff --git a/frontend_tests/casper_tests/08-edit.js b/frontend_tests/casper_tests/08-edit.js index 700ec1bf60..2639e21d80 100644 --- a/frontend_tests/casper_tests/08-edit.js +++ b/frontend_tests/casper_tests/08-edit.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); casper.options.verbose = true; diff --git a/frontend_tests/casper_tests/09-navigation.js b/frontend_tests/casper_tests/09-navigation.js index 98e629fe66..69ad9d7fc0 100644 --- a/frontend_tests/casper_tests/09-navigation.js +++ b/frontend_tests/casper_tests/09-navigation.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); // Test basic tab navigation. diff --git a/frontend_tests/casper_tests/10-admin.js b/frontend_tests/casper_tests/10-admin.js index 17c3d118b1..357f8ac986 100644 --- a/frontend_tests/casper_tests/10-admin.js +++ b/frontend_tests/casper_tests/10-admin.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/casper_tests/11-mention.js b/frontend_tests/casper_tests/11-mention.js index 57a848f116..7286409183 100644 --- a/frontend_tests/casper_tests/11-mention.js +++ b/frontend_tests/casper_tests/11-mention.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/casper_tests/12-custom-profile.js b/frontend_tests/casper_tests/12-custom-profile.js index 659888d96b..4c0d98eb3b 100644 --- a/frontend_tests/casper_tests/12-custom-profile.js +++ b/frontend_tests/casper_tests/12-custom-profile.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/casper_tests/13-user-deactivation.js b/frontend_tests/casper_tests/13-user-deactivation.js index cdb15ccd48..b3b719b87c 100644 --- a/frontend_tests/casper_tests/13-user-deactivation.js +++ b/frontend_tests/casper_tests/13-user-deactivation.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); function user_row(name) { diff --git a/frontend_tests/casper_tests/14-drafts.js b/frontend_tests/casper_tests/14-drafts.js index 46aed73317..485d5f7999 100644 --- a/frontend_tests/casper_tests/14-drafts.js +++ b/frontend_tests/casper_tests/14-drafts.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); function waitWhileDraftsVisible(then) { diff --git a/frontend_tests/casper_tests/15-delete-message.js b/frontend_tests/casper_tests/15-delete-message.js index 10814cf8ba..c657cd0c4b 100644 --- a/frontend_tests/casper_tests/15-delete-message.js +++ b/frontend_tests/casper_tests/15-delete-message.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/casper_tests/16-copy-and-paste.js b/frontend_tests/casper_tests/16-copy-and-paste.js index f600fedba0..8032fd23ec 100644 --- a/frontend_tests/casper_tests/16-copy-and-paste.js +++ b/frontend_tests/casper_tests/16-copy-and-paste.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/casper_tests/17-realm-linkifier.js b/frontend_tests/casper_tests/17-realm-linkifier.js index a2d5f45273..2ea74c563f 100644 --- a/frontend_tests/casper_tests/17-realm-linkifier.js +++ b/frontend_tests/casper_tests/17-realm-linkifier.js @@ -1,3 +1,5 @@ +"use strict"; + var common = require("../casper_lib/common.js"); common.start_and_log_in(); diff --git a/frontend_tests/node_tests/activity.js b/frontend_tests/node_tests/activity.js index ae139374b9..200f7cf8c6 100644 --- a/frontend_tests/node_tests/activity.js +++ b/frontend_tests/node_tests/activity.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); const window_stub = $.create("window-stub"); set_global("to_$", () => window_stub); diff --git a/frontend_tests/node_tests/alert_words.js b/frontend_tests/node_tests/alert_words.js index 1ddd1a2bc7..345e127860 100644 --- a/frontend_tests/node_tests/alert_words.js +++ b/frontend_tests/node_tests/alert_words.js @@ -1,3 +1,5 @@ +"use strict"; + const params = { alert_words: ["alertone", "alerttwo", "alertthree", "al*rt.*s", ".+", "emoji"], }; diff --git a/frontend_tests/node_tests/alert_words_ui.js b/frontend_tests/node_tests/alert_words_ui.js index 6993dae0ae..4f65657666 100644 --- a/frontend_tests/node_tests/alert_words_ui.js +++ b/frontend_tests/node_tests/alert_words_ui.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); set_global("channel", {}); diff --git a/frontend_tests/node_tests/billing.js b/frontend_tests/node_tests/billing.js index 49a5d58405..5dba519f68 100644 --- a/frontend_tests/node_tests/billing.js +++ b/frontend_tests/node_tests/billing.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = () => {}; const fs = require("fs"); diff --git a/frontend_tests/node_tests/billing_helpers.js b/frontend_tests/node_tests/billing_helpers.js index 592dea39a3..cb439fbf0a 100644 --- a/frontend_tests/node_tests/billing_helpers.js +++ b/frontend_tests/node_tests/billing_helpers.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const JQuery = require("jquery"); diff --git a/frontend_tests/node_tests/blueslip_stacktrace.js b/frontend_tests/node_tests/blueslip_stacktrace.js index 79d1d0ed03..fb99707110 100644 --- a/frontend_tests/node_tests/blueslip_stacktrace.js +++ b/frontend_tests/node_tests/blueslip_stacktrace.js @@ -1,3 +1,5 @@ +"use strict"; + const blueslip_stacktrace = zrequire("blueslip_stacktrace"); run_test("clean_path", () => { diff --git a/frontend_tests/node_tests/bot_data.js b/frontend_tests/node_tests/bot_data.js index 4d058208c3..46a20964a6 100644 --- a/frontend_tests/node_tests/bot_data.js +++ b/frontend_tests/node_tests/bot_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _settings_bots = { render_bots: () => {}, }; diff --git a/frontend_tests/node_tests/buddy_data.js b/frontend_tests/node_tests/buddy_data.js index 01b761ec8c..145ee86f4a 100644 --- a/frontend_tests/node_tests/buddy_data.js +++ b/frontend_tests/node_tests/buddy_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const _page_params = {}; diff --git a/frontend_tests/node_tests/buddy_list.js b/frontend_tests/node_tests/buddy_list.js index c394c986b2..bd346d6619 100644 --- a/frontend_tests/node_tests/buddy_list.js +++ b/frontend_tests/node_tests/buddy_list.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/channel.js b/frontend_tests/node_tests/channel.js index b8bb5ef39d..124b1ba14d 100644 --- a/frontend_tests/node_tests/channel.js +++ b/frontend_tests/node_tests/channel.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); set_global("$", {}); diff --git a/frontend_tests/node_tests/color_data.js b/frontend_tests/node_tests/color_data.js index e5e484d7b5..b09974b90b 100644 --- a/frontend_tests/node_tests/color_data.js +++ b/frontend_tests/node_tests/color_data.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("color_data"); run_test("pick_color", () => { diff --git a/frontend_tests/node_tests/colorspace.js b/frontend_tests/node_tests/colorspace.js index b8d1c5a930..28026853de 100644 --- a/frontend_tests/node_tests/colorspace.js +++ b/frontend_tests/node_tests/colorspace.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("colorspace"); run_test("sRGB_to_linear", () => { diff --git a/frontend_tests/node_tests/common.js b/frontend_tests/node_tests/common.js index 24fb9ea3b4..f9d7a0918c 100644 --- a/frontend_tests/node_tests/common.js +++ b/frontend_tests/node_tests/common.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = () => {}; set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/components.js b/frontend_tests/node_tests/components.js index 18b82a5799..40d2ed7411 100644 --- a/frontend_tests/node_tests/components.js +++ b/frontend_tests/node_tests/components.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); zrequire("keydown_util"); diff --git a/frontend_tests/node_tests/compose.js b/frontend_tests/node_tests/compose.js index e663ad2dee..f0863e8bf6 100644 --- a/frontend_tests/node_tests/compose.js +++ b/frontend_tests/node_tests/compose.js @@ -1,3 +1,5 @@ +"use strict"; + const {JSDOM} = require("jsdom"); const rewiremock = require("rewiremock/node"); diff --git a/frontend_tests/node_tests/compose_actions.js b/frontend_tests/node_tests/compose_actions.js index 83bdc82745..de62823d54 100644 --- a/frontend_tests/node_tests/compose_actions.js +++ b/frontend_tests/node_tests/compose_actions.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = function () {}; const return_false = function () { return false; diff --git a/frontend_tests/node_tests/compose_fade.js b/frontend_tests/node_tests/compose_fade.js index 2997db0834..33a60d2b9a 100644 --- a/frontend_tests/node_tests/compose_fade.js +++ b/frontend_tests/node_tests/compose_fade.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("stream_data"); zrequire("people"); zrequire("compose_fade"); diff --git a/frontend_tests/node_tests/compose_pm_pill.js b/frontend_tests/node_tests/compose_pm_pill.js index a58db08172..d13a954408 100644 --- a/frontend_tests/node_tests/compose_pm_pill.js +++ b/frontend_tests/node_tests/compose_pm_pill.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); const _people = { diff --git a/frontend_tests/node_tests/compose_ui.js b/frontend_tests/node_tests/compose_ui.js index 0eb1b2a747..1605963029 100644 --- a/frontend_tests/node_tests/compose_ui.js +++ b/frontend_tests/node_tests/compose_ui.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("compose_ui"); zrequire("people"); zrequire("user_status"); diff --git a/frontend_tests/node_tests/composebox_typeahead.js b/frontend_tests/node_tests/composebox_typeahead.js index 2b4ccec0a4..58713b5f02 100644 --- a/frontend_tests/node_tests/composebox_typeahead.js +++ b/frontend_tests/node_tests/composebox_typeahead.js @@ -1,3 +1,5 @@ +"use strict"; + const emoji = zrequire("emoji", "shared/js/emoji"); const typeahead = zrequire("typeahead", "shared/js/typeahead"); zrequire("compose_state"); diff --git a/frontend_tests/node_tests/copy_and_paste.js b/frontend_tests/node_tests/copy_and_paste.js index cb9789c6fd..1cb65caeb7 100644 --- a/frontend_tests/node_tests/copy_and_paste.js +++ b/frontend_tests/node_tests/copy_and_paste.js @@ -1,3 +1,5 @@ +"use strict"; + global.stub_out_jquery(); set_global("page_params", { diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index b9bc1429fd..1135ade319 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = function () {}; const events = require("./lib/events.js"); diff --git a/frontend_tests/node_tests/dispatch_subs.js b/frontend_tests/node_tests/dispatch_subs.js index 90286fa9e0..36b3b9f4a8 100644 --- a/frontend_tests/node_tests/dispatch_subs.js +++ b/frontend_tests/node_tests/dispatch_subs.js @@ -1,3 +1,5 @@ +"use strict"; + const events = require("./lib/events.js"); const event_fixtures = events.fixtures; diff --git a/frontend_tests/node_tests/drafts.js b/frontend_tests/node_tests/drafts.js index 5e03fb09e1..2a433129cf 100644 --- a/frontend_tests/node_tests/drafts.js +++ b/frontend_tests/node_tests/drafts.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/dropdown_list_widget.js b/frontend_tests/node_tests/dropdown_list_widget.js index 36d1d3e8bc..afd13e89a6 100644 --- a/frontend_tests/node_tests/dropdown_list_widget.js +++ b/frontend_tests/node_tests/dropdown_list_widget.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("dropdown_list_widget"); zrequire("scroll_util"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/echo.js b/frontend_tests/node_tests/echo.js index 22f1ceaf1c..a38c24862f 100644 --- a/frontend_tests/node_tests/echo.js +++ b/frontend_tests/node_tests/echo.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); set_global("markdown", {}); set_global("local_message", { diff --git a/frontend_tests/node_tests/emoji.js b/frontend_tests/node_tests/emoji.js index 48f2167c16..ac0567253a 100644 --- a/frontend_tests/node_tests/emoji.js +++ b/frontend_tests/node_tests/emoji.js @@ -1,3 +1,5 @@ +"use strict"; + const emoji_codes = zrequire("emoji_codes", "generated/emoji/emoji_codes.json"); const events = require("./lib/events.js"); diff --git a/frontend_tests/node_tests/emoji_picker.js b/frontend_tests/node_tests/emoji_picker.js index 7b7e4c8600..88f6247e4f 100644 --- a/frontend_tests/node_tests/emoji_picker.js +++ b/frontend_tests/node_tests/emoji_picker.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const emoji = zrequire("emoji", "shared/js/emoji"); diff --git a/frontend_tests/node_tests/fenced_code.js b/frontend_tests/node_tests/fenced_code.js index 75dace8597..5d90ab2369 100644 --- a/frontend_tests/node_tests/fenced_code.js +++ b/frontend_tests/node_tests/fenced_code.js @@ -1,3 +1,5 @@ +"use strict"; + const fenced_code = zrequire("fenced_code", "shared/js/fenced_code"); run_test("get_unused_fence", () => { diff --git a/frontend_tests/node_tests/fetch_status.js b/frontend_tests/node_tests/fetch_status.js index 82304e1883..3ae0437b70 100644 --- a/frontend_tests/node_tests/fetch_status.js +++ b/frontend_tests/node_tests/fetch_status.js @@ -1,3 +1,5 @@ +"use strict"; + const FetchStatus = zrequire("fetch_status"); set_global("message_scroll", { hide_loading_older: () => {}, diff --git a/frontend_tests/node_tests/filter.js b/frontend_tests/node_tests/filter.js index 6247f8477b..a77a828b5f 100644 --- a/frontend_tests/node_tests/filter.js +++ b/frontend_tests/node_tests/filter.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("unread"); zrequire("stream_data"); zrequire("people"); diff --git a/frontend_tests/node_tests/fold_dict.js b/frontend_tests/node_tests/fold_dict.js index 7be296a120..7df4c48efb 100644 --- a/frontend_tests/node_tests/fold_dict.js +++ b/frontend_tests/node_tests/fold_dict.js @@ -1,3 +1,5 @@ +"use strict"; + const FoldDict = zrequire("fold_dict").FoldDict; run_test("basic", () => { diff --git a/frontend_tests/node_tests/general.js b/frontend_tests/node_tests/general.js index e64e0b7749..c2b13aa50d 100644 --- a/frontend_tests/node_tests/general.js +++ b/frontend_tests/node_tests/general.js @@ -1,3 +1,5 @@ +"use strict"; + // This is a general tour of how to write node tests that // may also give you some quick insight on how the Zulip // browser app is constructed. Let's start with testing diff --git a/frontend_tests/node_tests/hash_util.js b/frontend_tests/node_tests/hash_util.js index b0e3dd3264..47369be8b2 100644 --- a/frontend_tests/node_tests/hash_util.js +++ b/frontend_tests/node_tests/hash_util.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("hash_util"); zrequire("stream_data"); zrequire("people"); diff --git a/frontend_tests/node_tests/hashchange.js b/frontend_tests/node_tests/hashchange.js index 36987c07ea..b67a468477 100644 --- a/frontend_tests/node_tests/hashchange.js +++ b/frontend_tests/node_tests/hashchange.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); const window_stub = $.create("window-stub"); set_global("location", { diff --git a/frontend_tests/node_tests/hotkey.js b/frontend_tests/node_tests/hotkey.js index 0243a84dcc..ffa35bea2f 100644 --- a/frontend_tests/node_tests/hotkey.js +++ b/frontend_tests/node_tests/hotkey.js @@ -1,3 +1,5 @@ +"use strict"; + // Important note on these tests: // // The way the Zulip hotkey tests work is as follows. First, we set diff --git a/frontend_tests/node_tests/i18n.js b/frontend_tests/node_tests/i18n.js index 23616fee5c..41ce76eb8e 100644 --- a/frontend_tests/node_tests/i18n.js +++ b/frontend_tests/node_tests/i18n.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("templates"); // We download our translations in `page_params` (which diff --git a/frontend_tests/node_tests/input_pill.js b/frontend_tests/node_tests/input_pill.js index 15a75308b1..3bc4694ec8 100644 --- a/frontend_tests/node_tests/input_pill.js +++ b/frontend_tests/node_tests/input_pill.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); zrequire("input_pill"); diff --git a/frontend_tests/node_tests/keydown_util.js b/frontend_tests/node_tests/keydown_util.js index 221753b04d..274612723e 100644 --- a/frontend_tests/node_tests/keydown_util.js +++ b/frontend_tests/node_tests/keydown_util.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); zrequire("keydown_util"); diff --git a/frontend_tests/node_tests/lazy_set.js b/frontend_tests/node_tests/lazy_set.js index 8e917715a9..b84fffce79 100644 --- a/frontend_tests/node_tests/lazy_set.js +++ b/frontend_tests/node_tests/lazy_set.js @@ -1,3 +1,5 @@ +"use strict"; + const LazySet = zrequire("lazy_set").LazySet; /* diff --git a/frontend_tests/node_tests/lib/events.js b/frontend_tests/node_tests/lib/events.js index 759dab34d0..9833ea2260 100644 --- a/frontend_tests/node_tests/lib/events.js +++ b/frontend_tests/node_tests/lib/events.js @@ -1,3 +1,5 @@ +"use strict"; + // TODO: These events are not guaranteed to be perfectly // representative of what the server sends. For // now we just want very basic test coverage. We diff --git a/frontend_tests/node_tests/lightbox.js b/frontend_tests/node_tests/lightbox.js index 202615c9df..e89251fbf5 100644 --- a/frontend_tests/node_tests/lightbox.js +++ b/frontend_tests/node_tests/lightbox.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("rows"); zrequire("lightbox"); diff --git a/frontend_tests/node_tests/list_cursor.js b/frontend_tests/node_tests/list_cursor.js index 9b8ecf1c10..d3ce3922c7 100644 --- a/frontend_tests/node_tests/list_cursor.js +++ b/frontend_tests/node_tests/list_cursor.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("list_cursor"); run_test("config errors", () => { diff --git a/frontend_tests/node_tests/list_render.js b/frontend_tests/node_tests/list_render.js index 863bdef8b7..89435353dc 100644 --- a/frontend_tests/node_tests/list_render.js +++ b/frontend_tests/node_tests/list_render.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("list_render"); // We need these stubs to get by instanceof checks. diff --git a/frontend_tests/node_tests/markdown.js b/frontend_tests/node_tests/markdown.js index 333b72ee97..94fd9fcef3 100644 --- a/frontend_tests/node_tests/markdown.js +++ b/frontend_tests/node_tests/markdown.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("hash_util"); const emoji = zrequire("emoji", "shared/js/emoji"); diff --git a/frontend_tests/node_tests/markdown_katex.js b/frontend_tests/node_tests/markdown_katex.js index 76e54e7102..0d301a030d 100644 --- a/frontend_tests/node_tests/markdown_katex.js +++ b/frontend_tests/node_tests/markdown_katex.js @@ -1,3 +1,5 @@ +"use strict"; + /* This whole module is dedicated to adding one line of coverage for markdown.js. diff --git a/frontend_tests/node_tests/message_edit.js b/frontend_tests/node_tests/message_edit.js index 1de52e0750..be132278ff 100644 --- a/frontend_tests/node_tests/message_edit.js +++ b/frontend_tests/node_tests/message_edit.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("document", null); set_global("page_params", { realm_community_topic_editing_limit_seconds: 86400, diff --git a/frontend_tests/node_tests/message_events.js b/frontend_tests/node_tests/message_events.js index 4b867b1bc2..b29b64dda7 100644 --- a/frontend_tests/node_tests/message_events.js +++ b/frontend_tests/node_tests/message_events.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("message_events"); zrequire("message_store"); zrequire("muting"); diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.js index 13bb9081bf..9230517ca1 100644 --- a/frontend_tests/node_tests/message_fetch.js +++ b/frontend_tests/node_tests/message_fetch.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/message_flags.js b/frontend_tests/node_tests/message_flags.js index 8061e09499..aa15926c94 100644 --- a/frontend_tests/node_tests/message_flags.js +++ b/frontend_tests/node_tests/message_flags.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("unread"); zrequire("unread_ops"); zrequire("message_flags"); diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js index 6dc9663449..e5f34cf51f 100644 --- a/frontend_tests/node_tests/message_list.js +++ b/frontend_tests/node_tests/message_list.js @@ -1,3 +1,5 @@ +"use strict"; + // These unit tests for static/js/message_list.js emphasize the model-ish // aspects of the MessageList class. We have to stub out a few functions // related to views and events to get the tests working. diff --git a/frontend_tests/node_tests/message_list_data.js b/frontend_tests/node_tests/message_list_data.js index 9c5e0335b6..cea13f3fe6 100644 --- a/frontend_tests/node_tests/message_list_data.js +++ b/frontend_tests/node_tests/message_list_data.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("unread"); zrequire("Filter", "js/filter"); diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js index 115778baac..90d96df366 100644 --- a/frontend_tests/node_tests/message_list_view.js +++ b/frontend_tests/node_tests/message_list_view.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/message_store.js b/frontend_tests/node_tests/message_store.js index c97a107ce6..142f16b255 100644 --- a/frontend_tests/node_tests/message_store.js +++ b/frontend_tests/node_tests/message_store.js @@ -1,3 +1,5 @@ +"use strict"; + const util = zrequire("util"); zrequire("pm_conversations"); zrequire("people"); diff --git a/frontend_tests/node_tests/muting.js b/frontend_tests/node_tests/muting.js index 818fa595af..0a0b0ace35 100644 --- a/frontend_tests/node_tests/muting.js +++ b/frontend_tests/node_tests/muting.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("timerender"); zrequire("muting"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/narrow.js b/frontend_tests/node_tests/narrow.js index ac79e42cd3..6e954e0ad9 100644 --- a/frontend_tests/node_tests/narrow.js +++ b/frontend_tests/node_tests/narrow.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); zrequire("hash_util"); zrequire("hashchange"); diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js index dc3c52abf9..c958e5434d 100644 --- a/frontend_tests/node_tests/narrow_activate.js +++ b/frontend_tests/node_tests/narrow_activate.js @@ -1,3 +1,5 @@ +"use strict"; + const util = zrequire("util"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/narrow_local.js b/frontend_tests/node_tests/narrow_local.js index 8bdefccc81..8194b84354 100644 --- a/frontend_tests/node_tests/narrow_local.js +++ b/frontend_tests/node_tests/narrow_local.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("Filter", "js/filter"); zrequire("FetchStatus", "js/fetch_status"); zrequire("MessageListData", "js/message_list_data"); diff --git a/frontend_tests/node_tests/narrow_state.js b/frontend_tests/node_tests/narrow_state.js index a8b0adcf6d..79bea63043 100644 --- a/frontend_tests/node_tests/narrow_state.js +++ b/frontend_tests/node_tests/narrow_state.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("people"); zrequire("Filter", "js/filter"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/narrow_unread.js b/frontend_tests/node_tests/narrow_unread.js index e82f20bd06..6f2a7db981 100644 --- a/frontend_tests/node_tests/narrow_unread.js +++ b/frontend_tests/node_tests/narrow_unread.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("Filter", "js/filter"); zrequire("people"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/notifications.js b/frontend_tests/node_tests/notifications.js index a8da203c1f..70354bebab 100644 --- a/frontend_tests/node_tests/notifications.js +++ b/frontend_tests/node_tests/notifications.js @@ -1,3 +1,5 @@ +"use strict"; + // Dependencies set_global( "$", diff --git a/frontend_tests/node_tests/password.js b/frontend_tests/node_tests/password.js index 8c5449ce45..88fdb5050f 100644 --- a/frontend_tests/node_tests/password.js +++ b/frontend_tests/node_tests/password.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("zxcvbn", zrequire("zxcvbn", "zxcvbn")); zrequire("common"); diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index eac1fe0087..f9c4ba8a66 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const moment = require("moment-timezone"); const rewiremock = require("rewiremock/node"); diff --git a/frontend_tests/node_tests/people_errors.js b/frontend_tests/node_tests/people_errors.js index f66f2ce0c3..1c2b1f27d7 100644 --- a/frontend_tests/node_tests/people_errors.js +++ b/frontend_tests/node_tests/people_errors.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("people"); const return_false = function () { diff --git a/frontend_tests/node_tests/pm_conversations.js b/frontend_tests/node_tests/pm_conversations.js index 02546dc944..fd09bbec6d 100644 --- a/frontend_tests/node_tests/pm_conversations.js +++ b/frontend_tests/node_tests/pm_conversations.js @@ -1,3 +1,5 @@ +"use strict"; + const pmc = zrequire("pm_conversations"); run_test("partners", () => { diff --git a/frontend_tests/node_tests/pm_list.js b/frontend_tests/node_tests/pm_list.js index deb24d5789..a20a22d6aa 100644 --- a/frontend_tests/node_tests/pm_list.js +++ b/frontend_tests/node_tests/pm_list.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); set_global("narrow_state", {}); diff --git a/frontend_tests/node_tests/poll_widget.js b/frontend_tests/node_tests/poll_widget.js index eab3eb4ff3..e46631e94e 100644 --- a/frontend_tests/node_tests/poll_widget.js +++ b/frontend_tests/node_tests/poll_widget.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("poll_widget"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/popovers.js b/frontend_tests/node_tests/popovers.js index d2801cb19c..5d8090ecc7 100644 --- a/frontend_tests/node_tests/popovers.js +++ b/frontend_tests/node_tests/popovers.js @@ -1,3 +1,5 @@ +"use strict"; + const rewiremock = require("rewiremock/node"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/presence.js b/frontend_tests/node_tests/presence.js index f43d34cd01..cf1007ffa7 100644 --- a/frontend_tests/node_tests/presence.js +++ b/frontend_tests/node_tests/presence.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); zrequire("people"); diff --git a/frontend_tests/node_tests/reactions.js b/frontend_tests/node_tests/reactions.js index b501887bbb..ee2e276f34 100644 --- a/frontend_tests/node_tests/reactions.js +++ b/frontend_tests/node_tests/reactions.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("document", "document-stub"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/recent_senders.js b/frontend_tests/node_tests/recent_senders.js index dd6933689d..f8d6498751 100644 --- a/frontend_tests/node_tests/recent_senders.js +++ b/frontend_tests/node_tests/recent_senders.js @@ -1,3 +1,5 @@ +"use strict"; + const rs = zrequire("recent_senders"); let next_id = 0; diff --git a/frontend_tests/node_tests/recent_topics.js b/frontend_tests/node_tests/recent_topics.js index b4226b6688..a45fe2b9bd 100644 --- a/frontend_tests/node_tests/recent_topics.js +++ b/frontend_tests/node_tests/recent_topics.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("message_util"); const noop = () => {}; diff --git a/frontend_tests/node_tests/rendered_markdown.js b/frontend_tests/node_tests/rendered_markdown.js index db62c1cd0f..84ffa09fb5 100644 --- a/frontend_tests/node_tests/rendered_markdown.js +++ b/frontend_tests/node_tests/rendered_markdown.js @@ -1,3 +1,5 @@ +"use strict"; + const rm = zrequire("rendered_markdown"); zrequire("people"); zrequire("user_groups"); diff --git a/frontend_tests/node_tests/rtl.js b/frontend_tests/node_tests/rtl.js index 74e6e061cc..71f5609cc5 100644 --- a/frontend_tests/node_tests/rtl.js +++ b/frontend_tests/node_tests/rtl.js @@ -1,3 +1,5 @@ +"use strict"; + const rtl = zrequire("rtl"); run_test("get_direction", () => { diff --git a/frontend_tests/node_tests/schema.js b/frontend_tests/node_tests/schema.js index 98c803110a..2d620047c3 100644 --- a/frontend_tests/node_tests/schema.js +++ b/frontend_tests/node_tests/schema.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("schema"); run_test("basics", () => { diff --git a/frontend_tests/node_tests/scroll_util.js b/frontend_tests/node_tests/scroll_util.js index 1e3ad161e6..e6bd93b4a7 100644 --- a/frontend_tests/node_tests/scroll_util.js +++ b/frontend_tests/node_tests/scroll_util.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("scroll_util"); set_global("ui", { get_scroll_element: (element) => element, diff --git a/frontend_tests/node_tests/search.js b/frontend_tests/node_tests/search.js index 319ab38e12..d346e00b41 100644 --- a/frontend_tests/node_tests/search.js +++ b/frontend_tests/node_tests/search.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("page_params", { search_pills_enabled: true, }); diff --git a/frontend_tests/node_tests/search_legacy.js b/frontend_tests/node_tests/search_legacy.js index edf77f4d41..7efaccf4b5 100644 --- a/frontend_tests/node_tests/search_legacy.js +++ b/frontend_tests/node_tests/search_legacy.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("page_params", { search_pills_enabled: false, }); diff --git a/frontend_tests/node_tests/search_pill.js b/frontend_tests/node_tests/search_pill.js index b26776af02..c588f3e4ab 100644 --- a/frontend_tests/node_tests/search_pill.js +++ b/frontend_tests/node_tests/search_pill.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("search_pill"); zrequire("input_pill"); zrequire("Filter", "js/filter"); diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js index 5bb1cbd590..fbe017e1a4 100644 --- a/frontend_tests/node_tests/search_suggestion.js +++ b/frontend_tests/node_tests/search_suggestion.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("page_params", { search_pills_enabled: true, }); diff --git a/frontend_tests/node_tests/search_suggestion_legacy.js b/frontend_tests/node_tests/search_suggestion_legacy.js index 301502879b..443badd619 100644 --- a/frontend_tests/node_tests/search_suggestion_legacy.js +++ b/frontend_tests/node_tests/search_suggestion_legacy.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("page_params", { search_pills_enabled: false, }); diff --git a/frontend_tests/node_tests/server_events.js b/frontend_tests/node_tests/server_events.js index fc2bb7ec7a..31cb1a6019 100644 --- a/frontend_tests/node_tests/server_events.js +++ b/frontend_tests/node_tests/server_events.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = function () {}; set_global("document", {}); diff --git a/frontend_tests/node_tests/settings_bots.js b/frontend_tests/node_tests/settings_bots.js index 275b8de5fd..196dcf1143 100644 --- a/frontend_tests/node_tests/settings_bots.js +++ b/frontend_tests/node_tests/settings_bots.js @@ -1,3 +1,5 @@ +"use strict"; + const rewiremock = require("rewiremock/node"); set_global("page_params", { diff --git a/frontend_tests/node_tests/settings_data.js b/frontend_tests/node_tests/settings_data.js index bf04298ee2..9261e11424 100644 --- a/frontend_tests/node_tests/settings_data.js +++ b/frontend_tests/node_tests/settings_data.js @@ -1,3 +1,5 @@ +"use strict"; + const settings_data = zrequire("settings_data"); const settings_config = zrequire("settings_config"); diff --git a/frontend_tests/node_tests/settings_emoji.js b/frontend_tests/node_tests/settings_emoji.js index d72a88b4e7..743a4f7848 100644 --- a/frontend_tests/node_tests/settings_emoji.js +++ b/frontend_tests/node_tests/settings_emoji.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); set_global("upload_widget", {}); zrequire("settings_emoji"); diff --git a/frontend_tests/node_tests/settings_muting.js b/frontend_tests/node_tests/settings_muting.js index c0a980dd6b..869821e7c0 100644 --- a/frontend_tests/node_tests/settings_muting.js +++ b/frontend_tests/node_tests/settings_muting.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); set_global("XDate", zrequire("XDate", "xdate")); diff --git a/frontend_tests/node_tests/settings_org.js b/frontend_tests/node_tests/settings_org.js index 5d4a45215a..6499bfe171 100644 --- a/frontend_tests/node_tests/settings_org.js +++ b/frontend_tests/node_tests/settings_org.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); const noop = () => {}; diff --git a/frontend_tests/node_tests/settings_profile_fields.js b/frontend_tests/node_tests/settings_profile_fields.js index 7f39d6fd6c..e818ca9419 100644 --- a/frontend_tests/node_tests/settings_profile_fields.js +++ b/frontend_tests/node_tests/settings_profile_fields.js @@ -1,3 +1,5 @@ +"use strict"; + const rewiremock = require("rewiremock/node"); set_global("page_params", {}); diff --git a/frontend_tests/node_tests/settings_user_groups.js b/frontend_tests/node_tests/settings_user_groups.js index 4f9953c336..36747501c9 100644 --- a/frontend_tests/node_tests/settings_user_groups.js +++ b/frontend_tests/node_tests/settings_user_groups.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); zrequire("user_pill"); diff --git a/frontend_tests/node_tests/spoilers.js b/frontend_tests/node_tests/spoilers.js index d3a8d76bb4..81b48f6ebd 100644 --- a/frontend_tests/node_tests/spoilers.js +++ b/frontend_tests/node_tests/spoilers.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); zrequire("spoilers"); diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index 990a467da7..a3ac443bf8 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); set_global("page_params", { diff --git a/frontend_tests/node_tests/stream_events.js b/frontend_tests/node_tests/stream_events.js index 9ce2f76e35..2198b20475 100644 --- a/frontend_tests/node_tests/stream_events.js +++ b/frontend_tests/node_tests/stream_events.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = function () {}; const return_true = function () { return true; diff --git a/frontend_tests/node_tests/stream_list.js b/frontend_tests/node_tests/stream_list.js index 0b486be7e8..92382e0470 100644 --- a/frontend_tests/node_tests/stream_list.js +++ b/frontend_tests/node_tests/stream_list.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("document", "document-stub"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/stream_search.js b/frontend_tests/node_tests/stream_search.js index a5329b8760..fbe49d960a 100644 --- a/frontend_tests/node_tests/stream_search.js +++ b/frontend_tests/node_tests/stream_search.js @@ -1,3 +1,5 @@ +"use strict"; + // This tests the stream searching functionality which currently // lives in stream_list.js. diff --git a/frontend_tests/node_tests/stream_sort.js b/frontend_tests/node_tests/stream_sort.js index a766e2a5fa..bba41a1a22 100644 --- a/frontend_tests/node_tests/stream_sort.js +++ b/frontend_tests/node_tests/stream_sort.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("stream_data"); zrequire("stream_sort"); diff --git a/frontend_tests/node_tests/stream_topic_history.js b/frontend_tests/node_tests/stream_topic_history.js index a5850fd870..03bf10fa6e 100644 --- a/frontend_tests/node_tests/stream_topic_history.js +++ b/frontend_tests/node_tests/stream_topic_history.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("unread"); zrequire("stream_data"); zrequire("stream_topic_history"); diff --git a/frontend_tests/node_tests/submessage.js b/frontend_tests/node_tests/submessage.js index 915605b992..fa26f88eb7 100644 --- a/frontend_tests/node_tests/submessage.js +++ b/frontend_tests/node_tests/submessage.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("submessage"); set_global("channel", {}); diff --git a/frontend_tests/node_tests/subs.js b/frontend_tests/node_tests/subs.js index d92e46c769..6ecaab424f 100644 --- a/frontend_tests/node_tests/subs.js +++ b/frontend_tests/node_tests/subs.js @@ -1,3 +1,5 @@ +"use strict"; + global.stub_out_jquery(); set_global("ui", { diff --git a/frontend_tests/node_tests/support.js b/frontend_tests/node_tests/support.js index 298a2cd35a..da8fe89800 100644 --- a/frontend_tests/node_tests/support.js +++ b/frontend_tests/node_tests/support.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const {JSDOM} = require("jsdom"); diff --git a/frontend_tests/node_tests/timerender.js b/frontend_tests/node_tests/timerender.js index 99933f53a9..1762a023ff 100644 --- a/frontend_tests/node_tests/timerender.js +++ b/frontend_tests/node_tests/timerender.js @@ -1,3 +1,5 @@ +"use strict"; + const moment = require("moment"); const XDate = require("xdate"); diff --git a/frontend_tests/node_tests/top_left_corner.js b/frontend_tests/node_tests/top_left_corner.js index dfcbd815e3..c4cfb14f23 100644 --- a/frontend_tests/node_tests/top_left_corner.js +++ b/frontend_tests/node_tests/top_left_corner.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); zrequire("Filter", "js/filter"); diff --git a/frontend_tests/node_tests/topic_generator.js b/frontend_tests/node_tests/topic_generator.js index 4342e42107..b944533a61 100644 --- a/frontend_tests/node_tests/topic_generator.js +++ b/frontend_tests/node_tests/topic_generator.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("pm_conversations", { recent: {}, }); diff --git a/frontend_tests/node_tests/topic_list_data.js b/frontend_tests/node_tests/topic_list_data.js index 3595654e4f..d3f3ad1060 100644 --- a/frontend_tests/node_tests/topic_list_data.js +++ b/frontend_tests/node_tests/topic_list_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); set_global("narrow_state", {}); diff --git a/frontend_tests/node_tests/transmit.js b/frontend_tests/node_tests/transmit.js index a7381f1799..b300a50a8d 100644 --- a/frontend_tests/node_tests/transmit.js +++ b/frontend_tests/node_tests/transmit.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = function () {}; set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/typeahead.js b/frontend_tests/node_tests/typeahead.js index 301a44c0bc..0220603b2e 100644 --- a/frontend_tests/node_tests/typeahead.js +++ b/frontend_tests/node_tests/typeahead.js @@ -1,3 +1,5 @@ +"use strict"; + const typeahead = zrequire("typeahead", "shared/js/typeahead"); // The data structures here may be different for diff --git a/frontend_tests/node_tests/typeahead_helper.js b/frontend_tests/node_tests/typeahead_helper.js index a1911f766c..5627e475f4 100644 --- a/frontend_tests/node_tests/typeahead_helper.js +++ b/frontend_tests/node_tests/typeahead_helper.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("page_params", {realm_is_zephyr_mirror_realm: false}); set_global("md5", (s) => "md5-" + s); diff --git a/frontend_tests/node_tests/typing_data.js b/frontend_tests/node_tests/typing_data.js index 7b5f09f891..d1f2b8a768 100644 --- a/frontend_tests/node_tests/typing_data.js +++ b/frontend_tests/node_tests/typing_data.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("typing_data"); run_test("basics", () => { diff --git a/frontend_tests/node_tests/typing_status.js b/frontend_tests/node_tests/typing_status.js index f3ebf0c54e..ffcda32a55 100644 --- a/frontend_tests/node_tests/typing_status.js +++ b/frontend_tests/node_tests/typing_status.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("typing"); zrequire("people"); zrequire("compose_pm_pill"); diff --git a/frontend_tests/node_tests/ui.js b/frontend_tests/node_tests/ui.js index b7357d3e82..8ed2e3eb26 100644 --- a/frontend_tests/node_tests/ui.js +++ b/frontend_tests/node_tests/ui.js @@ -1,3 +1,5 @@ +"use strict"; + const ui = zrequire("ui"); set_global("navigator", { diff --git a/frontend_tests/node_tests/ui_init.js b/frontend_tests/node_tests/ui_init.js index 514f3a34e7..c5779f652f 100644 --- a/frontend_tests/node_tests/ui_init.js +++ b/frontend_tests/node_tests/ui_init.js @@ -1,3 +1,5 @@ +"use strict"; + const rewiremock = require("rewiremock/node"); /* diff --git a/frontend_tests/node_tests/unread.js b/frontend_tests/node_tests/unread.js index 41648abdb1..3daf58a8b4 100644 --- a/frontend_tests/node_tests/unread.js +++ b/frontend_tests/node_tests/unread.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); zrequire("muting"); diff --git a/frontend_tests/node_tests/upgrade.js b/frontend_tests/node_tests/upgrade.js index 9b8a8bc904..67fc85c20c 100644 --- a/frontend_tests/node_tests/upgrade.js +++ b/frontend_tests/node_tests/upgrade.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = () => {}; const fs = require("fs"); diff --git a/frontend_tests/node_tests/upload.js b/frontend_tests/node_tests/upload.js index 856eaa1cb0..fd2757a832 100644 --- a/frontend_tests/node_tests/upload.js +++ b/frontend_tests/node_tests/upload.js @@ -1,3 +1,5 @@ +"use strict"; + const rewiremock = require("rewiremock/node"); set_global("$", global.make_zjquery()); diff --git a/frontend_tests/node_tests/user_events.js b/frontend_tests/node_tests/user_events.js index f74dc5910c..a4a17ace61 100644 --- a/frontend_tests/node_tests/user_events.js +++ b/frontend_tests/node_tests/user_events.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); zrequire("people"); diff --git a/frontend_tests/node_tests/user_groups.js b/frontend_tests/node_tests/user_groups.js index 78eb697135..3a7a47dbd4 100644 --- a/frontend_tests/node_tests/user_groups.js +++ b/frontend_tests/node_tests/user_groups.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("user_groups"); run_test("user_groups", () => { diff --git a/frontend_tests/node_tests/user_pill.js b/frontend_tests/node_tests/user_pill.js index da9492aefe..6abd113b9c 100644 --- a/frontend_tests/node_tests/user_pill.js +++ b/frontend_tests/node_tests/user_pill.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("people"); set_global("md5", (s) => "md5-" + s); zrequire("user_pill"); diff --git a/frontend_tests/node_tests/user_status.js b/frontend_tests/node_tests/user_status.js index 4295223b48..434d99b205 100644 --- a/frontend_tests/node_tests/user_status.js +++ b/frontend_tests/node_tests/user_status.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("channel", {}); zrequire("user_status"); diff --git a/frontend_tests/node_tests/util.js b/frontend_tests/node_tests/util.js index 50e4778720..5f8bfd10d5 100644 --- a/frontend_tests/node_tests/util.js +++ b/frontend_tests/node_tests/util.js @@ -1,3 +1,5 @@ +"use strict"; + const {JSDOM} = require("jsdom"); const _ = require("lodash"); diff --git a/frontend_tests/node_tests/vdom.js b/frontend_tests/node_tests/vdom.js index 6ccb22e7c8..4f84a83d2d 100644 --- a/frontend_tests/node_tests/vdom.js +++ b/frontend_tests/node_tests/vdom.js @@ -1,3 +1,5 @@ +"use strict"; + zrequire("vdom"); run_test("basics", () => { diff --git a/frontend_tests/node_tests/widgetize.js b/frontend_tests/node_tests/widgetize.js index 275689ec57..269dbd0add 100644 --- a/frontend_tests/node_tests/widgetize.js +++ b/frontend_tests/node_tests/widgetize.js @@ -1,3 +1,5 @@ +"use strict"; + set_global("$", global.make_zjquery()); set_global("poll_widget", {}); set_global("tictactoe_widget", {}); diff --git a/frontend_tests/node_tests/zblueslip.js b/frontend_tests/node_tests/zblueslip.js index 52214d1fd1..10373f8839 100644 --- a/frontend_tests/node_tests/zblueslip.js +++ b/frontend_tests/node_tests/zblueslip.js @@ -1,3 +1,5 @@ +"use strict"; + /* This test module actually tests our test code, particularly zblueslip, and diff --git a/frontend_tests/node_tests/zjquery.js b/frontend_tests/node_tests/zjquery.js index 4fe716e89b..33123a8970 100644 --- a/frontend_tests/node_tests/zjquery.js +++ b/frontend_tests/node_tests/zjquery.js @@ -1,3 +1,5 @@ +"use strict"; + /* This test module actually tests our test code, particularly zjquery, and diff --git a/frontend_tests/puppeteer_lib/common.js b/frontend_tests/puppeteer_lib/common.js index 81ecd15042..d3d0b014f7 100644 --- a/frontend_tests/puppeteer_lib/common.js +++ b/frontend_tests/puppeteer_lib/common.js @@ -1,3 +1,5 @@ +"use strict"; + const assert = require("assert").strict; const path = require("path"); diff --git a/frontend_tests/puppeteer_tests/00-realm-creation.js b/frontend_tests/puppeteer_tests/00-realm-creation.js index 979257b5fb..666d9d3f30 100644 --- a/frontend_tests/puppeteer_tests/00-realm-creation.js +++ b/frontend_tests/puppeteer_tests/00-realm-creation.js @@ -1,3 +1,5 @@ +"use strict"; + const assert = require("assert").strict; const common = require("../puppeteer_lib/common"); diff --git a/frontend_tests/puppeteer_tests/01-login.js b/frontend_tests/puppeteer_tests/01-login.js index c584018bfb..9c76b4094f 100644 --- a/frontend_tests/puppeteer_tests/01-login.js +++ b/frontend_tests/puppeteer_tests/01-login.js @@ -1,3 +1,5 @@ +"use strict"; + const test_credentials = require("../../var/casper/test_credentials.js").test_credentials; const common = require("../puppeteer_lib/common"); diff --git a/frontend_tests/puppeteer_tests/02-message-basics.js b/frontend_tests/puppeteer_tests/02-message-basics.js index baa49ad96e..e85ac8dc5f 100644 --- a/frontend_tests/puppeteer_tests/02-message-basics.js +++ b/frontend_tests/puppeteer_tests/02-message-basics.js @@ -1,3 +1,5 @@ +"use strict"; + const common = require("../puppeteer_lib/common"); async function message_basic_tests(page) { diff --git a/frontend_tests/puppeteer_tests/03-compose.js b/frontend_tests/puppeteer_tests/03-compose.js index 2f482aeb74..8a398c763b 100644 --- a/frontend_tests/puppeteer_tests/03-compose.js +++ b/frontend_tests/puppeteer_tests/03-compose.js @@ -1,3 +1,5 @@ +"use strict"; + const assert = require("assert").strict; const common = require("../puppeteer_lib/common"); diff --git a/frontend_tests/puppeteer_tests/04-subscriptions.js b/frontend_tests/puppeteer_tests/04-subscriptions.js index e3d4ca9496..86f68db952 100644 --- a/frontend_tests/puppeteer_tests/04-subscriptions.js +++ b/frontend_tests/puppeteer_tests/04-subscriptions.js @@ -1,3 +1,5 @@ +"use strict"; + const assert = require("assert").strict; const common = require("../puppeteer_lib/common"); diff --git a/frontend_tests/puppeteer_tests/05-settings.js b/frontend_tests/puppeteer_tests/05-settings.js index ecc44518ad..8809599249 100644 --- a/frontend_tests/puppeteer_tests/05-settings.js +++ b/frontend_tests/puppeteer_tests/05-settings.js @@ -1,3 +1,5 @@ +"use strict"; + const assert = require("assert").strict; const test_credentials = require("../../var/casper/test_credentials.js").test_credentials; diff --git a/frontend_tests/zjsunit/finder.js b/frontend_tests/zjsunit/finder.js index e5adbacfb4..c1eadba325 100644 --- a/frontend_tests/zjsunit/finder.js +++ b/frontend_tests/zjsunit/finder.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/frontend_tests/zjsunit/handlebars.js b/frontend_tests/zjsunit/handlebars.js index 9daafc87e2..71aa47f189 100644 --- a/frontend_tests/zjsunit/handlebars.js +++ b/frontend_tests/zjsunit/handlebars.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const path = require("path"); diff --git a/frontend_tests/zjsunit/i18n.js b/frontend_tests/zjsunit/i18n.js index 956a559efa..b9e96958bd 100644 --- a/frontend_tests/zjsunit/i18n.js +++ b/frontend_tests/zjsunit/i18n.js @@ -1,3 +1,5 @@ +"use strict"; + exports.t = function (str, context) { // HAPPY PATH: most translations are a simple string: if (context === undefined) { diff --git a/frontend_tests/zjsunit/index.js b/frontend_tests/zjsunit/index.js index f31afc9c3d..ecab7ef6b4 100644 --- a/frontend_tests/zjsunit/index.js +++ b/frontend_tests/zjsunit/index.js @@ -1,3 +1,5 @@ +"use strict"; + const fs = require("fs"); const Module = require("module"); const path = require("path"); diff --git a/frontend_tests/zjsunit/markdown_assert.js b/frontend_tests/zjsunit/markdown_assert.js index 73778525fb..e6f6e7648e 100644 --- a/frontend_tests/zjsunit/markdown_assert.js +++ b/frontend_tests/zjsunit/markdown_assert.js @@ -1,3 +1,5 @@ +"use strict"; + /** * markdown_assert.js * diff --git a/frontend_tests/zjsunit/mdiff.js b/frontend_tests/zjsunit/mdiff.js index 36b8ed0c44..d312769b6e 100644 --- a/frontend_tests/zjsunit/mdiff.js +++ b/frontend_tests/zjsunit/mdiff.js @@ -1,3 +1,5 @@ +"use strict"; + /** * mdiff.js * diff --git a/frontend_tests/zjsunit/namespace.js b/frontend_tests/zjsunit/namespace.js index effe06e6c3..119cc6d2b7 100644 --- a/frontend_tests/zjsunit/namespace.js +++ b/frontend_tests/zjsunit/namespace.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const requires = []; diff --git a/frontend_tests/zjsunit/stub.js b/frontend_tests/zjsunit/stub.js index 81a7e19d00..b39e1db720 100644 --- a/frontend_tests/zjsunit/stub.js +++ b/frontend_tests/zjsunit/stub.js @@ -1,3 +1,5 @@ +"use strict"; + const assert = require("assert").strict; // Stubs don't do any magical modifications to your namespace. They diff --git a/frontend_tests/zjsunit/zblueslip.js b/frontend_tests/zjsunit/zblueslip.js index b7f8fa9dab..ea74ade7e2 100644 --- a/frontend_tests/zjsunit/zblueslip.js +++ b/frontend_tests/zjsunit/zblueslip.js @@ -1,3 +1,5 @@ +"use strict"; + exports.make_zblueslip = function () { const lib = {}; diff --git a/frontend_tests/zjsunit/zjquery.js b/frontend_tests/zjsunit/zjquery.js index fc96b00f30..a1fe1fc076 100644 --- a/frontend_tests/zjsunit/zjquery.js +++ b/frontend_tests/zjsunit/zjquery.js @@ -1,3 +1,5 @@ +"use strict"; + const noop = function () {}; class Event { diff --git a/postcss.config.js b/postcss.config.js index 35f9b9b0f9..10620d2ab8 100644 --- a/postcss.config.js +++ b/postcss.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = ({file}) => ({ parser: file.extname === ".scss" ? "postcss-scss" : false, plugins: { diff --git a/prettier.config.js b/prettier.config.js index c638745810..1966c858a3 100644 --- a/prettier.config.js +++ b/prettier.config.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { bracketSpacing: false, trailingComma: "all", diff --git a/static/assets/icons/zulip-icons.font.js b/static/assets/icons/zulip-icons.font.js index 3136e6c8ef..5ef0b11a74 100644 --- a/static/assets/icons/zulip-icons.font.js +++ b/static/assets/icons/zulip-icons.font.js @@ -1,3 +1,5 @@ +"use strict"; + module.exports = { files: ["./*.svg"], fontName: "zulip-icons", diff --git a/static/js/activity.js b/static/js/activity.js index fe65dc5de7..8da6994193 100644 --- a/static/js/activity.js +++ b/static/js/activity.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); /* Helpers for detecting user activity and managing user idle states diff --git a/static/js/admin.js b/static/js/admin.js index e5772411e2..0c8508ba67 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -1,3 +1,5 @@ +"use strict"; + const render_admin_tab = require("../templates/admin_tab.hbs"); const render_settings_organization_settings_tip = require("../templates/settings/organization_settings_tip.hbs"); diff --git a/static/js/alert_words.js b/static/js/alert_words.js index 8968d2fbce..96861f1119 100644 --- a/static/js/alert_words.js +++ b/static/js/alert_words.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); // For simplicity, we use a list for our internal diff --git a/static/js/alert_words_ui.js b/static/js/alert_words_ui.js index 2a86a3e41f..a132ed5ba2 100644 --- a/static/js/alert_words_ui.js +++ b/static/js/alert_words_ui.js @@ -1,3 +1,5 @@ +"use strict"; + const render_alert_word_settings_item = require("../templates/settings/alert_word_settings_item.hbs"); exports.render_alert_words_ui = function () { diff --git a/static/js/analytics/activity.js b/static/js/analytics/activity.js index 5a17aff7f1..ea5cbe3e0f 100644 --- a/static/js/analytics/activity.js +++ b/static/js/analytics/activity.js @@ -1,3 +1,5 @@ +"use strict"; + $(() => { $("a.envelope-link").on("click", function () { common.copy_data_attribute_value($(this), "admin-emails"); diff --git a/static/js/analytics/support.js b/static/js/analytics/support.js index 46aba1eda8..fdfb141a0f 100644 --- a/static/js/analytics/support.js +++ b/static/js/analytics/support.js @@ -1,3 +1,5 @@ +"use strict"; + $(() => { $("body").on("click", ".scrub-realm-button", function (e) { e.preventDefault(); diff --git a/static/js/archive.js b/static/js/archive.js index 07b3f40131..993d78885c 100644 --- a/static/js/archive.js +++ b/static/js/archive.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const XDate = require("xdate"); diff --git a/static/js/attachments_ui.js b/static/js/attachments_ui.js index 6436c62a23..fca9190765 100644 --- a/static/js/attachments_ui.js +++ b/static/js/attachments_ui.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); const render_settings_upload_space_stats = require("../templates/settings/upload_space_stats.hbs"); diff --git a/static/js/avatar.js b/static/js/avatar.js index 4509431565..cac45998c1 100644 --- a/static/js/avatar.js +++ b/static/js/avatar.js @@ -1,3 +1,5 @@ +"use strict"; + exports.build_bot_create_widget = function () { // We have to do strange gyrations with the file input to clear it, // where we replace it wholesale, so we generalize the file input with diff --git a/static/js/billing/billing.js b/static/js/billing/billing.js index ca553c30bc..c6b54b059a 100644 --- a/static/js/billing/billing.js +++ b/static/js/billing/billing.js @@ -1,3 +1,5 @@ +"use strict"; + exports.initialize = function () { helpers.set_tab("billing"); diff --git a/static/js/billing/helpers.js b/static/js/billing/helpers.js index 5d3a33d378..0368b0320d 100644 --- a/static/js/billing/helpers.js +++ b/static/js/billing/helpers.js @@ -1,3 +1,5 @@ +"use strict"; + exports.create_ajax_request = function ( url, form_name, diff --git a/static/js/billing/upgrade.js b/static/js/billing/upgrade.js index cb4f7cc4fc..ab0f344f30 100644 --- a/static/js/billing/upgrade.js +++ b/static/js/billing/upgrade.js @@ -1,3 +1,5 @@ +"use strict"; + exports.initialize = () => { helpers.set_tab("upgrade"); diff --git a/static/js/blueslip.js b/static/js/blueslip.js index 094b7e8078..858d7d78c3 100644 --- a/static/js/blueslip.js +++ b/static/js/blueslip.js @@ -1,3 +1,5 @@ +"use strict"; + /* eslint-disable no-console */ // System documented in https://zulip.readthedocs.io/en/latest/subsystems/logging.html diff --git a/static/js/bot_data.js b/static/js/bot_data.js index 3244ac91d8..d8327769ea 100644 --- a/static/js/bot_data.js +++ b/static/js/bot_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const bots = new Map(); diff --git a/static/js/buddy_data.js b/static/js/buddy_data.js index 29920bd59e..59851cad92 100644 --- a/static/js/buddy_data.js +++ b/static/js/buddy_data.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); /* diff --git a/static/js/buddy_list.js b/static/js/buddy_list.js index b4d6c67f6b..81eca86a1d 100644 --- a/static/js/buddy_list.js +++ b/static/js/buddy_list.js @@ -1,3 +1,5 @@ +"use strict"; + const render_user_presence_row = require("../templates/user_presence_row.hbs"); const render_user_presence_rows = require("../templates/user_presence_rows.hbs"); diff --git a/static/js/channel.js b/static/js/channel.js index 23db2598b0..1cf077b672 100644 --- a/static/js/channel.js +++ b/static/js/channel.js @@ -1,3 +1,5 @@ +"use strict"; + const pending_requests = []; function add_pending_request(jqXHR) { diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index 789c30390a..33e1d09d83 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const WinChan = require("winchan"); diff --git a/static/js/color_data.js b/static/js/color_data.js index 6a9da6d296..e62eff0441 100644 --- a/static/js/color_data.js +++ b/static/js/color_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); // These colors are used now for streams. const stream_colors = [ diff --git a/static/js/colorspace.js b/static/js/colorspace.js index 8fb5f1b797..3096f46e62 100644 --- a/static/js/colorspace.js +++ b/static/js/colorspace.js @@ -1,3 +1,5 @@ +"use strict"; + // Convert an sRGB value in [0, 255] to a linear intensity // value in [0, 1]. // diff --git a/static/js/common.js b/static/js/common.js index 65a18c3812..ac36d6d5ab 100644 --- a/static/js/common.js +++ b/static/js/common.js @@ -1,3 +1,5 @@ +"use strict"; + // This reloads the module in development rather than refreshing the page if (module.hot) { module.hot.accept(); diff --git a/static/js/components.js b/static/js/components.js index dd71507660..5a11559e86 100644 --- a/static/js/components.js +++ b/static/js/components.js @@ -1,3 +1,5 @@ +"use strict"; + /* USAGE: Toggle x = components.toggle({ selected: Integer selected_index, diff --git a/static/js/compose.js b/static/js/compose.js index 2f56b71949..c2b76fb132 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -1,3 +1,5 @@ +"use strict"; + const Handlebars = require("handlebars/runtime"); const render_compose_all_everyone = require("../templates/compose_all_everyone.hbs"); diff --git a/static/js/compose_actions.js b/static/js/compose_actions.js index 84d41da982..426023cc8c 100644 --- a/static/js/compose_actions.js +++ b/static/js/compose_actions.js @@ -1,3 +1,5 @@ +"use strict"; + const autosize = require("autosize"); const fenced_code = require("../shared/js/fenced_code"); diff --git a/static/js/compose_fade.js b/static/js/compose_fade.js index bf1aef1850..d6093e16e5 100644 --- a/static/js/compose_fade.js +++ b/static/js/compose_fade.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const util = require("./util"); diff --git a/static/js/compose_pm_pill.js b/static/js/compose_pm_pill.js index b9d7a2a598..86b14c5496 100644 --- a/static/js/compose_pm_pill.js +++ b/static/js/compose_pm_pill.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); exports.initialize_pill = function () { diff --git a/static/js/compose_state.js b/static/js/compose_state.js index b42eca74a8..38ce7b664e 100644 --- a/static/js/compose_state.js +++ b/static/js/compose_state.js @@ -1,3 +1,5 @@ +"use strict"; + let message_type = false; // 'stream', 'private', or false-y exports.set_message_type = function (msg_type) { diff --git a/static/js/compose_ui.js b/static/js/compose_ui.js index 3cb876d715..35cd98e152 100644 --- a/static/js/compose_ui.js +++ b/static/js/compose_ui.js @@ -1,3 +1,5 @@ +"use strict"; + const autosize = require("autosize"); exports.autosize_textarea = function () { diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index df3d197a42..5d008cf8b6 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -1,3 +1,5 @@ +"use strict"; + const autosize = require("autosize"); const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js"); const moment = require("moment"); diff --git a/static/js/condense.js b/static/js/condense.js index 929213acfe..9dca9f9f39 100644 --- a/static/js/condense.js +++ b/static/js/condense.js @@ -1,3 +1,5 @@ +"use strict"; + /* This library implements two related, similar concepts: diff --git a/static/js/confirm_dialog.js b/static/js/confirm_dialog.js index b13d54b023..a638b1ac13 100644 --- a/static/js/confirm_dialog.js +++ b/static/js/confirm_dialog.js @@ -1,3 +1,5 @@ +"use strict"; + const render_confirm_dialog = require("../templates/confirm_dialog.hbs"); /* diff --git a/static/js/copy_and_paste.js b/static/js/copy_and_paste.js index 0976d370db..598272f70d 100644 --- a/static/js/copy_and_paste.js +++ b/static/js/copy_and_paste.js @@ -1,3 +1,5 @@ +"use strict"; + const TurndownService = require("turndown/lib/turndown.cjs.js"); function find_boundary_tr(initial_tr, iterate_row) { diff --git a/static/js/csrf.js b/static/js/csrf.js index cb237511d8..ec4d26d956 100644 --- a/static/js/csrf.js +++ b/static/js/csrf.js @@ -1,3 +1,5 @@ +"use strict"; + let csrf_token; $(() => { // This requires that we used Jinja2's {% csrf_input %} somewhere on the page. diff --git a/static/js/drafts.js b/static/js/drafts.js index f4f491416f..5a890a48fe 100644 --- a/static/js/drafts.js +++ b/static/js/drafts.js @@ -1,3 +1,5 @@ +"use strict"; + const Handlebars = require("handlebars/runtime"); const XDate = require("xdate"); diff --git a/static/js/dropdown_list_widget.js b/static/js/dropdown_list_widget.js index 9c5cb55768..c0a357d540 100644 --- a/static/js/dropdown_list_widget.js +++ b/static/js/dropdown_list_widget.js @@ -1,3 +1,5 @@ +"use strict"; + const DropdownListWidget = function (opts) { const init = () => { // Run basic sanity checks on opts, and set up sane defaults. diff --git a/static/js/echo.js b/static/js/echo.js index 4b7dbebcee..9cf9df9db7 100644 --- a/static/js/echo.js +++ b/static/js/echo.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); // Docs: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html diff --git a/static/js/emoji_picker.js b/static/js/emoji_picker.js index f2240724f0..af9deb0fb3 100644 --- a/static/js/emoji_picker.js +++ b/static/js/emoji_picker.js @@ -1,3 +1,5 @@ +"use strict"; + const emoji_codes = require("../generated/emoji/emoji_codes.json"); const emoji = require("../shared/js/emoji"); const typeahead = require("../shared/js/typeahead"); diff --git a/static/js/favicon.js b/static/js/favicon.js index 773fdfa6b0..23db6e9534 100644 --- a/static/js/favicon.js +++ b/static/js/favicon.js @@ -1,3 +1,5 @@ +"use strict"; + exports.set = function (url) { $("#favicon").attr("href", url); }; diff --git a/static/js/feature_flags.js b/static/js/feature_flags.js index af35ee5290..ae76281c87 100644 --- a/static/js/feature_flags.js +++ b/static/js/feature_flags.js @@ -1,3 +1,5 @@ +"use strict"; + // The features below have all settled into their final states and the flags // below can be removed when we get a chance. exports.reminders_in_message_action_menu = false; diff --git a/static/js/feedback_widget.js b/static/js/feedback_widget.js index c25293910a..7527138013 100644 --- a/static/js/feedback_widget.js +++ b/static/js/feedback_widget.js @@ -1,3 +1,5 @@ +"use strict"; + const render_feedback_container = require("../templates/feedback_container.hbs"); /* diff --git a/static/js/fetch_status.js b/static/js/fetch_status.js index 77dd50eb61..09428e35c1 100644 --- a/static/js/fetch_status.js +++ b/static/js/fetch_status.js @@ -1,3 +1,5 @@ +"use strict"; + function max_id_for_messages(messages) { let max_id = 0; for (const msg of messages) { diff --git a/static/js/filter.js b/static/js/filter.js index 56e1ed4fea..2acf93bb16 100644 --- a/static/js/filter.js +++ b/static/js/filter.js @@ -1,3 +1,5 @@ +"use strict"; + const Handlebars = require("handlebars/runtime"); const _ = require("lodash"); diff --git a/static/js/floating_recipient_bar.js b/static/js/floating_recipient_bar.js index 3ed40e0905..9b50513d26 100644 --- a/static/js/floating_recipient_bar.js +++ b/static/js/floating_recipient_bar.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); let is_floating_recipient_bar_showing = false; diff --git a/static/js/gear_menu.js b/static/js/gear_menu.js index bd812337de..89e15c4001 100644 --- a/static/js/gear_menu.js +++ b/static/js/gear_menu.js @@ -1,3 +1,5 @@ +"use strict"; + /* For various historical reasons there isn't one single chunk of code that really makes our gear diff --git a/static/js/hash_util.js b/static/js/hash_util.js index 9a55ae5094..1964a32b55 100644 --- a/static/js/hash_util.js +++ b/static/js/hash_util.js @@ -1,3 +1,5 @@ +"use strict"; + exports.get_hash_category = function (hash) { // given "#streams/subscribed", returns "streams" return hash ? hash.replace(/^#/, "").split(/\//)[0] : ""; diff --git a/static/js/hashchange.js b/static/js/hashchange.js index 728aba659b..9d06d2e03f 100644 --- a/static/js/hashchange.js +++ b/static/js/hashchange.js @@ -1,3 +1,5 @@ +"use strict"; + // Read https://zulip.readthedocs.io/en/latest/subsystems/hashchange-system.html // or locally: docs/subsystems/hashchange-system.md let changing_hash = false; diff --git a/static/js/hotkey.js b/static/js/hotkey.js index 528bf4663f..ae71d702cd 100644 --- a/static/js/hotkey.js +++ b/static/js/hotkey.js @@ -1,3 +1,5 @@ +"use strict"; + const emoji = require("../shared/js/emoji"); function do_narrow_action(action) { diff --git a/static/js/hotspots.js b/static/js/hotspots.js index aa15ee6eff..a926e69836 100644 --- a/static/js/hotspots.js +++ b/static/js/hotspots.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_hotspot_overlay = require("../templates/hotspot_overlay.hbs"); diff --git a/static/js/huddle_data.js b/static/js/huddle_data.js index a4ee46cac7..20a030fb7e 100644 --- a/static/js/huddle_data.js +++ b/static/js/huddle_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const huddle_timestamps = new Map(); diff --git a/static/js/info_overlay.js b/static/js/info_overlay.js index ad400711f9..8f47f080da 100644 --- a/static/js/info_overlay.js +++ b/static/js/info_overlay.js @@ -1,3 +1,5 @@ +"use strict"; + // Make it explicit that our toggler is undefined until // set_up_toggler is called. exports.toggler = undefined; diff --git a/static/js/input_pill.js b/static/js/input_pill.js index 7826a1da27..0b47eda3de 100644 --- a/static/js/input_pill.js +++ b/static/js/input_pill.js @@ -1,3 +1,5 @@ +"use strict"; + const render_input_pill = require("../templates/input_pill.hbs"); // See https://zulip.readthedocs.io/en/latest/subsystems/input-pills.html diff --git a/static/js/invite.js b/static/js/invite.js index 1db31bdab9..10bd4aba5c 100644 --- a/static/js/invite.js +++ b/static/js/invite.js @@ -1,3 +1,5 @@ +"use strict"; + const autosize = require("autosize"); const render_invitation_failed_error = require("../templates/invitation_failed_error.hbs"); diff --git a/static/js/keydown_util.js b/static/js/keydown_util.js index 0ebce06163..92ec7bde73 100644 --- a/static/js/keydown_util.js +++ b/static/js/keydown_util.js @@ -1,3 +1,5 @@ +"use strict"; + /* See hotkey.js for handlers that are more app-wide. */ diff --git a/static/js/lightbox.js b/static/js/lightbox.js index 404ff21890..050af75a12 100644 --- a/static/js/lightbox.js +++ b/static/js/lightbox.js @@ -1,3 +1,5 @@ +"use strict"; + let is_open = false; // the asset map is a map of all retrieved images and YouTube videos that are // memoized instead of being looked up multiple times. diff --git a/static/js/lightbox_canvas.js b/static/js/lightbox_canvas.js index d4a79908fb..4f6d7caecb 100644 --- a/static/js/lightbox_canvas.js +++ b/static/js/lightbox_canvas.js @@ -1,3 +1,5 @@ +"use strict"; + const funcs = { setZoom(meta, zoom) { // condition to handle zooming event by zoom hotkeys diff --git a/static/js/list_cursor.js b/static/js/list_cursor.js index 1256fd8e7d..a40edc82cb 100644 --- a/static/js/list_cursor.js +++ b/static/js/list_cursor.js @@ -1,3 +1,5 @@ +"use strict"; + class ListCursor { constructor({highlight_class, list}) { const config_ok = diff --git a/static/js/list_render.js b/static/js/list_render.js index b317b4f316..b282931285 100644 --- a/static/js/list_render.js +++ b/static/js/list_render.js @@ -1,3 +1,5 @@ +"use strict"; + const DEFAULTS = { INITIAL_RENDER_COUNT: 80, LOAD_COUNT: 20, diff --git a/static/js/list_util.js b/static/js/list_util.js index 5aeefeba56..e82b7d0838 100644 --- a/static/js/list_util.js +++ b/static/js/list_util.js @@ -1,3 +1,5 @@ +"use strict"; + const list_selectors = ["#stream_filters", "#global_filters", "#user_presences"]; exports.inside_list = function (e) { diff --git a/static/js/loading.js b/static/js/loading.js index 2f31c43193..e1b2f647fc 100644 --- a/static/js/loading.js +++ b/static/js/loading.js @@ -1,3 +1,5 @@ +"use strict"; + const render_loader = require("../templates/loader.hbs"); exports.make_indicator = function (outer_container, opts) { diff --git a/static/js/local_message.js b/static/js/local_message.js index 1df8abca5f..395351d39d 100644 --- a/static/js/local_message.js +++ b/static/js/local_message.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); function truncate_precision(float) { diff --git a/static/js/localstorage.js b/static/js/localstorage.js index 25081605cd..421669cd0a 100644 --- a/static/js/localstorage.js +++ b/static/js/localstorage.js @@ -1,3 +1,5 @@ +"use strict"; + const ls = { // parse JSON without throwing an error. parseJSON(str) { diff --git a/static/js/markdown.js b/static/js/markdown.js index 9d974b6b68..1e80ac812e 100644 --- a/static/js/markdown.js +++ b/static/js/markdown.js @@ -1,3 +1,5 @@ +"use strict"; + const katex = require("katex/dist/katex.min.js"); const _ = require("lodash"); const moment = require("moment"); diff --git a/static/js/markdown_config.js b/static/js/markdown_config.js index 718cd26c59..116b96a448 100644 --- a/static/js/markdown_config.js +++ b/static/js/markdown_config.js @@ -1,3 +1,5 @@ +"use strict"; + /* This config is in a separate file for partly tactical reasons. We want the webapp to diff --git a/static/js/message_edit.js b/static/js/message_edit.js index 79aa1a9f8c..ee8988c880 100644 --- a/static/js/message_edit.js +++ b/static/js/message_edit.js @@ -1,3 +1,5 @@ +"use strict"; + const ClipboardJS = require("clipboard"); const XDate = require("xdate"); diff --git a/static/js/message_edit_history.js b/static/js/message_edit_history.js index 00192d3544..7b05bccc24 100644 --- a/static/js/message_edit_history.js +++ b/static/js/message_edit_history.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); const render_message_edit_history = require("../templates/message_edit_history.hbs"); diff --git a/static/js/message_events.js b/static/js/message_events.js index 0d2bfe4639..6d3e9a255a 100644 --- a/static/js/message_events.js +++ b/static/js/message_events.js @@ -1,3 +1,5 @@ +"use strict"; + const huddle_data = require("./huddle_data"); const util = require("./util"); diff --git a/static/js/message_fetch.js b/static/js/message_fetch.js index f94fa7905a..a9d04e0dd4 100644 --- a/static/js/message_fetch.js +++ b/static/js/message_fetch.js @@ -1,3 +1,5 @@ +"use strict"; + const huddle_data = require("./huddle_data"); const consts = { diff --git a/static/js/message_flags.js b/static/js/message_flags.js index f3530fd4e6..d4c36a8c74 100644 --- a/static/js/message_flags.js +++ b/static/js/message_flags.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); function send_flag_update(message, flag, op) { diff --git a/static/js/message_list.js b/static/js/message_list.js index 4ee287b3c7..d844f2292e 100644 --- a/static/js/message_list.js +++ b/static/js/message_list.js @@ -1,3 +1,5 @@ +"use strict"; + const autosize = require("autosize"); exports.narrowed = undefined; diff --git a/static/js/message_list_data.js b/static/js/message_list_data.js index fefac29b02..9684db08c9 100644 --- a/static/js/message_list_data.js +++ b/static/js/message_list_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const util = require("./util"); diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js index 668a6ed24c..5fa7dadc6f 100644 --- a/static/js/message_list_view.js +++ b/static/js/message_list_view.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const XDate = require("xdate"); diff --git a/static/js/message_live_update.js b/static/js/message_live_update.js index c0b86ee61c..2e0187c232 100644 --- a/static/js/message_live_update.js +++ b/static/js/message_live_update.js @@ -1,3 +1,5 @@ +"use strict"; + function rerender_messages_view() { for (const list of [home_msg_list, message_list.narrowed, message_list.all]) { if (list === undefined) { diff --git a/static/js/message_scroll.js b/static/js/message_scroll.js index 2aff03015b..2376408af4 100644 --- a/static/js/message_scroll.js +++ b/static/js/message_scroll.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); let actively_scrolling = false; diff --git a/static/js/message_store.js b/static/js/message_store.js index 1e88d319f9..812a0e9416 100644 --- a/static/js/message_store.js +++ b/static/js/message_store.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); const stored_messages = new Map(); diff --git a/static/js/message_util.js b/static/js/message_util.js index b57eb3a849..6ec9d85b4a 100644 --- a/static/js/message_util.js +++ b/static/js/message_util.js @@ -1,3 +1,5 @@ +"use strict"; + exports.do_unread_count_updates = function do_unread_count_updates(messages) { unread.process_loaded_messages(messages); unread_ui.update_unread_counts(); diff --git a/static/js/message_view_header.js b/static/js/message_view_header.js index 37d7825692..a3b970b495 100644 --- a/static/js/message_view_header.js +++ b/static/js/message_view_header.js @@ -1,3 +1,5 @@ +"use strict"; + const render_message_view_header = require("../templates/message_view_header.hbs"); const rendered_markdown = require("./rendered_markdown"); diff --git a/static/js/message_viewport.js b/static/js/message_viewport.js index 1d052efc2e..58240c8257 100644 --- a/static/js/message_viewport.js +++ b/static/js/message_viewport.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); let jwindow; diff --git a/static/js/muting.js b/static/js/muting.js index 0f45dc77b7..c60ed41eb4 100644 --- a/static/js/muting.js +++ b/static/js/muting.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); const FoldDict = require("./fold_dict").FoldDict; diff --git a/static/js/muting_ui.js b/static/js/muting_ui.js index 5deb4cf775..a625878736 100644 --- a/static/js/muting_ui.js +++ b/static/js/muting_ui.js @@ -1,3 +1,5 @@ +"use strict"; + const render_muted_topic_ui_row = require("../templates/muted_topic_ui_row.hbs"); const render_topic_muted = require("../templates/topic_muted.hbs"); diff --git a/static/js/narrow.js b/static/js/narrow.js index deb1fb5f05..3cdca87142 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); let unnarrow_times; diff --git a/static/js/narrow_state.js b/static/js/narrow_state.js index e244df99f2..3b45151429 100644 --- a/static/js/narrow_state.js +++ b/static/js/narrow_state.js @@ -1,3 +1,5 @@ +"use strict"; + let current_filter; exports.reset_current_filter = function () { diff --git a/static/js/navigate.js b/static/js/navigate.js index f353202dd0..1eddcda530 100644 --- a/static/js/navigate.js +++ b/static/js/navigate.js @@ -1,3 +1,5 @@ +"use strict"; + function go_to_row(msg_id) { current_msg_list.select_id(msg_id, {then_scroll: true, from_scroll: true}); } diff --git a/static/js/night_mode.js b/static/js/night_mode.js index 3b32690ec1..9cbf9157a9 100644 --- a/static/js/night_mode.js +++ b/static/js/night_mode.js @@ -1,3 +1,5 @@ +"use strict"; + exports.enable = function () { $("body").removeClass("color-scheme-automatic").addClass("night-mode"); }; diff --git a/static/js/notifications.js b/static/js/notifications.js index 7664c8330e..610bba75c3 100644 --- a/static/js/notifications.js +++ b/static/js/notifications.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_compose_notification = require("../templates/compose_notification.hbs"); diff --git a/static/js/overlays.js b/static/js/overlays.js index f23acad583..a93d4baf15 100644 --- a/static/js/overlays.js +++ b/static/js/overlays.js @@ -1,3 +1,5 @@ +"use strict"; + let active_overlay; let close_handler; let open_overlay_name; diff --git a/static/js/padded_widget.js b/static/js/padded_widget.js index ee4611bd6e..3a74104e90 100644 --- a/static/js/padded_widget.js +++ b/static/js/padded_widget.js @@ -1,3 +1,5 @@ +"use strict"; + exports.update_padding = function (opts) { const content = $(opts.content_sel); const padding = $(opts.padding_sel); diff --git a/static/js/page_params.js b/static/js/page_params.js index 6dc03b148f..8364c82540 100644 --- a/static/js/page_params.js +++ b/static/js/page_params.js @@ -1,3 +1,5 @@ +"use strict"; + /* global __webpack_public_path__:writable */ const t1 = performance.now(); diff --git a/static/js/panels.js b/static/js/panels.js index f04c83b138..946d791b40 100644 --- a/static/js/panels.js +++ b/static/js/panels.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); const resize_app = function () { diff --git a/static/js/people.js b/static/js/people.js index 1ee53834ef..8d5e7c5cfa 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -1,3 +1,5 @@ +"use strict"; + const md5 = require("blueimp-md5"); const _ = require("lodash"); const moment = require("moment-timezone"); diff --git a/static/js/pm_conversations.js b/static/js/pm_conversations.js index b6d17378f2..a87d019b6d 100644 --- a/static/js/pm_conversations.js +++ b/static/js/pm_conversations.js @@ -1,3 +1,5 @@ +"use strict"; + const FoldDict = require("./fold_dict").FoldDict; const partners = new Set(); diff --git a/static/js/pm_list.js b/static/js/pm_list.js index 1ede45fcef..a9eb626d8e 100644 --- a/static/js/pm_list.js +++ b/static/js/pm_list.js @@ -1,3 +1,5 @@ +"use strict"; + let prior_dom; let private_messages_open = false; diff --git a/static/js/pm_list_dom.js b/static/js/pm_list_dom.js index 95250b7005..bf0afde78f 100644 --- a/static/js/pm_list_dom.js +++ b/static/js/pm_list_dom.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_pm_list_item = require("../templates/pm_list_item.hbs"); diff --git a/static/js/poll_widget.js b/static/js/poll_widget.js index 10db32e8bf..d5f9d2476f 100644 --- a/static/js/poll_widget.js +++ b/static/js/poll_widget.js @@ -1,3 +1,5 @@ +"use strict"; + const render_widgets_poll_widget = require("../templates/widgets/poll_widget.hbs"); const render_widgets_poll_widget_results = require("../templates/widgets/poll_widget_results.hbs"); diff --git a/static/js/popovers.js b/static/js/popovers.js index 86d5401aba..ba61bc7952 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -1,3 +1,5 @@ +"use strict"; + const ClipboardJS = require("clipboard"); const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js"); const moment = require("moment"); diff --git a/static/js/portico/confirm-preregistrationuser.js b/static/js/portico/confirm-preregistrationuser.js index 10d2f883ff..61c43376d0 100644 --- a/static/js/portico/confirm-preregistrationuser.js +++ b/static/js/portico/confirm-preregistrationuser.js @@ -1,3 +1,5 @@ +"use strict"; + $(() => { $("#register").trigger("submit"); }); diff --git a/static/js/portico/desktop-login.js b/static/js/portico/desktop-login.js index 52da6cba96..66dba54a34 100644 --- a/static/js/portico/desktop-login.js +++ b/static/js/portico/desktop-login.js @@ -1,3 +1,5 @@ +"use strict"; + document.querySelector("#form").addEventListener("submit", () => { document.querySelector("#bad-token").hidden = false; }); diff --git a/static/js/portico/desktop-redirect.js b/static/js/portico/desktop-redirect.js index 1a60d9d60d..164d8fa706 100644 --- a/static/js/portico/desktop-redirect.js +++ b/static/js/portico/desktop-redirect.js @@ -1,3 +1,5 @@ +"use strict"; + const ClipboardJS = require("clipboard"); new ClipboardJS("#copy"); diff --git a/static/js/portico/dev-login.js b/static/js/portico/dev-login.js index 5e1891b92c..265ef72b11 100644 --- a/static/js/portico/dev-login.js +++ b/static/js/portico/dev-login.js @@ -1,3 +1,5 @@ +"use strict"; + $(() => { // This code will be executed when the user visits /login and // dev_login.html is rendered. diff --git a/static/js/portico/email_log.js b/static/js/portico/email_log.js index 848111caba..d5e9ac6aec 100644 --- a/static/js/portico/email_log.js +++ b/static/js/portico/email_log.js @@ -1,3 +1,5 @@ +"use strict"; + $(() => { // This code will be executed when the user visits /emails in // development mode and email_log.html is rendered. diff --git a/static/js/portico/header.js b/static/js/portico/header.js index 4043020b89..2bf68dcc37 100644 --- a/static/js/portico/header.js +++ b/static/js/portico/header.js @@ -1,3 +1,5 @@ +"use strict"; + $(() => { $(".portico-header li.logout").on("click", () => { $("#logout_form").trigger("submit"); diff --git a/static/js/portico/integrations_dev_panel.js b/static/js/portico/integrations_dev_panel.js index d9fb21af40..b082c80298 100644 --- a/static/js/portico/integrations_dev_panel.js +++ b/static/js/portico/integrations_dev_panel.js @@ -1,3 +1,5 @@ +"use strict"; + // Main JavaScript file for the Integrations development panel at // /devtools/integrations. diff --git a/static/js/portico/signup.js b/static/js/portico/signup.js index 11328da994..9af27c452e 100644 --- a/static/js/portico/signup.js +++ b/static/js/portico/signup.js @@ -1,3 +1,5 @@ +"use strict"; + const moment = require("moment-timezone"); $(() => { diff --git a/static/js/presence.js b/static/js/presence.js index 203fc41f9c..59cdd96c8c 100644 --- a/static/js/presence.js +++ b/static/js/presence.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); // This module just manages data. See activity.js for diff --git a/static/js/reactions.js b/static/js/reactions.js index bb49c3e961..47a52b3fa2 100644 --- a/static/js/reactions.js +++ b/static/js/reactions.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const emoji = require("../shared/js/emoji"); diff --git a/static/js/ready.js b/static/js/ready.js index 17f30f3b03..2aaef76ba1 100644 --- a/static/js/ready.js +++ b/static/js/ready.js @@ -1 +1,3 @@ +"use strict"; + $("#app-loading").addClass("loaded"); diff --git a/static/js/realm_icon.js b/static/js/realm_icon.js index 9d12708b95..0467dccd18 100644 --- a/static/js/realm_icon.js +++ b/static/js/realm_icon.js @@ -1,3 +1,5 @@ +"use strict"; + exports.build_realm_icon_widget = function (upload_function) { const get_file_input = function () { return $("#realm-icon-upload-widget .image_file_input").expectOne(); diff --git a/static/js/realm_logo.js b/static/js/realm_logo.js index 3dc78f70ed..f82221919e 100644 --- a/static/js/realm_logo.js +++ b/static/js/realm_logo.js @@ -1,3 +1,5 @@ +"use strict"; + const settings_config = require("./settings_config"); exports.build_realm_logo_widget = function (upload_function, is_night) { diff --git a/static/js/recent_senders.js b/static/js/recent_senders.js index b450fc1e40..bd24a6e06e 100644 --- a/static/js/recent_senders.js +++ b/static/js/recent_senders.js @@ -1,3 +1,5 @@ +"use strict"; + const FoldDict = require("./fold_dict").FoldDict; // topic_senders[stream_id][topic_id][sender_id] = latest_message_id diff --git a/static/js/recent_topics.js b/static/js/recent_topics.js index d160ae08ef..3019a38721 100644 --- a/static/js/recent_topics.js +++ b/static/js/recent_topics.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); const render_recent_topic_row = require("../templates/recent_topic_row.hbs"); diff --git a/static/js/reload.js b/static/js/reload.js index 62567557b3..d1c558da3e 100644 --- a/static/js/reload.js +++ b/static/js/reload.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); // Read https://zulip.readthedocs.io/en/latest/subsystems/hashchange-system.html function preserve_state(send_after_reload, save_pointer, save_narrow, save_compose) { diff --git a/static/js/reload_state.js b/static/js/reload_state.js index 33ce867228..3e78804402 100644 --- a/static/js/reload_state.js +++ b/static/js/reload_state.js @@ -1,3 +1,5 @@ +"use strict"; + /* We want his module to load pretty early in the process of starting the app, so that people.js can load early. diff --git a/static/js/reminder.js b/static/js/reminder.js index bf336e7461..c8aedb940e 100644 --- a/static/js/reminder.js +++ b/static/js/reminder.js @@ -1,3 +1,5 @@ +"use strict"; + const moment = require("moment-timezone"); const util = require("./util"); diff --git a/static/js/rendered_markdown.js b/static/js/rendered_markdown.js index b15c7b0f1d..ef688fbd33 100644 --- a/static/js/rendered_markdown.js +++ b/static/js/rendered_markdown.js @@ -1,3 +1,5 @@ +"use strict"; + const moment = require("moment"); /* diff --git a/static/js/resize.js b/static/js/resize.js index c3418b3d12..2e034aa84a 100644 --- a/static/js/resize.js +++ b/static/js/resize.js @@ -1,3 +1,5 @@ +"use strict"; + const autosize = require("autosize"); const util = require("./util"); diff --git a/static/js/rows.js b/static/js/rows.js index 01b67f4c27..0b160b07ad 100644 --- a/static/js/rows.js +++ b/static/js/rows.js @@ -1,3 +1,5 @@ +"use strict"; + // We don't need an andSelf() here because we already know // that our next element is *not* a message_row, so this // isn't going to end up empty unless we're at the bottom or top. diff --git a/static/js/rtl.js b/static/js/rtl.js index 6058928b5c..f1b8083c04 100644 --- a/static/js/rtl.js +++ b/static/js/rtl.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); // How to determine the direction of a paragraph (P1-P3): https://www.unicode.org/reports/tr9/tr9-35.html#The_Paragraph_Level // Embedding level: https://www.unicode.org/reports/tr9/tr9-35.html#BD2 diff --git a/static/js/schema.js b/static/js/schema.js index aee875ad5f..7210e607e5 100644 --- a/static/js/schema.js +++ b/static/js/schema.js @@ -1,3 +1,5 @@ +"use strict"; + /* These runtime schema validators are defensive and diff --git a/static/js/scroll_bar.js b/static/js/scroll_bar.js index 613898f555..cfd8b4a0aa 100644 --- a/static/js/scroll_bar.js +++ b/static/js/scroll_bar.js @@ -1,3 +1,5 @@ +"use strict"; + // A few of our width properties in zulip depend on the width of the // browser scrollbar that is generated at the far right side of the // page, which unfortunately varies depending on the browser and diff --git a/static/js/scroll_util.js b/static/js/scroll_util.js index 934a96baf3..360f2264ab 100644 --- a/static/js/scroll_util.js +++ b/static/js/scroll_util.js @@ -1,3 +1,5 @@ +"use strict"; + exports.scroll_delta = function (opts) { const elem_top = opts.elem_top; const container_height = opts.container_height; diff --git a/static/js/search.js b/static/js/search.js index b33b099d6d..3952dec9da 100644 --- a/static/js/search.js +++ b/static/js/search.js @@ -1,3 +1,5 @@ +"use strict"; + // Exported for unit testing exports.is_using_input_method = false; diff --git a/static/js/search_pill.js b/static/js/search_pill.js index 90c47e0503..3b9ecb807d 100644 --- a/static/js/search_pill.js +++ b/static/js/search_pill.js @@ -1,3 +1,5 @@ +"use strict"; + exports.create_item_from_search_string = function (search_string) { const operator = Filter.parse(search_string); const description = Filter.describe(operator); diff --git a/static/js/search_pill_widget.js b/static/js/search_pill_widget.js index 10fd2fcda2..4726ab2afa 100644 --- a/static/js/search_pill_widget.js +++ b/static/js/search_pill_widget.js @@ -1,3 +1,5 @@ +"use strict"; + exports.initialize = function () { if (!page_params.search_pills_enabled) { return; diff --git a/static/js/search_suggestion.js b/static/js/search_suggestion.js index d39aeeeace..f3b5518d2f 100644 --- a/static/js/search_suggestion.js +++ b/static/js/search_suggestion.js @@ -1,3 +1,5 @@ +"use strict"; + const Handlebars = require("handlebars/runtime"); const huddle_data = require("./huddle_data"); diff --git a/static/js/search_util.js b/static/js/search_util.js index fc597ab97c..bf75258342 100644 --- a/static/js/search_util.js +++ b/static/js/search_util.js @@ -1,3 +1,5 @@ +"use strict"; + exports.get_search_terms = function (input) { const search_terms = input .toLowerCase() diff --git a/static/js/sent_messages.js b/static/js/sent_messages.js index d9f4784c32..c2e9702a2b 100644 --- a/static/js/sent_messages.js +++ b/static/js/sent_messages.js @@ -1,3 +1,5 @@ +"use strict"; + exports.messages = new Map(); exports.reset_id_state = function () { diff --git a/static/js/server_events.js b/static/js/server_events.js index 8b4a689b12..ab0d606d6c 100644 --- a/static/js/server_events.js +++ b/static/js/server_events.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); // Docs: https://zulip.readthedocs.io/en/latest/subsystems/events-system.html diff --git a/static/js/server_events_dispatch.js b/static/js/server_events_dispatch.js index d7f4d08f6f..4497881d72 100644 --- a/static/js/server_events_dispatch.js +++ b/static/js/server_events_dispatch.js @@ -1,3 +1,5 @@ +"use strict"; + const emoji = require("../shared/js/emoji"); const settings_config = require("./settings_config"); diff --git a/static/js/settings.js b/static/js/settings.js index 2e602c9770..2bded384fb 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -1,3 +1,5 @@ +"use strict"; + const moment = require("moment-timezone"); const render_settings_tab = require("../templates/settings_tab.hbs"); diff --git a/static/js/settings_account.js b/static/js/settings_account.js index f963c2ed57..3dd93a8306 100644 --- a/static/js/settings_account.js +++ b/static/js/settings_account.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_settings_api_key_modal = require("../templates/settings/api_key_modal.hbs"); diff --git a/static/js/settings_bots.js b/static/js/settings_bots.js index eccfe85643..7f9021aaea 100644 --- a/static/js/settings_bots.js +++ b/static/js/settings_bots.js @@ -1,3 +1,5 @@ +"use strict"; + const ClipboardJS = require("clipboard"); const render_bot_avatar_row = require("../templates/bot_avatar_row.hbs"); diff --git a/static/js/settings_config.js b/static/js/settings_config.js index 05f96b7d4a..3ccfe2789b 100644 --- a/static/js/settings_config.js +++ b/static/js/settings_config.js @@ -1,3 +1,5 @@ +"use strict"; + /* This file contains translations between the integer values used in the Zulip API to describe values in dropdowns, radio buttons, and diff --git a/static/js/settings_data.js b/static/js/settings_data.js index b8637f71cd..f0714f7da9 100644 --- a/static/js/settings_data.js +++ b/static/js/settings_data.js @@ -1,3 +1,5 @@ +"use strict"; + const settings_config = require("./settings_config"); /* diff --git a/static/js/settings_display.js b/static/js/settings_display.js index 15b7d83b2c..edcdc500d1 100644 --- a/static/js/settings_display.js +++ b/static/js/settings_display.js @@ -1,3 +1,5 @@ +"use strict"; + const emojisets = require("./emojisets.js"); const settings_config = require("./settings_config"); diff --git a/static/js/settings_emoji.js b/static/js/settings_emoji.js index 8f7b71fbc2..5e255e8a34 100644 --- a/static/js/settings_emoji.js +++ b/static/js/settings_emoji.js @@ -1,3 +1,5 @@ +"use strict"; + const emoji = require("../shared/js/emoji"); const render_admin_emoji_list = require("../templates/admin_emoji_list.hbs"); const render_settings_emoji_settings_tip = require("../templates/settings/emoji_settings_tip.hbs"); diff --git a/static/js/settings_exports.js b/static/js/settings_exports.js index 385e3601b8..bdd79a0da7 100644 --- a/static/js/settings_exports.js +++ b/static/js/settings_exports.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); const render_admin_export_list = require("../templates/admin_export_list.hbs"); diff --git a/static/js/settings_invites.js b/static/js/settings_invites.js index c67bb75bc1..271a0daa54 100644 --- a/static/js/settings_invites.js +++ b/static/js/settings_invites.js @@ -1,3 +1,5 @@ +"use strict"; + const render_admin_invites_list = require("../templates/admin_invites_list.hbs"); const render_settings_revoke_invite_modal = require("../templates/settings/revoke_invite_modal.hbs"); diff --git a/static/js/settings_linkifiers.js b/static/js/settings_linkifiers.js index 56f283a502..78d12627fc 100644 --- a/static/js/settings_linkifiers.js +++ b/static/js/settings_linkifiers.js @@ -1,3 +1,5 @@ +"use strict"; + const render_admin_filter_list = require("../templates/admin_filter_list.hbs"); const meta = { diff --git a/static/js/settings_muting.js b/static/js/settings_muting.js index 96b7e65178..8d9f39b270 100644 --- a/static/js/settings_muting.js +++ b/static/js/settings_muting.js @@ -1,3 +1,5 @@ +"use strict"; + exports.loaded = false; exports.set_up = function () { diff --git a/static/js/settings_notifications.js b/static/js/settings_notifications.js index a5e2923d72..9f693481d4 100644 --- a/static/js/settings_notifications.js +++ b/static/js/settings_notifications.js @@ -1,3 +1,5 @@ +"use strict"; + const render_stream_specific_notification_row = require("../templates/settings/stream_specific_notification_row.hbs"); const settings_config = require("./settings_config"); diff --git a/static/js/settings_org.js b/static/js/settings_org.js index 1ae124cb69..3fac66c795 100644 --- a/static/js/settings_org.js +++ b/static/js/settings_org.js @@ -1,3 +1,5 @@ +"use strict"; + const pygments_data = require("../generated/pygments_data.json"); const render_settings_admin_auth_methods_list = require("../templates/settings/admin_auth_methods_list.hbs"); const render_settings_admin_realm_domains_list = require("../templates/settings/admin_realm_domains_list.hbs"); diff --git a/static/js/settings_panel_menu.js b/static/js/settings_panel_menu.js index eff6eaf091..1feaad20b0 100644 --- a/static/js/settings_panel_menu.js +++ b/static/js/settings_panel_menu.js @@ -1,3 +1,5 @@ +"use strict"; + exports.mobile_deactivate_section = function () { const $settings_overlay_container = $("#settings_overlay_container"); $settings_overlay_container.find(".right").removeClass("show"); diff --git a/static/js/settings_profile_fields.js b/static/js/settings_profile_fields.js index fed6f2004d..11b2f6384c 100644 --- a/static/js/settings_profile_fields.js +++ b/static/js/settings_profile_fields.js @@ -1,3 +1,5 @@ +"use strict"; + const Sortable = require("sortablejs").default; const render_admin_profile_field_list = require("../templates/admin_profile_field_list.hbs"); diff --git a/static/js/settings_sections.js b/static/js/settings_sections.js index 9f729d47e8..6d018fbc51 100644 --- a/static/js/settings_sections.js +++ b/static/js/settings_sections.js @@ -1,3 +1,5 @@ +"use strict"; + const load_func_dict = new Map(); // group -> function const loaded_groups = new Set(); diff --git a/static/js/settings_streams.js b/static/js/settings_streams.js index 1203cd54a9..4a2d5368e3 100644 --- a/static/js/settings_streams.js +++ b/static/js/settings_streams.js @@ -1,3 +1,5 @@ +"use strict"; + const render_admin_default_streams_list = require("../templates/admin_default_streams_list.hbs"); const meta = { diff --git a/static/js/settings_toggle.js b/static/js/settings_toggle.js index 0aece5a231..53874000f6 100644 --- a/static/js/settings_toggle.js +++ b/static/js/settings_toggle.js @@ -1,3 +1,5 @@ +"use strict"; + let toggler; exports.highlight_toggle = function (tab_name) { diff --git a/static/js/settings_ui.js b/static/js/settings_ui.js index 24aa69320d..d789e33d22 100644 --- a/static/js/settings_ui.js +++ b/static/js/settings_ui.js @@ -1,3 +1,5 @@ +"use strict"; + exports.display_checkmark = function ($elem) { const check_mark = document.createElement("img"); check_mark.src = "/static/images/checkbox-green.svg"; diff --git a/static/js/settings_user_groups.js b/static/js/settings_user_groups.js index 3ab185bd00..e65992327b 100644 --- a/static/js/settings_user_groups.js +++ b/static/js/settings_user_groups.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_admin_user_group_list = require("../templates/admin_user_group_list.hbs"); diff --git a/static/js/settings_users.js b/static/js/settings_users.js index e6c70df210..36eb1c0ea7 100644 --- a/static/js/settings_users.js +++ b/static/js/settings_users.js @@ -1,3 +1,5 @@ +"use strict"; + const render_admin_bot_form = require("../templates/admin_bot_form.hbs"); const render_admin_human_form = require("../templates/admin_human_form.hbs"); const render_admin_user_list = require("../templates/admin_user_list.hbs"); diff --git a/static/js/setup.js b/static/js/setup.js index 5daaf8814f..73a8601468 100644 --- a/static/js/setup.js +++ b/static/js/setup.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); // Miscellaneous early setup. diff --git a/static/js/spoilers.js b/static/js/spoilers.js index c485a435da..96d4571756 100644 --- a/static/js/spoilers.js +++ b/static/js/spoilers.js @@ -1,3 +1,5 @@ +"use strict"; + function collapse_spoiler(spoiler) { const spoiler_height = spoiler.height(); diff --git a/static/js/starred_messages.js b/static/js/starred_messages.js index ad8ace1f1a..56e114321f 100644 --- a/static/js/starred_messages.js +++ b/static/js/starred_messages.js @@ -1,3 +1,5 @@ +"use strict"; + exports.ids = new Set(); exports.initialize = function () { diff --git a/static/js/stats/stats.js b/static/js/stats/stats.js index 17dd0c42ab..9eb39c1d40 100644 --- a/static/js/stats/stats.js +++ b/static/js/stats/stats.js @@ -1,3 +1,5 @@ +"use strict"; + const Plotly = require("plotly.js/lib/core"); Plotly.register([require("plotly.js/lib/bar"), require("plotly.js/lib/pie")]); diff --git a/static/js/stream_color.js b/static/js/stream_color.js index 7905675b4c..5194671df3 100644 --- a/static/js/stream_color.js +++ b/static/js/stream_color.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); exports.default_color = "#c2c2c2"; diff --git a/static/js/stream_create.js b/static/js/stream_create.js index 3ce42f9cba..6730623a87 100644 --- a/static/js/stream_create.js +++ b/static/js/stream_create.js @@ -1,3 +1,5 @@ +"use strict"; + const render_announce_stream_docs = require("../templates/announce_stream_docs.hbs"); const render_new_stream_users = require("../templates/new_stream_users.hbs"); const render_subscription_invites_warning_modal = require("../templates/subscription_invites_warning_modal.hbs"); diff --git a/static/js/stream_data.js b/static/js/stream_data.js index 00c6e4599b..00d80af889 100644 --- a/static/js/stream_data.js +++ b/static/js/stream_data.js @@ -1,3 +1,5 @@ +"use strict"; + const FoldDict = require("./fold_dict").FoldDict; const LazySet = require("./lazy_set").LazySet; const settings_config = require("./settings_config"); diff --git a/static/js/stream_edit.js b/static/js/stream_edit.js index 3e64be46fe..256094ce6a 100644 --- a/static/js/stream_edit.js +++ b/static/js/stream_edit.js @@ -1,3 +1,5 @@ +"use strict"; + const render_settings_deactivation_stream_modal = require("../templates/settings/deactivation_stream_modal.hbs"); const render_stream_member_list_entry = require("../templates/stream_member_list_entry.hbs"); const render_subscription_settings = require("../templates/subscription_settings.hbs"); diff --git a/static/js/stream_events.js b/static/js/stream_events.js index c1c6838a07..152d1faad9 100644 --- a/static/js/stream_events.js +++ b/static/js/stream_events.js @@ -1,3 +1,5 @@ +"use strict"; + // In theory, this function should apply the account-level defaults, // however, they are only called after a manual override, so // doing so is unnecessary with the current code. Ideally, we'd do a diff --git a/static/js/stream_list.js b/static/js/stream_list.js index f8901a0485..4cbb13410a 100644 --- a/static/js/stream_list.js +++ b/static/js/stream_list.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_stream_privacy = require("../templates/stream_privacy.hbs"); diff --git a/static/js/stream_muting.js b/static/js/stream_muting.js index 9b1ca59d71..6bf1680a8b 100644 --- a/static/js/stream_muting.js +++ b/static/js/stream_muting.js @@ -1,3 +1,5 @@ +"use strict"; + exports.update_is_muted = function (sub, value) { sub.is_muted = value; diff --git a/static/js/stream_popover.js b/static/js/stream_popover.js index 4b7a2d72c4..90fd7f0eae 100644 --- a/static/js/stream_popover.js +++ b/static/js/stream_popover.js @@ -1,3 +1,5 @@ +"use strict"; + const render_all_messages_sidebar_actions = require("../templates/all_messages_sidebar_actions.hbs"); const render_delete_topic_modal = require("../templates/delete_topic_modal.hbs"); const render_move_topic_to_stream = require("../templates/move_topic_to_stream.hbs"); diff --git a/static/js/stream_sort.js b/static/js/stream_sort.js index 21b96bc660..2626eac35f 100644 --- a/static/js/stream_sort.js +++ b/static/js/stream_sort.js @@ -1,3 +1,5 @@ +"use strict"; + const util = require("./util"); let previous_pinned; diff --git a/static/js/stream_topic_history.js b/static/js/stream_topic_history.js index 58c3426bd9..9d7ef8eb39 100644 --- a/static/js/stream_topic_history.js +++ b/static/js/stream_topic_history.js @@ -1,3 +1,5 @@ +"use strict"; + const FoldDict = require("./fold_dict").FoldDict; const stream_dict = new Map(); // stream_id -> PerStreamHistory object diff --git a/static/js/stream_ui_updates.js b/static/js/stream_ui_updates.js index 89aaa6ebf9..5caa9a6b84 100644 --- a/static/js/stream_ui_updates.js +++ b/static/js/stream_ui_updates.js @@ -1,3 +1,5 @@ +"use strict"; + const render_subscription_count = require("../templates/subscription_count.hbs"); const render_subscription_setting_icon = require("../templates/subscription_setting_icon.hbs"); const render_subscription_type = require("../templates/subscription_type.hbs"); diff --git a/static/js/submessage.js b/static/js/submessage.js index 361b9a6a8d..560ae6fdf4 100644 --- a/static/js/submessage.js +++ b/static/js/submessage.js @@ -1,3 +1,5 @@ +"use strict"; + exports.get_message_events = function (message) { if (message.locally_echoed) { return; diff --git a/static/js/subs.js b/static/js/subs.js index 07b16750cd..c03b95965f 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_subscription = require("../templates/subscription.hbs"); diff --git a/static/js/templates.js b/static/js/templates.js index 762312de78..b2f1bf6c14 100644 --- a/static/js/templates.js +++ b/static/js/templates.js @@ -1,3 +1,5 @@ +"use strict"; + const Handlebars = require("handlebars/runtime"); const util = require("./util"); diff --git a/static/js/tictactoe_widget.js b/static/js/tictactoe_widget.js index 17215fffaa..cdacc3305f 100644 --- a/static/js/tictactoe_widget.js +++ b/static/js/tictactoe_widget.js @@ -1,3 +1,5 @@ +"use strict"; + const render_widgets_tictactoe_widget = require("../templates/widgets/tictactoe_widget.hbs"); class TicTacToeData { diff --git a/static/js/timerender.js b/static/js/timerender.js index fbefc1668b..8f028ec18a 100644 --- a/static/js/timerender.js +++ b/static/js/timerender.js @@ -1,3 +1,5 @@ +"use strict"; + const moment = require("moment"); const XDate = require("xdate"); diff --git a/static/js/todo_widget.js b/static/js/todo_widget.js index d149acb36e..50e64ce67e 100644 --- a/static/js/todo_widget.js +++ b/static/js/todo_widget.js @@ -1,3 +1,5 @@ +"use strict"; + const render_widgets_todo_widget = require("../templates/widgets/todo_widget.hbs"); const render_widgets_todo_widget_tasks = require("../templates/widgets/todo_widget_tasks.hbs"); diff --git a/static/js/top_left_corner.js b/static/js/top_left_corner.js index be3354ca50..d1182c948e 100644 --- a/static/js/top_left_corner.js +++ b/static/js/top_left_corner.js @@ -1,3 +1,5 @@ +"use strict"; + exports.update_count_in_dom = function (unread_count_elem, count) { const count_span = unread_count_elem.find(".count"); const value_span = count_span.find(".value"); diff --git a/static/js/topic_generator.js b/static/js/topic_generator.js index 0685710686..1f67cf3dba 100644 --- a/static/js/topic_generator.js +++ b/static/js/topic_generator.js @@ -1,3 +1,5 @@ +"use strict"; + exports.sub_list_generator = function (lst, lower, upper) { // lower/upper has Python range semantics so if you pass // in lower=5 and upper=8, you get elements 5/6/7 diff --git a/static/js/topic_list.js b/static/js/topic_list.js index ee7b960168..45d9cd6c81 100644 --- a/static/js/topic_list.js +++ b/static/js/topic_list.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const render_more_topics = require("../templates/more_topics.hbs"); diff --git a/static/js/topic_list_data.js b/static/js/topic_list_data.js index 5d35a3649d..b6ec930ac7 100644 --- a/static/js/topic_list_data.js +++ b/static/js/topic_list_data.js @@ -1,3 +1,5 @@ +"use strict"; + const max_topics = 5; const max_topics_with_unread = 8; diff --git a/static/js/topic_zoom.js b/static/js/topic_zoom.js index 0f55534aa7..21c879ef08 100644 --- a/static/js/topic_zoom.js +++ b/static/js/topic_zoom.js @@ -1,3 +1,5 @@ +"use strict"; + let zoomed_in = false; exports.is_zoomed_in = function () { diff --git a/static/js/transmit.js b/static/js/transmit.js index 31cbafceae..5f617d4c3c 100644 --- a/static/js/transmit.js +++ b/static/js/transmit.js @@ -1,3 +1,5 @@ +"use strict"; + exports.send_message = function (request, on_success, error) { channel.post({ url: "/json/messages", diff --git a/static/js/tutorial.js b/static/js/tutorial.js index 53356d7e2f..70fbbf0a02 100644 --- a/static/js/tutorial.js +++ b/static/js/tutorial.js @@ -1,3 +1,5 @@ +"use strict"; + function set_tutorial_status(status, callback) { return channel.post({ url: "/json/users/me/tutorial_status", diff --git a/static/js/typeahead_helper.js b/static/js/typeahead_helper.js index a4019933ea..0d9d0b3304 100644 --- a/static/js/typeahead_helper.js +++ b/static/js/typeahead_helper.js @@ -1,3 +1,5 @@ +"use strict"; + const Handlebars = require("handlebars/runtime"); const _ = require("lodash"); diff --git a/static/js/typing.js b/static/js/typing.js index 60f3bb8bf9..6f43dce532 100644 --- a/static/js/typing.js +++ b/static/js/typing.js @@ -1,3 +1,5 @@ +"use strict"; + const typing_status = require("../shared/js/typing_status"); // This module handles the outbound side of typing indicators. diff --git a/static/js/typing_data.js b/static/js/typing_data.js index 2a2017e5bc..73a50a17d0 100644 --- a/static/js/typing_data.js +++ b/static/js/typing_data.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const util = require("./util"); diff --git a/static/js/typing_events.js b/static/js/typing_events.js index 3f67975dfd..4ce2b98f36 100644 --- a/static/js/typing_events.js +++ b/static/js/typing_events.js @@ -1,3 +1,5 @@ +"use strict"; + const render_typing_notifications = require("../templates/typing_notifications.hbs"); // See docs/subsystems/typing-indicators.md for details on typing indicators. diff --git a/static/js/ui.js b/static/js/ui.js index 3368cbfab5..37b7dce08f 100644 --- a/static/js/ui.js +++ b/static/js/ui.js @@ -1,3 +1,5 @@ +"use strict"; + const SimpleBar = require("simplebar/dist/simplebar.js"); // What, if anything, obscures the home tab? diff --git a/static/js/ui_init.js b/static/js/ui_init.js index 05f5791d23..9e3a0e8cc4 100644 --- a/static/js/ui_init.js +++ b/static/js/ui_init.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); const generated_emoji_codes = require("../generated/emoji/emoji_codes.json"); diff --git a/static/js/ui_report.js b/static/js/ui_report.js index c23491251c..138a884b3e 100644 --- a/static/js/ui_report.js +++ b/static/js/ui_report.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); /* Arguments used in the report_* functions are, response- response that we want to display diff --git a/static/js/ui_util.js b/static/js/ui_util.js index e063b6ea50..d4fac3283c 100644 --- a/static/js/ui_util.js +++ b/static/js/ui_util.js @@ -1,3 +1,5 @@ +"use strict"; + // Add functions to this that have no non-trivial // dependencies other than jQuery. diff --git a/static/js/unread.js b/static/js/unread.js index 4a8ad4fbae..6744226fb0 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -1,3 +1,5 @@ +"use strict"; + const FoldDict = require("./fold_dict").FoldDict; const util = require("./util"); diff --git a/static/js/unread_ops.js b/static/js/unread_ops.js index d2e7d116fc..a8d8245f1e 100644 --- a/static/js/unread_ops.js +++ b/static/js/unread_ops.js @@ -1,3 +1,5 @@ +"use strict"; + exports.mark_all_as_read = function () { unread.declare_bankruptcy(); unread_ui.update_unread_counts(); diff --git a/static/js/unread_ui.js b/static/js/unread_ui.js index cbe8388f3e..b7a3625e8b 100644 --- a/static/js/unread_ui.js +++ b/static/js/unread_ui.js @@ -1,3 +1,5 @@ +"use strict"; + const XDate = require("xdate"); let last_mention_count = 0; diff --git a/static/js/upload.js b/static/js/upload.js index e97f98c6e8..2f26e180c0 100644 --- a/static/js/upload.js +++ b/static/js/upload.js @@ -1,3 +1,5 @@ +"use strict"; + const Uppy = require("@uppy/core"); const ProgressBar = require("@uppy/progress-bar"); const XHRUpload = require("@uppy/xhr-upload"); diff --git a/static/js/upload_widget.js b/static/js/upload_widget.js index a58cb50a2a..cc97df2239 100644 --- a/static/js/upload_widget.js +++ b/static/js/upload_widget.js @@ -1,3 +1,5 @@ +"use strict"; + const default_max_file_size = 5; const supported_types = ["image/jpeg", "image/png", "image/gif", "image/tiff"]; diff --git a/static/js/user_events.js b/static/js/user_events.js index ff5b7e8620..11d4a053d3 100644 --- a/static/js/user_events.js +++ b/static/js/user_events.js @@ -1,3 +1,5 @@ +"use strict"; + // This module is kind of small, but it will help us keep // server_events.js simple while breaking some circular // dependencies that existed when this code was in people.js. diff --git a/static/js/user_groups.js b/static/js/user_groups.js index 1f899f4186..3eb1cda348 100644 --- a/static/js/user_groups.js +++ b/static/js/user_groups.js @@ -1,3 +1,5 @@ +"use strict"; + const FoldDict = require("./fold_dict").FoldDict; let user_group_name_dict; diff --git a/static/js/user_pill.js b/static/js/user_pill.js index c5fb6c99ab..721959bd47 100644 --- a/static/js/user_pill.js +++ b/static/js/user_pill.js @@ -1,3 +1,5 @@ +"use strict"; + // This will be used for pills for things like composing PMs // or adding users to a stream/group. const settings_data = require("./settings_data"); diff --git a/static/js/user_search.js b/static/js/user_search.js index 125d09858f..6f3acf8f2c 100644 --- a/static/js/user_search.js +++ b/static/js/user_search.js @@ -1,3 +1,5 @@ +"use strict"; + class UserSearch { // This is mostly view code to manage the user search widget // above the buddy list. We rely on other code to manage the diff --git a/static/js/user_status.js b/static/js/user_status.js index 930d71f7d0..df35ab0ed3 100644 --- a/static/js/user_status.js +++ b/static/js/user_status.js @@ -1,3 +1,5 @@ +"use strict"; + const away_user_ids = new Set(); const user_info = new Map(); diff --git a/static/js/user_status_ui.js b/static/js/user_status_ui.js index d977619d4c..c6641622fb 100644 --- a/static/js/user_status_ui.js +++ b/static/js/user_status_ui.js @@ -1,3 +1,5 @@ +"use strict"; + exports.input_field = function () { return $(".user_status_overlay input.user_status"); }; diff --git a/static/js/util.js b/static/js/util.js index 9261b51d01..7d09cbe779 100644 --- a/static/js/util.js +++ b/static/js/util.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); // From MDN: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math/random exports.random_int = function random_int(min, max) { diff --git a/static/js/vdom.js b/static/js/vdom.js index 8b46c83a66..555ce41196 100644 --- a/static/js/vdom.js +++ b/static/js/vdom.js @@ -1,3 +1,5 @@ +"use strict"; + const _ = require("lodash"); exports.eq_array = (a, b, eq) => { diff --git a/static/js/widgetize.js b/static/js/widgetize.js index 5ff0346fdd..7d4cde6b9a 100644 --- a/static/js/widgetize.js +++ b/static/js/widgetize.js @@ -1,3 +1,5 @@ +"use strict"; + const widgets = new Map([ ["poll", poll_widget], ["tictactoe", tictactoe_widget], diff --git a/static/js/zcommand.js b/static/js/zcommand.js index f50d47eea3..4223043c36 100644 --- a/static/js/zcommand.js +++ b/static/js/zcommand.js @@ -1,3 +1,5 @@ +"use strict"; + const marked = require("../third/marked/lib/marked"); /* diff --git a/static/js/zform.js b/static/js/zform.js index 89d6cc8b82..50f5ab0499 100644 --- a/static/js/zform.js +++ b/static/js/zform.js @@ -1,3 +1,5 @@ +"use strict"; + const render_widgets_zform_choices = require("../templates/widgets/zform_choices.hbs"); exports.validate_extra_data = function (data) { diff --git a/static/js/zulip.js b/static/js/zulip.js index 30632fa5ab..ec7189965d 100644 --- a/static/js/zulip.js +++ b/static/js/zulip.js @@ -1,3 +1,5 @@ +"use strict"; + // This file is being eliminated as part of the general purge of // global variables from Zulip (everything is being moved into // modules). Please don't add things here. diff --git a/tools/check-openapi b/tools/check-openapi index 4aa4e88654..0f04f7ef53 100755 --- a/tools/check-openapi +++ b/tools/check-openapi @@ -1,4 +1,5 @@ #!/usr/bin/env node +"use strict"; const fs = require("fs"); diff --git a/tools/debug-require.js b/tools/debug-require.js index 2aa998e143..60becbd372 100644 --- a/tools/debug-require.js +++ b/tools/debug-require.js @@ -1,3 +1,5 @@ +"use strict"; + /* global __webpack_require__ */ var webpackModules; diff --git a/tools/message-screenshot.js b/tools/message-screenshot.js index 2f098bc7f0..63fba2dd6b 100644 --- a/tools/message-screenshot.js +++ b/tools/message-screenshot.js @@ -1,3 +1,5 @@ +"use strict"; + const path = require("path"); const commander = require("commander"); diff --git a/tools/node_lib/dump_fixtures.js b/tools/node_lib/dump_fixtures.js index a31538a7b5..69329a2d87 100644 --- a/tools/node_lib/dump_fixtures.js +++ b/tools/node_lib/dump_fixtures.js @@ -1,3 +1,5 @@ +"use strict"; + const events = require("../../frontend_tests/node_tests/lib/events.js"); console.info(JSON.stringify(events.fixtures, null, 4)); diff --git a/zerver/openapi/javascript_examples.js b/zerver/openapi/javascript_examples.js index faf1106c85..7ff6c1412a 100644 --- a/zerver/openapi/javascript_examples.js +++ b/zerver/openapi/javascript_examples.js @@ -1,3 +1,5 @@ +"use strict"; + /* eslint-disable arrow-body-style */ /* This file makes use of functional comments in a way that makes the