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.

eslint: Fix unicorn/prefer-global-number-constants.

Anders Kaseorgba95b87f55a4
diff --git a/web/src/box_resize.ts b/web/src/box_resize.ts
index d33261c0060..b9dcd66f88d 100644
--- a/web/src/box_resize.ts
+++ b/web/src/box_resize.ts
@@ -89,13 +89,13 @@ function attach_handle(
if (spec.grows_width) {
const delta = spec.dx_sign * (e.clientX - start_x);
const min_width = parse_px_bound(style.minWidth, 0);
- const max_width = parse_px_bound(style.maxWidth, Number.POSITIVE_INFINITY);
+ const max_width = parse_px_bound(style.maxWidth, Infinity);
box.style.width = `${clamp(start_width + 2 * delta, min_width, max_width)}px`;
}
if (spec.grows_height) {
const delta = spec.dy_sign * (e.clientY - start_y);
const min_height = parse_px_bound(style.minHeight, 0);
- const max_height = parse_px_bound(style.maxHeight, Number.POSITIVE_INFINITY);
+ const max_height = parse_px_bound(style.maxHeight, Infinity);
box.style.height = `${clamp(start_height + 2 * delta, min_height, max_height)}px`;
}
on_resize?.();
diff --git a/web/src/emoji_picker.ts b/web/src/emoji_picker.ts
index cb6692c2062..bacf4c29e96 100644
--- a/web/src/emoji_picker.ts
+++ b/web/src/emoji_picker.ts
@@ -678,7 +678,7 @@ export function navigate(event_name: string, e?: JQuery.KeyDownEvent): boolean {
// goes to beginning) with something reasonable and
// consistent (cursor goes to the end of the filter
// string).
- $("#emoji-popover-filter").trigger("focus").caret(Number.POSITIVE_INFINITY);
+ $("#emoji-popover-filter").trigger("focus").caret(Infinity);
scroll_util.get_scroll_element($emoji_map).scrollTop(0);
scroll_util.get_scroll_element($(".emoji-search-results-container")).scrollTop(0);
current_section = 0;
diff --git a/web/src/hotkey.ts b/web/src/hotkey.ts
index eef94c1d017..0855ea900cb 100644
--- a/web/src/hotkey.ts
+++ b/web/src/hotkey.ts
@@ -1092,9 +1092,7 @@ function process_hotkey(e: JQuery.KeyDownEvent, hotkey: Hotkey): boolean {
case "page_down": {
// so that it always goes to the end of the text box.
const height = util.the($(":focus")).scrollHeight;
- $(":focus")
- .caret(Number.POSITIVE_INFINITY)
- .animate({scrollTop: height}, "fast");
+ $(":focus").caret(Infinity).animate({scrollTop: height}, "fast");
return true;
}
case "search_with_k":
diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.ts
index 0c524b3886c..d05f9ac4392 100644
--- a/web/src/recent_view_ui.ts
+++ b/web/src/recent_view_ui.ts
@@ -258,7 +258,7 @@ const SOME_MESSAGES_LOADED_INCLUDING_NEWEST = 2;
const ALL_MESSAGES_LOADED = 3;
let loading_state = NO_MESSAGES_LOADED;
-let oldest_message_timestamp = Number.POSITIVE_INFINITY;
+let oldest_message_timestamp = Infinity;
function set_oldest_message_date(msg_list_data: MessageListData): void {
const has_found_oldest = msg_list_data.fetch_status.has_found_oldest();
@@ -271,7 +271,7 @@ function set_oldest_message_date(msg_list_data: MessageListData): void {
);
}
- if (oldest_message_timestamp === Number.POSITIVE_INFINITY && !has_found_oldest) {
+ if (oldest_message_timestamp === Infinity && !has_found_oldest) {
// This should only happen either very early in loading the
// message list, since it requires the msg_list_data object
// being empty, without having server confirmation that's the
diff --git a/web/src/stats/stats.ts b/web/src/stats/stats.ts
index 05d051ebb2a..14d628c613a 100644
--- a/web/src/stats/stats.ts
+++ b/web/src/stats/stats.ts
@@ -122,7 +122,7 @@ const font_12pt = {
color: "#000000",
};
-let last_full_update = Number.POSITIVE_INFINITY;
+let last_full_update = Infinity;
function handle_parse_server_stats_result<T>(
result: z.core.util.SafeParseResult<T>,
diff --git a/web/src/unread.ts b/web/src/unread.ts
index 655dc4d4c3a..238ef1367bc 100644
--- a/web/src/unread.ts
+++ b/web/src/unread.ts
@@ -35,7 +35,7 @@ import * as util from "./util.ts";
export let old_unreads_missing = false;
// Note this doesn't handle the case of `old_unreads_missing` because
// it is simpler and we as a client are not expected to.
-export let first_unread_unmuted_message_id = Number.POSITIVE_INFINITY;
+export let first_unread_unmuted_message_id = Infinity;
export function clear_old_unreads_missing(): void {
old_unreads_missing = false;
@@ -966,7 +966,7 @@ export function get_counts(): FullUnreadCountsData {
const update_first_unmuted_message_id = true;
// Reset the first_unread_unmuted_message_id, to ensure it is always capture the
// minimum of current unread messages between topics and DMs.
- first_unread_unmuted_message_id = Number.POSITIVE_INFINITY;
+ first_unread_unmuted_message_id = Infinity;
const topic_res = unread_topic_counter.get_counts(update_first_unmuted_message_id);
const pm_res = unread_direct_message_counter.get_counts(update_first_unmuted_message_id);