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/prefer-at.

Anders Kaseorgea28083ba4ad
diff --git a/web/src/search_suggestion.js b/web/src/search_suggestion.js
index a1f3fa2d060..966dbcf4bdb 100644
--- a/web/src/search_suggestion.js
+++ b/web/src/search_suggestion.js
@@ -720,7 +720,7 @@ export function get_search_result(base_query, query) {
const search_operators = Filter.parse(query);
let last = {operator: "", operand: "", negated: false};
if (search_operators.length > 0) {
- last = search_operators.slice(-1)[0];
+ last = search_operators.at(-1);
} else if (page_params.search_pills_enabled) {
// We push an empty term so that we can get suggestions
// on the empty string based on the base query which is
diff --git a/web/src/settings_profile_fields.js b/web/src/settings_profile_fields.js
index 874330cb5dd..26583f16ac5 100644
--- a/web/src/settings_profile_fields.js
+++ b/web/src/settings_profile_fields.js
@@ -182,7 +182,7 @@ function get_value_for_new_option(container) {
existing_option_values.push(Number.parseInt($(this).attr("data-value"), 10));
});
existing_option_values.sort();
- return existing_option_values[existing_option_values.length - 1] + 1;
+ return existing_option_values.at(-1) + 1;
}
function create_choice_row(container) {
diff --git a/web/src/upload.js b/web/src/upload.js
index 62c7360d994..4082ecb0449 100644
--- a/web/src/upload.js
+++ b/web/src/upload.js
@@ -344,7 +344,7 @@ export function setup_upload(config) {
// TODO: Ideally, we'd be using the `.error()` hook or
// something, not parsing error message strings.
const infoList = uppy.getState().info;
- const info = infoList[infoList.length - 1];
+ const info = infoList.at(-1);
if (info.type === "error" && info.message === "No Internet connection") {
// server_events already handles the case of no internet.
return;