js: Use destructuring for require statements.

This allows import/order to auto-fix blocks including these
statements.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-08-03 14:57:48 -07:00 committed by Steve Howell
parent 5216b70691
commit 9238813135
33 changed files with 37 additions and 37 deletions

View File

@ -15,7 +15,7 @@ set_global("compose_actions", {
update_placeholder_text: noop,
});
const LazySet = zrequire("lazy_set").LazySet;
const {LazySet} = zrequire("lazy_set");
const _navigator = {
platform: "",

View File

@ -1,6 +1,6 @@
"use strict";
const FoldDict = zrequire("fold_dict").FoldDict;
const {FoldDict} = zrequire("fold_dict");
run_test("basic", () => {
const d = new FoldDict();

View File

@ -1,6 +1,6 @@
"use strict";
const LazySet = zrequire("lazy_set").LazySet;
const {LazySet} = zrequire("lazy_set");
/*
We mostly test LazySet indirectly. This code

View File

@ -17,7 +17,7 @@ zrequire("FetchStatus", "js/fetch_status");
zrequire("muting");
zrequire("MessageListData", "js/message_list_data");
zrequire("MessageListView", "js/message_list_view");
const MessageList = zrequire("message_list").MessageList;
const {MessageList} = zrequire("message_list");
function accept_all_filter() {
const filter = {

View File

@ -1,6 +1,6 @@
"use strict";
const LazySet = zrequire("lazy_set").LazySet;
const {LazySet} = zrequire("lazy_set");
const noop = () => {};
global.stub_templates(() => noop);

View File

@ -20,7 +20,7 @@ const pygments_data = zrequire("pygments_data", "generated/pygments_data.json");
const actual_pygments_data = Object.assign({}, pygments_data);
const ct = zrequire("composebox_typeahead");
const th = zrequire("typeahead_helper");
const LazySet = zrequire("lazy_set").LazySet;
const {LazySet} = zrequire("lazy_set");
let next_id = 0;

View File

@ -12,7 +12,7 @@ set_global("page_params", {
});
zrequire("settings_notifications");
const FoldDict = zrequire("fold_dict").FoldDict;
const {FoldDict} = zrequire("fold_dict");
set_global("narrow_state", {});
set_global("current_msg_list", {});

View File

@ -1,11 +1,11 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const path = require("path");
const puppeteer = require("puppeteer");
const test_credentials = require("../../var/puppeteer/test_credentials").test_credentials;
const {test_credentials} = require("../../var/puppeteer/test_credentials");
const root_dir = path.resolve(__dirname, "../../");
const puppeteer_dir = path.join(root_dir, "var/puppeteer");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const test_credentials = require("../../var/puppeteer/test_credentials").test_credentials;
const {test_credentials} = require("../../var/puppeteer/test_credentials");
const common = require("../puppeteer_lib/common");
async function login_tests(page) {

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const common = require("../puppeteer_lib/common");

View File

@ -1,8 +1,8 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
const test_credentials = require("../../var/puppeteer/test_credentials").test_credentials;
const {test_credentials} = require("../../var/puppeteer/test_credentials");
const common = require("../puppeteer_lib/common");
const OUTGOING_WEBHOOK_BOT_TYPE = "3";

View File

@ -11,7 +11,7 @@ const handlebars = require("./handlebars");
const stub_i18n = require("./i18n");
const namespace = require("./namespace");
const stub = require("./stub");
const make_blueslip = require("./zblueslip").make_zblueslip;
const {make_zblueslip} = require("./zblueslip");
const zjquery = require("./zjquery");
require("@babel/register")({
@ -130,7 +130,7 @@ try {
_.throttle = immediate;
_.debounce = immediate;
set_global("blueslip", make_blueslip());
set_global("blueslip", make_zblueslip());
set_global("i18n", stub_i18n);
namespace.clear_zulip_refs();

View File

@ -1,6 +1,6 @@
"use strict";
const assert = require("assert").strict;
const {strict: assert} = require("assert");
// Stubs don't do any magical modifications to your namespace. They
// just provide you a function that records what arguments get passed

View File

@ -2,7 +2,7 @@
const XDate = require("xdate");
const FoldDict = require("./fold_dict").FoldDict;
const {FoldDict} = require("./fold_dict");
const muted_topics = new Map();

View File

@ -1,6 +1,6 @@
"use strict";
const FoldDict = require("./fold_dict").FoldDict;
const {FoldDict} = require("./fold_dict");
// topic_senders[stream_id][topic_id][sender_id] = latest_message_id
const topic_senders = new Map();

View File

@ -1,6 +1,6 @@
"use strict";
const Sortable = require("sortablejs").default;
const {default: Sortable} = require("sortablejs");
const render_admin_profile_field_list = require("../templates/admin_profile_field_list.hbs");
const render_settings_profile_field_choice = require("../templates/settings/profile_field_choice.hbs");

View File

@ -1,7 +1,7 @@
"use strict";
const FoldDict = require("./fold_dict").FoldDict;
const LazySet = require("./lazy_set").LazySet;
const {FoldDict} = require("./fold_dict");
const {LazySet} = require("./lazy_set");
const people = require("./people");
const settings_config = require("./settings_config");
const util = require("./util");

View File

@ -1,6 +1,6 @@
"use strict";
const FoldDict = require("./fold_dict").FoldDict;
const {FoldDict} = require("./fold_dict");
const stream_dict = new Map(); // stream_id -> PerStreamHistory object
const fetched_stream_ids = new Set();

View File

@ -1,6 +1,6 @@
"use strict";
const SimpleBar = require("simplebar").default;
const {default: SimpleBar} = require("simplebar");
// What, if anything, obscures the home tab?

View File

@ -1,6 +1,6 @@
"use strict";
const FoldDict = require("./fold_dict").FoldDict;
const {FoldDict} = require("./fold_dict");
const people = require("./people");
const util = require("./util");

View File

@ -1,6 +1,6 @@
"use strict";
const FoldDict = require("./fold_dict").FoldDict;
const {FoldDict} = require("./fold_dict");
let user_group_name_dict;
let user_group_by_id_dict;