diff --git a/.eslintrc.json b/.eslintrc.json index 58bd7a2307..37ca2a5fd1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -127,7 +127,6 @@ "globals": { "$": false, "Filter": false, - "MessageListData": false, "MessageListView": false, "activity": false, "admin": false, diff --git a/frontend_tests/node_tests/message_fetch.js b/frontend_tests/node_tests/message_fetch.js index f7e1e6be36..37ebf17c3f 100644 --- a/frontend_tests/node_tests/message_fetch.js +++ b/frontend_tests/node_tests/message_fetch.js @@ -20,7 +20,6 @@ function MessageListView() { set_global("MessageListView", MessageListView); const Filter = zrequire("Filter", "js/filter"); -zrequire("MessageListData", "js/message_list_data"); const message_list = zrequire("message_list"); const people = zrequire("people"); diff --git a/frontend_tests/node_tests/message_list.js b/frontend_tests/node_tests/message_list.js index 25c830381e..6d275103ad 100644 --- a/frontend_tests/node_tests/message_list.js +++ b/frontend_tests/node_tests/message_list.js @@ -26,7 +26,6 @@ const narrow_state = set_global("narrow_state", {}); const stream_data = set_global("stream_data", {}); const muting = zrequire("muting"); -zrequire("MessageListData", "js/message_list_data"); zrequire("MessageListView", "js/message_list_view"); const {MessageList} = zrequire("message_list"); diff --git a/frontend_tests/node_tests/message_list_data.js b/frontend_tests/node_tests/message_list_data.js index a1580ff2de..1f9489989c 100644 --- a/frontend_tests/node_tests/message_list_data.js +++ b/frontend_tests/node_tests/message_list_data.js @@ -9,7 +9,7 @@ const muting = zrequire("muting"); zrequire("unread"); zrequire("Filter", "js/filter"); -const MessageListData = zrequire("MessageListData", "js/message_list_data"); +const {MessageListData} = zrequire("MessageListData", "js/message_list_data"); set_global("page_params", {}); diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js index d4d714efe8..3c69ddaa8e 100644 --- a/frontend_tests/node_tests/message_list_view.js +++ b/frontend_tests/node_tests/message_list_view.js @@ -10,7 +10,6 @@ const {run_test} = require("../zjsunit/test"); set_global("document", "document-stub"); const Filter = zrequire("Filter", "js/filter"); -zrequire("MessageListData", "js/message_list_data"); const MessageListView = zrequire("MessageListView", "js/message_list_view"); const message_list = zrequire("message_list"); diff --git a/frontend_tests/node_tests/narrow_activate.js b/frontend_tests/node_tests/narrow_activate.js index 019ece9f78..75c3f07000 100644 --- a/frontend_tests/node_tests/narrow_activate.js +++ b/frontend_tests/node_tests/narrow_activate.js @@ -13,7 +13,6 @@ set_global("resize", { }); const stream_data = zrequire("stream_data"); zrequire("Filter", "js/filter"); -zrequire("MessageListData", "js/message_list_data"); zrequire("unread"); const narrow = zrequire("narrow"); diff --git a/frontend_tests/node_tests/narrow_local.js b/frontend_tests/node_tests/narrow_local.js index 1d54c9adee..5e5940f322 100644 --- a/frontend_tests/node_tests/narrow_local.js +++ b/frontend_tests/node_tests/narrow_local.js @@ -6,7 +6,7 @@ const {set_global, zrequire} = require("../zjsunit/namespace"); const {run_test} = require("../zjsunit/test"); const Filter = zrequire("Filter", "js/filter"); -const MessageListData = zrequire("MessageListData", "js/message_list_data"); +const {MessageListData} = zrequire("MessageListData", "js/message_list_data"); const narrow_state = zrequire("narrow_state"); const narrow = zrequire("narrow"); zrequire("stream_data"); diff --git a/frontend_tests/node_tests/stream_data.js b/frontend_tests/node_tests/stream_data.js index 2132570916..1874962c87 100644 --- a/frontend_tests/node_tests/stream_data.js +++ b/frontend_tests/node_tests/stream_data.js @@ -20,7 +20,6 @@ const people = zrequire("people"); const stream_color = zrequire("stream_color"); const stream_data = zrequire("stream_data"); zrequire("Filter", "js/filter"); -zrequire("MessageListData", "js/message_list_data"); zrequire("MessageListView", "js/message_list_view"); const message_list = zrequire("message_list"); const settings_config = zrequire("settings_config"); diff --git a/static/js/bundles/app.js b/static/js/bundles/app.js index 133e0e4006..187e50439d 100644 --- a/static/js/bundles/app.js +++ b/static/js/bundles/app.js @@ -44,7 +44,6 @@ import "../filter"; import "../poll_widget"; import "../widgetize"; import "../submessage"; -import "../message_list_data"; import "../message_list_view"; import "../message_list"; import "../message_live_update"; diff --git a/static/js/global.d.ts b/static/js/global.d.ts index 97b254100a..a80ae8bdac 100644 --- a/static/js/global.d.ts +++ b/static/js/global.d.ts @@ -4,7 +4,6 @@ // to TS. declare let Filter: any; -declare let MessageListData: any; declare let MessageListView: any; declare let activity: any; declare let admin: any; diff --git a/static/js/message_list.js b/static/js/message_list.js index d1902b3f30..6b6bb37ef1 100644 --- a/static/js/message_list.js +++ b/static/js/message_list.js @@ -2,6 +2,8 @@ const autosize = require("autosize"); +const {MessageListData} = require("./message_list_data"); + exports.narrowed = undefined; exports.set_narrowed = function (value) { exports.narrowed = value; diff --git a/static/js/message_list_data.js b/static/js/message_list_data.js index e11abe0c84..84195a755b 100644 --- a/static/js/message_list_data.js +++ b/static/js/message_list_data.js @@ -1,11 +1,9 @@ -"use strict"; +import _ from "lodash"; -const _ = require("lodash"); +import {FetchStatus} from "./fetch_status"; +import * as util from "./util"; -const {FetchStatus} = require("./fetch_status"); -const util = require("./util"); - -class MessageListData { +export class MessageListData { constructor(opts) { this.excludes_muted_topics = opts.excludes_muted_topics; if (this.excludes_muted_topics) { @@ -521,7 +519,3 @@ class MessageListData { return msg; } } - -module.exports = MessageListData; - -window.MessageListData = MessageListData; diff --git a/static/js/narrow.js b/static/js/narrow.js index 67457807dc..dd550d7611 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -1,5 +1,6 @@ "use strict"; +const {MessageListData} = require("./message_list_data"); const people = require("./people"); const search_pill = require("./search_pill"); const topic_generator = require("./topic_generator");