Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
eslint: Fix unicorn/no-subtraction-comparison.
Anders Kaseorga4beb5d17342
diff --git a/web/src/components.ts b/web/src/components.tsindex 00c0d3d9abd..9dcbe2c73b9 100644--- a/web/src/components.ts+++ b/web/src/components.ts@@ -104,7 +104,7 @@ export function toggle(opts: {function maybe_go_left(): boolean {// Select the first non-disabled tab to the left, if any.let i = 1;- while (meta.idx - i >= 0) {+ while (meta.idx >= i) {if (select_tab(meta.idx - i)) {return true;}diff --git a/web/src/inbox_ui.ts b/web/src/inbox_ui.tsindex 1696a5ba1f7..ea5d2c98862 100644--- a/web/src/inbox_ui.ts+++ b/web/src/inbox_ui.ts@@ -1934,10 +1934,7 @@ export function change_focused_element(input_key: string): boolean {const start = textInput.selectionStart ?? 0;const end = textInput.selectionEnd ?? 0;const text_length = textInput.value.length;- let is_selected = false;- if (end - start > 0) {- is_selected = true;- }+ const is_selected = end > start;switch (input_key) {case "down_arrow":diff --git a/web/src/message_list_view.ts b/web/src/message_list_view.tsindex 7a451f7c728..cd0c12e8e6e 100644--- a/web/src/message_list_view.ts+++ b/web/src/message_list_view.ts@@ -2021,7 +2021,7 @@ export class MessageListView {}prepend(messages: Message[]): void {- if (this._render_win_end - this._render_win_start === 0) {+ if (this._render_win_end === this._render_win_start) {// If the message list previously contained no visible// messages, appending and prepending are equivalent, but// the prepend logic will throw an exception, so justdiff --git a/web/src/reactions.ts b/web/src/reactions.tsindex c3bb5422b01..caad8a8f451 100644--- a/web/src/reactions.ts+++ b/web/src/reactions.ts@@ -388,7 +388,7 @@ export let insert_new_reaction = (// If the given reaction is the first reaction in a message, then we add// the whole message reactions section along with the new reaction.// Else, we insert the new reaction before the add reaction button.- if (message.clean_reactions.size - 1 === 0) {+ if (message.clean_reactions.size === 1) {const $rows = message_lists.all_rendered_row_for_message_id(message.id);const reaction_section_context = {msg: {diff --git a/web/src/recent_view_ui.ts b/web/src/recent_view_ui.tsindex fceb2c0296a..e610f1cf233 100644--- a/web/src/recent_view_ui.ts+++ b/web/src/recent_view_ui.ts@@ -1950,7 +1950,7 @@ function up_arrow_navigation(row: number, col: number): void {}const type = get_row_type(row);- if (type === "stream" && col === COLUMNS.read && row - 1 >= 0 && !has_unread(row - 1)) {+ if (type === "stream" && col === COLUMNS.read && row >= 1 && !has_unread(row - 1)) {col_focus = COLUMNS.topic;}}@@ -2101,10 +2101,7 @@ export function change_focused_element($elt: JQuery, input_key: string): booleanconst start = textInput.selectionStart!;const end = textInput.selectionEnd!;const text_length = textInput.value.length;- let is_selected = false;- if (end - start > 0) {- is_selected = true;- }+ const is_selected = end > start;switch (input_key) {// Allow browser to handle alldiff --git a/web/src/timerender.ts b/web/src/timerender.tsindex 256d244bfea..8a2d0952f33 100644--- a/web/src/timerender.ts+++ b/web/src/timerender.ts@@ -520,7 +520,7 @@ export function format_time_modern(time: number | Date, today = new Date()): strexport function absolute_time(timestamp: number): string {const today = new Date();const date = new Date(timestamp);- const is_older_year = today.getFullYear() - date.getFullYear() > 0;+ const is_older_year = today.getFullYear() > date.getFullYear();return get_localized_date_or_time_for_format(date,