diff --git a/jest.config.js b/jest.config.js index 8185b29f82..c2f1a6bb6a 100644 --- a/jest.config.js +++ b/jest.config.js @@ -18,6 +18,7 @@ module.exports = { setupFilesAfterEnv: ['/test-utils/setup-tests-after.ts'], moduleNameMapper: { '\\.(css|less|scss|sass)$': 'jest-transform-css', + '^lodash-es$': 'lodash', }, testMatch: ['**/*.test.[jt]s?(x)'], testPathIgnorePatterns: ['.visual.'], diff --git a/package-lock.json b/package-lock.json index e6e5521341..a631c7499f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@hello-pangea/dnd": "^18.0.1", "@tanstack/react-virtual": "^3.13.9", "blueimp-md5": "^2.19.0", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "rc-slider": "^11.1.8", "react-transition-group": "^4.4.5", "react-virtualized-auto-sizer": "^1.0.26", @@ -53,7 +53,7 @@ "@types/blueimp-md5": "^2.18.2", "@types/chroma-js": "^3.1.1", "@types/jest": "^29.5.14", - "@types/lodash": "^4.17.17", + "@types/lodash-es": "^4.17.12", "@types/react": "^18.3.23", "@types/react-dom": "^18.3.7", "@types/react-transition-group": "^4.4.12", @@ -6846,6 +6846,16 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/lodash-es": { + "version": "4.17.12", + "resolved": "https://registry.npmjs.org/@types/lodash-es/-/lodash-es-4.17.12.tgz", + "integrity": "sha512-0NgftHUcV4v34VhXm8QBSftKVXtbkBG3ViCjs6+eJ5a6y6Mi/jiFGPc1sC7QK+9BFhWrURE3EOggmWaSxL9OzQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/lodash": "*" + } + }, "node_modules/@types/mdx": { "version": "2.0.13", "resolved": "https://registry.npmjs.org/@types/mdx/-/mdx-2.0.13.tgz", @@ -18136,6 +18146,13 @@ "version": "4.17.21", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, + "node_modules/lodash-es": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash-es/-/lodash-es-4.17.21.tgz", + "integrity": "sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==", "license": "MIT" }, "node_modules/lodash.camelcase": { diff --git a/package.json b/package.json index 0042c54e03..7a9f1b3bfe 100644 --- a/package.json +++ b/package.json @@ -133,7 +133,7 @@ "@hello-pangea/dnd": "^18.0.1", "@tanstack/react-virtual": "^3.13.9", "blueimp-md5": "^2.19.0", - "lodash": "^4.17.21", + "lodash-es": "^4.17.21", "rc-slider": "^11.1.8", "react-transition-group": "^4.4.5", "react-virtualized-auto-sizer": "^1.0.26", @@ -170,7 +170,7 @@ "@types/blueimp-md5": "^2.18.2", "@types/chroma-js": "^3.1.1", "@types/jest": "^29.5.14", - "@types/lodash": "^4.17.17", + "@types/lodash-es": "^4.17.12", "@types/react": "^18.3.23", "@types/react-dom": "^18.3.7", "@types/react-transition-group": "^4.4.12", diff --git a/src/components/ActionsPanel/components/hooks/useDropdownActions.ts b/src/components/ActionsPanel/components/hooks/useDropdownActions.ts index 0e00ab380c..b71488ced3 100644 --- a/src/components/ActionsPanel/components/hooks/useDropdownActions.ts +++ b/src/components/ActionsPanel/components/hooks/useDropdownActions.ts @@ -1,6 +1,6 @@ 'use client'; -import groupBy from 'lodash/groupBy'; +import {groupBy} from 'lodash-es'; import type {DropdownMenuItem} from '../../../DropdownMenu'; import type {ActionsPanelItem} from '../../types'; diff --git a/src/components/Hotkey/parse.ts b/src/components/Hotkey/parse.ts index 5b99cf35c6..91c3356060 100644 --- a/src/components/Hotkey/parse.ts +++ b/src/components/Hotkey/parse.ts @@ -1,5 +1,4 @@ -import capitalize from 'lodash/capitalize'; -import uniqBy from 'lodash/uniqBy'; +import {capitalize, uniqBy} from 'lodash-es'; import type {KeyDefs, KeyParser, PlatformDefs} from './types'; import {split} from './utils'; diff --git a/src/components/List/List.tsx b/src/components/List/List.tsx index 6eb9f86b0c..3af8a6936e 100644 --- a/src/components/List/List.tsx +++ b/src/components/List/List.tsx @@ -10,8 +10,7 @@ import type { DroppableProvided, } from '@hello-pangea/dnd'; import {DragDropContext, Draggable, Droppable} from '@hello-pangea/dnd'; -import isEqual from 'lodash/isEqual'; -import isObject from 'lodash/isObject'; +import {isEqual, isObject} from 'lodash-es'; import type {Size} from 'react-virtualized-auto-sizer'; import AutoSizer from 'react-virtualized-auto-sizer'; import type {VariableSizeListProps} from 'react-window'; diff --git a/src/components/Pagination/utils.ts b/src/components/Pagination/utils.ts index e5b0ccdfee..78fa96f886 100644 --- a/src/components/Pagination/utils.ts +++ b/src/components/Pagination/utils.ts @@ -1,4 +1,4 @@ -import uniq from 'lodash/uniq'; +import {uniq} from 'lodash-es'; import type {PaginationSize} from './types'; diff --git a/src/components/Select/__stories__/Select.stories.tsx b/src/components/Select/__stories__/Select.stories.tsx index 1d60e36e23..d8647fd1f9 100644 --- a/src/components/Select/__stories__/Select.stories.tsx +++ b/src/components/Select/__stories__/Select.stories.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import {Plus, TrashBin} from '@gravity-ui/icons'; import type {Decorator, Meta, StoryObj} from '@storybook/react-webpack5'; -import escapeRegExp from 'lodash/escapeRegExp'; +import {escapeRegExp} from 'lodash-es'; import {useArgs} from 'storybook/preview-api'; import {Select} from '..'; diff --git a/src/components/Table/Table.tsx b/src/components/Table/Table.tsx index b201a2eee4..3bc3100dde 100644 --- a/src/components/Table/Table.tsx +++ b/src/components/Table/Table.tsx @@ -2,8 +2,7 @@ import * as React from 'react'; -import get from 'lodash/get'; -import has from 'lodash/has'; +import {get, has} from 'lodash-es'; import type {AriaLabelingProps, QAProps} from '../types'; import {block} from '../utils/cn'; diff --git a/src/components/Table/__stories__/Adaptive.tsx b/src/components/Table/__stories__/Adaptive.tsx index 55d6c90ad5..bf0813f826 100644 --- a/src/components/Table/__stories__/Adaptive.tsx +++ b/src/components/Table/__stories__/Adaptive.tsx @@ -1,5 +1,5 @@ import type {StoryFn} from '@storybook/react-webpack5'; -import cloneDeep from 'lodash/cloneDeep'; +import {cloneDeep} from 'lodash-es'; import {Table} from '../Table'; import type {TableProps} from '../Table'; diff --git a/src/components/Table/__stories__/Table.stories.tsx b/src/components/Table/__stories__/Table.stories.tsx index 6dbee31965..1aaead7769 100644 --- a/src/components/Table/__stories__/Table.stories.tsx +++ b/src/components/Table/__stories__/Table.stories.tsx @@ -2,8 +2,7 @@ import * as React from 'react'; import {CircleChevronDownFill, Pencil} from '@gravity-ui/icons'; import type {Meta, StoryFn} from '@storybook/react-webpack5'; -import cloneDeep from 'lodash/cloneDeep'; -import isEqual from 'lodash/isEqual'; +import {cloneDeep, isEqual} from 'lodash-es'; import {action} from 'storybook/actions'; import type {TableAction, TableSettingsData} from '..'; diff --git a/src/components/Table/__stories__/WithTableSettingsCustomActions/WithTableSettingsCustomActions.tsx b/src/components/Table/__stories__/WithTableSettingsCustomActions/WithTableSettingsCustomActions.tsx index e2849a8214..71648b299d 100644 --- a/src/components/Table/__stories__/WithTableSettingsCustomActions/WithTableSettingsCustomActions.tsx +++ b/src/components/Table/__stories__/WithTableSettingsCustomActions/WithTableSettingsCustomActions.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; import {ArrowRotateLeft} from '@gravity-ui/icons'; -import isEqual from 'lodash/isEqual'; +import {isEqual} from 'lodash-es'; import {Button} from '../../../Button'; import type {ButtonButtonProps} from '../../../Button'; diff --git a/src/components/Table/hoc/withTableActions/withTableActions.tsx b/src/components/Table/hoc/withTableActions/withTableActions.tsx index 2613555466..361d2b0486 100644 --- a/src/components/Table/hoc/withTableActions/withTableActions.tsx +++ b/src/components/Table/hoc/withTableActions/withTableActions.tsx @@ -3,7 +3,7 @@ import * as React from 'react'; import {Ellipsis} from '@gravity-ui/icons'; -import memoize from 'lodash/memoize'; +import {memoize} from 'lodash-es'; import {useUniqId} from '../../../../hooks'; import {useBoolean} from '../../../../hooks/private'; diff --git a/src/components/Table/hoc/withTableCopy/withTableCopy.tsx b/src/components/Table/hoc/withTableCopy/withTableCopy.tsx index 377ef7a505..1bcb5a0e21 100644 --- a/src/components/Table/hoc/withTableCopy/withTableCopy.tsx +++ b/src/components/Table/hoc/withTableCopy/withTableCopy.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; -import memoize from 'lodash/memoize'; +import {memoize} from 'lodash-es'; import {ClipboardButton} from '../../../ClipboardButton'; import {block} from '../../../utils/cn'; diff --git a/src/components/Table/hoc/withTableSelection/withTableSelection.tsx b/src/components/Table/hoc/withTableSelection/withTableSelection.tsx index 734bed6386..2896a17bc7 100644 --- a/src/components/Table/hoc/withTableSelection/withTableSelection.tsx +++ b/src/components/Table/hoc/withTableSelection/withTableSelection.tsx @@ -2,10 +2,7 @@ import * as React from 'react'; -import difference from 'lodash/difference'; -import memoize from 'lodash/memoize'; -import union from 'lodash/union'; -import without from 'lodash/without'; +import {difference, memoize, union, without} from 'lodash-es'; import {Checkbox} from '../../../Checkbox'; import {block} from '../../../utils/cn'; diff --git a/src/components/Table/hoc/withTableSorting/withTableSorting.tsx b/src/components/Table/hoc/withTableSorting/withTableSorting.tsx index fca5550007..e795fc7604 100644 --- a/src/components/Table/hoc/withTableSorting/withTableSorting.tsx +++ b/src/components/Table/hoc/withTableSorting/withTableSorting.tsx @@ -2,8 +2,7 @@ import * as React from 'react'; -import get from 'lodash/get'; -import memoize from 'lodash/memoize'; +import {get, memoize} from 'lodash-es'; import {createOnKeyDownHandler} from '../../../../hooks/useActionHandlers/useActionHandlers'; import {block} from '../../../utils/cn'; diff --git a/src/components/layout/utils/overrideLayoutTheme.ts b/src/components/layout/utils/overrideLayoutTheme.ts index 6142348863..d71ede460e 100644 --- a/src/components/layout/utils/overrideLayoutTheme.ts +++ b/src/components/layout/utils/overrideLayoutTheme.ts @@ -1,4 +1,4 @@ -import merge from 'lodash/merge'; +import {merge} from 'lodash-es'; import type {LayoutTheme, RecursivePartial} from '../types'; diff --git a/src/components/legacy/Breadcrumbs/Breadcrumbs.tsx b/src/components/legacy/Breadcrumbs/Breadcrumbs.tsx index 720cfb840f..1c30cac00f 100644 --- a/src/components/legacy/Breadcrumbs/Breadcrumbs.tsx +++ b/src/components/legacy/Breadcrumbs/Breadcrumbs.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; -import throttle from 'lodash/throttle'; +import {throttle} from 'lodash-es'; import type {PopupPlacement} from '../../Popup'; import type {QAProps} from '../../types'; diff --git a/src/components/useList/hooks/useListFilter.ts b/src/components/useList/hooks/useListFilter.ts index 4f75a98b46..c3472062fd 100644 --- a/src/components/useList/hooks/useListFilter.ts +++ b/src/components/useList/hooks/useListFilter.ts @@ -1,6 +1,6 @@ import * as React from 'react'; -import debounce from 'lodash/debounce'; +import {debounce} from 'lodash-es'; import type {ListItemType} from '../types'; import {defaultFilterItems} from '../utils/defaultFilterItems'; diff --git a/src/hooks/private/useElementSize/useElementSize.ts b/src/hooks/private/useElementSize/useElementSize.ts index 18ca7656b4..6787a77f0e 100644 --- a/src/hooks/private/useElementSize/useElementSize.ts +++ b/src/hooks/private/useElementSize/useElementSize.ts @@ -1,7 +1,6 @@ import * as React from 'react'; -import round from 'lodash/round'; -import throttle from 'lodash/throttle'; +import {round, throttle} from 'lodash-es'; const RESIZE_THROTTLE = 16; const ROUND_PRECISION = 2;