mirror of https://github.com/zulip/zulip.git
eslint: Fix unicorn/consistent-existence-index-check.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
5cbe3203f5
commit
3b79a534a2
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -187,7 +187,7 @@ export function toggle(opts: {
|
|||
|
||||
const idx = opts.values.indexOf(value);
|
||||
|
||||
if (idx >= 0) {
|
||||
if (idx !== -1) {
|
||||
select_tab(idx);
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -233,7 +233,7 @@ function get_group_suggestions(last: NarrowTerm, terms: NarrowTerm[]): Suggestio
|
|||
const 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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue