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: Fix unicorn/operator-assignment.

Anders Kaseorg27813a9b7f06
diff --git a/web/src/channel_folders_ui.ts b/web/src/channel_folders_ui.ts
index 456919d76e7..bddbb08c2ec 100644
--- a/web/src/channel_folders_ui.ts
+++ b/web/src/channel_folders_ui.ts
@@ -151,7 +151,7 @@ function archive_folder(folder_id: number): void {
}
function on_success(): void {
- successful_requests = successful_requests + 1;
+ successful_requests += 1;
if (successful_requests === stream_ids.length) {
// Make request to archive folder only after all channels
diff --git a/web/src/compose_paste.ts b/web/src/compose_paste.ts
index 76566fa50b6..71debbee8bc 100644
--- a/web/src/compose_paste.ts
+++ b/web/src/compose_paste.ts
@@ -575,7 +575,7 @@ export function paste_handler_converter(
let delimiter = "`";
const matches: string[] = code.match(/`+/gm) ?? [];
while (matches.includes(delimiter)) {
- delimiter = delimiter + "`";
+ delimiter += "`";
}
return delimiter + extraSpace + code + extraSpace + delimiter;
diff --git a/web/src/compose_reply.ts b/web/src/compose_reply.ts
index d2ccfb3d0b8..5eecf88eeb6 100644
--- a/web/src/compose_reply.ts
+++ b/web/src/compose_reply.ts
@@ -831,7 +831,7 @@ export let get_message_selection = (selection = window.getSelection()): string =
// the message_content div or its descendants, if any, then convert the html
// in those ranges to markdown for quoting (firefox can have multiple ranges
// in one selection), and also compute their combined bounding rect.
- for (let i = 0; i < selection.rangeCount; i = i + 1) {
+ for (let i = 0; i < selection.rangeCount; i += 1) {
let range = selection.getRangeAt(i);
const range_common_ancestor = range.commonAncestorContainer;
let html_to_convert = "";
diff --git a/web/src/compose_ui.ts b/web/src/compose_ui.ts
index 2a106c830a8..58fc38eef01 100644
--- a/web/src/compose_ui.ts
+++ b/web/src/compose_ui.ts
@@ -322,7 +322,7 @@ export function smart_insert_block(
// are at least padding_newlines number of new lines between
// the content block and the content after the cursor, if any.
const new_lines_needed_after_count = padding_newlines - new_lines_after_count;
- syntax = syntax + "\n".repeat(new_lines_needed_after_count);
+ syntax += "\n".repeat(new_lines_needed_after_count);
insert_and_scroll_into_view(syntax, $textarea);
}
@@ -1218,7 +1218,7 @@ export let format_text = (
spoiler_syntax_start_without_break = "\n" + spoiler_syntax_start_without_break;
}
if (range.end < text.length && text[range.end] !== "\n") {
- spoiler_syntax_end = spoiler_syntax_end + "\n";
+ spoiler_syntax_end += "\n";
}
const spoiler_syntax_start_with_header = spoiler_syntax_start_without_break + "Header\n";
@@ -1471,7 +1471,7 @@ export let format_text = (
block_code_syntax_start = "\n" + block_code_syntax_start;
}
if (range.end < text.length && text[range.end] !== "\n") {
- block_code_syntax_end = block_code_syntax_end + "\n";
+ block_code_syntax_end += "\n";
}
const added_fence = format(block_code_syntax_start, block_code_syntax_end);
if (added_fence) {
@@ -1508,7 +1508,7 @@ export let format_text = (
quote_syntax_start = "\n" + quote_syntax_start;
}
if (range.end < text.length && text[range.end] !== "\n") {
- quote_syntax_end = quote_syntax_end + "\n";
+ quote_syntax_end += "\n";
}
format(quote_syntax_start, quote_syntax_end);
break;
@@ -1532,7 +1532,7 @@ export let format_text = (
block_latex_syntax_start = "\n" + block_latex_syntax_start;
}
if (range.end < text.length && text[range.end] !== "\n") {
- block_latex_syntax_end = block_latex_syntax_end + "\n";
+ block_latex_syntax_end += "\n";
}
format(block_latex_syntax_start, block_latex_syntax_end);
} else {
diff --git a/web/src/composebox_typeahead.ts b/web/src/composebox_typeahead.ts
index 3654eb4dc15..97e41c95fe8 100644
--- a/web/src/composebox_typeahead.ts
+++ b/web/src/composebox_typeahead.ts
@@ -1417,7 +1417,7 @@ export function content_typeahead_selected(
case "slash":
beginning = beginning.slice(0, -token.length - 1) + "/" + item.name + " ";
if (item.placeholder) {
- beginning = beginning + item.placeholder;
+ beginning += item.placeholder;
highlight.start = item.name.length + 2;
highlight.end = highlight.start + item.placeholder.length;
}
@@ -1465,7 +1465,7 @@ export function content_typeahead_selected(
// If there is more text after the cursor, then don't
// touch "rest" (i.e. do not add a closing fence)
if (rest === "") {
- beginning = beginning + "\n";
+ beginning += "\n";
rest = "\n" + beginning.slice(Math.max(0, backticks - 4), backticks).trim() + rest;
}
break;
diff --git a/web/src/emoji_picker.ts b/web/src/emoji_picker.ts
index f4ecb879f8b..cb6692c2062 100644
--- a/web/src/emoji_picker.ts
+++ b/web/src/emoji_picker.ts
@@ -581,7 +581,7 @@ function get_next_emoji_coordinates(move_by: number): {section: number; index: n
let next_index = current_index + move_by;
let max_len;
if (next_index < 0) {
- next_section = next_section - 1;
+ next_section -= 1;
if (next_section >= 0) {
next_index = get_max_index(next_section)! - 1;
if (move_by === -6) {
@@ -592,7 +592,7 @@ function get_next_emoji_coordinates(move_by: number): {section: number; index: n
}
}
} else if (next_index >= get_max_index(next_section)!) {
- next_section = next_section + 1;
+ next_section += 1;
if (next_section < get_total_sections()) {
next_index = 0;
if (move_by === 6) {
diff --git a/web/src/settings_streams.ts b/web/src/settings_streams.ts
index 90d61b329f0..e88b3da7dbf 100644
--- a/web/src/settings_streams.ts
+++ b/web/src/settings_streams.ts
@@ -179,7 +179,7 @@ function show_add_default_streams_modal(): void {
url: "/json/default_streams",
data,
success() {
- successful_requests = successful_requests + 1;
+ successful_requests += 1;
if (successful_requests === chosen_streams.size) {
dialog_widget.close();
diff --git a/web/src/spoilers.ts b/web/src/spoilers.ts
index 2bd0bd95ca4..031c95a88a8 100644
--- a/web/src/spoilers.ts
+++ b/web/src/spoilers.ts
@@ -43,9 +43,9 @@ export const hide_spoilers_in_notification = ($content: JQuery): JQuery => {
$(elem).find(".spoiler-content").remove();
let text = $(elem).find(".spoiler-header").text().trim();
if (text.length > 0) {
- text = `${text} `;
+ text += " ";
}
- text = `${text}(…)`;
+ text += "(…)";
$(elem).find(".spoiler-header").text(text);
});
return $content;
diff --git a/web/src/user_deactivation_ui.ts b/web/src/user_deactivation_ui.ts
index 7cabb3cd374..158722284e4 100644
--- a/web/src/user_deactivation_ui.ts
+++ b/web/src/user_deactivation_ui.ts
@@ -46,7 +46,7 @@ export function confirm_deactivation(
let number_of_invites_by_user = 0;
for (const invite of data.invites) {
if (invite.invited_by_user_id === user_id) {
- number_of_invites_by_user = number_of_invites_by_user + 1;
+ number_of_invites_by_user += 1;
}
}
diff --git a/web/src/user_group_edit.ts b/web/src/user_group_edit.ts
index 62bb577aee1..bf3357daf48 100644
--- a/web/src/user_group_edit.ts
+++ b/web/src/user_group_edit.ts
@@ -759,7 +759,7 @@ export function add_assigned_permission_to_permissions_panel(
break;
}
if ($subsection_elem.find(`.prop-element[name="${CSS.escape(name)}"`).length > 0) {
- insert_position = insert_position + 1;
+ insert_position += 1;
}
}
diff --git a/web/tests/activity.test.cjs b/web/tests/activity.test.cjs
index 7f31a55d8a4..174069049ee 100644
--- a/web/tests/activity.test.cjs
+++ b/web/tests/activity.test.cjs
@@ -410,7 +410,7 @@ test("insert_one_user_into_empty_list", ({override}) => {
},
should_add_guest_user_indicator: false,
});
- num_calls = num_calls + 1;
+ num_calls += 1;
return "<presence-row>";
});
diff --git a/web/tests/message_list_data.test.cjs b/web/tests/message_list_data.test.cjs
index 31fbb0a5661..ca610ba4fe1 100644
--- a/web/tests/message_list_data.test.cjs
+++ b/web/tests/message_list_data.test.cjs
@@ -249,7 +249,7 @@ run_test("muting", () => {
let unmuted_messages_calls = 0;
mld.unmuted_messages = (messages) => {
- unmuted_messages_calls = unmuted_messages_calls + 1;
+ unmuted_messages_calls += 1;
return messages;
};