Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix unicorn/explicit-length-check. (#32666)
Anders Kaseorg77f97762c64f
diff --git a/eslint.config.js b/eslint.config.jsindex c7e43d82f13..3974e105139 100644--- a/eslint.config.js+++ b/eslint.config.js@@ -132,7 +132,6 @@ export default ["spaced-comment": ["error", "always", {markers: ["/"]}],strict: "error","unicorn/consistent-function-scoping": "off",- "unicorn/explicit-length-check": "off","unicorn/filename-case": "off","unicorn/no-await-expression-member": "off","unicorn/no-negated-condition": "off",diff --git a/web/shared/src/fenced_code.ts b/web/shared/src/fenced_code.tsindex 0c786098345..9df1b30b035 100644--- a/web/shared/src/fenced_code.ts+++ b/web/shared/src/fenced_code.ts@@ -236,7 +236,7 @@ export function process_fenced_code(content: string): string {// Clean up all trailing blocks by letting them// insert closing fences- while (handler_stack.length !== 0) {+ while (handler_stack.length > 0) {const handler = handler_stack.at(-1);handler!.done();}diff --git a/web/src/activity_ui.ts b/web/src/activity_ui.tsindex 5d5bc3d2192..32534ba7a35 100644--- a/web/src/activity_ui.ts+++ b/web/src/activity_ui.ts@@ -111,7 +111,7 @@ export function searching(): boolean {export function render_empty_user_list_message_if_needed($container: JQuery): void {const empty_list_message = $container.attr("data-search-results-empty");- if (!empty_list_message || $container.children().length) {+ if (!empty_list_message || $container.children().length > 0) {return;}diff --git a/web/src/billing/upgrade.ts b/web/src/billing/upgrade.tsindex 8d891139fb1..d7cd084a406 100644--- a/web/src/billing/upgrade.ts+++ b/web/src/billing/upgrade.ts@@ -128,7 +128,7 @@ function update_license_count(license_count: number): void {function restore_manual_license_count(): void {const $manual_license_count_input = $("#manual_license_count");// Only present on the manual license management page.- if ($manual_license_count_input.length) {+ if ($manual_license_count_input.length > 0) {const ls_manual_license_count = ls.get("manual_license_count");if (typeof ls_manual_license_count === "number") {$manual_license_count_input.val(ls_manual_license_count);diff --git a/web/src/bootstrap_typeahead.ts b/web/src/bootstrap_typeahead.tsindex f0e508523fb..ca3bb00414b 100644--- a/web/src/bootstrap_typeahead.ts+++ b/web/src/bootstrap_typeahead.ts@@ -507,10 +507,10 @@ export class Typeahead<ItemType extends string | object> {const items = this.source(this.query, this.input_element);- if (!items.length && this.shown) {+ if (items.length === 0 && this.shown) {this.hide();}- return items.length ? this.process(items) : this;+ return items.length > 0 ? this.process(items) : this;}process(items: ItemType[]): this {@@ -518,7 +518,7 @@ export class Typeahead<ItemType extends string | object> {const final_items = this.sorter(matching_items, this.query);- if (!final_items.length) {+ if (final_items.length === 0) {return this.shown ? this.hide() : this;}if (this.automated()) {@@ -573,11 +573,11 @@ export class Typeahead<ItemType extends string | object> {// This lets there be a way to not have any item highlighted,// which can be important for e.g. letting the user press enter on// whatever's already in the search box.- if (!this.requireHighlight && $active.length && !$next.length) {+ if (!this.requireHighlight && $active.length > 0 && $next.length === 0) {return;}- if (!$next.length) {+ if ($next.length === 0) {$next = this.$menu.find("li").first();}@@ -592,11 +592,11 @@ export class Typeahead<ItemType extends string | object> {// This lets there be a way to not have any item highlighted,// which can be important for e.g. letting the user press enter on// whatever's already in the search box.- if (!this.requireHighlight && $active.length && !$prev.length) {+ if (!this.requireHighlight && $active.length > 0 && $prev.length === 0) {return;}- if (!$prev.length) {+ if ($prev.length === 0) {$prev = this.$menu.find("li").last();}diff --git a/web/src/buddy_data.ts b/web/src/buddy_data.tsindex 559f1a1689e..ec88c95c800 100644--- a/web/src/buddy_data.ts+++ b/web/src/buddy_data.ts@@ -433,7 +433,7 @@ function get_filtered_user_id_list(// We want to always show PM recipients even if they're inactive.const pm_ids_set = narrow_state.pm_ids_set();- if (pm_ids_set.size) {+ if (pm_ids_set.size > 0) {const base_user_id_set = new Set([...base_user_id_list, ...pm_ids_set]);base_user_id_list = [...base_user_id_set];}diff --git a/web/src/buddy_list.ts b/web/src/buddy_list.tsindex 3ad8e053d7a..7503e7f9389 100644--- a/web/src/buddy_list.ts+++ b/web/src/buddy_list.ts@@ -46,7 +46,7 @@ function get_total_human_subscriber_count(// might not show up in the buddy list.if (current_sub) {return peer_data.get_subscriber_count(current_sub.stream_id, false);- } else if (pm_ids_set.size) {+ } else if (pm_ids_set.size > 0) {// The current user is only in the provided recipients list// for direct message conversations with oneself.const all_recipient_user_ids_set = pm_ids_set.union(new Set([current_user.user_id]));@@ -69,7 +69,7 @@ function should_hide_headers(// If we aren't in a stream/DM view, then there's never "other"// users, so we don't show section headers and only show one// untitled section.- return !current_sub && !pm_ids_set.size;+ return !current_sub && pm_ids_set.size === 0;}type BuddyListRenderData = {@@ -365,7 +365,7 @@ export class BuddyList extends BuddyListConf {function add_or_update_empty_list_placeholder(selector: string, message: string): void {if ($(selector).children().length === 0 ||- $(`${selector} .empty-list-message`).length+ $(`${selector} .empty-list-message`).length > 0) {const empty_list_widget_html = render_empty_list_widget_for_list({empty_list_message: message,@@ -566,7 +566,7 @@ export class BuddyList extends BuddyListConf {}this.$participants_list = $(this.participants_list_selector);- if (participants.length) {+ if (participants.length > 0) {// Remove the empty list message before adding usersif ($(`${this.participants_list_selector} .empty-list-message`).length > 0) {this.$participants_list.empty();@@ -578,7 +578,7 @@ export class BuddyList extends BuddyListConf {}this.$users_matching_view_list = $(this.matching_view_list_selector);- if (subscribed_users.length) {+ if (subscribed_users.length > 0) {// Remove the empty list message before adding usersif ($(`${this.matching_view_list_selector} .empty-list-message`).length > 0) {this.$users_matching_view_list.empty();@@ -590,7 +590,7 @@ export class BuddyList extends BuddyListConf {}this.$other_users_list = $(this.other_user_list_selector);- if (other_users.length) {+ if (other_users.length > 0) {// Remove the empty list message before adding usersif ($(`${this.other_user_list_selector} .empty-list-message`).length > 0) {this.$other_users_list.empty();@@ -669,13 +669,13 @@ export class BuddyList extends BuddyListConf {// From `type List<Key>`, where the key is a user_id.first_key(): number | undefined {- if (this.participant_user_ids.length) {+ if (this.participant_user_ids.length > 0) {return this.participant_user_ids[0];}- if (this.users_matching_view_ids.length) {+ if (this.users_matching_view_ids.length > 0) {return this.users_matching_view_ids[0];}- if (this.other_user_ids.length) {+ if (this.other_user_ids.length > 0) {return this.other_user_ids[0];}return undefined;diff --git a/web/src/click_handlers.js b/web/src/click_handlers.jsindex 3fc8f9d348c..ae445d2f517 100644--- a/web/src/click_handlers.js+++ b/web/src/click_handlers.js@@ -834,7 +834,7 @@ export function initialize() {return;}- if (compose_state.composing() && !$(e.target).parents("#compose").length) {+ if (compose_state.composing() && $(e.target).parents("#compose").length === 0) {if ($(e.target).closest("a").length > 0 ||$(e.target).closest(".copy_codeblock").length > 0@@ -854,20 +854,20 @@ export function initialize() {// the compose box; this means using the sidebar// filters or search widgets won't unnecessarily close// compose.- !$(e.target).closest("input").length &&- !$(e.target).closest(".todo-widget label.checkbox").length &&- !$(e.target).closest("textarea").length &&- !$(e.target).closest("select").length &&+ $(e.target).closest("input").length === 0 &&+ $(e.target).closest(".todo-widget label.checkbox").length === 0 &&+ $(e.target).closest("textarea").length === 0 &&+ $(e.target).closest("select").length === 0 &&// Clicks inside an overlay, popover, custom// modal, or backdrop of one of the above// should not have any effect on the compose// state.- !$(e.target).closest(".overlay").length &&- !$(e.target).closest(".micromodal").length &&- !$(e.target).closest("[data-tippy-root]").length &&- !$(e.target).closest(".typeahead").length &&- !$(e.target).closest(".flatpickr-calendar").length &&- $(e.target).closest("body").length+ $(e.target).closest(".overlay").length === 0 &&+ $(e.target).closest(".micromodal").length === 0 &&+ $(e.target).closest("[data-tippy-root]").length === 0 &&+ $(e.target).closest(".typeahead").length === 0 &&+ $(e.target).closest(".flatpickr-calendar").length === 0 &&+ $(e.target).closest("body").length > 0) {// Unfocus our compose area if we click out of it. Don't let exits out// of overlays or selecting text (for copy+paste) trigger cancelling.diff --git a/web/src/compose_banner.ts b/web/src/compose_banner.tsindex d4470a18e99..fd673f4a6d1 100644--- a/web/src/compose_banner.ts+++ b/web/src/compose_banner.ts@@ -231,7 +231,7 @@ export function show_stream_does_not_exist_error(stream_name: string): void {export function show_stream_not_subscribed_error(sub: StreamSubscription): void {const $banner_container = $("#compose_banners");- if ($(`#compose_banners .${CSS.escape(CLASSNAMES.user_not_subscribed)}`).length) {+ if ($(`#compose_banners .${CSS.escape(CLASSNAMES.user_not_subscribed)}`).length > 0) {return;}const new_row_html = render_compose_banner({diff --git a/web/src/compose_popovers.ts b/web/src/compose_popovers.tsindex 11bb7bb5cd9..bd78ade6648 100644--- a/web/src/compose_popovers.ts+++ b/web/src/compose_popovers.ts@@ -21,7 +21,7 @@ export function initialize(): void {let preview_mode_on;// If the popover is opened from a message edit form, we want to// infer the preview mode from that row, else from the compose box.- if (parent_row.length) {+ if (parent_row.length > 0) {preview_mode_on = parent_row.hasClass("preview_mode");} else {preview_mode_on = $("#compose").hasClass("preview_mode");diff --git a/web/src/compose_reply.ts b/web/src/compose_reply.tsindex febb5fafdf8..a3be95d722b 100644--- a/web/src/compose_reply.ts+++ b/web/src/compose_reply.ts@@ -393,7 +393,7 @@ export function get_message_selection(selection = window.getSelection()): stringrange_common_ancestor.classList.contains("message_content")) {html_to_convert = extract_range_html(range);- } else if ($(range_common_ancestor).parents(".message_content").length) {+ } else if ($(range_common_ancestor).parents(".message_content").length > 0) {// We want to preserve the structure of the html with 2 levels of// ancestors (to retain code block / list formatting) in such a range.html_to_convert = extract_range_html(range, true);diff --git a/web/src/compose_setup.js b/web/src/compose_setup.jsindex 55dfd1c1081..4fb5f7333a7 100644--- a/web/src/compose_setup.js+++ b/web/src/compose_setup.js@@ -111,10 +111,8 @@ export function initialize() {function get_input_info(event) {const $edit_banners_container = $(event.target).closest(".edit_form_banners");- const is_edit_input = Boolean($edit_banners_container.length);- const $banner_container = $edit_banners_container.length- ? $edit_banners_container- : $("#compose_banners");+ const is_edit_input = $edit_banners_container.length > 0;+ const $banner_container = is_edit_input ? $edit_banners_container : $("#compose_banners");return {is_edit_input, $banner_container};}diff --git a/web/src/compose_ui.ts b/web/src/compose_ui.tsindex 034a17a50f2..ca23042927e 100644--- a/web/src/compose_ui.ts+++ b/web/src/compose_ui.ts@@ -663,11 +663,11 @@ export let format_text = (// when the markdown is rendered.// Add blank line between text before and list if not already present.- if (before_lines.length && before_lines.at(-1) !== "\n") {+ if (before_lines.length > 0 && before_lines.at(-1) !== "\n") {before_lines += "\n";}// Add blank line between list and rest of text if not already present.- if (after_lines.length && after_lines.at(0) !== "\n") {+ if (after_lines.length > 0 && after_lines.at(0) !== "\n") {after_lines = "\n" + after_lines;}} else {@@ -1223,7 +1223,7 @@ export function get_compose_click_target(element: HTMLElement): Element {const compose_control_buttons_popover = popover_menus.get_compose_control_buttons_popover();if (compose_control_buttons_popover &&- $(compose_control_buttons_popover.popper).has(element).length+ $(compose_control_buttons_popover.popper).has(element).length > 0) {return compose_control_buttons_popover.reference;}diff --git a/web/src/condense.ts b/web/src/condense.tsindex 9ec1b3cf912..68cd2a6f540 100644--- a/web/src/condense.ts+++ b/web/src/condense.ts@@ -79,7 +79,7 @@ export function uncollapse(message: Message): void {for (const list of message_lists.all_rendered_message_lists()) {const $rendered_row = list.get_row(message.id);- if ($rendered_row.length !== 0) {+ if ($rendered_row.length > 0) {process_row($rendered_row);}}@@ -105,7 +105,7 @@ export function collapse(message: Message): void {for (const list of message_lists.all_rendered_message_lists()) {const $rendered_row = list.get_row(message.id);- if ($rendered_row.length !== 0) {+ if ($rendered_row.length > 0) {process_row($rendered_row);}}diff --git a/web/src/dropdown_widget.ts b/web/src/dropdown_widget.tsindex a1b42d6f24d..fcd0ed8c7dd 100644--- a/web/src/dropdown_widget.ts+++ b/web/src/dropdown_widget.ts@@ -354,7 +354,7 @@ export class DropdownWidget {if (e.target === $search_input.get(0)) {// Select first item if in search input.first_item().trigger("click");- } else if (list_items.length !== 0) {+ } else if (list_items.length > 0) {$(e.target).trigger("click");}e.stopPropagation();diff --git a/web/src/emoji_picker.ts b/web/src/emoji_picker.tsindex 574f4f11388..e76bc186321 100644--- a/web/src/emoji_picker.ts+++ b/web/src/emoji_picker.ts@@ -308,7 +308,7 @@ function toggle_reaction(emoji_name: string, event: JQuery.ClickEvent | JQuery.K// doesn't have a concept of toggling.// TODO: Ideally we never even get here in// that context, see #28464.- if ($("#set-user-status-modal").length) {+ if ($("#set-user-status-modal").length > 0) {return;}diff --git a/web/src/giphy.ts b/web/src/giphy.tsindex 172380ad946..ab0965568ac 100644--- a/web/src/giphy.ts+++ b/web/src/giphy.ts@@ -135,7 +135,7 @@ async function update_grid_with_search_term(): Promise<void> {const $search_elem = $<HTMLInputElement>("input#giphy-search-query");// GIPHY popover may have been hidden by the// time this function is called.- if ($search_elem.length) {+ if ($search_elem.length > 0) {search_term = the($search_elem).value;gifs_grid.remove();gifs_grid = await renderGIPHYGrid(the($("#giphy_grid_in_popover .giphy-content")));diff --git a/web/src/hash_util.ts b/web/src/hash_util.tsindex 48dc6ce0a6f..5a1ba3b612a 100644--- a/web/src/hash_util.ts+++ b/web/src/hash_util.ts@@ -15,7 +15,7 @@ import * as util from "./util.ts";export function build_reload_url(): string {let hash = window.location.hash;- if (hash.length !== 0 && hash.startsWith("#")) {+ if (hash.startsWith("#")) {hash = hash.slice(1);}return "+oldhash=" + encodeURIComponent(hash);diff --git a/web/src/hotkey.js b/web/src/hotkey.jsindex 8067095a8b1..d6095293f07 100644--- a/web/src/hotkey.js+++ b/web/src/hotkey.js@@ -257,9 +257,9 @@ export let processing_text = () => {$focused_elt.is("input") ||$focused_elt.is("select") ||$focused_elt.is("textarea") ||- $focused_elt.parents(".pill-container").length >= 1 ||+ $focused_elt.parents(".pill-container").length > 0 ||$focused_elt.attr("id") === "compose-send-button" ||- $focused_elt.parents(".dropdown-list-container").length >= 1+ $focused_elt.parents(".dropdown-list-container").length > 0);};@@ -360,7 +360,7 @@ export function process_escape_key(e) {}// Check for errors in compose box; close errors if they exist- if ($("main-view-banner").length) {+ if ($("main-view-banner").length > 0) {compose_banner.clear_all();return true;}@@ -813,7 +813,7 @@ export function process_hotkey(e, hotkey) {);if ($last_focused_compose_type_input.hasClass("message_edit_content")) {- if ($last_focused_compose_type_input.closest(".preview_mode").length) {+ if ($last_focused_compose_type_input.closest(".preview_mode").length > 0) {message_edit.clear_preview_area($last_focused_compose_type_input);$last_focused_compose_type_input.trigger("focus");} else {diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.tsindex d69976bab32..aacd0364a1b 100644--- a/web/src/inbox_ui.ts+++ b/web/src/inbox_ui.ts@@ -275,7 +275,7 @@ function format_dm(latest_msg_id: number,): DirectMessageContext {const recipient_ids = people.user_ids_string_to_ids_array(user_ids_string);- if (!recipient_ids.length) {+ if (recipient_ids.length === 0) {// Self DMrecipient_ids.push(people.my_current_user_id());}@@ -1459,7 +1459,7 @@ function move_focus_to_visible_area(): void {const $element_in_row = $(element_in_row);let $inbox_row = $element_in_row.closest(".inbox-row");- if (!$inbox_row.length) {+ if ($inbox_row.length === 0) {$inbox_row = $element_in_row.closest(".inbox-header");}diff --git a/web/src/inbox_util.ts b/web/src/inbox_util.tsindex df35b24764f..fd651b6cce5 100644--- a/web/src/inbox_util.ts+++ b/web/src/inbox_util.ts@@ -29,7 +29,7 @@ export function update_stream_colors(): void {const background_color = stream_color.get_recipient_bar_color(color);const $stream_privacy_icon = $stream_header.find(".stream-privacy");- if ($stream_privacy_icon.length) {+ if ($stream_privacy_icon.length > 0) {$stream_privacy_icon.css("color", stream_color.get_stream_privacy_icon_color(color));}diff --git a/web/src/input_pill.ts b/web/src/input_pill.tsindex 0db01c28dfc..02dad2192dc 100644--- a/web/src/input_pill.ts+++ b/web/src/input_pill.ts@@ -399,7 +399,7 @@ export function create<ItemType extends {type: string}>(const $prev = $pill.prev();const $next = $pill.next();funcs.removePill(util.the($pill), "backspace");- if ($prev.length) {+ if ($prev.length > 0) {$prev.trigger("focus");} else {$next.trigger("focus");diff --git a/web/src/invite.ts b/web/src/invite.tsindex 78902bc0e7f..83301392966 100644--- a/web/src/invite.ts+++ b/web/src/invite.ts@@ -294,7 +294,7 @@ function valid_to(): string {}function set_streams_to_join_list_visibility(): void {- const realm_has_default_streams = stream_data.get_default_stream_ids().length !== 0;+ const realm_has_default_streams = stream_data.get_default_stream_ids().length > 0;const hide_streams_list =realm_has_default_streams &&util.the($<HTMLInputElement>("input#invite_select_default_streams")).checked;@@ -387,7 +387,7 @@ function open_invite_user_modal(e: JQuery.ClickEvent<Document, undefined>): voidinvite_as_options: settings_config.user_role_values,expires_in_options: settings_config.expires_in_values,time_choices: settings_config.custom_time_unit_values,- show_select_default_streams_option: stream_data.get_default_stream_ids().length !== 0,+ show_select_default_streams_option: stream_data.get_default_stream_ids().length > 0,user_has_email_set: !settings_data.user_email_not_configured(),can_subscribe_other_users: settings_data.user_can_subscribe_other_users(),});diff --git a/web/src/lightbox.ts b/web/src/lightbox.tsindex c6a4078645c..081164f9ef0 100644--- a/web/src/lightbox.ts+++ b/web/src/lightbox.ts@@ -472,7 +472,7 @@ export function show_from_selected_message(): void {}}- if ($media.length !== 0) {+ if ($media.length > 0) {const open_media = build_open_media_function(undefined);// Since this function is only called from the "show_lightbox"// hotkey, we don't have a selected image to load. Therefore,@@ -496,10 +496,10 @@ export function parse_media_data(media: HTMLMediaElement | HTMLImageElement): Pa// if wrapped in the .youtube-video class, it will be length = 1, and therefore// cast to true.- const is_youtube_video = Boolean($media.closest(".youtube-video").length);- const is_vimeo_video = Boolean($media.closest(".vimeo-video").length);- const is_embed_video = Boolean($media.closest(".embed-video").length);- const is_inline_video = Boolean($media.closest(".message_inline_video").length);+ const is_youtube_video = $media.closest(".youtube-video").length > 0;+ const is_vimeo_video = $media.closest(".vimeo-video").length > 0;+ const is_embed_video = $media.closest(".embed-video").length > 0;+ const is_inline_video = $media.closest(".message_inline_video").length > 0;// check if media is descendent of #compose .preview_contentconst is_compose_preview_media = $media.closest("#compose .preview_content").length === 1;diff --git a/web/src/list_widget.ts b/web/src/list_widget.tsindex 29f327064f9..cc3e7d1e0ba 100644--- a/web/src/list_widget.ts+++ b/web/src/list_widget.ts@@ -204,7 +204,7 @@ function is_scroll_position_for_render(scroll_container: HTMLElement): boolean {function get_column_count_for_table($table: JQuery): number {let column_count = 0;const $thead = $table.find("thead");- if ($thead.length) {+ if ($thead.length > 0) {column_count = $thead.find("tr").children().length;}return column_count;@@ -221,7 +221,7 @@ export function render_empty_list_message_if_needed(empty_list_message = empty_search_results_message;}- if (!empty_list_message || $container.children().length) {+ if (!empty_list_message || $container.children().length > 0) {return;}@@ -317,7 +317,7 @@ export function create<Key, Item = Key>(const $list_item = $container.find(`li[data-value="${CSS.escape(String(value))}"]`,);- if ($list_item.length) {+ if ($list_item.length > 0) {const $link_elem = $list_item.find("a").expectOne();$list_item.addClass("checked");$link_elem.prepend($("<i>").addClass(["fa", "fa-check"]));@@ -542,13 +542,13 @@ export function create<Key, Item = Key>($target_row.after($(rendered_row));} else {let $target_row = opts.html_selector!(meta.filtered_list[insert_index + 1]!);- if ($target_row.length !== 0) {+ if ($target_row.length > 0) {$target_row.before($(rendered_row));} else if (insert_index > 0) {// We don't have a row rendered after row we are trying to insert at.// So, try looking for the row before current row.$target_row = opts.html_selector!(meta.filtered_list[insert_index - 1]!);- if ($target_row.length !== 0) {+ if ($target_row.length > 0) {$target_row.after($(rendered_row));}}diff --git a/web/src/message_edit.ts b/web/src/message_edit.tsindex 4336dc8d7e3..13ee0befc68 100644--- a/web/src/message_edit.ts+++ b/web/src/message_edit.ts@@ -133,7 +133,7 @@ export function is_topic_editable(message: Message, edit_limit_seconds_buffer =}function is_widget_message(message: Message): boolean {- if (message.submessages && message.submessages.length !== 0) {+ if (message.submessages && message.submessages.length > 0) {return true;}return false;@@ -657,7 +657,7 @@ export function start($row: JQuery, edit_box_open_callback?: () => void): void {return;}- if ($row.find(".message_edit_form form").length !== 0) {+ if ($row.find(".message_edit_form form").length > 0) {return;}@@ -929,8 +929,8 @@ export function end_message_row_edit($row: JQuery): void {message_lists.current.hide_edit_message($row);compose_call.abort_video_callbacks(message.id.toString());}- if ($row.find(".could-be-condensed").length !== 0) {- if ($row.find(".condensed").length !== 0) {+ if ($row.find(".could-be-condensed").length > 0) {+ if ($row.find(".condensed").length > 0) {condense.show_message_expander($row);} else {condense.show_message_condenser($row);@@ -1180,7 +1180,7 @@ export function save_message_row_edit($row: JQuery): void {// class attached.const {detached_uploads} = detached_uploads_api_response_schema.parse(res);- if (detached_uploads.length) {+ if (detached_uploads.length > 0) {attachments_ui.suggest_delete_detached_attachments(detached_uploads);}},diff --git a/web/src/message_fetch.ts b/web/src/message_fetch.tsindex 819b944979c..3c0cda85f69 100644--- a/web/src/message_fetch.ts+++ b/web/src/message_fetch.ts@@ -153,7 +153,7 @@ function process_result(data: MessageFetchResponse, opts: MessageFetchOptions):// messages not tracked in unread.ts during this fetching process.message_util.do_unread_count_updates(messages, true);- if (messages.length !== 0) {+ if (messages.length > 0) {if (opts.msg_list) {if (opts.validate_filter_topic_post_fetch) {opts.msg_list.data.filter.try_adjusting_for_moved_with_target(messages[0]);diff --git a/web/src/message_list.ts b/web/src/message_list.tsindex 7ad55b34217..551790253a3 100644--- a/web/src/message_list.ts+++ b/web/src/message_list.ts@@ -514,7 +514,7 @@ export class MessageList {}show_edit_message($row: JQuery, $form: JQuery): void {- if ($row.find(".message_edit_form form").length !== 0) {+ if ($row.find(".message_edit_form form").length > 0) {return;}$row.find(".messagebox-content").append($form);diff --git a/web/src/message_list_view.ts b/web/src/message_list_view.tsindex 3ae62a5deed..041d5c7e5ae 100644--- a/web/src/message_list_view.ts+++ b/web/src/message_list_view.ts@@ -1806,7 +1806,7 @@ export class MessageListView {this._rerender_message(message_container, {message_content_edited, is_revealed: false});}- if (current_group.length !== 0) {+ if (current_group.length > 0) {message_groups.push(current_group);}@@ -2143,7 +2143,7 @@ export class MessageListView {const message_rows = elements_below_sticky_header.filter((element) => element instanceof HTMLElement).filter((element) => element.classList.contains("message_row"));- if (!message_rows.length) {+ if (message_rows.length === 0) {/* If there is no message row under the header, it means it is not sticky yet,so we just get the message next to the header. */$message_row = $sticky_header.nextAll(".message_row").first();@@ -2188,11 +2188,11 @@ export class MessageListView {});// This corner case only occurs when the date is unchanged// from the previous recipient row.- if ($sticky_header.find(".recipient_row_date.recipient_row_date_unchanged").length) {+ if ($sticky_header.find(".recipient_row_date.recipient_row_date_unchanged").length > 0) {const $prev_recipient_row = $sticky_header.closest(".recipient_row").prev(".recipient_row");- if (!$prev_recipient_row.length) {+ if ($prev_recipient_row.length === 0) {return;}const $prev_header_date_row = $prev_recipient_row.find(".recipient_row_date");diff --git a/web/src/message_scroll.ts b/web/src/message_scroll.tsindex 07455141179..cc9e1d342c0 100644--- a/web/src/message_scroll.ts+++ b/web/src/message_scroll.ts@@ -181,7 +181,7 @@ export function initialize(): void {if (event.msg_list.can_mark_messages_read()) {unread_ops.notify_server_messages_read(messages, {from: "pointer"});} else if (- unread.get_unread_messages(messages).length !== 0 &&+ unread.get_unread_messages(messages).length > 0 &&// The below checks might seem redundant, but it's// possible this logic, which runs after a delay, lost// a race with switching to another view, like Recentdiff --git a/web/src/message_view.ts b/web/src/message_view.tsindex c7b71305467..293c1cb0e3e 100644--- a/web/src/message_view.ts+++ b/web/src/message_view.ts@@ -423,7 +423,7 @@ export let show = (raw_terms: NarrowTerm[], show_opts: ShowMessageViewOpts): voi// we need to check if the narrow is allowed for spectator here too.if (page_params.is_spectator &&- raw_terms.length &&+ raw_terms.length > 0 &&// TODO: is:home is currently not permitted for spectators// because they can't mute things; maybe that's the wrong// policy?diff --git a/web/src/message_viewport.ts b/web/src/message_viewport.tsindex f5341693192..2918a71e47b 100644--- a/web/src/message_viewport.ts+++ b/web/src/message_viewport.ts@@ -56,7 +56,7 @@ export function message_viewport_info(): MessageViewportInfo {let visible_top = $element_just_above_us.outerHeight() ?? 0;const $sticky_header = $(".sticky_header");- if ($sticky_header.length) {+ if ($sticky_header.length > 0) {visible_top += $sticky_header.outerHeight() ?? 0;}@@ -205,7 +205,7 @@ const top_of_feed = new util.CachedValue({let visible_top = $header.outerHeight() ?? 0;const $sticky_header = $(".sticky_header");- if ($sticky_header.length) {+ if ($sticky_header.length > 0) {visible_top += $sticky_header.outerHeight() ?? 0;}return visible_top;@@ -522,7 +522,7 @@ export function keep_pointer_in_view(): void {export function scroll_to_selected(): void {assert(message_lists.current !== undefined);const $selected_row = message_lists.current.selected_row();- if ($selected_row && $selected_row.length !== 0) {+ if ($selected_row && $selected_row.length > 0) {recenter_view($selected_row);}}diff --git a/web/src/people.ts b/web/src/people.tsindex 151aa00cc42..dc4323fc3ed 100644--- a/web/src/people.ts+++ b/web/src/people.ts@@ -507,7 +507,7 @@ export function sorted_other_user_ids(user_ids: number[]): number[] {const other_user_ids = user_ids.filter((user_id) => !is_my_user_id(user_id));- if (other_user_ids.length >= 1) {+ if (other_user_ids.length > 0) {user_ids = other_user_ids;} else {user_ids = [my_user_id];diff --git a/web/src/pm_list.ts b/web/src/pm_list.tsindex 0b2a39d9dd3..95e1b7ecba7 100644--- a/web/src/pm_list.ts+++ b/web/src/pm_list.ts@@ -157,7 +157,7 @@ function scroll_all_private_into_view(): void {export function handle_narrow_activated(filter: Filter): void {const active_filter = filter;const is_all_private_message_view = _.isEqual(active_filter.sorted_term_types(), ["is-dm"]);- const narrow_to_private_messages_section = active_filter.operands("dm").length !== 0;+ const narrow_to_private_messages_section = active_filter.operands("dm").length > 0;const is_private_messages_in_view = active_filter.has_operator("dm");if (is_all_private_message_view) {diff --git a/web/src/portico/hello.ts b/web/src/portico/hello.tsindex 3a622f6ad48..ca468e1068d 100644--- a/web/src/portico/hello.ts+++ b/web/src/portico/hello.ts@@ -7,7 +7,7 @@ function get_new_rand(old_random_int: number, max: number): number {}function get_random_item_from_array<T>(array: T[]): T {- assert(array.length >= 1);+ assert(array.length > 0);return array[Math.floor(Math.random() * array.length)]!;}diff --git a/web/src/portico/help.ts b/web/src/portico/help.tsindex 275c4c6e766..6e9aaa3f663 100644--- a/web/src/portico/help.ts+++ b/web/src/portico/help.ts@@ -102,7 +102,7 @@ $(".hamburger").on("click", () => {});$(".markdown").on("click", () => {- if ($(".sidebar.show").length) {+ if ($(".sidebar.show").length > 0) {$(".sidebar.show").toggleClass("show");}});diff --git a/web/src/portico/signup.ts b/web/src/portico/signup.tsindex 82c3c486e53..71dae977269 100644--- a/web/src/portico/signup.ts+++ b/web/src/portico/signup.ts@@ -204,7 +204,7 @@ $(() => {}function update_full_name_section(): void {- if ($("#source_realm_select").length && $("#source_realm_select").val() !== "") {+ if ($("#source_realm_select").length > 0 && $("#source_realm_select").val() !== "") {$("#full_name_input_section").hide();$("#profile_info_section").show();const avatar_url = $($("#source_realm_select").prop("selectedOptions")).attr(diff --git a/web/src/portico/tabbed-instructions.ts b/web/src/portico/tabbed-instructions.tsindex 1db08d3cb33..f4a588eedcf 100644--- a/web/src/portico/tabbed-instructions.ts+++ b/web/src/portico/tabbed-instructions.ts@@ -57,7 +57,7 @@ export function activate_correct_tab($tabbed_section: JQuery): void {// if no tab was activated, just activate the first oneconst $active_list_items = $li.filter(".active");- if (!$active_list_items.length) {+ if ($active_list_items.length === 0) {$li.first().addClass("active");const tab_key = util.the($li.first()).dataset.tabKey;if (tab_key) {diff --git a/web/src/read_receipts.ts b/web/src/read_receipts.tsindex bb05b55bac1..6a4a57c1c9c 100644--- a/web/src/read_receipts.ts+++ b/web/src/read_receipts.ts@@ -45,7 +45,7 @@ export function show_user_list(message_id: number): void {);// If the read receipts modal for the selected message ID is closed// by the time we receive the response, return immediately.- if (!$modal.length) {+ if ($modal.length === 0) {return;}const data = read_receipts_api_response_schema.parse(raw_data);diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.tsindex 516371d8e0e..97722d9c186 100644--- a/web/src/recent_view_ui.ts+++ b/web/src/recent_view_ui.ts@@ -196,7 +196,7 @@ function set_oldest_message_date(msg_list_data: MessageListData): void {// We might be loading messages in another narrow before the recent view// is shown, so we keep the state updated and update the banner only// once it's actually rendered.- if ($("#recent-view-content-tbody tr").length) {+ if ($("#recent-view-content-tbody tr").length > 0) {update_load_more_banner();}}@@ -1579,7 +1579,7 @@ export function change_focused_element($elt: JQuery, input_key: string): boolean$current_focus_elem = $(post_tab_focus_elem);}- if ($(post_tab_focus_elem).parents("#recent-view-content-table").length) {+ if ($(post_tab_focus_elem).parents("#recent-view-content-table").length > 0) {$current_focus_elem = "table";const topic_row_index = $(post_tab_focus_elem).closest("tr").index();const col_index = $(post_tab_focus_elem)diff --git a/web/src/rendered_markdown.ts b/web/src/rendered_markdown.tsindex 26dc65156fa..6bdd097f0d0 100644--- a/web/src/rendered_markdown.ts+++ b/web/src/rendered_markdown.ts@@ -70,7 +70,7 @@ function get_message_for_message_content($content: JQuery): Message | undefined// those elements, and we should address that quirk for// mentions holistically.const $message_row = $content.closest(".message_row");- if (!$message_row.length || $message_row.closest(".overlay-message-row").length) {+ if ($message_row.length === 0 || $message_row.closest(".overlay-message-row").length > 0) {// There's no containing message when rendering a preview.return undefined;}@@ -152,7 +152,7 @@ export const update_elements = ($content: JQuery): void => {$(this).addClass("user-mention-me");}- if (user_id && user_id !== "*" && !$(this).find(".highlight").length) {+ if (user_id && user_id !== "*" && $(this).find(".highlight").length === 0) {// If it's a mention of a specific user, edit the mention// text to show the user's current name, assuming that// you're not searching for text inside the highlight.@@ -209,7 +209,7 @@ export const update_elements = ($content: JQuery): void => {$(this).addClass("user-mention-me");}- if (user_group_id && !$(this).find(".highlight").length) {+ if (user_group_id && $(this).find(".highlight").length === 0) {// Edit the mention to show the current name for the// user group, if its not in search.set_name_in_mention_element(this, user_group.name);@@ -220,7 +220,7 @@ export const update_elements = ($content: JQuery): void => {const stream_id_string = $(this).attr("data-stream-id");assert(stream_id_string !== undefined);const stream_id = Number.parseInt(stream_id_string, 10);- if (stream_id && !$(this).find(".highlight").length) {+ if (stream_id && $(this).find(".highlight").length === 0) {// Display the current name for stream if it is not// being displayed in search highlight.const stream_name = sub_store.maybe_get_stream_name(stream_id);@@ -237,7 +237,7 @@ export const update_elements = ($content: JQuery): void => {const stream_id_string = $(this).attr("data-stream-id");assert(stream_id_string !== undefined);const stream_id = Number.parseInt(stream_id_string, 10);- if (stream_id && !$(this).find(".highlight").length) {+ if (stream_id && $(this).find(".highlight").length === 0) {// Display the current name for stream if it is not// being displayed in search highlight.const stream_name = sub_store.maybe_get_stream_name(stream_id);diff --git a/web/src/rows.ts b/web/src/rows.tsindex ecad7cf4ba6..cd12d48469c 100644--- a/web/src/rows.ts+++ b/web/src/rows.ts@@ -14,7 +14,7 @@ export function next_visible($message_row: JQuery): JQuery {return $();}const $row = $message_row.next(".selectable_row");- if ($row.length !== 0) {+ if ($row.length > 0) {return $row;}const $recipient_row = get_message_recipient_row($message_row);@@ -30,7 +30,7 @@ export function prev_visible($message_row: JQuery): JQuery {return $();}const $row = $message_row.prev(".selectable_row");- if ($row.length !== 0) {+ if ($row.length > 0) {return $row;}const $recipient_row = get_message_recipient_row($message_row);@@ -75,7 +75,7 @@ export function visible_range(start_id: number, end_id: number): JQuery[] {}export function is_overlay_row($row: JQuery): boolean {- return $row.closest(".overlay-message-row").length >= 1;+ return $row.closest(".overlay-message-row").length > 0;}export function id($message_row: JQuery): number {diff --git a/web/src/saved_snippets_ui.ts b/web/src/saved_snippets_ui.tsindex 442a2604689..23ebaf0b768 100644--- a/web/src/saved_snippets_ui.ts+++ b/web/src/saved_snippets_ui.ts@@ -70,7 +70,7 @@ function item_click_callback(if ($(event.target).closest(".saved_snippets-dropdown-list-container .dropdown-list-delete")- .length+ .length > 0) {confirm_dialog.launch({html_heading: $t_html({defaultMessage: "Delete saved snippet?"}),diff --git a/web/src/search_pill.ts b/web/src/search_pill.tsindex a8afce39f67..813ab0a93e7 100644--- a/web/src/search_pill.ts+++ b/web/src/search_pill.ts@@ -70,7 +70,7 @@ function on_pill_exit(remove_pill: (pill: HTMLElement) => void,): void {const $user_pill_container = $(clicked_element).parents(".user-pill-container");- if (!$user_pill_container.length) {+ if ($user_pill_container.length === 0) {// This is just a regular search pill, so we don't need to do fancy logic.const $clicked_pill = $(clicked_element).closest(".pill");remove_pill(util.the($clicked_pill));@@ -211,7 +211,7 @@ export function set_search_bar_contents(search_bar_text_strings.push(partial_pill);}set_search_bar_text(search_bar_text_strings.join(" "));- if (invalid_inputs.length) {+ if (invalid_inputs.length > 0) {$("#search_query").addClass("shake");}}diff --git a/web/src/search_suggestion.ts b/web/src/search_suggestion.tsindex 9d37c6e7420..f10b6ffd84a 100644--- a/web/src/search_suggestion.ts+++ b/web/src/search_suggestion.ts@@ -562,7 +562,7 @@ function get_term_subset_suggestions(terms: NarrowTerm[]): Suggestion[] {// For channel:a topic:b search:c, suggest:// channel:a topic:b// channel:a- if (terms.length < 1) {+ if (terms.length === 0) {return [];}diff --git a/web/src/server_events.js b/web/src/server_events.jsindex 298bba595b5..6acedf13d3f 100644--- a/web/src/server_events.js+++ b/web/src/server_events.js@@ -99,7 +99,7 @@ function get_events_success(events) {}}- if (messages.length !== 0) {+ if (messages.length > 0) {// Sort by ID, so that if we get multiple messages back from// the server out-of-order, we'll still end up with our// message lists in order.@@ -129,7 +129,7 @@ function get_events_success(events) {}}- if (update_message_events.length !== 0) {+ if (update_message_events.length > 0) {try {message_events.update_messages(update_message_events);} catch (error) {diff --git a/web/src/server_events_dispatch.js b/web/src/server_events_dispatch.jsindex 27f933bd1dc..9efba25c830 100644--- a/web/src/server_events_dispatch.js+++ b/web/src/server_events_dispatch.js@@ -157,7 +157,7 @@ export function dispatch_normal_event(event) {break;case "invites_changed":- if ($("#admin-invites-list").length) {+ if ($("#admin-invites-list").length > 0) {settings_invites.set_up(false);}break;diff --git a/web/src/settings_account.ts b/web/src/settings_account.tsindex 38cadfe0a09..d0f681c0dfe 100644--- a/web/src/settings_account.ts+++ b/web/src/settings_account.ts@@ -228,7 +228,7 @@ function update_user_custom_profile_fields(function update_user_type_field(field: PillUpdateField, pills: UserPillWidget): void {const user_ids = user_pill.get_user_ids(pills);- if (user_ids.length < 1) {+ if (user_ids.length === 0) {update_user_custom_profile_fields([{id: field.id}], channel.del);} else {update_user_custom_profile_fields([{id: field.id, value: user_ids}], channel.patch);diff --git a/web/src/settings_components.ts b/web/src/settings_components.tsindex 8cda1561365..e85cb5918a4 100644--- a/web/src/settings_components.ts+++ b/web/src/settings_components.ts@@ -1418,7 +1418,7 @@ function enable_or_disable_save_button($subsection_elem: JQuery): void {const time_limit_settings = [...$subsection_elem.find(".time-limit-setting")];let disable_save_button = false;- if (time_limit_settings.length) {+ if (time_limit_settings.length > 0) {disable_save_button =should_disable_save_button_for_time_limit_settings(time_limit_settings);} else if ($subsection_elem.attr("id") === "org-other-settings") {@@ -1448,7 +1448,7 @@ function enable_or_disable_save_button($subsection_elem: JQuery): void {const group_settings = [...$subsection_elem.find(".pill-container")].map((elem) =>extract_property_name($(elem)),);- if (group_settings.length) {+ if (group_settings.length > 0) {disable_save_button = should_disable_save_button_for_group_settings(group_settings);}}diff --git a/web/src/settings_exports.ts b/web/src/settings_exports.tsindex f172f2619c3..9487b2665be 100644--- a/web/src/settings_exports.ts+++ b/web/src/settings_exports.ts@@ -132,7 +132,7 @@ export function populate_exports_table(exports: RealmExport[]): void {});const $spinner = $(".export_row .export_url_spinner");- if ($spinner.length) {+ if ($spinner.length > 0) {loading.make_indicator($spinner);} else {loading.destroy_indicator($spinner);@@ -423,7 +423,7 @@ function maybe_store_export_consent_data_and_return(export_consent: ExportConsenfunction update_start_export_modal_stats(): void {total_users_count = export_consents.size;users_consented_for_export_count = get_export_consents_having_consent_value(true).length;- if ($("#allow_private_data_export_stats").length) {+ if ($("#allow_private_data_export_stats").length > 0) {$("#allow_private_data_export_stats").text($t({diff --git a/web/src/settings_notifications.ts b/web/src/settings_notifications.tsindex c503a00fd00..19961d389ba 100644--- a/web/src/settings_notifications.ts+++ b/web/src/settings_notifications.ts@@ -245,7 +245,7 @@ export function set_up(settings_panel: SettingsPanel): void {e.preventDefault();e.stopPropagation();const $input_elem = $(e.currentTarget);- if ($input_elem.parents("#stream-specific-notify-table").length) {+ if ($input_elem.parents("#stream-specific-notify-table").length > 0) {assert(e.currentTarget instanceof HTMLInputElement);stream_notification_setting_changed(e.currentTarget);return;diff --git a/web/src/settings_org.ts b/web/src/settings_org.tsindex 3c61124f854..067705b737e 100644--- a/web/src/settings_org.ts+++ b/web/src/settings_org.ts@@ -787,7 +787,7 @@ export function sync_realm_settings(property: string): void {break;}const $element = $(`#id_realm_${CSS.escape(property)}`);- if ($element.length) {+ if ($element.length > 0) {const $subsection = $element.closest(".settings-subsection-parent");if ($subsection.find(".save-button-controls").hasClass("hide")) {discard_realm_property_element_changes(util.the($element));diff --git a/web/src/settings_preferences.ts b/web/src/settings_preferences.tsindex b67856cefa9..db533c5b573 100644--- a/web/src/settings_preferences.ts+++ b/web/src/settings_preferences.ts@@ -363,7 +363,7 @@ export async function report_emojiset_change(settings_panel: SettingsPanel): Proawait emojisets.select(settings_panel.settings_object.emojiset);const $spinner = $(settings_panel.container).find(".emoji-preferences-settings-status");- if ($spinner.length) {+ if ($spinner.length > 0) {loading.destroy_indicator($spinner);ui_report.success($t_html({defaultMessage: "Emoji set changed successfully!"}),@@ -383,7 +383,7 @@ export function report_user_list_style_change(settings_panel: SettingsPanel): vo// implementation is wrong, though, in that it displays the UI// update in all active browser windows.const $spinner = $(settings_panel.container).find(".information-settings-status");- if ($spinner.length) {+ if ($spinner.length > 0) {loading.destroy_indicator($spinner);ui_report.success($t_html({defaultMessage: "User list style changed successfully!"}),diff --git a/web/src/settings_profile_fields.ts b/web/src/settings_profile_fields.tsindex c192d6119a2..655f23883b6 100644--- a/web/src/settings_profile_fields.ts+++ b/web/src/settings_profile_fields.ts@@ -560,7 +560,7 @@ function open_edit_form_modal(this: HTMLElement): void {}}- if (Object.keys(deleted_values).length !== 0) {+ if (Object.keys(deleted_values).length > 0) {const edit_select_field_modal_callback = (): void => {show_modal_for_deleting_options(field, deleted_values, update_profile_field);};diff --git a/web/src/settings_realm_user_settings_defaults.ts b/web/src/settings_realm_user_settings_defaults.tsindex 073a3fa3c26..6a22a86efbc 100644--- a/web/src/settings_realm_user_settings_defaults.ts+++ b/web/src/settings_realm_user_settings_defaults.ts@@ -42,7 +42,7 @@ export function update_page(property: string): void {}const $element = $(`#realm_${CSS.escape(property)}`);- if ($element.length) {+ if ($element.length > 0) {const $subsection = $element.closest(".settings-subsection-parent");if ($subsection.find(".save-button-controls").hasClass("hide")) {settings_org.discard_realm_default_property_element_changes(util.the($element));diff --git a/web/src/settings_users.ts b/web/src/settings_users.tsindex f00406ece68..3f80d5d96f3 100644--- a/web/src/settings_users.ts+++ b/web/src/settings_users.ts@@ -109,7 +109,7 @@ export function allow_sorting_deactivated_users_list_by_email(): boolean {(user) => !user.is_bot && user.delivery_email,);- return deactivated_humans_with_visible_email.length !== 0;+ return deactivated_humans_with_visible_email.length > 0;}export function update_view_on_deactivate(user_id: number): void {diff --git a/web/src/sidebar_ui.ts b/web/src/sidebar_ui.tsindex fbd026da8e1..ffb1a4e573c 100644--- a/web/src/sidebar_ui.ts+++ b/web/src/sidebar_ui.ts@@ -184,23 +184,23 @@ export function initialize(): void {const $elt = $(e.target);// Since sidebar toggle buttons have their own click handlers, don't handle them here.if (- $elt.closest(".left-sidebar-toggle-button").length ||- $elt.closest("#userlist-toggle-button").length+ $elt.closest(".left-sidebar-toggle-button").length > 0 ||+ $elt.closest("#userlist-toggle-button").length > 0) {return;}// Overrides for certain elements that should not close the sidebars.- if ($elt.closest(".no-auto-hide-sidebar-overlays").length) {+ if ($elt.closest(".no-auto-hide-sidebar-overlays").length > 0) {return;}if (left_sidebar_expanded_as_overlay &&- !$elt.closest(".no-auto-hide-left-sidebar-overlay").length+ $elt.closest(".no-auto-hide-left-sidebar-overlay").length === 0) {const $left_column = $(".app-main .column-left");- const click_outside_left_sidebar = !$elt.closest($left_column).length;+ const click_outside_left_sidebar = $elt.closest($left_column).length === 0;if (click_outside_left_sidebar) {hide_streamlist_sidebar();}@@ -208,10 +208,10 @@ export function initialize(): void {if (right_sidebar_expanded_as_overlay &&- !$elt.closest(".no-auto-hide-right-sidebar-overlay").length+ $elt.closest(".no-auto-hide-right-sidebar-overlay").length === 0) {const $right_column = $(".app-main .column-right");- const click_outside_right_sidebar = !$elt.closest($right_column).length;+ const click_outside_right_sidebar = $elt.closest($right_column).length === 0;if (click_outside_right_sidebar) {hide_userlist_sidebar();@@ -257,7 +257,7 @@ export function initialize_right_sidebar(): void {$("#buddy-list-users-matching-view").on("mouseenter", ".user_sidebar_entry", (e) => {const $status_emoji = $(e.target).closest(".user_sidebar_entry").find("img.status-emoji");- if ($status_emoji.length) {+ if ($status_emoji.length > 0) {const animated_url = $status_emoji.attr("data-animated-url");if (animated_url) {$status_emoji.attr("src", animated_url);@@ -267,7 +267,7 @@ export function initialize_right_sidebar(): void {$("#buddy-list-users-matching-view").on("mouseleave", ".user_sidebar_entry", (e) => {const $status_emoji = $(e.target).closest(".user_sidebar_entry").find("img.status-emoji");- if ($status_emoji.length) {+ if ($status_emoji.length > 0) {const still_url = $status_emoji.attr("data-still-url");if (still_url) {$status_emoji.attr("src", still_url);diff --git a/web/src/stats/stats.ts b/web/src/stats/stats.tsindex 466b41e31fe..f11f66507e5 100644--- a/web/src/stats/stats.ts+++ b/web/src/stats/stats.ts@@ -678,7 +678,7 @@ function compute_summary_chart_data(values.push(0);}}- if (data.size !== 0) {+ if (data.size > 0) {labels[labels.length - 1] = "Other";for (const sum of data.values()) {values[labels.length - 1]! += sum;diff --git a/web/src/stream_color.ts b/web/src/stream_color.tsindex f66b9a01b22..a7eecc30bc4 100644--- a/web/src/stream_color.ts+++ b/web/src/stream_color.ts@@ -13,7 +13,7 @@ import * as stream_settings_api from "./stream_settings_api.ts";extend([lchPlugin, mixPlugin]);export function update_stream_recipient_color($stream_header: JQuery): void {- if ($stream_header.length) {+ if ($stream_header.length > 0) {const stream_id = Number.parseInt($stream_header.attr("data-stream-id")!, 10);if (!stream_id) {return;@@ -22,7 +22,7 @@ export function update_stream_recipient_color($stream_header: JQuery): void {const recipient_bar_color = get_recipient_bar_color(stream_color);const $stream_privacy_icon = $stream_header.find(".stream-privacy");- if ($stream_privacy_icon.length) {+ if ($stream_privacy_icon.length > 0) {$stream_privacy_icon.css("color", get_stream_privacy_icon_color(stream_color));}diff --git a/web/src/stream_settings_components.ts b/web/src/stream_settings_components.tsindex af4f18421a1..775f427a207 100644--- a/web/src/stream_settings_components.ts+++ b/web/src/stream_settings_components.ts@@ -157,7 +157,7 @@ export function ajaxSubscribe(already_subscribed: z.record(z.string(), z.array(z.string())),}).parse(xhr.responseJSON);- if (Object.keys(res.already_subscribed).length) {+ if (Object.keys(res.already_subscribed).length > 0) {// Display the canonical stream capitalization.true_stream_name = res.already_subscribed[current_user.user_id]![0];ui_report.success(diff --git a/web/src/stream_settings_ui.ts b/web/src/stream_settings_ui.tsindex ba891633aae..e6692e3491f 100644--- a/web/src/stream_settings_ui.ts+++ b/web/src/stream_settings_ui.ts@@ -471,12 +471,12 @@ export function update_empty_left_panel_message(): void {// this case here we are also checking DOM if there are streams// displayed in panel or not.has_streams =- stream_data.subscribed_subs().length ||- $("#channels_overlay_container .stream-row:not(.notdisplayed)").length;+ stream_data.subscribed_subs().length > 0 ||+ $("#channels_overlay_container .stream-row:not(.notdisplayed)").length > 0;} else if (stream_ui_updates.is_not_subscribed_stream_tab_active()) {has_streams =- stream_data.unsubscribed_subs().length ||- $("#channels_overlay_container .stream-row:not(.notdisplayed)").length;+ stream_data.unsubscribed_subs().length > 0 ||+ $("#channels_overlay_container .stream-row:not(.notdisplayed)").length > 0;} else {has_streams = stream_data.get_unsorted_subs().length;}diff --git a/web/src/stream_topic_history.ts b/web/src/stream_topic_history.tsindex cee45ae781a..9b0575c83a7 100644--- a/web/src/stream_topic_history.ts+++ b/web/src/stream_topic_history.ts@@ -124,7 +124,7 @@ export class PerStreamHistory {}has_topics(): boolean {- return this.topics.size !== 0;+ return this.topics.size > 0;}update_stream_with_message_id(message_id: number): void {diff --git a/web/src/stream_ui_updates.ts b/web/src/stream_ui_updates.tsindex fd426ac0778..9eea069c608 100644--- a/web/src/stream_ui_updates.ts+++ b/web/src/stream_ui_updates.ts@@ -189,7 +189,7 @@ export function update_settings_button_for_sub(sub: StreamSubscription): void {// This is for the Subscribe/Unsubscribe button in the right panel.const $settings_button = settings_button_for_sub(sub);- if (!$settings_button.length) {+ if ($settings_button.length === 0) {// `subscribe` button hasn't been rendered yet while we are processing the event.return;}@@ -368,7 +368,7 @@ export function update_notification_setting_checkbox(): void {// This is in the right panel (Personal settings).const $stream_row = $("#channels_overlay_container .stream-row.active");- if (!$stream_row.length) {+ if ($stream_row.length === 0) {return;}const stream_id = Number($stream_row.attr("data-stream-id"));diff --git a/web/src/submessage.ts b/web/src/submessage.tsindex f5ba8e68b29..a63212f06dc 100644--- a/web/src/submessage.ts+++ b/web/src/submessage.ts@@ -88,7 +88,7 @@ export function get_message_events(message: Message): SubmessageEvents | undefinexport function process_widget_rows_in_list(list: MessageList | undefined): void {for (const message_id of widgetize.widget_event_handlers.keys()) {const $row = list?.get_row(message_id);- if ($row && $row.length !== 0) {+ if ($row && $row.length > 0) {process_submessages({message_id, $row});}}diff --git a/web/src/topic_list.ts b/web/src/topic_list.tsindex 62f4d3bc6dd..9d5a9dab9af 100644--- a/web/src/topic_list.ts+++ b/web/src/topic_list.ts@@ -228,7 +228,7 @@ export class TopicListWidget {export function clear_topic_search(e: JQuery.Event): void {e.stopPropagation();const $input = $("#filter-topic-input");- if ($input.length) {+ if ($input.length > 0) {$input.val("");$input.trigger("blur");diff --git a/web/src/ui_init.js b/web/src/ui_init.jsindex 91b8db6a9f8..19699571697 100644--- a/web/src/ui_init.js+++ b/web/src/ui_init.js@@ -267,7 +267,7 @@ export function initialize_kitchen_sink_stuff() {// Ignore wheel events in the compose area which weren't already handled above.$("#compose").on("wheel", (e) => {// Except for the compose banners, which still need scroll events.- if ($(e.target).closest("#compose_banners").length) {+ if ($(e.target).closest("#compose_banners").length > 0) {return;}e.stopPropagation();diff --git a/web/src/unread.ts b/web/src/unread.tsindex 6b242b0c8ab..fa4853013f4 100644--- a/web/src/unread.ts+++ b/web/src/unread.ts@@ -573,7 +573,7 @@ class UnreadTopicCounter {return false;}- return id_set.size !== 0;+ return id_set.size > 0;}get_topics_with_unread_mentions(stream_id: number): Set<string> {diff --git a/web/src/upload.ts b/web/src/upload.tsindex cde2a909e21..5540bd75e0c 100644--- a/web/src/upload.ts+++ b/web/src/upload.ts@@ -559,7 +559,7 @@ export function initialize(): void {// A message edit box is open; drop there.const row_id = rows.get_message_id($last_drag_drop_edit_container[0]);const $drag_drop_container = edit_config(row_id).drag_drop_container();- if (!$drag_drop_container.closest("html").length) {+ if ($drag_drop_container.closest("html").length === 0) {return;}const edit_upload_object = upload_objects_by_message_edit_row.get(row_id);diff --git a/web/src/user_group_edit.ts b/web/src/user_group_edit.tsindex 4645437b431..771d97f511a 100644--- a/web/src/user_group_edit.ts+++ b/web/src/user_group_edit.ts@@ -132,7 +132,7 @@ function update_add_members_elements(group: UserGroup): void {if (settings_data.can_add_members_to_user_group(group.id)) {$input_element.prop("contenteditable", true);- if (user_group_edit_members.pill_widget.items().length !== 0) {+ if (user_group_edit_members.pill_widget.items().length > 0) {$button_element.prop("disabled", false);}$button_element.css("pointer-events", "");@@ -277,7 +277,7 @@ function initialize_tooltip_for_membership_button(group_id: number): void {function update_group_membership_button(group_id: number): void {const $group_settings_button = group_membership_button(group_id);- if (!$group_settings_button.length) {+ if ($group_settings_button.length === 0) {return;}@@ -368,7 +368,7 @@ function update_your_groups_list_if_needed(group_id: number): void {// We remove the group row immediately only if the// user cannot join the group again themselves.const group_row = row_for_group_id(group_id);- if (group_row.length) {+ if (group_row.length > 0) {group_row.remove();update_empty_left_panel_message();}@@ -941,7 +941,7 @@ export function switch_group_tab(tab_name: string): void {export function add_or_remove_from_group(group: UserGroup, $group_row: JQuery): void {const user_id = people.my_current_user_id();function success_callback(): void {- if ($group_row.length) {+ if ($group_row.length > 0) {hide_membership_toggle_spinner($group_row);// This should only be triggered when a user is on another group// edit panel and they join a group via the left panel plus button.@@ -958,12 +958,12 @@ export function add_or_remove_from_group(group: UserGroup, $group_row: JQuery):}function error_callback(): void {- if ($group_row.length) {+ if ($group_row.length > 0) {hide_membership_toggle_spinner($group_row);}}- if ($group_row.length) {+ if ($group_row.length > 0) {display_membership_toggle_spinner($group_row);}if (user_groups.is_direct_member_of(user_id, group.id)) {diff --git a/web/src/user_groups.ts b/web/src/user_groups.tsindex d232d7990c4..93bc1ef965d 100644--- a/web/src/user_groups.ts+++ b/web/src/user_groups.ts@@ -520,7 +520,7 @@ export function check_system_user_group_allowed_for_setting(return false;}- if (allowed_system_groups.length && !allowed_system_groups.includes(group_name)) {+ if (allowed_system_groups.length > 0 && !allowed_system_groups.includes(group_name)) {return false;}diff --git a/web/src/user_profile.ts b/web/src/user_profile.tsindex 8150a57a7b2..e2d00d668d2 100644--- a/web/src/user_profile.ts+++ b/web/src/user_profile.ts@@ -348,7 +348,7 @@ function render_user_stream_list(streams: StreamSubscription[], user: User): voireturn item?.name.toLocaleLowerCase().includes(value);},onupdate() {- if ($container.find(".empty-table-message").length) {+ if ($container.find(".empty-table-message").length > 0) {$container.parent().addClass("empty-list");}},diff --git a/web/src/user_status_ui.ts b/web/src/user_status_ui.tsindex 1342786d81c..035efcad539 100644--- a/web/src/user_status_ui.ts+++ b/web/src/user_status_ui.ts@@ -107,7 +107,7 @@ export function clear_message(): void {}export function user_status_picker_open(): boolean {- return $("#set-user-status-modal").length !== 0;+ return $("#set-user-status-modal").length > 0;}function emoji_status_fields_changed(@@ -130,7 +130,7 @@ function emoji_status_fields_changed(function rebuild_status_emoji_selector_ui(selected_emoji_info: Partial<UserStatusEmojiInfo>): void {let selected_emoji = null;- if (selected_emoji_info && Object.keys(selected_emoji_info).length) {+ if (selected_emoji_info && Object.keys(selected_emoji_info).length > 0) {selected_emoji = selected_emoji_info;}const rendered_status_emoji_selector = render_status_emoji_selector({selected_emoji});diff --git a/web/src/user_topics_ui.ts b/web/src/user_topics_ui.tsindex 951c33aa281..4807ea6d310 100644--- a/web/src/user_topics_ui.ts+++ b/web/src/user_topics_ui.ts@@ -86,7 +86,7 @@ export function handle_topic_updates(// Find the row with the specified stream_id and topic_nameconst $row = $('tr[data-stream-id="' + stream_id + '"][data-topic="' + topic_name + '"]');- if ($row.length) {+ if ($row.length > 0) {// If the row exists, update the status only.// We don't call 'populate_list' in this case as it re-creates the panel (re-sorts by date updated +// removes topics with status set to 'Default for channel'), making it hard to review the changesdiff --git a/web/tests/lib/zjquery_element.cjs b/web/tests/lib/zjquery_element.cjsindex 6b32d86e0af..fdd51f829ba 100644--- a/web/tests/lib/zjquery_element.cjs+++ b/web/tests/lib/zjquery_element.cjs@@ -224,7 +224,7 @@ function FakeElement(selector, opts) {return $self;},text(...args) {- if (args.length !== 0) {+ if (args.length > 0) {if (args[0] !== undefined) {text = args[0].toString();}