From d771a4ed8ecb67fd5f40a2b65e645e0f159becd7 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Tue, 8 Oct 2024 17:40:53 +0200 Subject: [PATCH 01/11] fix eslint import restrictions --- .eslintrc.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 797b84522df3f..79f9fac1e46ae 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1007,6 +1007,7 @@ module.exports = { 'error', { patterns: ['**/legacy_uptime/*'], + paths: RESTRICTED_IMPORTS, }, ], }, @@ -1048,6 +1049,7 @@ module.exports = { { // prevents UI code from importing server side code and then webpack including it when doing builds patterns: ['**/server/*'], + paths: RESTRICTED_IMPORTS, }, ], }, @@ -1106,6 +1108,7 @@ module.exports = { { // prevents UI code from importing server side code and then webpack including it when doing builds patterns: ['**/server/*'], + paths: RESTRICTED_IMPORTS, }, ], }, @@ -1177,13 +1180,7 @@ module.exports = { // to help deprecation and prevent accidental re-use/continued use of code we plan on removing. If you are // finding yourself turning this off a lot for "new code" consider renaming the file and functions if it is has valid uses. patterns: ['*legacy*'], - paths: [ - { - name: 'react-router-dom', - importNames: ['Route'], - message: "import { Route } from '@kbn/kibana-react-plugin/public'", - }, - ], + paths: RESTRICTED_IMPORTS, }, ], }, @@ -1341,6 +1338,7 @@ module.exports = { { // prevents UI code from importing server side code and then webpack including it when doing builds patterns: ['**/server/*'], + paths: RESTRICTED_IMPORTS, }, ], }, @@ -1518,6 +1516,7 @@ module.exports = { // to help deprecation and prevent accidental re-use/continued use of code we plan on removing. If you are // finding yourself turning this off a lot for "new code" consider renaming the file and functions if it has valid uses. patterns: ['*legacy*'], + paths: RESTRICTED_IMPORTS, }, ], }, From d8bfa5e31a923720c4be94a50c30de72d965f43c Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Tue, 8 Oct 2024 22:00:03 +0200 Subject: [PATCH 02/11] fix react-use --- .../impl/assistant/index.test.tsx | 6 ++++-- .../quick_prompts/quick_prompts.test.tsx | 15 ++++++--------- .../assistant/quick_prompts/quick_prompts.tsx | 2 +- .../impl/assistant_context/index.test.tsx | 8 +++----- .../impl/assistant_context/index.tsx | 3 ++- .../public/common/hooks/use_availability.ts | 2 +- .../common/alerting_callout/alerting_callout.tsx | 2 +- .../monitor_add_edit/form/controlled_field.tsx | 2 +- .../monitor_status/use_monitor_status_data.ts | 2 +- .../monitors_page/hooks/use_monitor_list.ts | 2 +- .../overview/grid_by_group/grid_group_item.tsx | 2 +- .../settings/global_params/params_list.tsx | 2 +- .../contexts/synthetics_refresh_context.tsx | 2 +- .../apps/synthetics/hooks/use_monitor_name.ts | 2 +- .../top_values_popover.test.tsx | 5 +---- .../top_values_popover/top_values_popover.tsx | 2 +- .../public/assistant/provider.tsx | 2 +- .../public/attack_discovery/pages/index.test.tsx | 15 +++++---------- .../public/attack_discovery/pages/index.tsx | 2 +- .../cards/video_card/video_card.tsx | 2 +- .../onboarding/hooks/use_available_steps.ts | 2 +- .../onboarding/hooks/use_product_types.ts | 2 +- .../onboarding/hooks/use_project_features_url.ts | 2 +- .../onboarding/hooks/use_projects_url.ts | 2 +- .../onboarding/hooks/use_users_url.ts | 2 +- .../use_security_solution_navigation.tsx | 2 +- .../components/visualization_actions/actions.tsx | 2 +- .../related_integrations_help_info.tsx | 2 +- .../required_fields/required_fields_help_info.tsx | 2 +- .../final_side/final_side_help_info.tsx | 2 +- .../add_prebuilt_rules_header_buttons.tsx | 2 +- .../add_prebuilt_rules_install_button.tsx | 2 +- .../asset_criticality_selector.tsx | 2 +- 33 files changed, 48 insertions(+), 58 deletions(-) diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.test.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.test.tsx index 4b1851834cdba..d042a4cfd96f5 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.test.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/index.test.tsx @@ -15,7 +15,8 @@ import { useLoadConnectors } from '../connectorland/use_load_connectors'; import { DefinedUseQueryResult, UseQueryResult } from '@tanstack/react-query'; -import { useLocalStorage, useSessionStorage } from 'react-use'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; +import useSessionStorage from 'react-use/lib/useSessionStorage'; import { QuickPrompts } from './quick_prompts/quick_prompts'; import { mockAssistantAvailability, TestProviders } from '../mock/test_providers/test_providers'; import { useFetchCurrentUserConversations } from './api'; @@ -27,7 +28,8 @@ import { omit } from 'lodash'; jest.mock('../connectorland/use_load_connectors'); jest.mock('../connectorland/connector_setup'); -jest.mock('react-use'); +jest.mock('react-use/lib/useLocalStorage'); +jest.mock('react-use/lib/useSessionStorage'); jest.mock('./quick_prompts/quick_prompts', () => ({ QuickPrompts: jest.fn() })); jest.mock('./api/conversations/use_fetch_current_user_conversations'); diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.test.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.test.tsx index e46f54ddede40..c3927a939af92 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.test.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.test.tsx @@ -32,15 +32,12 @@ const testTitle = 'SPL_QUERY_CONVERSION_TITLE'; const testPrompt = 'SPL_QUERY_CONVERSION_PROMPT'; const customTitle = 'A_CUSTOM_OPTION'; -jest.mock('react-use', () => ({ - ...jest.requireActual('react-use'), - useMeasure: () => [ - () => {}, - { - width: 500, - }, - ], -})); +jest.mock('react-use/lib/useMeasure', () => () => [ + () => {}, + { + width: 500, + }, +]); jest.mock('../../assistant_context', () => ({ ...jest.requireActual('../../assistant_context'), diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.tsx index 036fb4fb4db3f..f2baf4528b52d 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant/quick_prompts/quick_prompts.tsx @@ -14,7 +14,7 @@ import { EuiButtonIcon, EuiButtonEmpty, } from '@elastic/eui'; -import { useMeasure } from 'react-use'; +import useMeasure from 'react-use/lib/useMeasure'; import { css } from '@emotion/react'; import { diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx index 5bd49fec6c857..3f41cf745dff0 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx @@ -8,13 +8,11 @@ import { renderHook } from '@testing-library/react-hooks'; import { useAssistantContext } from '.'; -import { useLocalStorage } from 'react-use'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; import { TestProviders } from '../mock/test_providers/test_providers'; -jest.mock('react-use', () => ({ - useLocalStorage: jest.fn().mockReturnValue(['456', jest.fn()]), - useSessionStorage: jest.fn().mockReturnValue(['456', jest.fn()]), -})); +jest.mock('react-use/lib/useLocalstorage', () => jest.fn().mockReturnValue(['456', jest.fn()])); +jest.mock('react-use/lib/useSessionStorage', () => jest.fn().mockReturnValue(['456', jest.fn()])); describe('AssistantContext', () => { beforeEach(() => jest.clearAllMocks()); diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx index 75516eaf907b2..c7b15f681a717 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.tsx @@ -10,7 +10,8 @@ import { omit } from 'lodash/fp'; import React, { useCallback, useMemo, useState, useRef } from 'react'; import type { IToasts } from '@kbn/core-notifications-browser'; import { ActionTypeRegistryContract } from '@kbn/triggers-actions-ui-plugin/public'; -import { useLocalStorage, useSessionStorage } from 'react-use'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; +import useSessionStorage from 'react-use/lib/useSessionStorage'; import type { DocLinksStart } from '@kbn/core-doc-links-browser'; import { AssistantFeatures, defaultAssistantFeatures } from '@kbn/elastic-assistant-common'; import { NavigateToAppOptions } from '@kbn/core/public'; diff --git a/x-pack/plugins/integration_assistant/public/common/hooks/use_availability.ts b/x-pack/plugins/integration_assistant/public/common/hooks/use_availability.ts index 02f523fcde226..3fdf37297ad65 100644 --- a/x-pack/plugins/integration_assistant/public/common/hooks/use_availability.ts +++ b/x-pack/plugins/integration_assistant/public/common/hooks/use_availability.ts @@ -6,7 +6,7 @@ */ import { useMemo } from 'react'; -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { MINIMUM_LICENSE_TYPE } from '../../../common/constants'; import { useKibana } from './use_kibana'; import type { RenderUpselling } from '../../services'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/alerting_callout/alerting_callout.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/alerting_callout/alerting_callout.tsx index 397b1597107c4..a6353c674d7c0 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/alerting_callout/alerting_callout.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/common/alerting_callout/alerting_callout.tsx @@ -11,7 +11,7 @@ import { useDispatch, useSelector } from 'react-redux'; import { EuiButton, EuiButtonEmpty, EuiCallOut, EuiMarkdownFormat, EuiSpacer } from '@elastic/eui'; import { syntheticsSettingsLocatorID } from '@kbn/observability-plugin/common'; import { useFetcher } from '@kbn/observability-shared-plugin/public'; -import { useSessionStorage } from 'react-use'; +import useSessionStorage from 'react-use/lib/useSessionStorage'; import { i18n } from '@kbn/i18n'; import { isEmpty } from 'lodash'; import { useKibana } from '@kbn/kibana-react-plugin/public'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/controlled_field.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/controlled_field.tsx index cc37a530087c4..ddf1db76d819f 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/controlled_field.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_add_edit/form/controlled_field.tsx @@ -7,7 +7,7 @@ import React, { useCallback, useState } from 'react'; import { EuiFormRow, EuiFormRowProps } from '@elastic/eui'; import { useSelector } from 'react-redux'; -import { useDebounce } from 'react-use'; +import useDebounce from 'react-use/lib/useDebounce'; import { ControllerRenderProps, ControllerFieldState, useFormContext } from 'react-hook-form'; import { useKibanaSpace, useIsEditFlow } from '../hooks'; import { selectServiceLocationsState } from '../../../state'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/monitor_status/use_monitor_status_data.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/monitor_status/use_monitor_status_data.ts index 8eaa80fb44a53..710ff65de7c66 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/monitor_status/use_monitor_status_data.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitor_details/monitor_status/use_monitor_status_data.ts @@ -7,7 +7,7 @@ import { useCallback, useEffect, useMemo, useState } from 'react'; import { useSelector, useDispatch } from 'react-redux'; -import { useDebounce } from 'react-use'; +import useDebounce from 'react-use/lib/useDebounce'; import { useLocation } from 'react-router-dom'; import { useSyntheticsRefreshContext } from '../../../contexts/synthetics_refresh_context'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/hooks/use_monitor_list.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/hooks/use_monitor_list.ts index 29e1f550d43cf..df8be3c98b451 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/hooks/use_monitor_list.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/hooks/use_monitor_list.ts @@ -7,7 +7,7 @@ import { useCallback, useEffect, useRef } from 'react'; import { useDispatch, useSelector } from 'react-redux'; -import { useDebounce } from 'react-use'; +import useDebounce from 'react-use/lib/useDebounce'; import { useMonitorFiltersState } from '../common/monitor_filters/use_filters'; import { fetchMonitorListAction, diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/grid_by_group/grid_group_item.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/grid_by_group/grid_group_item.tsx index f9f0a417e065e..6fcf90f631fad 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/grid_by_group/grid_group_item.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/monitors_page/overview/overview/grid_by_group/grid_group_item.tsx @@ -19,7 +19,7 @@ import { import React, { useState } from 'react'; import { i18n } from '@kbn/i18n'; import { useSelector } from 'react-redux'; -import { useKey } from 'react-use'; +import useKey from 'react-use/lib/useKey'; import { FlyoutParamProps } from '../types'; import { OverviewLoader } from '../overview_loader'; import { useFilteredGroupMonitors } from './use_filtered_group_monitors'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/global_params/params_list.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/global_params/params_list.tsx index d72d92156e42e..2ff3ea547ae9f 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/global_params/params_list.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/components/settings/global_params/params_list.tsx @@ -21,7 +21,7 @@ import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n-react'; import { useKibana } from '@kbn/kibana-react-plugin/public'; import { EuiBasicTableColumn } from '@elastic/eui/src/components/basic_table/basic_table'; -import { useDebounce } from 'react-use'; +import useDebounce from 'react-use/lib/useDebounce'; import { TableTitle } from '../../common/components/table_title'; import { ParamsText } from './params_text'; import { SyntheticsParams } from '../../../../../../common/runtime_types'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx index 9f3902b8ccaf2..68f6910b43b78 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/contexts/synthetics_refresh_context.tsx @@ -15,7 +15,7 @@ import React, { FC, } from 'react'; import useLocalStorage from 'react-use/lib/useLocalStorage'; -import { useEvent } from 'react-use'; +import useEvent from 'react-use/lib/useEvent'; import moment from 'moment'; import { Subject } from 'rxjs'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_monitor_name.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_monitor_name.ts index 717399d94d1fc..b90044725d070 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_monitor_name.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_monitor_name.ts @@ -7,7 +7,7 @@ import { useMemo, useState } from 'react'; import { useParams } from 'react-router-dom'; -import { useDebounce } from 'react-use'; +import useDebounce from 'react-use/lib/useDebounce'; import { useFetcher } from '@kbn/observability-shared-plugin/public'; import { fetchMonitorManagementList, getMonitorListPageStateWithDefaults } from '../state'; diff --git a/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx b/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx index 80b22c42b544e..0334af18135bc 100644 --- a/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx +++ b/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx @@ -29,10 +29,7 @@ const data = { const mockUseObservable = jest.fn(); -jest.mock('react-use', () => ({ - ...jest.requireActual('react-use'), - useObservable: () => mockUseObservable(), -})); +jest.mock('react-use/lib/useObservable', () => mockUseObservable); jest.mock('../../../common/lib/kibana', () => { const original = jest.requireActual('../../../common/lib/kibana'); diff --git a/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.tsx b/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.tsx index ad88362e9e861..f03be50f39660 100644 --- a/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.tsx +++ b/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.tsx @@ -8,7 +8,7 @@ import React, { useCallback } from 'react'; import { EuiWrappingPopover } from '@elastic/eui'; import { useLocation } from 'react-router-dom'; -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { StatefulTopN } from '../../../common/components/top_n'; import { getScopeFromPath } from '../../../sourcerer/containers/sourcerer_paths'; import { useSourcererDataView } from '../../../sourcerer/containers'; diff --git a/x-pack/plugins/security_solution/public/assistant/provider.tsx b/x-pack/plugins/security_solution/public/assistant/provider.tsx index 54d4e47edb684..93c65bb463584 100644 --- a/x-pack/plugins/security_solution/public/assistant/provider.tsx +++ b/x-pack/plugins/security_solution/public/assistant/provider.tsx @@ -23,7 +23,7 @@ import { once } from 'lodash/fp'; import type { HttpSetup } from '@kbn/core-http-browser'; import type { Message } from '@kbn/elastic-assistant-common'; import { loadAllActions as loadConnectors } from '@kbn/triggers-actions-ui-plugin/public/common/constants'; -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { APP_ID } from '../../common'; import { useBasePath, useKibana } from '../common/lib/kibana'; import { useAssistantTelemetry } from './use_assistant_telemetry'; diff --git a/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx b/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx index 97f98b81dc153..8288174a9aeac 100644 --- a/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx +++ b/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx @@ -13,7 +13,7 @@ import { UpsellingService } from '@kbn/security-solution-upselling/service'; import { Router } from '@kbn/shared-ux-router'; import { render, screen } from '@testing-library/react'; import React from 'react'; -import { useLocalStorage } from 'react-use'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; import { TestProviders } from '../../common/mock'; import { ATTACK_DISCOVERY_PATH } from '../../../common/constants'; @@ -38,15 +38,10 @@ const mockConnectors: unknown[] = [ }, ]; -jest.mock('react-use', () => { - const actual = jest.requireActual('react-use'); - - return { - ...actual, - useLocalStorage: jest.fn().mockReturnValue(['test-id', jest.fn()]), - useSessionStorage: jest.fn().mockReturnValue([undefined, jest.fn()]), - }; -}); +jest.mock('react-use/lib/useLocalstorage', () => jest.fn().mockReturnValue(['test-id', jest.fn()])); +jest.mock('react-use/lib/useSessionStorage', () => + jest.fn().mockReturnValue([undefined, jest.fn()]) +); jest.mock( '@kbn/elastic-assistant/impl/assistant/api/anonymization_fields/use_fetch_anonymization_fields', diff --git a/x-pack/plugins/security_solution/public/attack_discovery/pages/index.tsx b/x-pack/plugins/security_solution/public/attack_discovery/pages/index.tsx index f3981696b3e80..ea5c16fc3cbba 100644 --- a/x-pack/plugins/security_solution/public/attack_discovery/pages/index.tsx +++ b/x-pack/plugins/security_solution/public/attack_discovery/pages/index.tsx @@ -16,7 +16,7 @@ import { import type { AttackDiscoveries, Replacements } from '@kbn/elastic-assistant-common'; import { uniq } from 'lodash/fp'; import React, { useCallback, useEffect, useMemo, useState } from 'react'; -import { useLocalStorage } from 'react-use'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; import { SecurityPageName } from '../../../common/constants'; import { HeaderPage } from '../../common/components/header_page'; diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/data_ingestion_hub_header/cards/video_card/video_card.tsx b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/data_ingestion_hub_header/cards/video_card/video_card.tsx index 1081b0db365b7..bacfee91924e4 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/data_ingestion_hub_header/cards/video_card/video_card.tsx +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/data_ingestion_hub_header/cards/video_card/video_card.tsx @@ -6,7 +6,7 @@ */ import React, { useState } from 'react'; -import { useLocalStorage } from 'react-use'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; import { EuiLink, EuiText } from '@elastic/eui'; import { Card } from '../card'; import { DataIngestionHubVideoModal } from './video_modal'; diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_available_steps.ts b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_available_steps.ts index e4548ed3f4cb0..8851f47e75f3f 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_available_steps.ts +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_available_steps.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useKibana } from '../../../../lib/kibana'; export const useAvailableSteps = () => { diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_product_types.ts b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_product_types.ts index dda575c3b789f..5c129cd22a060 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_product_types.ts +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_product_types.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useKibana } from '../../../../lib/kibana'; export const useProductTypes = () => { diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_project_features_url.ts b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_project_features_url.ts index c65eea5cca031..7cca2ec79bbe2 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_project_features_url.ts +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_project_features_url.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useKibana } from '../../../../lib/kibana'; export const useProjectFeaturesUrl = () => { diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_projects_url.ts b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_projects_url.ts index 9fc8f4f06ea02..bbc43d71a6290 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_projects_url.ts +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_projects_url.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useKibana } from '../../../../lib/kibana'; export const useProjectsUrl = () => { diff --git a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_users_url.ts b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_users_url.ts index 8597a98b37e7f..be18f2207a4ac 100644 --- a/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_users_url.ts +++ b/x-pack/plugins/security_solution/public/common/components/landing_page/onboarding/hooks/use_users_url.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useKibana } from '../../../../lib/kibana'; export const useUsersUrl = () => { diff --git a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx index 30ebf658f0020..c436b7ed9feb5 100644 --- a/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx +++ b/x-pack/plugins/security_solution/public/common/components/navigation/use_security_solution_navigation/use_security_solution_navigation.tsx @@ -14,7 +14,7 @@ import React, { useMemo } from 'react'; import { i18n } from '@kbn/i18n'; import type { KibanaPageTemplateProps } from '@kbn/shared-ux-page-kibana-template'; -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useKibana } from '../../../lib/kibana'; import { useBreadcrumbsNav } from '../breadcrumbs'; import { SecuritySideNav } from '../security_side_nav'; diff --git a/x-pack/plugins/security_solution/public/common/components/visualization_actions/actions.tsx b/x-pack/plugins/security_solution/public/common/components/visualization_actions/actions.tsx index b1ec30833b396..bcdb9d163164c 100644 --- a/x-pack/plugins/security_solution/public/common/components/visualization_actions/actions.tsx +++ b/x-pack/plugins/security_solution/public/common/components/visualization_actions/actions.tsx @@ -10,7 +10,7 @@ import { buildContextMenuForActions } from '@kbn/ui-actions-plugin/public'; import React, { useCallback, useMemo, useState } from 'react'; import styled from 'styled-components'; -import { useAsync } from 'react-use'; +import useAsync from 'react-use/lib/useAsync'; import { InputsModelId } from '../../store/inputs/constants'; import { ModalInspectQuery } from '../inspect/modal'; diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/related_integrations/related_integrations_help_info.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/related_integrations/related_integrations_help_info.tsx index 08c4a8e22edfd..1b5d3784364b6 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/related_integrations/related_integrations_help_info.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/related_integrations/related_integrations_help_info.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { useToggle } from 'react-use'; +import useToggle from 'react-use/lib/useToggle'; import { EuiLink, EuiPopover, EuiText, EuiButtonIcon } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import { useKibana } from '../../../../common/lib/kibana'; diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx index 187f05880d205..9cc1a085507a7 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_creation/components/required_fields/required_fields_help_info.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { useToggle } from 'react-use'; +import useToggle from 'react-use/lib/useToggle'; import { EuiPopover, EuiText, EuiButtonIcon } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; import * as defineRuleI18n from '../../../rule_creation_ui/components/step_define_rule/translations'; diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_side/final_side_help_info.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_side/final_side_help_info.tsx index 766692e9efecd..51e0c5097b97d 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_side/final_side_help_info.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_side/final_side_help_info.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { useToggle } from 'react-use'; +import useToggle from 'react-use/lib/useToggle'; import { EuiPopover, EuiText, EuiButtonIcon } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_header_buttons.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_header_buttons.tsx index b4ff6ab29a3ff..6fbdd5b4f8910 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_header_buttons.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_header_buttons.tsx @@ -16,7 +16,7 @@ import { EuiPopover, } from '@elastic/eui'; import React, { useCallback, useMemo } from 'react'; -import { useBoolean } from 'react-use'; +import useBoolean from 'react-use/lib/useBoolean'; import { useUserData } from '../../../../../detections/components/user_info'; import { useAddPrebuiltRulesTableContext } from './add_prebuilt_rules_table_context'; import * as i18n from './translations'; diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_install_button.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_install_button.tsx index ea83efae768fa..6ea9e9dd6a749 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_install_button.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management_ui/components/rules_table/add_prebuilt_rules_table/add_prebuilt_rules_install_button.tsx @@ -16,7 +16,7 @@ import { EuiPopover, } from '@elastic/eui'; import React, { useCallback, useMemo } from 'react'; -import { useBoolean } from 'react-use'; +import useBoolean from 'react-use/lib/useBoolean'; import type { Rule } from '../../../../rule_management/logic'; import type { RuleSignatureId } from '../../../../../../common/api/detection_engine'; import type { AddPrebuiltRulesTableActions } from './add_prebuilt_rules_table_context'; diff --git a/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality/asset_criticality_selector.tsx b/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality/asset_criticality_selector.tsx index e29dca9d48f3d..51ebecedac3d4 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality/asset_criticality_selector.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/components/asset_criticality/asset_criticality_selector.tsx @@ -34,7 +34,7 @@ import React, { useState } from 'react'; import { FormattedMessage } from '@kbn/i18n-react'; import { css } from '@emotion/css'; import { i18n } from '@kbn/i18n'; -import { useToggle } from 'react-use'; +import useToggle from 'react-use/lib/useToggle'; import { PICK_ASSET_CRITICALITY } from './translations'; import { AssetCriticalityBadge } from './asset_criticality_badge'; import type { Entity, State } from './use_asset_criticality'; From 43059f6efdaceae1e13e991f824cd05c0ec939d2 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Tue, 8 Oct 2024 22:10:42 +0200 Subject: [PATCH 03/11] wip lodash set --- x-pack/plugins/cases/common/types/domain/user/v1.test.ts | 2 +- .../public/components/visualizations/open_lens_button.test.tsx | 2 +- .../common/endpoint/models/policy_config_helpers.test.ts | 3 ++- .../public/common/lib/endpoint/utils/get_host_platform.test.ts | 2 +- .../management/hooks/policy/use_fetch_endpoint_policy.test.ts | 2 +- .../policy_settings_form/components/advanced_section.test.tsx | 2 +- .../components/cards/behaviour_protection_card.test.tsx | 2 +- .../components/cards/linux_event_collection_card.test.tsx | 2 +- .../components/cards/mac_event_collection_card.test.tsx | 2 +- .../components/cards/memory_protection_card.test.tsx | 2 +- .../components/cards/ransomware_protection_card.test.tsx | 2 +- .../components/cards/windows_event_collection_card.test.tsx | 2 +- .../management/pages/policy/view/policy_settings_form/mocks.ts | 2 +- .../actions/clients/lib/base_response_actions_client.test.ts | 2 +- 14 files changed, 15 insertions(+), 14 deletions(-) diff --git a/x-pack/plugins/cases/common/types/domain/user/v1.test.ts b/x-pack/plugins/cases/common/types/domain/user/v1.test.ts index 56d23fff6fc1a..3c90054857e93 100644 --- a/x-pack/plugins/cases/common/types/domain/user/v1.test.ts +++ b/x-pack/plugins/cases/common/types/domain/user/v1.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { UserRt, UserWithProfileInfoRt, UsersRt, CaseUserProfileRt, CaseAssigneesRt } from './v1'; describe('User', () => { diff --git a/x-pack/plugins/cases/public/components/visualizations/open_lens_button.test.tsx b/x-pack/plugins/cases/public/components/visualizations/open_lens_button.test.tsx index 7ac2ed8d45da4..752bdd2980987 100644 --- a/x-pack/plugins/cases/public/components/visualizations/open_lens_button.test.tsx +++ b/x-pack/plugins/cases/public/components/visualizations/open_lens_button.test.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import React from 'react'; import { screen } from '@testing-library/react'; import type { AppMockRenderer } from '../../common/mock'; diff --git a/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.test.ts b/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.test.ts index 5d7cc61d1d7bd..603ec6b1ac6e3 100644 --- a/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.test.ts +++ b/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.test.ts @@ -17,7 +17,8 @@ import { checkIfPopupMessagesContainCustomNotifications, resetCustomNotifications, } from './policy_config_helpers'; -import { get, merge, set } from 'lodash'; +import { get, merge } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; describe('Policy Config helpers', () => { describe('disableProtections', () => { diff --git a/x-pack/plugins/security_solution/public/common/lib/endpoint/utils/get_host_platform.test.ts b/x-pack/plugins/security_solution/public/common/lib/endpoint/utils/get_host_platform.test.ts index 1459c690068b4..c87129319597c 100644 --- a/x-pack/plugins/security_solution/public/common/lib/endpoint/utils/get_host_platform.test.ts +++ b/x-pack/plugins/security_solution/public/common/lib/endpoint/utils/get_host_platform.test.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { getHostPlatform } from './get_host_platform'; import type { TimelineEventsDetailsItem } from '@kbn/timelines-plugin/common'; diff --git a/x-pack/plugins/security_solution/public/management/hooks/policy/use_fetch_endpoint_policy.test.ts b/x-pack/plugins/security_solution/public/management/hooks/policy/use_fetch_endpoint_policy.test.ts index 85647202a755c..6feaeb878790c 100644 --- a/x-pack/plugins/security_solution/public/management/hooks/policy/use_fetch_endpoint_policy.test.ts +++ b/x-pack/plugins/security_solution/public/management/hooks/policy/use_fetch_endpoint_policy.test.ts @@ -16,7 +16,7 @@ import { DefaultPolicyNotificationMessage, DefaultPolicyRuleNotificationMessage, } from '../../../../common/endpoint/models/policy_config'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { API_VERSIONS } from '@kbn/fleet-plugin/common'; const useQueryMock = _useQuery as jest.Mock; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/advanced_section.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/advanced_section.test.tsx index 937804565e29f..b86c79c46242d 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/advanced_section.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/advanced_section.test.tsx @@ -18,7 +18,7 @@ import { AdvancedSection } from './advanced_section'; import userEvent from '@testing-library/user-event'; import { AdvancedPolicySchema } from '../../../models/advanced_policy_schema'; import { within } from '@testing-library/react'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; jest.mock('../../../../../../common/hooks/use_license'); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/behaviour_protection_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/behaviour_protection_card.test.tsx index 9a5c9db321b4b..94399b7c33c4c 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/behaviour_protection_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/behaviour_protection_card.test.tsx @@ -13,7 +13,7 @@ import React from 'react'; import { licenseService as licenseServiceMocked } from '../../../../../../../common/hooks/__mocks__/use_license'; import { useLicense as _useLicense } from '../../../../../../../common/hooks/use_license'; import { createLicenseServiceMock } from '../../../../../../../../common/license/mocks'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { ProtectionModes } from '../../../../../../../../common/endpoint/types'; import type { BehaviourProtectionCardProps } from './protection_seetings_card/behaviour_protection_card'; import { diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/linux_event_collection_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/linux_event_collection_card.test.tsx index 7be10cb5ca6d0..f28b379ce5140 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/linux_event_collection_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/linux_event_collection_card.test.tsx @@ -12,7 +12,7 @@ import { FleetPackagePolicyGenerator } from '../../../../../../../../common/endp import React from 'react'; import type { LinuxEventCollectionCardProps } from './linux_event_collection_card'; import { LinuxEventCollectionCard } from './linux_event_collection_card'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; describe('Policy Linux Event Collection Card', () => { const testSubj = getPolicySettingsFormTestSubjects('test').linuxEvents; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/mac_event_collection_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/mac_event_collection_card.test.tsx index ac2c81da1c121..d951975d467f0 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/mac_event_collection_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/mac_event_collection_card.test.tsx @@ -10,7 +10,7 @@ import type { AppContextTestRender } from '../../../../../../../common/mock/endp import { createAppRootMockRenderer } from '../../../../../../../common/mock/endpoint'; import { FleetPackagePolicyGenerator } from '../../../../../../../../common/endpoint/data_generators/fleet_package_policy_generator'; import React from 'react'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { MacEventCollectionCardProps } from './mac_event_collection_card'; import { MacEventCollectionCard } from './mac_event_collection_card'; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/memory_protection_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/memory_protection_card.test.tsx index 35ee4eb4fd2d5..4d5236a559985 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/memory_protection_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/memory_protection_card.test.tsx @@ -11,7 +11,7 @@ import { createAppRootMockRenderer } from '../../../../../../../common/mock/endp import { FleetPackagePolicyGenerator } from '../../../../../../../../common/endpoint/data_generators/fleet_package_policy_generator'; import React from 'react'; import { ProtectionModes } from '../../../../../../../../common/endpoint/types'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { MemoryProtectionCardProps } from './memory_protection_card'; import { LOCKED_CARD_MEMORY_TITLE, MemoryProtectionCard } from './memory_protection_card'; import { createLicenseServiceMock } from '../../../../../../../../common/license/mocks'; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/ransomware_protection_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/ransomware_protection_card.test.tsx index 1970c5915fe07..d78840a44e9ce 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/ransomware_protection_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/ransomware_protection_card.test.tsx @@ -11,7 +11,7 @@ import { createAppRootMockRenderer } from '../../../../../../../common/mock/endp import { FleetPackagePolicyGenerator } from '../../../../../../../../common/endpoint/data_generators/fleet_package_policy_generator'; import React from 'react'; import { ProtectionModes } from '../../../../../../../../common/endpoint/types'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { createLicenseServiceMock } from '../../../../../../../../common/license/mocks'; import { licenseService as licenseServiceMocked } from '../../../../../../../common/hooks/__mocks__/use_license'; import { useLicense as _useLicense } from '../../../../../../../common/hooks/use_license'; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/windows_event_collection_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/windows_event_collection_card.test.tsx index 2ee20f4a51a51..4dfe847297ef2 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/windows_event_collection_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/windows_event_collection_card.test.tsx @@ -10,7 +10,7 @@ import type { AppContextTestRender } from '../../../../../../../common/mock/endp import { createAppRootMockRenderer } from '../../../../../../../common/mock/endpoint'; import { FleetPackagePolicyGenerator } from '../../../../../../../../common/endpoint/data_generators/fleet_package_policy_generator'; import React from 'react'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { WindowsEventCollectionCardProps } from './windows_event_collection_card'; import { WindowsEventCollectionCard } from './windows_event_collection_card'; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/mocks.ts b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/mocks.ts index b2ef180dd4bfd..07f0e5b7005d8 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/mocks.ts +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/mocks.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { PolicyConfig } from '../../../../../../common/endpoint/types'; import { AntivirusRegistrationModes, diff --git a/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/lib/base_response_actions_client.test.ts b/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/lib/base_response_actions_client.test.ts index 20389d41f3956..dafc0b285f489 100644 --- a/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/lib/base_response_actions_client.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/services/actions/clients/lib/base_response_actions_client.test.ts @@ -36,7 +36,7 @@ import { ENDPOINT_ACTIONS_INDEX, } from '../../../../../../common/endpoint/constants'; import type { DeepMutable } from '../../../../../../common/endpoint/types/utility_types'; -import { set } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { responseActionsClientMock } from '../mocks'; import type { ResponseActionAgentType } from '../../../../../../common/endpoint/service/response_actions/constants'; import { getResponseActionFeatureKey } from '../../../feature_usage/feature_keys'; From dad4c60893c952a676fa00938136da92404b491e Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Wed, 9 Oct 2024 11:21:26 +0200 Subject: [PATCH 04/11] wip --- .../impl/assistant_context/index.test.tsx | 2 +- .../connectors/cases/cases_oracle_service.test.ts | 3 ++- .../server/connectors/cases/cases_service.test.ts | 3 ++- .../cases/server/services/user_actions/index.test.ts | 3 ++- .../services/user_actions/operations/create.test.ts | 3 ++- .../create_integration/create_integration.tsx | 8 ++++---- .../apps/synthetics/hooks/use_breadcrumbs.test.tsx | 2 +- .../apps/synthetics/utils/formatting/test_helpers.ts | 1 + .../data_generators/endpoint_metadata_generator.ts | 3 ++- .../common/endpoint/models/policy_config_helpers.ts | 3 ++- .../security_solution/common/utils/expand_dotted.ts | 3 ++- .../cell_action/add_to_timeline.test.ts | 2 +- .../public/attack_discovery/pages/index.test.tsx | 2 +- .../security_solution/public/common/mock/router.tsx | 2 +- .../common/utils/global_query_string/helpers.test.tsx | 2 +- .../public/entity_analytics/routes.tsx | 11 +++++------ .../explore/network/pages/details/index.test.tsx | 3 ++- .../privileged_route/privileged_route.test.tsx | 6 +++--- .../cards/attack_surface_reduction_card.test.tsx | 3 ++- .../cards/malware_protections_card.test.tsx | 3 ++- .../detect_prevent_protection_level.test.tsx | 3 ++- .../components/event_collection_card.test.tsx | 3 ++- .../components/notify_user_option.test.tsx | 3 ++- .../protection_setting_card_switch.test.tsx | 3 ++- .../policy_settings_layout.test.tsx | 3 ++- .../plugins/security_solution/public/notes/routes.tsx | 7 +++---- .../timelines/store/middlewares/timeline_save.ts | 3 ++- .../endpoint/routes/actions/response_actions.test.ts | 3 ++- .../factories/utils/traverse_and_mutate_doc.ts | 3 ++- .../security_solution/server/lib/telemetry/helpers.ts | 3 ++- 30 files changed, 60 insertions(+), 42 deletions(-) diff --git a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx index 3f41cf745dff0..4e877e1886fb4 100644 --- a/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx +++ b/x-pack/packages/kbn-elastic-assistant/impl/assistant_context/index.test.tsx @@ -11,7 +11,7 @@ import { useAssistantContext } from '.'; import useLocalStorage from 'react-use/lib/useLocalStorage'; import { TestProviders } from '../mock/test_providers/test_providers'; -jest.mock('react-use/lib/useLocalstorage', () => jest.fn().mockReturnValue(['456', jest.fn()])); +jest.mock('react-use/lib/useLocalStorage', () => jest.fn().mockReturnValue(['456', jest.fn()])); jest.mock('react-use/lib/useSessionStorage', () => jest.fn().mockReturnValue(['456', jest.fn()])); describe('AssistantContext', () => { diff --git a/x-pack/plugins/cases/server/connectors/cases/cases_oracle_service.test.ts b/x-pack/plugins/cases/server/connectors/cases/cases_oracle_service.test.ts index ea64b20f2c1a2..4d5d167a58852 100644 --- a/x-pack/plugins/cases/server/connectors/cases/cases_oracle_service.test.ts +++ b/x-pack/plugins/cases/server/connectors/cases/cases_oracle_service.test.ts @@ -12,7 +12,8 @@ import { loggingSystemMock } from '@kbn/core-logging-server-mocks'; import { CasesOracleService } from './cases_oracle_service'; import { CASE_RULES_SAVED_OBJECT } from '../../../common/constants'; -import { isEmpty, set } from 'lodash'; +import { isEmpty } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; describe('CasesOracleService', () => { const savedObjectsClient = savedObjectsClientMock.create(); diff --git a/x-pack/plugins/cases/server/connectors/cases/cases_service.test.ts b/x-pack/plugins/cases/server/connectors/cases/cases_service.test.ts index 848d3fa276236..183d628d7a742 100644 --- a/x-pack/plugins/cases/server/connectors/cases/cases_service.test.ts +++ b/x-pack/plugins/cases/server/connectors/cases/cases_service.test.ts @@ -8,7 +8,8 @@ import { createHash } from 'node:crypto'; import stringify from 'json-stable-stringify'; -import { isEmpty, set } from 'lodash'; +import { isEmpty } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { CasesService } from './cases_service'; describe('CasesService', () => { diff --git a/x-pack/plugins/cases/server/services/user_actions/index.test.ts b/x-pack/plugins/cases/server/services/user_actions/index.test.ts index 20c06f2701fed..9e5b7589f1626 100644 --- a/x-pack/plugins/cases/server/services/user_actions/index.test.ts +++ b/x-pack/plugins/cases/server/services/user_actions/index.test.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { set, omit, unset } from 'lodash'; +import { omit, unset } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { loggerMock } from '@kbn/logging-mocks'; import { savedObjectsClientMock } from '@kbn/core/server/mocks'; import type { diff --git a/x-pack/plugins/cases/server/services/user_actions/operations/create.test.ts b/x-pack/plugins/cases/server/services/user_actions/operations/create.test.ts index 833e8676a2619..38fb3e4e746ec 100644 --- a/x-pack/plugins/cases/server/services/user_actions/operations/create.test.ts +++ b/x-pack/plugins/cases/server/services/user_actions/operations/create.test.ts @@ -11,7 +11,8 @@ import { createSavedObjectsSerializerMock } from '../../../client/mocks'; import { savedObjectsClientMock } from '@kbn/core-saved-objects-api-server-mocks'; import { loggerMock } from '@kbn/logging-mocks'; import { auditLoggerMock } from '@kbn/security-plugin/server/audit/mocks'; -import { set, unset } from 'lodash'; +import { unset } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { createConnectorObject } from '../../test_utils'; import { UserActionPersister } from './create'; import { createUserActionSO } from '../test_utils'; diff --git a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration.tsx b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration.tsx index 494bc94d8c58c..6afacc8e417f3 100644 --- a/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration.tsx +++ b/x-pack/plugins/integration_assistant/public/components/create_integration/create_integration.tsx @@ -5,8 +5,8 @@ * 2.0. */ import React from 'react'; -import { Redirect, Switch } from 'react-router-dom'; -import { Route } from '@kbn/shared-ux-router'; +import { Redirect } from 'react-router-dom'; +import { Route, Routes } from '@kbn/shared-ux-router'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import type { Services } from '../../services'; import { TelemetryContextProvider } from './telemetry'; @@ -33,7 +33,7 @@ const CreateIntegrationRouter = React.memo(() => { const { canUseIntegrationAssistant, canUseIntegrationUpload } = useRoutesAuthorization(); const isAvailable = useIsAvailable(); return ( - + {isAvailable && canUseIntegrationAssistant && ( )} @@ -44,7 +44,7 @@ const CreateIntegrationRouter = React.memo(() => { } /> - + ); }); CreateIntegrationRouter.displayName = 'CreateIntegrationRouter'; diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_breadcrumbs.test.tsx b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_breadcrumbs.test.tsx index 6a07150070362..5e524eca31bda 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_breadcrumbs.test.tsx +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/hooks/use_breadcrumbs.test.tsx @@ -9,7 +9,7 @@ import { ChromeBreadcrumb } from '@kbn/core/public'; import { render } from '../utils/testing'; import React from 'react'; import { i18n } from '@kbn/i18n'; -import { Route } from 'react-router-dom'; +import { Route } from '@kbn/shared-ux-router'; import { OVERVIEW_ROUTE } from '../../../../common/constants'; import { KibanaContextProvider } from '@kbn/kibana-react-plugin/public'; import { diff --git a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/formatting/test_helpers.ts b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/formatting/test_helpers.ts index 0b32c4a2420e8..8ba26624f3f0c 100644 --- a/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/formatting/test_helpers.ts +++ b/x-pack/plugins/observability_solution/synthetics/public/apps/synthetics/utils/formatting/test_helpers.ts @@ -8,6 +8,7 @@ import moment from 'moment'; import { Moment } from 'moment-timezone'; import * as redux from 'react-redux'; +// eslint-disable-next-line no-restricted-imports import * as reactRouterDom from 'react-router-dom'; export function mockMoment() { diff --git a/x-pack/plugins/security_solution/common/endpoint/data_generators/endpoint_metadata_generator.ts b/x-pack/plugins/security_solution/common/endpoint/data_generators/endpoint_metadata_generator.ts index 558a9b8371068..b14ddc1e8af9e 100644 --- a/x-pack/plugins/security_solution/common/endpoint/data_generators/endpoint_metadata_generator.ts +++ b/x-pack/plugins/security_solution/common/endpoint/data_generators/endpoint_metadata_generator.ts @@ -8,7 +8,8 @@ /* eslint-disable max-classes-per-file */ import type { DeepPartial } from 'utility-types'; -import { merge, set } from 'lodash'; +import { merge } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { gte } from 'semver'; import type { EndpointCapabilities } from '../service/response_actions/constants'; import { BaseDataGenerator } from './base_data_generator'; diff --git a/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.ts b/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.ts index 9b3906191b698..5079493724d78 100644 --- a/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.ts +++ b/x-pack/plugins/security_solution/common/endpoint/models/policy_config_helpers.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { get, set } from 'lodash'; +import { get } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { DefaultPolicyNotificationMessage } from './policy_config'; import type { PolicyConfig } from '../types'; import { PolicyOperatingSystem, ProtectionModes, AntivirusRegistrationModes } from '../types'; diff --git a/x-pack/plugins/security_solution/common/utils/expand_dotted.ts b/x-pack/plugins/security_solution/common/utils/expand_dotted.ts index e919b71dcdcf4..d452ca4df9fb6 100644 --- a/x-pack/plugins/security_solution/common/utils/expand_dotted.ts +++ b/x-pack/plugins/security_solution/common/utils/expand_dotted.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { merge, setWith } from 'lodash'; +import { merge } from 'lodash'; +import { setWith } from '@kbn/safer-lodash-set'; /* * Expands an object with "dotted" fields to a nested object with unflattened fields. diff --git a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts index dfdc2a5ede83f..8b51e5dfa2091 100644 --- a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts @@ -12,7 +12,7 @@ import { createAddToTimelineCellActionFactory } from './add_to_timeline'; import type { CellActionExecutionContext } from '@kbn/cell-actions'; import { GEO_FIELD_TYPE } from '../../../../timelines/components/timeline/body/renderers/constants'; import { createStartServicesMock } from '../../../../common/lib/kibana/kibana_react.mock'; -import { set } from 'lodash/fp'; +import set from '@kbn/safer-lodash-set/fp/set'; import { KBN_FIELD_TYPES } from '@kbn/field-types'; const services = createStartServicesMock(); diff --git a/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx b/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx index 8288174a9aeac..8a53cd81db96a 100644 --- a/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx +++ b/x-pack/plugins/security_solution/public/attack_discovery/pages/index.test.tsx @@ -38,7 +38,7 @@ const mockConnectors: unknown[] = [ }, ]; -jest.mock('react-use/lib/useLocalstorage', () => jest.fn().mockReturnValue(['test-id', jest.fn()])); +jest.mock('react-use/lib/useLocalStorage', () => jest.fn().mockReturnValue(['test-id', jest.fn()])); jest.mock('react-use/lib/useSessionStorage', () => jest.fn().mockReturnValue([undefined, jest.fn()]) ); diff --git a/x-pack/plugins/security_solution/public/common/mock/router.tsx b/x-pack/plugins/security_solution/public/common/mock/router.tsx index d9cf89a74db08..7bb6027f1150d 100644 --- a/x-pack/plugins/security_solution/public/common/mock/router.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/router.tsx @@ -5,7 +5,7 @@ * 2.0. */ -import { Router } from 'react-router-dom'; +import { Router } from '@kbn/shared-ux-router'; // eslint-disable-next-line @kbn/eslint/module_migration import routeData from 'react-router'; type Action = 'PUSH' | 'POP' | 'REPLACE'; diff --git a/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx b/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx index 69f1b5fcbf4e0..9eb9a6ca814f7 100644 --- a/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx @@ -16,7 +16,7 @@ import { } from './helpers'; import { renderHook } from '@testing-library/react-hooks'; import { createMemoryHistory } from 'history'; -import { Router } from 'react-router-dom'; +import { Router } from '@kbn/shared-ux-router'; import React from 'react'; const flyoutString = diff --git a/x-pack/plugins/security_solution/public/entity_analytics/routes.tsx b/x-pack/plugins/security_solution/public/entity_analytics/routes.tsx index 048b37915e0f4..835265c7402fe 100644 --- a/x-pack/plugins/security_solution/public/entity_analytics/routes.tsx +++ b/x-pack/plugins/security_solution/public/entity_analytics/routes.tsx @@ -5,8 +5,7 @@ * 2.0. */ import React from 'react'; -import { Switch } from 'react-router-dom'; -import { Route } from '@kbn/shared-ux-router'; +import { Route, Routes } from '@kbn/shared-ux-router'; import { TrackApplicationView } from '@kbn/usage-collection-plugin/public'; @@ -33,14 +32,14 @@ const EntityAnalyticsManagementTelemetry = () => ( const EntityAnalyticsManagementContainer: React.FC = React.memo(() => { return ( - + - + ); }); EntityAnalyticsManagementContainer.displayName = 'EntityAnalyticsManagementContainer'; @@ -56,14 +55,14 @@ const EntityAnalyticsAssetClassificationTelemetry = () => ( const EntityAnalyticsAssetClassificationContainer: React.FC = React.memo(() => { return ( - + - + ); }); diff --git a/x-pack/plugins/security_solution/public/explore/network/pages/details/index.test.tsx b/x-pack/plugins/security_solution/public/explore/network/pages/details/index.test.tsx index 57cbbb4bc65e6..19b3f653b8f14 100644 --- a/x-pack/plugins/security_solution/public/explore/network/pages/details/index.test.tsx +++ b/x-pack/plugins/security_solution/public/explore/network/pages/details/index.test.tsx @@ -6,7 +6,8 @@ */ import React from 'react'; -import { Router, useParams } from 'react-router-dom'; +import { Router } from '@kbn/shared-ux-router'; +import { useParams } from 'react-router-dom'; import { useSourcererDataView } from '../../../../sourcerer/containers'; import { TestProviders } from '../../../../common/mock'; diff --git a/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx b/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx index 2fdac844b5e41..1e5ed2b0b5ab9 100644 --- a/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { Switch, MemoryRouter } from 'react-router-dom'; +import { Routes, MemoryRouter } from '@kbn/shared-ux-router'; import type { AppContextTestRender } from '../../../common/mock/endpoint'; import { createAppRootMockRenderer } from '../../../common/mock/endpoint'; import { PrivilegedRoute } from './privileged_route'; @@ -39,9 +39,9 @@ describe('PrivilegedRoute', () => { render = () => { renderResult = renderer.render( - + - + ); }; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/attack_surface_reduction_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/attack_surface_reduction_card.test.tsx index c55f0793027e5..35cf98b5f5075 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/attack_surface_reduction_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/attack_surface_reduction_card.test.tsx @@ -17,7 +17,8 @@ import { SWITCH_LABEL, } from './attack_surface_reduction_card'; import { useLicense as _useLicense } from '../../../../../../../common/hooks/use_license'; -import { cloneDeep, set } from 'lodash'; +import { cloneDeep } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import userEvent from '@testing-library/user-event'; import { createLicenseServiceMock } from '../../../../../../../../common/license/mocks'; import { licenseService as licenseServiceMocked } from '../../../../../../../common/hooks/__mocks__/use_license'; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/malware_protections_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/malware_protections_card.test.tsx index c4060cf0d7de0..d4ca438c5e25f 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/malware_protections_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/cards/malware_protections_card.test.tsx @@ -19,7 +19,8 @@ import type { MalwareProtectionsProps } from './malware_protections_card'; import { MalwareProtectionsCard } from './malware_protections_card'; import type { PolicyConfig } from '../../../../../../../../common/endpoint/types'; import { ProtectionModes } from '../../../../../../../../common/endpoint/types'; -import { cloneDeep, set } from 'lodash'; +import { cloneDeep } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import userEvent from '@testing-library/user-event'; jest.mock('../../../../../../../common/hooks/use_license'); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/detect_prevent_protection_level.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/detect_prevent_protection_level.test.tsx index ee31a690c27db..6616ac02e3c5a 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/detect_prevent_protection_level.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/detect_prevent_protection_level.test.tsx @@ -12,7 +12,8 @@ import React from 'react'; import type { DetectPreventProtectionLevelProps } from './detect_prevent_protection_level'; import { DetectPreventProtectionLevel } from './detect_prevent_protection_level'; import userEvent from '@testing-library/user-event'; -import { cloneDeep, set } from 'lodash'; +import { cloneDeep } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { ProtectionModes } from '../../../../../../../common/endpoint/types'; import { expectIsViewOnly, exactMatchText } from '../mocks'; import { createLicenseServiceMock } from '../../../../../../../common/license/mocks'; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.test.tsx index 51e2fb275a78a..ba2cd95989cde 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.test.tsx @@ -17,7 +17,8 @@ import { EventCollectionCard } from './event_collection_card'; import { OperatingSystem } from '@kbn/securitysolution-utils'; import { expectIsViewOnly, exactMatchText } from '../mocks'; import userEvent from '@testing-library/user-event'; -import { cloneDeep, set } from 'lodash'; +import { cloneDeep } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { within } from '@testing-library/react'; describe('Policy Event Collection Card common component', () => { diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/notify_user_option.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/notify_user_option.test.tsx index b75084f6b97a5..eb0686d7e07ef 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/notify_user_option.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/notify_user_option.test.tsx @@ -20,7 +20,8 @@ import { NotifyUserOption, } from './notify_user_option'; import { expectIsViewOnly, exactMatchText } from '../mocks'; -import { cloneDeep, set } from 'lodash'; +import { cloneDeep } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { ProtectionModes } from '../../../../../../../common/endpoint/types'; import userEvent from '@testing-library/user-event'; diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/protection_setting_card_switch.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/protection_setting_card_switch.test.tsx index 9a2bb55d85ea5..aa57720d58160 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/protection_setting_card_switch.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/protection_setting_card_switch.test.tsx @@ -16,7 +16,8 @@ import type { ProtectionSettingCardSwitchProps } from './protection_setting_card import { ProtectionSettingCardSwitch } from './protection_setting_card_switch'; import { exactMatchText, expectIsViewOnly, setMalwareMode } from '../mocks'; import { ProtectionModes } from '../../../../../../../common/endpoint/types'; -import { cloneDeep, set } from 'lodash'; +import { cloneDeep } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import userEvent from '@testing-library/user-event'; jest.mock('../../../../../../common/hooks/use_license'); diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_layout/policy_settings_layout.test.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_layout/policy_settings_layout.test.tsx index 84642ffdc1582..f26d520406407 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_layout/policy_settings_layout.test.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_layout/policy_settings_layout.test.tsx @@ -21,7 +21,8 @@ import { getPolicySettingsFormTestSubjects, setMalwareMode, } from '../policy_settings_form/mocks'; -import { cloneDeep, set } from 'lodash'; +import { cloneDeep } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import { ProtectionModes } from '../../../../../../common/endpoint/types'; import { waitFor, cleanup } from '@testing-library/react'; import { packagePolicyRouteService, API_VERSIONS } from '@kbn/fleet-plugin/common'; diff --git a/x-pack/plugins/security_solution/public/notes/routes.tsx b/x-pack/plugins/security_solution/public/notes/routes.tsx index 7bd17c2b012ef..c49f54f9c9a93 100644 --- a/x-pack/plugins/security_solution/public/notes/routes.tsx +++ b/x-pack/plugins/security_solution/public/notes/routes.tsx @@ -6,8 +6,7 @@ */ import React from 'react'; -import { Switch } from 'react-router-dom'; -import { Route } from '@kbn/shared-ux-router'; +import { Route, Routes } from '@kbn/shared-ux-router'; import { TrackApplicationView } from '@kbn/usage-collection-plugin/public'; import { NoteManagementPage } from './pages/note_management_page'; import { SpyRoute } from '../common/utils/route/spy_routes'; @@ -26,10 +25,10 @@ const NotesManagementTelemetry = () => ( const NotesManagementContainer: React.FC = React.memo(() => { return ( - + - + ); }); NotesManagementContainer.displayName = 'NotesManagementContainer'; diff --git a/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts b/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts index 58e8aced4470b..337b1815b2f49 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts @@ -5,7 +5,8 @@ * 2.0. */ -import { get, has, set, omit, isObject, toString as fpToString } from 'lodash/fp'; +import { get, has, omit, isObject, toString as fpToString } from 'lodash/fp'; +import { set } from '@kbn/safer-lodash-set'; import type { Action, Middleware } from 'redux'; import type { CoreStart } from '@kbn/core/public'; import type { Filter, MatchAllFilter } from '@kbn/es-query'; diff --git a/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts b/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts index 66b804e07eb10..b3011005a8b76 100644 --- a/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts +++ b/x-pack/plugins/security_solution/server/endpoint/routes/actions/response_actions.test.ts @@ -71,7 +71,8 @@ import type { HapiReadableStream, SecuritySolutionRequestHandlerContext } from ' import { createHapiReadableStreamMock } from '../../services/actions/mocks'; import { EndpointActionGenerator } from '../../../../common/endpoint/data_generators/endpoint_action_generator'; import { CustomHttpRequestError } from '../../../utils/custom_http_request_error'; -import { omit, set } from 'lodash'; +import { omit } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { ResponseActionAgentType } from '../../../../common/endpoint/service/response_actions/constants'; import { responseActionsClientMock } from '../../services/actions/clients/mocks'; import type { ActionsApiRequestHandlerContext } from '@kbn/actions-plugin/server'; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/traverse_and_mutate_doc.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/traverse_and_mutate_doc.ts index c9720a139ae7d..128cabf02aca6 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/traverse_and_mutate_doc.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/rule_types/factories/utils/traverse_and_mutate_doc.ts @@ -8,7 +8,8 @@ import { ecsFieldMap } from '@kbn/alerts-as-data-utils'; import { flattenWithPrefix } from '@kbn/securitysolution-rules'; -import { isPlainObject, isArray, set } from 'lodash'; +import { isPlainObject, isArray } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { SearchTypes } from '../../../../../../common/detection_engine/types'; import { isValidIpType } from './ecs_types_validators/is_valid_ip_type'; diff --git a/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts b/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts index cb33d608ea0c9..0f29a415dfeba 100644 --- a/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts +++ b/x-pack/plugins/security_solution/server/lib/telemetry/helpers.ts @@ -8,7 +8,8 @@ import moment from 'moment'; import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types'; import type { PackagePolicy } from '@kbn/fleet-plugin/common/types/models/package_policy'; -import { merge, set } from 'lodash'; +import { merge } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { Logger, LogMeta } from '@kbn/core/server'; import { sha256 } from 'js-sha256'; import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; From 5d993700588909bb27d969b89685eb0197a779cb Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Wed, 9 Oct 2024 12:28:09 +0200 Subject: [PATCH 05/11] fix --- .../policy_settings_form/components/event_collection_card.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx index a1fee2d77b01d..8ab5f92da27c0 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/components/event_collection_card.tsx @@ -19,7 +19,8 @@ import { EuiSpacer, EuiText, } from '@elastic/eui'; -import { cloneDeep, get, set } from 'lodash'; +import { cloneDeep, get } from 'lodash'; +import { set } from '@kbn/safer-lodash-set'; import type { EuiCheckboxProps } from '@elastic/eui'; import { getEmptyValue } from '../../../../../../common/components/empty_value'; import { useTestIdGenerator } from '../../../../../hooks/use_test_id_generator'; From 12689db10716fa5a2fa92b8eb6a3b5abf2e8e2e3 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Wed, 9 Oct 2024 12:57:26 +0200 Subject: [PATCH 06/11] fixes --- .../security_solution/public/common/mock/router.tsx | 3 ++- .../common/utils/global_query_string/helpers.test.tsx | 3 ++- .../components/privileged_route/privileged_route.test.tsx | 7 ++++--- .../public/timelines/store/middlewares/timeline_save.ts | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/security_solution/public/common/mock/router.tsx b/x-pack/plugins/security_solution/public/common/mock/router.tsx index 7bb6027f1150d..b946c3bd9bd5f 100644 --- a/x-pack/plugins/security_solution/public/common/mock/router.tsx +++ b/x-pack/plugins/security_solution/public/common/mock/router.tsx @@ -5,7 +5,8 @@ * 2.0. */ -import { Router } from '@kbn/shared-ux-router'; +// eslint-disable-next-line no-restricted-imports +import { Router } from 'react-router-dom'; // eslint-disable-next-line @kbn/eslint/module_migration import routeData from 'react-router'; type Action = 'PUSH' | 'POP' | 'REPLACE'; diff --git a/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx b/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx index 9eb9a6ca814f7..6da409bcf92d9 100644 --- a/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx +++ b/x-pack/plugins/security_solution/public/common/utils/global_query_string/helpers.test.tsx @@ -16,7 +16,8 @@ import { } from './helpers'; import { renderHook } from '@testing-library/react-hooks'; import { createMemoryHistory } from 'history'; -import { Router } from '@kbn/shared-ux-router'; +// eslint-disable-next-line no-restricted-imports +import { Router } from 'react-router-dom'; import React from 'react'; const flyoutString = diff --git a/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx b/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx index 1e5ed2b0b5ab9..32294d09ea82d 100644 --- a/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx +++ b/x-pack/plugins/security_solution/public/management/components/privileged_route/privileged_route.test.tsx @@ -6,7 +6,8 @@ */ import React from 'react'; -import { Routes, MemoryRouter } from '@kbn/shared-ux-router'; +// eslint-disable-next-line no-restricted-imports +import { Switch, MemoryRouter } from 'react-router-dom'; import type { AppContextTestRender } from '../../../common/mock/endpoint'; import { createAppRootMockRenderer } from '../../../common/mock/endpoint'; import { PrivilegedRoute } from './privileged_route'; @@ -39,9 +40,9 @@ describe('PrivilegedRoute', () => { render = () => { renderResult = renderer.render( - + - + ); }; diff --git a/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts b/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts index 337b1815b2f49..a0d0ab4dd1061 100644 --- a/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts +++ b/x-pack/plugins/security_solution/public/timelines/store/middlewares/timeline_save.ts @@ -6,7 +6,7 @@ */ import { get, has, omit, isObject, toString as fpToString } from 'lodash/fp'; -import { set } from '@kbn/safer-lodash-set'; +import { set } from '@kbn/safer-lodash-set/fp'; import type { Action, Middleware } from 'redux'; import type { CoreStart } from '@kbn/core/public'; import type { Filter, MatchAllFilter } from '@kbn/es-query'; From be73153a2dde77c0a9f7557b4b6bdc234adf4d2b Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Wed, 9 Oct 2024 14:19:54 +0200 Subject: [PATCH 07/11] fix --- .../actions/add_to_timeline/cell_action/add_to_timeline.test.ts | 2 +- .../components/top_values_popover/top_values_popover.test.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts index 8b51e5dfa2091..3d105c34515b4 100644 --- a/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts +++ b/x-pack/plugins/security_solution/public/app/actions/add_to_timeline/cell_action/add_to_timeline.test.ts @@ -12,7 +12,7 @@ import { createAddToTimelineCellActionFactory } from './add_to_timeline'; import type { CellActionExecutionContext } from '@kbn/cell-actions'; import { GEO_FIELD_TYPE } from '../../../../timelines/components/timeline/body/renderers/constants'; import { createStartServicesMock } from '../../../../common/lib/kibana/kibana_react.mock'; -import set from '@kbn/safer-lodash-set/fp/set'; +import { set } from '@kbn/safer-lodash-set/fp'; import { KBN_FIELD_TYPES } from '@kbn/field-types'; const services = createStartServicesMock(); diff --git a/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx b/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx index 0334af18135bc..ed65f8a12a02a 100644 --- a/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx +++ b/x-pack/plugins/security_solution/public/app/components/top_values_popover/top_values_popover.test.tsx @@ -29,7 +29,7 @@ const data = { const mockUseObservable = jest.fn(); -jest.mock('react-use/lib/useObservable', () => mockUseObservable); +jest.mock('react-use/lib/useObservable', () => () => mockUseObservable()); jest.mock('../../../common/lib/kibana', () => { const original = jest.requireActual('../../../common/lib/kibana'); From 9295a4c62dbae5faa60413de8633657df06049f3 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Thu, 10 Oct 2024 11:12:21 +0200 Subject: [PATCH 08/11] update codeowners --- .github/CODEOWNERS | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 9b3c46d065fe1..81f96adc32e59 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1321,6 +1321,8 @@ x-pack/test_serverless/**/test_suites/observability/ai_assistant @elastic/obs-ai /x-pack/dev-tools @elastic/kibana-operations /catalog-info.yaml @elastic/kibana-operations @elastic/kibana-tech-leads /.devcontainer/ @elastic/kibana-operations +/.eslintrc.js @elastic/kibana-operations +/.eslintignore @elastic/kibana-operations # Appex QA /x-pack/test_serverless/tsconfig.json @elastic/appex-qa From 48673b3bd0f2a16cdd30162a24c5d5c57fdc2f69 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 14 Oct 2024 11:58:02 +0200 Subject: [PATCH 09/11] fixes --- .../comparison_side/comparison_side_help_info.tsx | 2 +- .../integrations/callouts/integration_card_top_callout.tsx | 2 +- .../components/onboarding_body/hooks/use_body_config.test.ts | 2 +- .../components/onboarding_body/hooks/use_body_config.ts | 2 +- .../onboarding_header/cards/teammates_card/teammates_card.tsx | 2 +- .../public/onboarding/hooks/use_stored_state.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/comparison_side/comparison_side_help_info.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/comparison_side/comparison_side_help_info.tsx index a2b7e1a360150..e1eaa9b1e96cd 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/comparison_side/comparison_side_help_info.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/comparison_side/comparison_side_help_info.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { useToggle } from 'react-use'; +import useToggle from 'react-use/lib/useToggle'; import { EuiPopover, EuiText, EuiButtonIcon } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n-react'; diff --git a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/cards/integrations/callouts/integration_card_top_callout.tsx b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/cards/integrations/callouts/integration_card_top_callout.tsx index 27c92d0f0b11f..3a6b5ae3be92c 100644 --- a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/cards/integrations/callouts/integration_card_top_callout.tsx +++ b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/cards/integrations/callouts/integration_card_top_callout.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useOnboardingService } from '../../../../../hooks/use_onboarding_service'; import { AgentlessAvailableCallout } from './agentless_available_callout'; diff --git a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts index 19e80e4005a59..303896e99e675 100644 --- a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts +++ b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts @@ -7,7 +7,7 @@ import { renderHook } from '@testing-library/react-hooks'; import { useBodyConfig } from './use_body_config'; import { useKibana } from '../../../../common/lib/kibana/kibana_react'; -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { hasCapabilities } from '../../../../common/lib/capabilities'; const bodyConfig = [ diff --git a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.ts b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.ts index e140f953fb028..f7b12e5988c0d 100644 --- a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.ts +++ b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useMemo } from 'react'; import { hasCapabilities } from '../../../../common/lib/capabilities'; import { useKibana } from '../../../../common/lib/kibana/kibana_react'; diff --git a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_header/cards/teammates_card/teammates_card.tsx b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_header/cards/teammates_card/teammates_card.tsx index da316e0d0d907..a79b288dd8562 100644 --- a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_header/cards/teammates_card/teammates_card.tsx +++ b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_header/cards/teammates_card/teammates_card.tsx @@ -6,7 +6,7 @@ */ import React from 'react'; -import { useObservable } from 'react-use'; +import useObservable from 'react-use/lib/useObservable'; import { useOnboardingService } from '../../../../hooks/use_onboarding_service'; import { LinkCard } from '../common/link_card'; import teammatesImage from './images/teammates_card.png'; diff --git a/x-pack/plugins/security_solution/public/onboarding/hooks/use_stored_state.ts b/x-pack/plugins/security_solution/public/onboarding/hooks/use_stored_state.ts index c22c8f0f5310c..eac269f3a4a35 100644 --- a/x-pack/plugins/security_solution/public/onboarding/hooks/use_stored_state.ts +++ b/x-pack/plugins/security_solution/public/onboarding/hooks/use_stored_state.ts @@ -5,7 +5,7 @@ * 2.0. */ -import { useLocalStorage } from 'react-use'; +import useLocalStorage from 'react-use/lib/useLocalStorage'; import type { OnboardingCardId } from '../constants'; import type { IntegrationTabId } from '../components/onboarding_body/cards/integrations/types'; From f0abe1203282e3f09ae0d160789d42f6914f6641 Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Mon, 14 Oct 2024 13:46:49 +0200 Subject: [PATCH 10/11] test fix --- .../components/onboarding_body/hooks/use_body_config.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts index 303896e99e675..775ff09546fe6 100644 --- a/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts +++ b/x-pack/plugins/security_solution/public/onboarding/components/onboarding_body/hooks/use_body_config.test.ts @@ -43,7 +43,7 @@ const bodyConfig = [ ]; // Mock dependencies -jest.mock('react-use'); +jest.mock('react-use/lib/useObservable'); jest.mock('../../../../common/lib/kibana/kibana_react'); jest.mock('../../../../common/lib/capabilities'); jest.mock('../body_config', () => ({ bodyConfig })); From f80d6a3b0d68d6ecd925054d2aefe1bb9d9d7faf Mon Sep 17 00:00:00 2001 From: Anton Dosov Date: Tue, 15 Oct 2024 11:14:56 +0200 Subject: [PATCH 11/11] fix --- .../rule_details/three_way_diff/final_edit/fields/kql_query.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_edit/fields/kql_query.tsx b/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_edit/fields/kql_query.tsx index abd3c93550694..69a00436b6992 100644 --- a/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_edit/fields/kql_query.tsx +++ b/x-pack/plugins/security_solution/public/detection_engine/rule_management/components/rule_details/three_way_diff/final_edit/fields/kql_query.tsx @@ -6,7 +6,7 @@ */ import React, { useCallback } from 'react'; -import { useToggle } from 'react-use'; +import useToggle from 'react-use/lib/useToggle'; import { css } from '@emotion/css'; import { EuiButtonEmpty } from '@elastic/eui'; import type { Type } from '@kbn/securitysolution-io-ts-alerting-types';