From ea28083ba4addfc2b1847f7b5dee7619ed982606 Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Thu, 11 May 2023 12:49:21 -0700 Subject: [PATCH] eslint: Fix unicorn/prefer-at. Signed-off-by: Anders Kaseorg --- web/src/search_suggestion.js | 2 +- web/src/settings_profile_fields.js | 2 +- web/src/upload.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/src/search_suggestion.js b/web/src/search_suggestion.js index a1f3fa2d06..966dbcf4bd 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 874330cb5d..26583f16ac 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 62c7360d99..4082ecb044 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;