eslint: Replace sort-imports with import/order.

import/order sorts require() calls as well as import statements.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
Anders Kaseorg 2020-07-23 21:02:07 -07:00 committed by Tim Abbott
parent 0771e7fc59
commit e3b3df328d
70 changed files with 156 additions and 84 deletions

View File

@ -19,7 +19,16 @@
"empty-returns/main": "error", "empty-returns/main": "error",
"eqeqeq": "error", "eqeqeq": "error",
"guard-for-in": "error", "guard-for-in": "error",
"import/first": "error",
"import/newline-after-import": "error",
"import/no-unresolved": ["error", {"ignore": ["!"]}], "import/no-unresolved": ["error", {"ignore": ["!"]}],
"import/order": [
"error",
{
"alphabetize": {"order": "asc"},
"newlines-between": "always"
}
],
"new-cap": [ "new-cap": [
"error", "error",
{ {
@ -78,7 +87,6 @@
} }
], ],
"radix": "error", "radix": "error",
"sort-imports": "error",
"spaced-comment": "off", "spaced-comment": "off",
"strict": "off", "strict": "off",
"valid-typeof": ["error", {"requireStringLiterals": true}], "valid-typeof": ["error", {"requireStringLiterals": true}],

View File

@ -1,4 +1,5 @@
var common = require("../casper_lib/common.js"); var common = require("../casper_lib/common.js");
var realm_url = "http://zulip.zulipdev.com:9981/"; var realm_url = "http://zulip.zulipdev.com:9981/";
// Start of test script. // Start of test script.

View File

@ -1,5 +1,6 @@
var common = require("../casper_lib/common.js");
var test_credentials = require("../../var/casper/test_credentials.js").test_credentials; var test_credentials = require("../../var/casper/test_credentials.js").test_credentials;
var common = require("../casper_lib/common.js");
var OUTGOING_WEBHOOK_BOT_TYPE = "3"; var OUTGOING_WEBHOOK_BOT_TYPE = "3";
var GENERIC_BOT_TYPE = "1"; var GENERIC_BOT_TYPE = "1";

View File

