From 1ee18a7fa33a14058c68c3a7a6c85f96522bce0c Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Wed, 3 Jun 2026 01:56:18 +0300 Subject: [PATCH] cleaned up lodash imports --- src/components/chat/chat.js | 4 ++-- src/components/edit_status_modal/edit_status_modal.js | 2 +- src/components/post_status_modal/post_status_modal.js | 2 +- src/components/search/search.js | 3 +-- src/components/settings_modal/tabs/mutes_and_blocks_tab.js | 4 +--- src/components/staff_panel/staff_panel.js | 3 +-- src/components/user_card/user_card.js | 5 +---- src/components/user_profile/user_profile.js | 2 +- src/hocs/with_load_more/with_load_more.jsx | 2 +- src/hocs/with_subscription/with_subscription.jsx | 2 +- src/lib/persisted_state.js | 3 +-- src/services/chat_service/chat_service.js | 6 +++--- src/services/component_utils/component_utils.js | 2 +- src/services/locale/locale.service.js | 4 ++-- src/stores/reports.js | 2 +- 15 files changed, 19 insertions(+), 27 deletions(-) diff --git a/src/components/chat/chat.js b/src/components/chat/chat.js index caeb2aea7..2fef86c0a 100644 --- a/src/components/chat/chat.js +++ b/src/components/chat/chat.js @@ -1,4 +1,4 @@ -import _ from 'lodash' +import { throttle } from 'lodash' import { mapState as mapPiniaState } from 'pinia' import { mapGetters, mapState } from 'vuex' @@ -224,7 +224,7 @@ const Chat = { } }, 5000) }, - handleScroll: _.throttle(function () { + handleScroll: throttle(function () { this.lastScrollPosition = getScrollPosition() if (!this.currentChat) { return diff --git a/src/components/edit_status_modal/edit_status_modal.js b/src/components/edit_status_modal/edit_status_modal.js index 88e92c156..5922e5167 100644 --- a/src/components/edit_status_modal/edit_status_modal.js +++ b/src/components/edit_status_modal/edit_status_modal.js @@ -1,4 +1,4 @@ -import get from 'lodash/get' +import { get } from 'lodash' import { defineAsyncComponent } from 'vue' import Modal from '../modal/modal.vue' diff --git a/src/components/post_status_modal/post_status_modal.js b/src/components/post_status_modal/post_status_modal.js index 091b056e5..90326da51 100644 --- a/src/components/post_status_modal/post_status_modal.js +++ b/src/components/post_status_modal/post_status_modal.js @@ -1,4 +1,4 @@ -import get from 'lodash/get' +import { get } from 'lodash' import { defineAsyncComponent } from 'vue' import Modal from '../modal/modal.vue' diff --git a/src/components/search/search.js b/src/components/search/search.js index b8812d0ac..23710b390 100644 --- a/src/components/search/search.js +++ b/src/components/search/search.js @@ -1,5 +1,4 @@ -import { uniqBy } from 'lodash' -import map from 'lodash/map' +import { uniqBy, map } from 'lodash' import TabSwitcher from 'src/components/tab_switcher/tab_switcher.jsx' import Conversation from '../conversation/conversation.vue' diff --git a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js index cb198619f..3b82bbb4c 100644 --- a/src/components/settings_modal/tabs/mutes_and_blocks_tab.js +++ b/src/components/settings_modal/tabs/mutes_and_blocks_tab.js @@ -1,6 +1,4 @@ -import get from 'lodash/get' -import map from 'lodash/map' -import reject from 'lodash/reject' +import { get, map, reject } from 'lodash' import withLoadMore from 'src/components/../hocs/with_load_more/with_load_more' import withSubscription from 'src/components/../hocs/with_subscription/with_subscription' diff --git a/src/components/staff_panel/staff_panel.js b/src/components/staff_panel/staff_panel.js index 3f271f4d3..b659b3b75 100644 --- a/src/components/staff_panel/staff_panel.js +++ b/src/components/staff_panel/staff_panel.js @@ -1,5 +1,4 @@ -import groupBy from 'lodash/groupBy' -import map from 'lodash/map' +import { map, groupBy } from 'lodash' import { mapGetters, mapState } from 'vuex' import BasicUserCard from '../basic_user_card/basic_user_card.vue' diff --git a/src/components/user_card/user_card.js b/src/components/user_card/user_card.js index bcb5f9ddc..d7a9d4403 100644 --- a/src/components/user_card/user_card.js +++ b/src/components/user_card/user_card.js @@ -1,7 +1,4 @@ -import ldEscape from 'lodash/escape' -import isEqual from 'lodash/isEqual' -import merge from 'lodash/merge' -import ldUnescape from 'lodash/unescape' +import { escape as ldEscape, isEqual, merge, unescape as ldUnescape } from 'lodash' import { mapState } from 'pinia' import Checkbox from 'src/components/checkbox/checkbox.vue' diff --git a/src/components/user_profile/user_profile.js b/src/components/user_profile/user_profile.js index 17d69f49b..8d24feeee 100644 --- a/src/components/user_profile/user_profile.js +++ b/src/components/user_profile/user_profile.js @@ -1,4 +1,4 @@ -import get from 'lodash/get' +import { get } from 'lodash' import { mapState } from 'pinia' import RichContent from 'src/components/rich_content/rich_content.jsx' diff --git a/src/hocs/with_load_more/with_load_more.jsx b/src/hocs/with_load_more/with_load_more.jsx index 9cb9d78c4..e839f796f 100644 --- a/src/hocs/with_load_more/with_load_more.jsx +++ b/src/hocs/with_load_more/with_load_more.jsx @@ -1,6 +1,6 @@ // eslint-disable-next-line no-unused -import isEmpty from 'lodash/isEmpty' +import { isEmpty } from 'lodash' import { h } from 'vue' import { getComponentProps } from '../../services/component_utils/component_utils' diff --git a/src/hocs/with_subscription/with_subscription.jsx b/src/hocs/with_subscription/with_subscription.jsx index 198be6862..7805161c6 100644 --- a/src/hocs/with_subscription/with_subscription.jsx +++ b/src/hocs/with_subscription/with_subscription.jsx @@ -1,6 +1,6 @@ // eslint-disable-next-line no-unused -import isEmpty from 'lodash/isEmpty' +import { isEmpty } from 'lodash' import { h } from 'vue' import { getComponentProps } from '../../services/component_utils/component_utils' diff --git a/src/lib/persisted_state.js b/src/lib/persisted_state.js index f7e2b0b08..2f8892f27 100644 --- a/src/lib/persisted_state.js +++ b/src/lib/persisted_state.js @@ -1,5 +1,4 @@ -import { cloneDeep, each, get, set } from 'lodash' -import merge from 'lodash.merge' +import { cloneDeep, each, get, set, merge } from 'lodash' import { storage } from './storage.js' diff --git a/src/services/chat_service/chat_service.js b/src/services/chat_service/chat_service.js index f6d381d6e..314f9bb0c 100644 --- a/src/services/chat_service/chat_service.js +++ b/src/services/chat_service/chat_service.js @@ -1,4 +1,4 @@ -import _ from 'lodash' +import { maxBy, minBy } from 'lodash' const empty = (chatId) => { return { @@ -42,12 +42,12 @@ const deleteMessage = (storage, messageId) => { delete storage.idIndex[messageId] if (storage.maxId === messageId) { - const lastMessage = _.maxBy(storage.messages, 'id') + const lastMessage = maxBy(storage.messages, 'id') storage.maxId = lastMessage.id } if (storage.minId === messageId) { - const firstMessage = _.minBy(storage.messages, 'id') + const firstMessage = minBy(storage.messages, 'id') storage.minId = firstMessage.id } } diff --git a/src/services/component_utils/component_utils.js b/src/services/component_utils/component_utils.js index 49a110860..1973a7923 100644 --- a/src/services/component_utils/component_utils.js +++ b/src/services/component_utils/component_utils.js @@ -1,4 +1,4 @@ -import isFunction from 'lodash/isFunction' +import { isFunction } from 'lodash' const getComponentOptions = (Component) => isFunction(Component) ? Component.options : Component diff --git a/src/services/locale/locale.service.js b/src/services/locale/locale.service.js index 9fe62318c..bdc07c1ec 100644 --- a/src/services/locale/locale.service.js +++ b/src/services/locale/locale.service.js @@ -1,5 +1,5 @@ import ISO6391 from 'iso-639-1' -import _ from 'lodash' +import { map } from 'lodash' import languagesObject from '../../i18n/messages' @@ -35,7 +35,7 @@ const getLanguageName = (code) => { ) } -const languages = _.map(languagesObject.languages, (code) => ({ +const languages = map(languagesObject.languages, (code) => ({ code, name: getLanguageName(code), })).sort((a, b) => a.name.localeCompare(b.name)) diff --git a/src/stores/reports.js b/src/stores/reports.js index d2cd4fd7c..d3acebcb4 100644 --- a/src/stores/reports.js +++ b/src/stores/reports.js @@ -1,4 +1,4 @@ -import filter from 'lodash/filter' +import { filter } from 'lodash' import { defineStore } from 'pinia' import { useInterfaceStore } from 'src/stores/interface.js'