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: Enable no-jquery/no-sizzle.

Anders Kaseorgccfb50d4dd09
diff --git a/eslint.config.js b/eslint.config.js
index cba3305d6cc..74064f9148f 100644
--- a/eslint.config.js
+++ b/eslint.config.js
@@ -131,6 +131,7 @@ export default tseslint.config(
"no-jquery/no-append-html": "error",
"no-jquery/no-constructor-attributes": "error",
"no-jquery/no-parse-html-literal": "error",
+ "no-jquery/no-sizzle": ["error", {}],
"no-label-var": "error",
"no-labels": "error",
"no-multi-str": "error",
diff --git a/web/src/navbar_menus.ts b/web/src/navbar_menus.ts
index 6a58bc01a0e..d677f1579c2 100644
--- a/web/src/navbar_menus.ts
+++ b/web/src/navbar_menus.ts
@@ -68,6 +68,7 @@ function get_target_navbar_menu(
event_name: string,
$current_navbar_menu: JQuery,
): string | undefined {
+ // eslint-disable-next-line no-jquery/no-sizzle
const $visible_navbar_menus = $(".navbar-item:visible");
const index = $visible_navbar_menus.index($current_navbar_menu);
let $target_navbar_menu;
diff --git a/web/src/popover_menus.ts b/web/src/popover_menus.ts
index b93831b5f55..a762e382f25 100644
--- a/web/src/popover_menus.ts
+++ b/web/src/popover_menus.ts
@@ -173,6 +173,7 @@ export function get_popover_items_for_instance(instance: tippy.Instance): JQuery
return undefined;
}
+ // eslint-disable-next-line no-jquery/no-sizzle
return $current_elem.find("a, [tabindex='0']").filter(":visible");
}
diff --git a/web/src/settings_panel_menu.ts b/web/src/settings_panel_menu.ts
index a370455b9f4..626208015bd 100644
--- a/web/src/settings_panel_menu.ts
+++ b/web/src/settings_panel_menu.ts
@@ -156,17 +156,20 @@ export class SettingsPanelMenu {
}
prev(): boolean {
+ // eslint-disable-next-line no-jquery/no-sizzle
this.$curr_li.prevAll(":visible").first().trigger("focus").trigger("click");
return true;
}
next(): boolean {
+ // eslint-disable-next-line no-jquery/no-sizzle
this.$curr_li.nextAll(":visible").first().trigger("focus").trigger("click");
return true;
}
enter_panel(): boolean {
const $panel = this.get_panel();
+ // eslint-disable-next-line no-jquery/no-sizzle
const $panel_elem = $panel.find("input:visible,button:visible,select:visible").first();
$panel_elem.trigger("focus");
diff --git a/web/src/stream_ui_updates.ts b/web/src/stream_ui_updates.ts
index baa11f691c9..e15ebdb4564 100644
--- a/web/src/stream_ui_updates.ts
+++ b/web/src/stream_ui_updates.ts
@@ -590,7 +590,9 @@ export function update_stream_privacy_choices(policy: string): void {
if (!overlays.streams_open()) {
return;
}
+ // eslint-disable-next-line no-jquery/no-sizzle
const stream_edit_panel_opened = $("#stream_permission_settings").is(":visible");
+ // eslint-disable-next-line no-jquery/no-sizzle
const stream_creation_form_opened = $("#stream-creation").is(":visible");
if (!stream_edit_panel_opened && !stream_creation_form_opened) {
diff --git a/web/src/user_card_popover.ts b/web/src/user_card_popover.ts
index a37d65488e5..5d87a2cf648 100644
--- a/web/src/user_card_popover.ts
+++ b/web/src/user_card_popover.ts
@@ -94,6 +94,7 @@ class PopoverMenu {
const $popover = $(this.instance.popper);
+ // eslint-disable-next-line no-jquery/no-sizzle
const $items = $("[tabindex='0']", $popover).filter(":visible");
popover_items_handle_keyboard_with_overrides(key, $items);
@@ -631,6 +632,7 @@ function get_user_card_popover_for_message_items(): JQuery | undefined {
// Return only the popover menu options that are visible, and not the
// copy buttons or the link items in the custom profile fields.
+ // eslint-disable-next-line no-jquery/no-sizzle
return $(".link-item .popover-menu-link", $popover).filter(":visible");
}
diff --git a/web/src/user_group_popover.ts b/web/src/user_group_popover.ts
index 7a8f248b956..ac8e8d9e875 100644
--- a/web/src/user_group_popover.ts
+++ b/web/src/user_group_popover.ts
@@ -46,6 +46,7 @@ function get_user_group_popover_items(): JQuery | undefined {
return undefined;
}
+ // eslint-disable-next-line no-jquery/no-sizzle
return $("li:not(.divider):visible a", $popover);
}