@ -1,7 +1,8 @@
const noop = () => {}; const noop = () => {};
const {JSDOM} = require("jsdom");
const fs = require("fs"); const fs = require("fs");
const {JSDOM} = require("jsdom");
const template = fs.readFileSync("templates/corporate/billing.html", "utf-8"); const template = fs.readFileSync("templates/corporate/billing.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true}); const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document; const document = dom.window.document;

View File

@ -1,8 +1,11 @@
const {JSDOM} = require("jsdom");
const fs = require("fs"); const fs = require("fs");
const JQuery = require("jquery");
const {JSDOM} = require("jsdom");
const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8"); const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true}); const dom = new JSDOM(template, {pretendToBeVisual: true});
const jquery = require("jquery")(dom.window); const jquery = JQuery(dom.window);
set_global("$", global.make_zjquery()); set_global("$", global.make_zjquery());
set_global("page_params", {}); set_global("page_params", {});

View File

@ -1,5 +1,5 @@
const rewiremock = require("rewiremock/node");
const {JSDOM} = require("jsdom"); const {JSDOM} = require("jsdom");
const rewiremock = require("rewiremock/node");
set_global("bridge", false); set_global("bridge", false);

View File

@ -6,9 +6,11 @@ set_global("page_params", {
set_global("compose_ui", {}); set_global("compose_ui", {});
const {JSDOM} = require("jsdom"); const {JSDOM} = require("jsdom");
const {window} = new JSDOM("<!DOCTYPE html><p>Hello world</p>"); const {window} = new JSDOM("<!DOCTYPE html><p>Hello world</p>");
const {DOMParser, document} = window; const {DOMParser, document} = window;
set_global("$", require("jquery")(window)); set_global("$", require("jquery")(window));
set_global("DOMParser", DOMParser); set_global("DOMParser", DOMParser);
set_global("document", document); set_global("document", document);

View File

@ -1,4 +1,5 @@
const events = require("./lib/events.js"); const events = require("./lib/events.js");
const event_fixtures = events.fixtures; const event_fixtures = events.fixtures;
const test_user = events.test_user; const test_user = events.test_user;

View File

@ -1,5 +1,7 @@
const fs = require("fs"); const fs = require("fs");
const {JSDOM} = require("jsdom"); const {JSDOM} = require("jsdom");
const template = fs.readFileSync("templates/analytics/realm_details.html", "utf-8"); const template = fs.readFileSync("templates/analytics/realm_details.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true}); const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document; const document = dom.window.document;

View File

@ -3,6 +3,7 @@ set_global("page_params", {
twenty_four_hour_time: true, twenty_four_hour_time: true,
}); });
set_global("moment", require("moment-timezone")); set_global("moment", require("moment-timezone"));
set_global("XDate", zrequire("XDate", "xdate")); set_global("XDate", zrequire("XDate", "xdate"));
zrequire("timerender"); zrequire("timerender");

View File

@ -1,7 +1,8 @@
const noop = () => {}; const noop = () => {};
const {JSDOM} = require("jsdom");
const fs = require("fs"); const fs = require("fs");
const {JSDOM} = require("jsdom");
const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8"); const template = fs.readFileSync("templates/corporate/upgrade.html", "utf-8");
const dom = new JSDOM(template, {pretendToBeVisual: true}); const dom = new JSDOM(template, {pretendToBeVisual: true});
const document = dom.window.document; const document = dom.window.document;

View File

@ -1,6 +1,8 @@
const path = require("path");
const puppeteer = require("puppeteer");
const assert = require("assert").strict; const assert = require("assert").strict;
const path = require("path");
const puppeteer = require("puppeteer");
const test_credentials = require("../../var/casper/test_credentials.js").test_credentials; const test_credentials = require("../../var/casper/test_credentials.js").test_credentials;
class CommonUtils { class CommonUtils {

View File

@ -1,6 +1,7 @@
const common = require("../puppeteer_lib/common");
const assert = require("assert").strict; const assert = require("assert").strict;
const common = require("../puppeteer_lib/common");
const email = "alice@test.example.com"; const email = "alice@test.example.com";
const subdomain = "testsubdomain"; const subdomain = "testsubdomain";
const organization_name = "Awesome Organization"; const organization_name = "Awesome Organization";

View File

@ -1,5 +1,5 @@
const common = require("../puppeteer_lib/common");
const test_credentials = require("../../var/casper/test_credentials.js").test_credentials; const test_credentials = require("../../var/casper/test_credentials.js").test_credentials;
const common = require("../puppeteer_lib/common");
async function login_tests(page) { async function login_tests(page) {
await common.log_in(page, test_credentials.default_user); await common.log_in(page, test_credentials.default_user);

View File

@ -1,7 +1,8 @@
const _ = require("underscore/underscore.js");
const fs = require("fs"); const fs = require("fs");
const path = require("path"); const path = require("path");
const _ = require("underscore/underscore.js");
exports.find_files_to_run = function () { exports.find_files_to_run = function () {
let oneFileFilter = []; let oneFileFilter = [];
let testsDifference = []; let testsDifference = [];

View File

@ -1,6 +1,7 @@
const fs = require("fs"); const fs = require("fs");
const Handlebars = require("handlebars/dist/cjs/handlebars.js");
const path = require("path"); const path = require("path");
const Handlebars = require("handlebars/dist/cjs/handlebars.js");
const {SourceMapConsumer, SourceNode} = require("source-map"); const {SourceMapConsumer, SourceNode} = require("source-map");
const templates_path = path.resolve(__dirname, "../../static/templates"); const templates_path = path.resolve(__dirname, "../../static/templates");

View File

@ -1,7 +1,17 @@
const path = require("path");
const fs = require("fs"); const fs = require("fs");
const Module = require("module");
const path = require("path");
const escapeRegExp = require("lodash/escapeRegExp"); const escapeRegExp = require("lodash/escapeRegExp");
const finder = require("./finder.js");
const handlebars = require("./handlebars.js");
const stub_i18n = require("./i18n.js");
const namespace = require("./namespace.js");
const stub = require("./stub.js");
const make_blueslip = require("./zblueslip.js").make_zblueslip;
const zjquery = require("./zjquery.js");
require("@babel/register")({ require("@babel/register")({
extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".ts"], extensions: [".es6", ".es", ".jsx", ".js", ".mjs", ".ts"],
only: [ only: [
@ -15,6 +25,7 @@ require("@babel/register")({
global.assert = require("assert").strict; global.assert = require("assert").strict;
global._ = require("underscore/underscore.js"); global._ = require("underscore/underscore.js");
const _ = global._; const _ = global._;
// Create a helper function to avoid sneaky delays in tests. // Create a helper function to avoid sneaky delays in tests.
@ -23,14 +34,12 @@ function immediate(f) {
} }
// Find the files we need to run. // Find the files we need to run.
const finder = require("./finder.js");
const files = finder.find_files_to_run(); // may write to console const files = finder.find_files_to_run(); // may write to console
if (files.length === 0) { if (files.length === 0) {
throw "No tests found"; throw "No tests found";
} }
// Set up our namespace helpers. // Set up our namespace helpers.
const namespace = require("./namespace.js");
global.set_global = namespace.set_global; global.set_global = namespace.set_global;
global.patch_builtin = namespace.set_global; global.patch_builtin = namespace.set_global;
global.zrequire = namespace.zrequire; global.zrequire = namespace.zrequire;
@ -43,28 +52,19 @@ global.window = new Proxy(global, {
global.to_$ = () => window; global.to_$ = () => window;
// Set up stub helpers. // Set up stub helpers.
const stub = require("./stub.js");
global.make_stub = stub.make_stub; global.make_stub = stub.make_stub;
global.with_stub = stub.with_stub; global.with_stub = stub.with_stub;
// Set up fake jQuery // Set up fake jQuery
global.make_zjquery = require("./zjquery.js").make_zjquery; global.make_zjquery = zjquery.make_zjquery;
// Set up fake blueslip
const make_blueslip = require("./zblueslip.js").make_zblueslip;
// Set up fake translation
const stub_i18n = require("./i18n.js");
// Set up Handlebars // Set up Handlebars
const handlebars = require("./handlebars.js");
global.make_handlebars = handlebars.make_handlebars; global.make_handlebars = handlebars.make_handlebars;
global.stub_templates = handlebars.stub_templates; global.stub_templates = handlebars.stub_templates;
const noop = function () {}; const noop = function () {};
// Set up fake module.hot // Set up fake module.hot
const Module = require("module");
Module.prototype.hot = { Module.prototype.hot = {
accept: noop, accept: noop,
}; };

View File

@ -1,3 +1,5 @@
const assert = require("assert").strict;
// Stubs don't do any magical modifications to your namespace. They // Stubs don't do any magical modifications to your namespace. They
// just provide you a function that records what arguments get passed // just provide you a function that records what arguments get passed
// to it. To use stubs as something more like "spies," use something // to it. To use stubs as something more like "spies," use something

View File

@ -1,8 +1,9 @@
const settings_config = require("./settings_config");
const settings_data = require("./settings_data");
const render_admin_tab = require("../templates/admin_tab.hbs"); const render_admin_tab = require("../templates/admin_tab.hbs");
const render_settings_organization_settings_tip = require("../templates/settings/organization_settings_tip.hbs"); const render_settings_organization_settings_tip = require("../templates/settings/organization_settings_tip.hbs");
const settings_config = require("./settings_config");
const settings_data = require("./settings_data");
const admin_settings_label = { const admin_settings_label = {
// Organization settings // Organization settings
realm_allow_community_topic_editing: i18n.t("Users can edit the topic of any message"), realm_allow_community_topic_editing: i18n.t("Users can edit the topic of any message"),

View File

@ -1,7 +1,8 @@
import $ from "jquery";
import ErrorStackParser from "error-stack-parser"; import ErrorStackParser from "error-stack-parser";
import $ from "jquery";
import StackFrame from "stackframe"; import StackFrame from "stackframe";
import StackTraceGPS from "stacktrace-gps"; import StackTraceGPS from "stacktrace-gps";
import render_blueslip_stacktrace from "../templates/blueslip_stacktrace.hbs"; import render_blueslip_stacktrace from "../templates/blueslip_stacktrace.hbs";
type FunctionName = { type FunctionName = {

View File

@ -1,10 +1,11 @@
const util = require("./util");
const settings_panel_menu = require("./settings_panel_menu");
// You won't find every click handler here, but it's a good place to start! // You won't find every click handler here, but it's a good place to start!
const render_buddy_list_tooltip = require("../templates/buddy_list_tooltip.hbs"); const render_buddy_list_tooltip = require("../templates/buddy_list_tooltip.hbs");
const render_buddy_list_tooltip_content = require("../templates/buddy_list_tooltip_content.hbs"); const render_buddy_list_tooltip_content = require("../templates/buddy_list_tooltip_content.hbs");
const settings_panel_menu = require("./settings_panel_menu");
const util = require("./util");
function convert_enter_to_click(e) { function convert_enter_to_click(e) {
const key = e.which; const key = e.which;
if (key === 13) { if (key === 13) {

View File

@ -1,11 +1,12 @@
const rendered_markdown = require("./rendered_markdown");
const util = require("./util");
const render_compose_all_everyone = require("../templates/compose_all_everyone.hbs"); const render_compose_all_everyone = require("../templates/compose_all_everyone.hbs");
const render_compose_announce = require("../templates/compose_announce.hbs"); const render_compose_announce = require("../templates/compose_announce.hbs");
const render_compose_invite_users = require("../templates/compose_invite_users.hbs"); const render_compose_invite_users = require("../templates/compose_invite_users.hbs");
const render_compose_not_subscribed = require("../templates/compose_not_subscribed.hbs"); const render_compose_not_subscribed = require("../templates/compose_not_subscribed.hbs");
const render_compose_private_stream_alert = require("../templates/compose_private_stream_alert.hbs"); const render_compose_private_stream_alert = require("../templates/compose_private_stream_alert.hbs");
const rendered_markdown = require("./rendered_markdown");
const util = require("./util");
// Docs: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html // Docs: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html
/* Track the state of the @all warning. The user must acknowledge that they are spamming the entire /* Track the state of the @all warning. The user must acknowledge that they are spamming the entire

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
let focused_recipient; let focused_recipient;
let normal_display = false; let normal_display = false;

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
exports.initialize_pill = function () { exports.initialize_pill = function () {
const container = $("#private_message_recipient").parent(); const container = $("#private_message_recipient").parent();

View File

@ -1,8 +1,10 @@
const autosize = require("autosize");
const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js");
const pygments_data = require("../generated/pygments_data.json"); const pygments_data = require("../generated/pygments_data.json");
const typeahead = require("../shared/js/typeahead"); const typeahead = require("../shared/js/typeahead");
const autosize = require("autosize");
const settings_data = require("./settings_data"); const settings_data = require("./settings_data");
const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js");
//************************************ //************************************
// AN IMPORTANT NOTE ABOUT TYPEAHEADS // AN IMPORTANT NOTE ABOUT TYPEAHEADS

View File

@ -1,6 +1,7 @@
const util = require("./util");
const render_draft_table_body = require("../templates/draft_table_body.hbs"); const render_draft_table_body = require("../templates/draft_table_body.hbs");
const util = require("./util");
function set_count(count) { function set_count(count) {
const draft_count = count.toString(); const draft_count = count.toString();
const text = i18n.t("Drafts (__draft_count__)", {draft_count}); const text = i18n.t("Drafts (__draft_count__)", {draft_count});

View File

@ -1,6 +1,7 @@
const util = require("./util");
const emoji_codes = require("../generated/emoji/emoji_codes.json"); const emoji_codes = require("../generated/emoji/emoji_codes.json");
const util = require("./util");
// `emojis_by_name` is the central data source that is supposed to be // `emojis_by_name` is the central data source that is supposed to be
// used by every widget in the webapp for gathering data for displaying // used by every widget in the webapp for gathering data for displaying
// emojis. Emoji picker uses this data to derive data for its own use. // emojis. Emoji picker uses this data to derive data for its own use.

View File

@ -1,6 +1,5 @@
const emoji_codes = require("../generated/emoji/emoji_codes.json"); const emoji_codes = require("../generated/emoji/emoji_codes.json");
const typeahead = require("../shared/js/typeahead"); const typeahead = require("../shared/js/typeahead");
const render_emoji_popover = require("../templates/emoji_popover.hbs"); const render_emoji_popover = require("../templates/emoji_popover.hbs");
const render_emoji_popover_content = require("../templates/emoji_popover_content.hbs"); const render_emoji_popover_content = require("../templates/emoji_popover_content.hbs");
const render_emoji_popover_search_results = require("../templates/emoji_popover_search_results.hbs"); const render_emoji_popover_search_results = require("../templates/emoji_popover_search_results.hbs");

View File

@ -1,10 +1,11 @@
import google_blob_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-blob-sprite.css";
import google_blob_sheet from "emoji-datasource-google-blob/img/google/sheets-256/64.png"; import google_blob_sheet from "emoji-datasource-google-blob/img/google/sheets-256/64.png";
import google_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-sprite.css";
import google_sheet from "emoji-datasource-google/img/google/sheets-256/64.png"; import google_sheet from "emoji-datasource-google/img/google/sheets-256/64.png";
import twitter_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/twitter-sprite.css";
import twitter_sheet from "emoji-datasource-twitter/img/twitter/sheets-256/64.png"; import twitter_sheet from "emoji-datasource-twitter/img/twitter/sheets-256/64.png";
import google_blob_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-blob-sprite.css";
import google_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/google-sprite.css";
import twitter_css from "!style-loader?injectType=lazyStyleTag!css-loader!../generated/emoji-styles/twitter-sprite.css";
const emojisets = new Map([ const emojisets = new Map([
["google", {css: google_css, sheet: google_sheet}], ["google", {css: google_css, sheet: google_sheet}],
["google-blob", {css: google_blob_css, sheet: google_blob_sheet}], ["google-blob", {css: google_blob_css, sheet: google_blob_sheet}],

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
function zephyr_stream_name_match(message, operand) { function zephyr_stream_name_match(message, operand) {
// Zephyr users expect narrowing to "social" to also show messages to /^(un)*social(.d)*$/ // Zephyr users expect narrowing to "social" to also show messages to /^(un)*social(.d)*$/
// (unsocial, ununsocial, social.d, etc) // (unsocial, ununsocial, social.d, etc)

View File

@ -1,9 +1,9 @@
const autosize = require("autosize");
const render_invitation_failed_error = require("../templates/invitation_failed_error.hbs"); const render_invitation_failed_error = require("../templates/invitation_failed_error.hbs");
const render_invite_subscription = require("../templates/invite_subscription.hbs"); const render_invite_subscription = require("../templates/invite_subscription.hbs");
const render_settings_dev_env_email_access = require("../templates/settings/dev_env_email_access.hbs"); const render_settings_dev_env_email_access = require("../templates/settings/dev_env_email_access.hbs");
const autosize = require("autosize");
function reset_error_messages() { function reset_error_messages() {
$("#invite_status").hide().text("").removeClass(common.status_classes); $("#invite_status").hide().text("").removeClass(common.status_classes);
$("#multiuse_invite_status").hide().text("").removeClass(common.status_classes); $("#multiuse_invite_status").hide().text("").removeClass(common.status_classes);

View File

@ -1,5 +1,5 @@
const util = require("./util");
const huddle_data = require("./huddle_data"); const huddle_data = require("./huddle_data");
const util = require("./util");
function maybe_add_narrowed_messages(messages, msg_list) { function maybe_add_narrowed_messages(messages, msg_list) {
const ids = []; const ids = [];

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
function MessageListData(opts) { function MessageListData(opts) {
this.muting_enabled = opts.muting_enabled; this.muting_enabled = opts.muting_enabled;
if (this.muting_enabled) { if (this.muting_enabled) {

View File

@ -1,10 +1,11 @@
const util = require("./util");
const rendered_markdown = require("./rendered_markdown");
const render_bookend = require("../templates/bookend.hbs"); const render_bookend = require("../templates/bookend.hbs");
const render_message_group = require("../templates/message_group.hbs"); const render_message_group = require("../templates/message_group.hbs");
const render_recipient_row = require("../templates/recipient_row.hbs"); const render_recipient_row = require("../templates/recipient_row.hbs");
const render_single_message = require("../templates/single_message.hbs"); const render_single_message = require("../templates/single_message.hbs");
const rendered_markdown = require("./rendered_markdown");
const util = require("./util");
function MessageListView(list, table_name, collapse_messages) { function MessageListView(list, table_name, collapse_messages) {
this.list = list; this.list = list;
this.collapse_messages = collapse_messages; this.collapse_messages = collapse_messages;

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
const stored_messages = new Map(); const stored_messages = new Map();
/* /*

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
let jwindow; let jwindow;
const dimensions = {}; const dimensions = {};
let in_stoppable_autoscroll = false; let in_stoppable_autoscroll = false;

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
let unnarrow_times; let unnarrow_times;
const LARGER_THAN_MAX_MESSAGE_ID = 10000000000000000; const LARGER_THAN_MAX_MESSAGE_ID = 10000000000000000;

View File

@ -1,5 +1,6 @@
const render_compose_notification = require("../templates/compose_notification.hbs"); const render_compose_notification = require("../templates/compose_notification.hbs");
const render_notification = require("../templates/notification.hbs"); const render_notification = require("../templates/notification.hbs");
const settings_config = require("./settings_config"); const settings_config = require("./settings_config");
const notice_memory = new Map(); const notice_memory = new Map();

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
const resize_app = function () { const resize_app = function () {
const panels_height = $("#panels").height(); const panels_height = $("#panels").height();
$("body > .app").height("calc(100% - " + panels_height + "px)"); $("body > .app").height("calc(100% - " + panels_height + "px)");

View File

@ -1,8 +1,9 @@
const util = require("./util");
require("unorm"); // String.prototype.normalize polyfill for IE11 require("unorm"); // String.prototype.normalize polyfill for IE11
const FoldDict = require("./fold_dict").FoldDict;
const typeahead = require("../shared/js/typeahead"); const typeahead = require("../shared/js/typeahead");
const FoldDict = require("./fold_dict").FoldDict;
const settings_data = require("./settings_data"); const settings_data = require("./settings_data");
const util = require("./util");
let people_dict; let people_dict;
let people_by_name_dict; let people_by_name_dict;

View File

@ -1,6 +1,5 @@
const util = require("./util");
const settings_data = require("./settings_data");
const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js"); const confirmDatePlugin = require("flatpickr/dist/plugins/confirmDate/confirmDate.js");
const render_actions_popover_content = require("../templates/actions_popover_content.hbs"); const render_actions_popover_content = require("../templates/actions_popover_content.hbs");
const render_mobile_message_buttons_popover = require("../templates/mobile_message_buttons_popover.hbs"); const render_mobile_message_buttons_popover = require("../templates/mobile_message_buttons_popover.hbs");
const render_mobile_message_buttons_popover_content = require("../templates/mobile_message_buttons_popover_content.hbs"); const render_mobile_message_buttons_popover_content = require("../templates/mobile_message_buttons_popover_content.hbs");
@ -12,6 +11,9 @@ const render_user_info_popover_content = require("../templates/user_info_popover
const render_user_info_popover_title = require("../templates/user_info_popover_title.hbs"); const render_user_info_popover_title = require("../templates/user_info_popover_title.hbs");
const render_user_profile_modal = require("../templates/user_profile_modal.hbs"); const render_user_profile_modal = require("../templates/user_profile_modal.hbs");
const settings_data = require("./settings_data");
const util = require("./util");
let current_actions_popover_elem; let current_actions_popover_elem;
let current_flatpickr_instance; let current_flatpickr_instance;
let current_message_info_popover_elem; let current_message_info_popover_elem;

View File

@ -1,3 +1,4 @@
const ClipboardJS = require("clipboard"); const ClipboardJS = require("clipboard");
new ClipboardJS("#copy"); new ClipboardJS("#copy");
document.querySelector("#copy").focus(); document.querySelector("#copy").focus();

View File

@ -1,5 +1,6 @@
import * as google_analytics from "./google-analytics.js";
import SimpleBar from "simplebar"; import SimpleBar from "simplebar";
import * as google_analytics from "./google-analytics.js";
import {activate_correct_tab} from "./tabbed-instructions.js"; import {activate_correct_tab} from "./tabbed-instructions.js";
function registerCodeSection($codeSection) { function registerCodeSection($codeSection) {

View File

@ -1,6 +1,5 @@
import * as google_analytics from "./google-analytics.js";
import blueslip from "./../blueslip"; import blueslip from "./../blueslip";
import * as google_analytics from "./google-analytics.js";
import {path_parts} from "./landing-page"; import {path_parts} from "./landing-page";
// these constants are populated immediately with data from the DOM on page load // these constants are populated immediately with data from the DOM on page load

View File

@ -1,6 +1,7 @@
const render_recent_topics_body = require("../templates/recent_topics_table.hbs");
const render_recent_topic_row = require("../templates/recent_topic_row.hbs"); const render_recent_topic_row = require("../templates/recent_topic_row.hbs");
const render_recent_topics_filters = require("../templates/recent_topics_filters.hbs"); const render_recent_topics_filters = require("../templates/recent_topics_filters.hbs");
const render_recent_topics_body = require("../templates/recent_topics_table.hbs");
const topics = new Map(); // Key is stream-id:topic. const topics = new Map(); // Key is stream-id:topic.
let topics_widget; let topics_widget;
// Sets the number of avatars to display. // Sets the number of avatars to display.

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
const deferred_message_types = { const deferred_message_types = {
scheduled: { scheduled: {
delivery_type: "send_later", delivery_type: "send_later",

View File

@ -1,6 +1,7 @@
const util = require("./util");
const autosize = require("autosize"); const autosize = require("autosize");
const util = require("./util");
let narrow_window = false; let narrow_window = false;
function confine_to_range(lo, val, hi) { function confine_to_range(lo, val, hi) {

View File

@ -1,5 +1,5 @@
const settings_data = require("./settings_data");
const huddle_data = require("./huddle_data"); const huddle_data = require("./huddle_data");
const settings_data = require("./settings_data");
exports.max_num_of_search_results = 12; exports.max_num_of_search_results = 12;

View File

@ -1,6 +1,7 @@
const settings_config = require("./settings_config");
const render_settings_tab = require("../templates/settings_tab.hbs"); const render_settings_tab = require("../templates/settings_tab.hbs");
const settings_config = require("./settings_config");
$("body").ready(() => { $("body").ready(() => {
$("#settings_overlay_container").on("click", (e) => { $("#settings_overlay_container").on("click", (e) => {
if (!overlays.is_modal_open()) { if (!overlays.is_modal_open()) {

View File

@ -1,6 +1,6 @@
const render_settings_api_key_modal = require("../templates/settings/api_key_modal.hbs");
const render_settings_custom_user_profile_field = require("../templates/settings/custom_user_profile_field.hbs"); const render_settings_custom_user_profile_field = require("../templates/settings/custom_user_profile_field.hbs");
const render_settings_dev_env_email_access = require("../templates/settings/dev_env_email_access.hbs"); const render_settings_dev_env_email_access = require("../templates/settings/dev_env_email_access.hbs");
const render_settings_api_key_modal = require("../templates/settings/api_key_modal.hbs");
exports.update_email = function (new_email) { exports.update_email = function (new_email) {
const email_input = $("#email_value"); const email_input = $("#email_value");

View File

@ -1,8 +1,9 @@
const util = require("./util");
const settings_config = require("./settings_config");
const render_admin_invites_list = require("../templates/admin_invites_list.hbs"); const render_admin_invites_list = require("../templates/admin_invites_list.hbs");
const render_settings_revoke_invite_modal = require("../templates/settings/revoke_invite_modal.hbs"); const render_settings_revoke_invite_modal = require("../templates/settings/revoke_invite_modal.hbs");
const settings_config = require("./settings_config");
const util = require("./util");
const meta = { const meta = {
loaded: false, loaded: false,
}; };

View File

@ -1,4 +1,5 @@
const render_stream_specific_notification_row = require("../templates/settings/stream_specific_notification_row.hbs"); const render_stream_specific_notification_row = require("../templates/settings/stream_specific_notification_row.hbs");
const settings_config = require("./settings_config"); const settings_config = require("./settings_config");
exports.get_notifications_table_row_data = function (notify_settings) { exports.get_notifications_table_row_data = function (notify_settings) {

View File

@ -1,7 +1,8 @@
const settings_config = require("./settings_config"); 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_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"); const render_settings_admin_realm_domains_list = require("../templates/settings/admin_realm_domains_list.hbs");
const pygments_data = require("../generated/pygments_data.json");
const settings_config = require("./settings_config");
const meta = { const meta = {
loaded: false, loaded: false,

View File

@ -1,8 +1,9 @@
const settings_data = require("./settings_data");
const settings_config = require("./settings_config");
const render_admin_user_list = require("../templates/admin_user_list.hbs");
const render_admin_human_form = require("../templates/admin_human_form.hbs");
const render_admin_bot_form = require("../templates/admin_bot_form.hbs"); 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");
const settings_config = require("./settings_config");
const settings_data = require("./settings_data");
const section = { const section = {
active: {}, active: {},

View File

@ -1,7 +1,7 @@
const util = require("./util");
const FoldDict = require("./fold_dict").FoldDict; const FoldDict = require("./fold_dict").FoldDict;
const LazySet = require("./lazy_set").LazySet; const LazySet = require("./lazy_set").LazySet;
const settings_config = require("./settings_config"); const settings_config = require("./settings_config");
const util = require("./util");
const BinaryDict = function (pred) { const BinaryDict = function (pred) {
/* /*

View File

@ -1,10 +1,11 @@
const util = require("./util");
const render_settings_deactivation_stream_modal = require("../templates/settings/deactivation_stream_modal.hbs"); 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_stream_member_list_entry = require("../templates/stream_member_list_entry.hbs");
const render_subscription_settings = require("../templates/subscription_settings.hbs"); const render_subscription_settings = require("../templates/subscription_settings.hbs");
const render_subscription_stream_privacy_modal = require("../templates/subscription_stream_privacy_modal.hbs"); const render_subscription_stream_privacy_modal = require("../templates/subscription_stream_privacy_modal.hbs");
const settings_data = require("./settings_data");
const settings_config = require("./settings_config"); const settings_config = require("./settings_config");
const settings_data = require("./settings_data");
const util = require("./util");
function setup_subscriptions_stream_hash(sub) { function setup_subscriptions_stream_hash(sub) {
const hash = hash_util.stream_edit_uri(sub); const hash = hash_util.stream_edit_uri(sub);

View File

@ -1,10 +1,10 @@
const render_all_messages_sidebar_actions = require("../templates/all_messages_sidebar_actions.hbs"); 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_delete_topic_modal = require("../templates/delete_topic_modal.hbs");
const render_move_topic_to_stream = require("../templates/move_topic_to_stream.hbs");
const render_starred_messages_sidebar_actions = require("../templates/starred_messages_sidebar_actions.hbs"); const render_starred_messages_sidebar_actions = require("../templates/starred_messages_sidebar_actions.hbs");
const render_stream_sidebar_actions = require("../templates/stream_sidebar_actions.hbs"); const render_stream_sidebar_actions = require("../templates/stream_sidebar_actions.hbs");
const render_topic_sidebar_actions = require("../templates/topic_sidebar_actions.hbs"); const render_topic_sidebar_actions = require("../templates/topic_sidebar_actions.hbs");
const render_unstar_messages_modal = require("../templates/unstar_messages_modal.hbs"); const render_unstar_messages_modal = require("../templates/unstar_messages_modal.hbs");
const render_move_topic_to_stream = require("../templates/move_topic_to_stream.hbs");
// We handle stream popovers and topic popovers in this // We handle stream popovers and topic popovers in this
// module. Both are popped up from the left sidebar. // module. Both are popped up from the left sidebar.

View File

@ -1,4 +1,5 @@
const util = require("./util"); const util = require("./util");
let previous_pinned; let previous_pinned;
let previous_normal; let previous_normal;
let previous_dormant; let previous_dormant;

View File

@ -1,9 +1,10 @@
const util = require("./util");
const render_subscription = require("../templates/subscription.hbs"); const render_subscription = require("../templates/subscription.hbs");
const render_subscription_settings = require("../templates/subscription_settings.hbs"); const render_subscription_settings = require("../templates/subscription_settings.hbs");
const render_subscription_table_body = require("../templates/subscription_table_body.hbs"); const render_subscription_table_body = require("../templates/subscription_table_body.hbs");
const render_subscriptions = require("../templates/subscriptions.hbs"); const render_subscriptions = require("../templates/subscriptions.hbs");
const util = require("./util");
exports.show_subs_pane = { exports.show_subs_pane = {
nothing_selected() { nothing_selected() {
$(".nothing-selected, #stream_settings_title").show(); $(".nothing-selected, #stream_settings_title").show();

View File

@ -1,4 +1,5 @@
const render_tab_bar = require("../templates/tab_bar.hbs"); const render_tab_bar = require("../templates/tab_bar.hbs");
const rendered_markdown = require("./rendered_markdown"); const rendered_markdown = require("./rendered_markdown");
function get_sub_count(current_stream) { function get_sub_count(current_stream) {

View File

@ -1,6 +1,7 @@
const render_more_topics = require("../templates/more_topics.hbs"); const render_more_topics = require("../templates/more_topics.hbs");
const render_more_topics_spinner = require("../templates/more_topics_spinner.hbs"); const render_more_topics_spinner = require("../templates/more_topics_spinner.hbs");
const render_topic_list_item = require("../templates/topic_list_item.hbs"); const render_topic_list_item = require("../templates/topic_list_item.hbs");
const topic_list_data = require("./topic_list_data"); const topic_list_data = require("./topic_list_data");
/* /*

View File

@ -1,8 +1,9 @@
const util = require("./util");
const pygments_data = require("../generated/pygments_data.json"); const pygments_data = require("../generated/pygments_data.json");
const typeahead = require("../shared/js/typeahead"); const typeahead = require("../shared/js/typeahead");
const render_typeahead_list_item = require("../templates/typeahead_list_item.hbs"); const render_typeahead_list_item = require("../templates/typeahead_list_item.hbs");
const settings_data = require("./settings_data"); const settings_data = require("./settings_data");
const util = require("./util");
// Returns an array of private message recipients, removing empty elements. // Returns an array of private message recipients, removing empty elements.
// For example, "a,,b, " => ["a", "b"] // For example, "a,,b, " => ["a", "b"]

View File

@ -1,5 +1,5 @@
const util = require("./util");
const FoldDict = require("./fold_dict").FoldDict; const FoldDict = require("./fold_dict").FoldDict;
const util = require("./util");
// The unread module tracks the message IDs and locations of the // The unread module tracks the message IDs and locations of the
// user's unread messages. The tracking is initialized with // user's unread messages. The tracking is initialized with

View File

@ -1,6 +1,6 @@
const Uppy = require("@uppy/core"); const Uppy = require("@uppy/core");
const XHRUpload = require("@uppy/xhr-upload");
const ProgressBar = require("@uppy/progress-bar"); const ProgressBar = require("@uppy/progress-bar");
const XHRUpload = require("@uppy/xhr-upload");
exports.make_upload_absolute = function (uri) { exports.make_upload_absolute = function (uri) {
if (uri.startsWith(compose.uploads_path)) { if (uri.startsWith(compose.uploads_path)) {

View File

@ -3,6 +3,7 @@
// dependencies that existed when this code was in people.js. // dependencies that existed when this code was in people.js.
// (We should do bot updates here too.) // (We should do bot updates here too.)
const settings_config = require("./settings_config"); const settings_config = require("./settings_config");
exports.update_person = function update(person) { exports.update_person = function update(person) {
const person_obj = people.get_by_user_id(person.user_id); const person_obj = people.get_by_user_id(person.user_id);

View File

@ -1,9 +1,10 @@
#!/usr/bin/env node #!/usr/bin/env node
const fs = require("fs"); const fs = require("fs");
const jsyaml = require("js-yaml"); const jsyaml = require("js-yaml");
const SwaggerParser = require("swagger-parser");
const ExampleValidator = require("openapi-examples-validator"); const ExampleValidator = require("openapi-examples-validator");
const SwaggerParser = require("swagger-parser");
(async () => { (async () => {
// Iterate through the changed files, passed in the arguments. // Iterate through the changed files, passed in the arguments.

View File

@ -2,9 +2,10 @@
// debugging. It also exposes the list of modules it knows about as the keys // debugging. It also exposes the list of modules it knows about as the keys
// of the require.ids object. // of the require.ids object.
import webpack, {Template} from "webpack";
import path from "path"; import path from "path";
import webpack, {Template} from "webpack";
export default class DebugRequirePlugin { export default class DebugRequirePlugin {
apply(compiler: webpack.Compiler): void { apply(compiler: webpack.Compiler): void {
const resolved = new Map(); const resolved = new Map();

View File

@ -1,7 +1,9 @@
const puppeteer = require("puppeteer");
const commander = require("commander");
const path = require("path"); const path = require("path");
const commander = require("commander");
const mkdirp = require("mkdirp"); const mkdirp = require("mkdirp");
const puppeteer = require("puppeteer");
const host = "localhost:9991"; const host = "localhost:9991";
const options = {}; const options = {};

View File

@ -1,6 +1,7 @@
import {RuleSetRule, RuleSetUseItem} from "webpack";
import {basename, resolve} from "path"; import {basename, resolve} from "path";
import {RuleSetRule, RuleSetUseItem} from "webpack";
export const cacheLoader: RuleSetUseItem = { export const cacheLoader: RuleSetUseItem = {
loader: "cache-loader", loader: "cache-loader",
options: { options: {

View File

@ -1,17 +1,19 @@
import {basename, resolve} from "path"; import {basename, resolve} from "path";
import {cacheLoader, getExposeLoaders} from "./webpack-helpers";
import BundleTracker from "webpack4-bundle-tracker";
import CleanCss from "clean-css"; import CleanCss from "clean-css";
import DebugRequirePlugin from "./debug-require-webpack-plugin";
import HtmlWebpackPlugin from "html-webpack-plugin"; import HtmlWebpackPlugin from "html-webpack-plugin";
import MiniCssExtractPlugin from "mini-css-extract-plugin"; import MiniCssExtractPlugin from "mini-css-extract-plugin";
import OptimizeCssAssetsPlugin from "optimize-css-assets-webpack-plugin"; import OptimizeCssAssetsPlugin from "optimize-css-assets-webpack-plugin";
import TerserPlugin from "terser-webpack-plugin"; import TerserPlugin from "terser-webpack-plugin";
// The devServer member of webpack.Configuration is managed by the // The devServer member of webpack.Configuration is managed by the
// webpack-dev-server package. We are only importing the type here. // webpack-dev-server package. We are only importing the type here.
import _webpackDevServer from "webpack-dev-server";
import assets from "./webpack.assets.json";
import webpack from "webpack"; import webpack from "webpack";
import _webpackDevServer from "webpack-dev-server";
import BundleTracker from "webpack4-bundle-tracker";
import DebugRequirePlugin from "./debug-require-webpack-plugin";
import {cacheLoader, getExposeLoaders} from "./webpack-helpers";
import assets from "./webpack.assets.json";
export default (env?: string): webpack.Configuration[] => { export default (env?: string): webpack.Configuration[] => {
const production: boolean = env === "production"; const production: boolean = env === "production";