Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

js: Add "use strict" directive to CommonJS files.

Anders Kaseorg6ec808b8df0f
diff --git a/.eslintrc.json b/.eslintrc.json
index 7d1cf6ad91c..e94d64e56bb 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 889341cc916..642e5ac4774 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 62b9c0cd522..b61d3634cab 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 62cd4a5047e..35de4557bba 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 fb299ad3fc5..5816df80c0f 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 = "[email protected]";
diff --git a/frontend_tests/casper_tests/01-login.js b/frontend_tests/casper_tests/01-login.js
index b10249c05c8..6fca4a4d974 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 37510c14cd7..9f58ceae8ce 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 180b3054463..ecf8e464b31 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 3ffb1d51d7e..cfe40f760ac 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 f30847a1ad8..d4a46097647 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 aca1fc473fe..75b215513bb 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 79e05f474bf..e3028116bc2 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 700ec1bf608..2639e21d809 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 98e629fe660..69ad9d7fc01 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 17c3d118b17..357f8ac9867 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 57a848f1167..7286409183e 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 659888d96b6..4c0d98eb3b3 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 cdb15ccd485..b3b719b87c3 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 46aed73317d..485d5f79991 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 10814cf8ba3..c657cd0c4be 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 f600fedba0a..8032fd23ecb 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 a2d5f452735..2ea74c563f2 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 ae139374b9d..200f7cf8c66 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 1ddd1a2bc73..345e1278609 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 6993dae0ae7..4f65657666d 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 49a5d584052..5dba519f680 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 592dea39a34..cb439fbf0ad 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 79d1d0ed032..fb997071109 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 4d058208c33..46a20964a61 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 01b761ec8c2..145ee86f4a9 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 c394c986b25..bd346d66196 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 b8bb5ef39d6..124b1ba14d7 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 e5e484d7b5b..b09974b90b0 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 b8d1c5a930d..28026853de9 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 24fb9ea3b45..f9d7a0918cf 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 18b82a57993..40d2ed74117 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 e663ad2deef..f0863e8bf63 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 83bdc827450..de62823d547 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 2997db0834f..33a60d2b9a4 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 a58db081724..d13a9544083 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 0eb1b2a7473..1605963029b 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 2b4ccec0a47..58713b5f027 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 cb9789c6fdf..1cb65caeb77 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 b9bc1429fd9..1135ade3196 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 90286fa9e06..36b3b9f4a80 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 5e03fb09e18..2a433129cf9 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 36d1d3e8bc4..afd13e89a67 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 22f1ceaf1c4..a38c24862f9 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 48f2167c16d..ac0567253a5 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 7b7e4c86001..88f6247e4f8 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 75dace85974..5d90ab2369f 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 82304e18834..3ae0437b705 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 6247f8477ba..a77a828b5f4 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 7be296a1206..7df4c48efb1 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 e64e0b77494..c2b13aa50dc 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 b0e3dd3264e..47369be8b2e 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 36987c07ea5..b67a4684778 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 0243a84dcc8..ffa35bea2fe 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 23616fee5c0..41ce76eb8ee 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 15a75308b1c..3bc4694ec8a 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 221753b04d7..274612723ea 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 8e917715a93..b84fffce795 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 759dab34d07..9833ea22608 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 202615c9df6..e89251fbf5a 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 9b8ecf1c10e..d3ce3922c70 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 863bdef8b77..89435353dc3 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 333b72ee97f..94fd9fcef39 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 76e54e7102c..0d301a030d1 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 1de52e07503..be132278ff2 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 4b867b1bc24..b29b64dda7d 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 13bb9081bfa..9230517ca16 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 8061e09499d..aa15926c94f 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 6dc9663449c..e5f34cf51f7 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 9c5e0335b65..cea13f3fe6d 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 115778baac1..90d96df3661 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 c97a107ce6a..142f16b2550 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 818fa595afb..0a0b0ace356 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 ac79e42cd3b..6e954e0ad95 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 dc3c52abf99..c958e5434dd 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 8bdefccc810..8194b84354f 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 a8b0adcf6d2..79bea630439 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 e82f20bd06c..6f2a7db9817 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 a8da203c1f9..70354bebabf 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 8c5449ce459..88fdb5050fa 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 eac1fe00878..f9c4ba8a66e 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 f66f2ce0c3b..1c2b1f27d7a 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 02546dc9447..fd09bbec6d9 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 deb24d57894..a20a22d6aae 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 eab3eb4ff3e..e46631e94e7 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 d2801cb19c5..5d8090ecc73 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 f43d34cd01b..cf1007ffa77 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 b501887bbbf..ee2e276f34a 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 dd6933689da..f8d6498751e 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 b4226b6688f..a45fe2b9bdb 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 db62c1cd0f6..84ffa09fb54 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 74e6e061cc3..71f5609cc5c 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 98c803110aa..2d620047c33 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 1e3ad161e6d..e6bd93b4a74 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 319ab38e12d..d346e00b417 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 edf77f4d412..7efaccf4b54 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 b26776af021..c588f3e4ab3 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 5bb1cbd590a..fbe017e1a42 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 301502879be..443badd6190 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 fc2bb7ec7ad..31cb1a6019c 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 275b8de5fd0..196dcf11430 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 bf04298ee20..9261e114246 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 d72a88b4e76..743a4f78489 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 c0a980dd6b5..869821e7c04 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 5d4a45215ad..6499bfe171e 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 7f39d6fd6cd..e818ca94196 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 4f9953c3366..36747501c9a 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 d3a8d76bb4e..81b48f6ebdb 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 990a467da71..a3ac443bf88 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 9ce2f76e351..2198b204754 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 0b486be7e83..92382e04700 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 a5329b8760a..fbe49d960a1 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 a766e2a5fa1..bba41a1a22b 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 a5850fd8700..03bf10fa6e0 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 915605b9925..fa26f88eb73 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 d92e46c7695..6ecaab424ff 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 298a2cd35a6..da8fe898000 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 99933f53a96..1762a023ffc 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 dfcbd815e30..c4cfb14f230 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 4342e421077..b944533a614 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 3595654e4f1..d3f3ad10603 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 a7381f17992..b300a50a8d7 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 301a44c0bc9..0220603b2e0 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 a1911f766c1..5627e475f44 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 7b5f09f8910..d1f2b8a7686 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 f3ebf0c54e1..ffcda32a553 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 b7357d3e829..8ed2e3eb26b 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 514f3a34e77..c5779f652fb 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 41648abdb11..3daf58a8b4f 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 9b8a8bc9045..67fc85c20c3 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 856eaa1cb09..fd2757a8327 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 f74dc5910c9..a4a17ace61b 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 78eb697135a..3a7a47dbd4d 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 da9492aefe6..6abd113b9c6 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 4295223b48f..434d99b2051 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 50e4778720a..5f8bfd10d51 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 6ccb22e7c8d..4f84a83d2dc 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 275689ec577..269dbd0adda 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 52214d1fd19..10373f88392 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 4fe716e89bf..33123a8970e 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 81ecd15042f..d3d0b014f7b 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 979257b5fba..666d9d3f309 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 c584018bfb2..9c76b4094f6 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 baa49ad96e5..e85ac8dc5fa 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 2f482aeb74a..8a398c763b9 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 e3d4ca94965..86f68db9523 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 ecc44518adf..88095992490 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 e5adbacfb46..c1eadba3250 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 9daafc87e24..71aa47f189a 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 956a559efa0..b9e96958bd9 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 f31afc9c3d6..ecab7ef6b45 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 73778525fbd..e6f6e7648ea 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 36b8ed0c443..d312769b6e7 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 effe06e6c34..119cc6d2b75 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 81a7e19d000..b39e1db7205 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 b7f8fa9dab7..ea74ade7e21 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 fc96b00f305..a1fe1fc076b 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 35f9b9b0f91..10620d2ab8a 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 c638745810c..1966c858a3b 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 3136e6c8efb..5ef0b11a747 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 fe65dc5de76..8da69941939 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 e5772411e2a..0c8508ba674 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 8968d2fbceb..96861f1119b 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 2a86a3e41f8..a132ed5ba29 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 5a17aff7f1f..ea5cbe3e0fc 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 46aba1eda81..fdfb141a0f5 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 07b3f401310..993d78885c7 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 6436c62a23c..fca9190765c 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 45094315650..cac45998c16 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 ca553c30bcf..c6b54b059a3 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 5d3a33d3784..0368b0320d3 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 cb4f7cc4fc3..ab0f344f308 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 094b7e80781..858d7d78c38 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 3244ac91d89..d8327769ea0 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 29920bd59ed..59851cad925 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 b4d6c67f6bb..81eca86a1d9 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 23db2598b0c..1cf077b672c 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 789c30390af..33e1d09d83d 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 6a9da6d2969..e62eff04414 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 8fb5f1b797f..3096f46e624 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 65a18c38129..ac36d6d5ab1 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 dd71507660c..5a11559e867 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 2f56b71949a..c2b76fb1327 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 84d41da982f..426023cc8c1 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 bf1aef1850a..d6093e16e5e 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 b9d7a2a5985..86b14c5496f 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 b42eca74a8e..38ce7b664e8 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 3cb876d7158..35cd98e1524 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 df3d197a42d..5d008cf8b6c 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 929213acfed..9dca9f9f39a 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 b13d54b0233..a638b1ac13a 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 0976d370db9..598272f70d7 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 cb237511d88..ec4d26d956e 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 f4f491416f6..5a890a48feb 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 9c5cb557684..c0a357d5402 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 4b7dbebceee..9cf9df9db7d 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 f2240724f02..af9deb0fb30 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 773fdfa6b0a..23db6e95349 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 af35ee52906..ae76281c879 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 c25293910a9..7527138013d 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 77dd50eb61f..09428e35c12 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 56e1ed4fea9..2acf93bb16d 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 3ed40e0905c..9b50513d263 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 bd812337de7..89e15c4001a 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 9a55ae50947..1964a32b553 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 728aba659b4..9d06d2e03f5 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 528bf4663fd..ae71d702cdf 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 aa15ee6eff3..a926e69836e 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 a4ee46cac7d..20a030fb7e9 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 ad400711f91..8f47f080da1 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 7826a1da273..0b47eda3de1 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 1db31bdab91..10bd4aba5c9 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 0ebce061637..92ec7bde73c 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 404ff21890a..050af75a12f 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 d4a79908fb3..4f6d7caecb6 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 1256fd8e7d4..a40edc82cbd 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 b317b4f316f..b2829312856 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 5aeefeba568..e82b7d08389 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 2f31c43193e..e1b2f647fcc 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 1df8abca5f3..395351d39d7 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 25081605cda..421669cd0aa 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 9d974b6b68e..1e80ac812e2 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 718cd26c59e..116b96a448a 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 79aa1a9f8ca..ee8988c8805 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 00192d35449..7b05bccc248 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 0d2bfe4639a..6d3e9a255a3 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 f94fa7905ac..a9d04e0dd44 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 f3530fd4e65..d4c36a8c745 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 4ee287b3c7c..d844f2292e3 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 fefac29b02f..9684db08c9d 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 668a6ed24c6..5fa7dadc6fb 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 c0b86ee61ce..2e0187c232d 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 2aff03015b0..2376408af42 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 1e88d319f9f..812a0e94163 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 b57eb3a849a..6ec9d85b4a7 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 37d78256921..a3b970b4952 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 1d052efc2ea..58240c8257e 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 0f45dc77b72..c60ed41eb4b 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 5deb4cf7758..a625878736b 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 deb1fb5f05b..3cdca871423 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 e244df99f2b..3b451514295 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 f353202dd04..1eddcda530c 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 3b32690ec1f..9cbf9157a96 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 7664c8330ee..610bba75c3f 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 f23acad583a..a93d4baf15a 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 ee4611bd6e4..3a74104e901 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 6dc03b148fb..8364c825406 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 f04c83b138f..946d791b40f 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 1ee53834ef7..8d5e7c5cfae 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 b6d17378f23..a87d019b6d8 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 1ede45fceff..a9eb626d8e2 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 95250b70052..bf0afde78f6 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 10db32e8bfa..d5f9d2476f5 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 86d5401abae..ba61bc79529 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 10d2f883ffb..61c43376d01 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 52da6cba969..66dba54a347 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 1a60d9d60de..164d8fa7067 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 5e1891b92cc..265ef72b11a 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 848111cabaa..d5e9ac6aec5 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 4043020b89f..2bf68dcc373 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 d9fb21af402..b082c802987 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 11328da9948..9af27c452e9 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 203fc41f9ce..59cdd96c8c4 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 bb49c3e9611..47a52b3fa22 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 17f30f3b032..2aaef76ba16 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 9d12708b950..0467dccd188 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 3dc78f70ed2..f82221919ea 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 b450fc1e405..bd24a6e06e8 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 d160ae08ef4..3019a387218 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 62567557b3d..d1c558da3eb 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 33ce867228a..3e78804402f 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 bf336e7461f..c8aedb940e1 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 b15c7b0f1d6..ef688fbd330 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 c3418b3d121..2e034aa84a1 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 01b67f4c270..0b160b07ad3 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 6058928b5c9..f1b8083c043 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 aee875ad5f8..7210e607e5e 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 613898f5554..cfd8b4a0aa9 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 934a96baf3d..360f2264abb 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 b33b099d6d4..3952dec9da9 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 90c47e0503f..3b9ecb807d2 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 10fd2fcda2e..4726ab2afa6 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 d39aeeeace5..f3b5518d2fc 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 fc597ab97c1..bf75258342f 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 d9f4784c322..c2e9702a2bd 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 8b4a689b12a..ab0d606d6ce 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 d7f4d08f6f2..4497881d728 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 2e602c97705..2bded384fbe 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 f963c2ed57d..3dd93a83069 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 eccfe85643e..7f9021aaea1 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 05f96b7d4a7..3ccfe2789b1 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 b8637f71cd1..f0714f7da96 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 15b7d83b2c9..edcdc500d1e 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 8f7b71fbc2b..5e255e8a346 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 385e3601b87..bdd79a0da79 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 c67bb75bc19..271a0daa54c 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 56f283a502c..78d12627fc4 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 96b7e65178b..8d9f39b270c 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 a5e2923d72f..9f693481d41 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 1ae124cb691..3fac66c795a 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 eff6eaf0912..1feaad20b0d 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 fed6f2004d3..11b2f6384c6 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 9f729d47e82..6d018fbc512 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 1203cd54a97..4a2d5368e3c 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 0aece5a231b..53874000f6a 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 24aa69320da..d789e33d221 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 3ab185bd006..e65992327bd 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 e6c70df2107..36eb1c0ea75 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 5daaf8814f5..73a8601468a 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 c485a435dae..96d4571756c 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 ad8ace1f1ac..56e114321fa 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 17dd0c42abb..9eb39c1d401 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 7905675b4c6..5194671df32 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 3ce42f9cbad..6730623a872 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 00c6e4599b4..00d80af889a 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 3e64be46fee..256094ce6a5 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 c1c6838a079..152d1faad96 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 f8901a04853..4cbb13410a8 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 9b1ca59d712..6bf1680a8b5 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 4b7a2d72c47..90fd7f0eae5 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 21b96bc6607..2626eac35f2 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 58c3426bd9b..9d7ef8eb390 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 89aaa6ebf92..5caa9a6b849 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 361b9a6a8da..560ae6fdf49 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 07b16750cd2..c03b95965f8 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 762312de782..b2f1bf6c140 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 17215fffaa1..cdacc3305f0 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 fbefc1668b9..8f028ec18a1 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 d149acb36e7..50e64ce67e8 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 be3354ca502..d1182c948e5 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 06857106860..1f67cf3dba8 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 ee7b9601683..45d9cd6c81e 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 5d35a3649d8..b6ec930ac7b 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 0f55534aa73..21c879ef08a 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 31cbafceae4..5f617d4c3cf 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 53356d7e2fc..70fbbf0a022 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 a4019933eaa..0d9d0b3304a 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 60f3bb8bf92..6f43dce532f 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 2a2017e5bcc..73a50a17d0c 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 3f67975dfd2..4ce2b98f367 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 3368cbfab5a..37b7dce08fc 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 05f5791d23f..9e3a0e8cc40 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 c23491251cc..138a884b3e4 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 e063b6ea50d..d4fac3283c1 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 4a8ad4fbae2..6744226fb08 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 d2e7d116fc7..a8d8245f1e4 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 cbe8388f3ec..b7a3625e8b7 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 e97f98c6e82..2f26e180c02 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 a58cb50a2a6..cc97df22392 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 ff5b7e8620c..11d4a053d37 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 1f899f41868..3eb1cda3489 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 c5fb6c99abc..721959bd47f 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 125d09858fb..6f3acf8f2c3 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 930d71f7d0b..df35ab0ed35 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 d977619d4c3..c6641622fb9 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 9261b51d011..7d09cbe7796 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 8b46c83a666..555ce411966 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 5ff0346fdd7..7d4cde6b9ae 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 f50d47eea30..4223043c367 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 89d6cc8b82a..50f5ab04992 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 30632fa5abb..ec7189965d2 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 4aa4e88654e..0f04f7ef530 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 2aa998e143a..60becbd372f 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 2f098bc7f07..63fba2dd6bc 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 a31538a7b5c..69329a2d87a 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 faf1106c85d..7ff6c1412ab 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