Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix unicorn/consistent-existence-index-check.
Anders Kaseorg3b79a534a2a9
diff --git a/web/src/buddy_list.ts b/web/src/buddy_list.tsindex b192a7bc905..f4812d402f3 100644--- a/web/src/buddy_list.ts+++ b/web/src/buddy_list.ts@@ -746,7 +746,7 @@ export class BuddyList extends BuddyListConf {this.other_user_ids,]) {const pos = user_id_list.indexOf(opts.user_id);- if (pos >= 0) {+ if (pos !== -1) {user_id_list.splice(pos, 1);was_removed = true;break;@@ -829,7 +829,7 @@ export class BuddyList extends BuddyListConf {// it yet.const pos = this.all_user_ids.indexOf(user_id);- if (pos < 0) {+ if (pos === -1) {return undefined;}diff --git a/web/src/color_data.ts b/web/src/color_data.tsindex 106257fcaf5..1698097d791 100644--- a/web/src/color_data.ts+++ b/web/src/color_data.ts@@ -43,7 +43,7 @@ reset();export function claim_color(color: string): void {const i = unused_colors.indexOf(color);- if (i < 0) {+ if (i === -1) {return;}diff --git a/web/src/components.ts b/web/src/components.tsindex 397fa0f9d4d..0d22a0a2773 100644--- a/web/src/components.ts+++ b/web/src/components.ts@@ -187,7 +187,7 @@ export function toggle(opts: {const idx = opts.values.indexOf(value);- if (idx >= 0) {+ if (idx !== -1) {select_tab(idx);}},diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.tsindex dac6e789e64..2616cdae153 100644--- a/web/src/recent_view_ui.ts+++ b/web/src/recent_view_ui.ts@@ -415,7 +415,7 @@ export function revive_current_focus(): boolean {const last_visited_topic_index = current_list.findIndex((topic) => topic.last_msg_id === topic_last_msg_id,);- if (last_visited_topic_index >= 0) {+ if (last_visited_topic_index !== -1) {row_focus = last_visited_topic_index;}}diff --git a/web/src/search_suggestion.ts b/web/src/search_suggestion.tsindex 314aa85253d..d8075e20bb4 100644--- a/web/src/search_suggestion.ts+++ b/web/src/search_suggestion.ts@@ -233,7 +233,7 @@ function get_group_suggestions(last: NarrowTerm, terms: NarrowTerm[]): Suggestioconst last_comma_index = operand.lastIndexOf(",");let all_but_last_part;let last_part;- if (last_comma_index < 0) {+ if (last_comma_index === -1) {all_but_last_part = operand;last_part = "";} else {diff --git a/web/src/stream_list_sort.ts b/web/src/stream_list_sort.tsindex 8c0eaeb7b99..50c2e7f1d11 100644--- a/web/src/stream_list_sort.ts+++ b/web/src/stream_list_sort.ts@@ -183,7 +183,7 @@ export function first_stream_id(): number | undefined {export function prev_stream_id(stream_id: number): number | undefined {const i = all_streams.indexOf(stream_id);- if (i < 0) {+ if (i === -1) {return undefined;}@@ -193,7 +193,7 @@ export function prev_stream_id(stream_id: number): number | undefined {export function next_stream_id(stream_id: number): number | undefined {const i = all_streams.indexOf(stream_id);- if (i < 0) {+ if (i === -1) {return undefined;}diff --git a/web/src/topic_generator.ts b/web/src/topic_generator.tsindex 0ab63adb9fb..e91566f8f20 100644--- a/web/src/topic_generator.ts+++ b/web/src/topic_generator.ts@@ -163,7 +163,7 @@ export function get_next_stream(curr_stream_id: number): number | undefined {const my_streams = stream_list_sort.get_stream_ids();const curr_stream_index = my_streams.indexOf(curr_stream_id);return my_streams[- curr_stream_index < 0 || curr_stream_index === my_streams.length - 1+ curr_stream_index === -1 || curr_stream_index === my_streams.length - 1? 0: curr_stream_index + 1];