diff --git a/.eslintrc.js b/.eslintrc.js
index e46dde5a3c56f..006f39ce1026c 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -1014,6 +1014,7 @@ module.exports = {
'error',
{
patterns: ['**/legacy_uptime/*'],
+ paths: RESTRICTED_IMPORTS,
},
],
},
@@ -1055,6 +1056,7 @@ module.exports = {
{
// prevents UI code from importing server side code and then webpack including it when doing builds
patterns: ['**/server/*'],
+ paths: RESTRICTED_IMPORTS,
},
],
},
@@ -1113,6 +1115,7 @@ module.exports = {
{
// prevents UI code from importing server side code and then webpack including it when doing builds
patterns: ['**/server/*'],
+ paths: RESTRICTED_IMPORTS,
},
],
},
@@ -1184,13 +1187,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,
},
],
},
@@ -1348,6 +1345,7 @@ module.exports = {
{
// prevents UI code from importing server side code and then webpack including it when doing builds
patterns: ['**/server/*'],
+ paths: RESTRICTED_IMPORTS,
},
],
},
@@ -1525,6 +1523,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,
},
],
},
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 5dfa3bc89c0e6..08bac25c0a522 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';
@@ -26,7 +27,8 @@ import { AIConnector } from '../connectorland/connector_selector';
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..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
@@ -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 12f4a838a10a3..9ac817e03973a 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, UserProfileService } from '@kbn/core/public';
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/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/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/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/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 51fcb698d3a8f..aef2906d2206d 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 d738aa1fb150e..160287f9a3683 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_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/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/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.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/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..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 'lodash/fp';
+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 80b22c42b544e..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,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 5e26cea3c9783..f4161fccbc1c2 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/header/settings_modal/index.tsx b/x-pack/plugins/security_solution/public/attack_discovery/pages/header/settings_modal/index.tsx
index 0d342c591f32b..7543985c74786 100644
--- a/x-pack/plugins/security_solution/public/attack_discovery/pages/header/settings_modal/index.tsx
+++ b/x-pack/plugins/security_solution/public/attack_discovery/pages/header/settings_modal/index.tsx
@@ -24,7 +24,7 @@ import {
SHOW_SETTINGS_TOUR_LOCAL_STORAGE_KEY,
} from '@kbn/elastic-assistant';
import React, { useCallback, useEffect, useMemo, useState } from 'react';
-import { useLocalStorage } from 'react-use';
+import useLocalStorage from 'react-use/lib/useLocalStorage';
import { AlertsSettings } from './alerts_settings';
import { useSpaceId } from '../../../../common/hooks/use_space_id';
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..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
@@ -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 80d5488b62fde..e55b2fe5083b6 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
@@ -18,7 +18,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/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/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/common/mock/router.tsx b/x-pack/plugins/security_solution/public/common/mock/router.tsx
index d9cf89a74db08..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,6 +5,7 @@
* 2.0.
*/
+// 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';
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..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,6 +16,7 @@ import {
} from './helpers';
import { renderHook } from '@testing-library/react-hooks';
import { createMemoryHistory } from 'history';
+// eslint-disable-next-line no-restricted-imports
import { Router } from 'react-router-dom';
import React from 'react';
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/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/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';
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';
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 634027da6560a..7dc9970da5d9b 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';
@@ -34,14 +33,14 @@ const EntityAnalyticsManagementTelemetry = () => (
const EntityAnalyticsManagementContainer: React.FC = React.memo(() => {
return (
-
+
-
+
);
});
EntityAnalyticsManagementContainer.displayName = 'EntityAnalyticsManagementContainer';
@@ -57,14 +56,14 @@ const EntityAnalyticsAssetClassificationTelemetry = () => (
const EntityAnalyticsAssetClassificationContainer: React.FC = React.memo(() => {
return (
-
+
-
+
);
});
@@ -82,14 +81,14 @@ const EntityAnalyticsEntityStoreTelemetry = () => (
const EntityAnalyticsEntityStoreContainer: 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..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,6 +6,7 @@
*/
import React from 'react';
+// 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';
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/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/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/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/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/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/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';
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_form/mocks.ts b/x-pack/plugins/security_solution/public/management/pages/policy/view/policy_settings_form/mocks.ts
index 9448b93c7627e..e51382a6b91a8 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/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/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..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
@@ -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 = [
@@ -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 }));
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';
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..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
@@ -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/fp';
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/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';
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';