[8.7] Fix eslint rule for restricting certain lodash imports (#151023) (#151495)

# Backport

This will backport the following commits from `main` to `8.7`:
- [Fix eslint rule for restricting certain lodash imports
(#151023)](https://github.com/elastic/kibana/pull/151023)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Thomas
Watson","email":"watson@elastic.co"},"sourceCommit":{"committedDate":"2023-02-16T15:35:09Z","message":"Fix
eslint rule for restricting certain lodash imports (#151023)\n\nFixes
#110422\r\n\r\nTL;DR: The `lodash.set` function is unsafe and shouldn't
be called.\r\n\r\nCause of error: If you specify multiple
`no-restricted-imports` paths\r\nfor the same module, only the last path
is used. Instead you need to\r\ncombine them into a single path as I've
done in this PR.\r\n\r\nThis regression was introduced in
#100277","sha":"fbdeffb48fcc6c23ded1e84e62d3f33dc84de23d","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:APM","Team:uptime","release_note:skip","backport:all-open","v8.8.0"],"number":151023,"url":"https://github.com/elastic/kibana/pull/151023","mergeCommit":{"message":"Fix
eslint rule for restricting certain lodash imports (#151023)\n\nFixes
#110422\r\n\r\nTL;DR: The `lodash.set` function is unsafe and shouldn't
be called.\r\n\r\nCause of error: If you specify multiple
`no-restricted-imports` paths\r\nfor the same module, only the last path
is used. Instead you need to\r\ncombine them into a single path as I've
done in this PR.\r\n\r\nThis regression was introduced in
#100277","sha":"fbdeffb48fcc6c23ded1e84e62d3f33dc84de23d"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/151023","number":151023,"mergeCommit":{"message":"Fix
eslint rule for restricting certain lodash imports (#151023)\n\nFixes
#110422\r\n\r\nTL;DR: The `lodash.set` function is unsafe and shouldn't
be called.\r\n\r\nCause of error: If you specify multiple
`no-restricted-imports` paths\r\nfor the same module, only the last path
is used. Instead you need to\r\ncombine them into a single path as I've
done in this PR.\r\n\r\nThis regression was introduced in
#100277","sha":"fbdeffb48fcc6c23ded1e84e62d3f33dc84de23d"}}]}]
BACKPORT-->
This commit is contained in:
Thomas Watson 2023-02-17 11:16:52 +01:00 committed by GitHub
parent 58ce277564
commit 4ed6814a5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
68 changed files with 173 additions and 142 deletions

View file

@ -183,50 +183,49 @@ const DEV_PATTERNS = [
const RESTRICTED_IMPORTS = [
{
name: 'lodash',
importNames: ['set', 'setWith'],
message: 'Please use @kbn/safer-lodash-set instead',
importNames: ['set', 'setWith', 'template'],
message:
'lodash.set/setWith: Please use @kbn/safer-lodash-set instead.\n' +
'lodash.template: Function is unsafe, and not compatible with our content security policy.',
},
{
name: 'lodash.set',
message: 'Please use @kbn/safer-lodash-set instead',
message: 'Please use @kbn/safer-lodash-set/set instead',
},
{
name: 'lodash.setwith',
message: 'Please use @kbn/safer-lodash-set instead',
message: 'Please use @kbn/safer-lodash-set/setWith instead',
},
{
name: 'lodash/set',
message: 'Please use @kbn/safer-lodash-set instead',
message: 'Please use @kbn/safer-lodash-set/set instead',
},
{
name: 'lodash/setWith',
message: 'Please use @kbn/safer-lodash-set instead',
message: 'Please use @kbn/safer-lodash-set/setWith instead',
},
{
name: 'lodash/fp',
importNames: ['set', 'setWith', 'assoc', 'assocPath'],
message: 'Please use @kbn/safer-lodash-set instead',
importNames: ['set', 'setWith', 'assoc', 'assocPath', 'template'],
message:
'lodash.set/setWith/assoc/assocPath: Please use @kbn/safer-lodash-set/fp instead\n' +
'lodash.template: Function is unsafe, and not compatible with our content security policy.',
},
{
name: 'lodash/fp/set',
message: 'Please use @kbn/safer-lodash-set instead',
message: 'Please use @kbn/safer-lodash-set/fp/set instead',
},
{
name: 'lodash/fp/setWith',
message: 'Please use @kbn/safer-lodash-set instead',
message: 'Please use @kbn/safer-lodash-set/fp/setWith instead',
},
{
name: 'lodash/fp/assoc',
message: 'Please use @kbn/safer-lodash-set instead',
message: 'Please use @kbn/safer-lodash-set/fp/assoc instead',
},
{
name: 'lodash/fp/assocPath',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
name: 'lodash',
importNames: ['template'],
message: 'lodash.template is unsafe, and not compatible with our content security policy.',
message: 'Please use @kbn/safer-lodash-set/fp/assocPath instead',
},
{
name: 'lodash.template',
@ -236,11 +235,6 @@ const RESTRICTED_IMPORTS = [
name: 'lodash/template',
message: 'lodash.template is unsafe, and not compatible with our content security policy.',
},
{
name: 'lodash/fp',
importNames: ['template'],
message: 'lodash.template is unsafe, and not compatible with our content security policy.',
},
{
name: 'lodash/fp/template',
message: 'lodash.template is unsafe, and not compatible with our content security policy.',
@ -734,47 +728,54 @@ module.exports = {
{
files: ['**/*.{js,mjs,ts,tsx}'],
rules: {
'no-restricted-imports': [
2,
{
paths: RESTRICTED_IMPORTS,
},
],
'no-restricted-imports': ['error', ...RESTRICTED_IMPORTS],
'no-restricted-modules': [
2,
'error',
{
paths: [
{
name: 'lodash.set',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
name: 'lodash.setwith',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
name: 'lodash.template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
{
name: 'lodash/set',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
name: 'lodash/setWith',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
name: 'lodash/template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
],
name: 'lodash.set',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
name: 'lodash.setwith',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
name: 'lodash.template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
{
name: 'lodash/set',
message: 'Please use @kbn/safer-lodash-set/set instead',
},
{
name: 'lodash/setWith',
message: 'Please use @kbn/safer-lodash-set/setWith instead',
},
{
name: 'lodash/fp/set',
message: 'Please use @kbn/safer-lodash-set/fp/set instead',
},
{
name: 'lodash/fp/setWith',
message: 'Please use @kbn/safer-lodash-set/fp/setWith instead',
},
{
name: 'lodash/fp/assoc',
message: 'Please use @kbn/safer-lodash-set/fp/assoc instead',
},
{
name: 'lodash/fp/assocPath',
message: 'Please use @kbn/safer-lodash-set/fp/assocPath instead',
},
{
name: 'lodash/template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
],
'no-restricted-properties': [
2,
'error',
{
object: 'lodash',
property: 'set',
@ -785,18 +786,6 @@ module.exports = {
property: 'set',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
object: 'lodash',
property: 'template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
{
object: '_',
property: 'template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
{
object: 'lodash',
property: 'setWith',
@ -827,6 +816,18 @@ module.exports = {
property: 'assocPath',
message: 'Please use @kbn/safer-lodash-set instead',
},
{
object: 'lodash',
property: 'template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
{
object: '_',
property: 'template',
message:
'lodash.template is unsafe, and not compatible with our content security policy.',
},
],
},
},
@ -834,15 +835,11 @@ module.exports = {
files: ['**/common/**/*.{js,mjs,ts,tsx}', '**/public/**/*.{js,mjs,ts,tsx}'],
rules: {
'no-restricted-imports': [
2,
'error',
...RESTRICTED_IMPORTS,
{
paths: [
...RESTRICTED_IMPORTS,
{
name: 'semver',
message: 'Please use "semver/*/{function}" instead',
},
],
name: 'semver',
message: 'Please use "semver/*/{function}" instead',
},
],
},

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
export function dedot(source: Record<string, any>, target: Record<string, any>) {
// eslint-disable-next-line guard-for-in

View file

@ -14,5 +14,6 @@
],
"kbn_references": [
"@kbn/datemath",
"@kbn/safer-lodash-set",
]
}

View file

@ -5,7 +5,7 @@
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import {
buildInlineScriptForPhraseFilter,
buildPhraseFilter,

View file

@ -15,6 +15,7 @@
"kbn_references": [
"@kbn/utility-types",
"@kbn/i18n",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -7,7 +7,8 @@
*/
import { toExpression } from './to_expression';
import { cloneDeep, set, unset } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep, unset } from 'lodash';
describe('toExpression', () => {
describe('single expression', () => {

View file

@ -13,6 +13,7 @@
"**/*.js"
],
"kbn_references": [
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -7,7 +7,7 @@ Lodash v4.x.
## Example Usage
```js
const { set } = require('@elastic/safer-loadsh-set');
const { set } = require('@kbn/safer-lodash-set');
const object = { a: [{ b: { c: 3 } }] };

View file

@ -6,7 +6,7 @@
* Side Public License, v 1.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { PersistableStateService } from '@kbn/kibana-utils-plugin/common';
import {
ControlGroupTelemetry,

View file

@ -33,6 +33,7 @@
"@kbn/config-schema",
"@kbn/storybook",
"@kbn/ui-theme",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -6,7 +6,8 @@
* Side Public License, v 1.
*/
import { defaults, get, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { defaults, get } from 'lodash';
import { DataViewsService, DataView } from '.';
import { fieldFormatsMock } from '@kbn/field-formats-plugin/common/mocks';

View file

@ -26,6 +26,7 @@
"@kbn/core-test-helpers-http-setup-browser",
"@kbn/config-schema",
"@kbn/utility-types-jest",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -7,7 +7,7 @@
*/
import type { Logger } from '@kbn/core/server';
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { Readable } from 'stream';
import { encode } from 'cbor-x';
import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks';

View file

@ -27,6 +27,7 @@
"@kbn/core-saved-objects-api-server",
"@kbn/core-logging-server-mocks",
"@kbn/ecs",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { isEmpty, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { isEmpty } from 'lodash';
import { IEvent, SAVED_OBJECT_REL_PRIMARY } from '@kbn/event-log-plugin/server';
import { RelatedSavedObjects } from './related_saved_objects';

View file

@ -31,7 +31,8 @@
"@kbn/std",
"@kbn/logging",
"@kbn/logging-mocks",
"@kbn/core-elasticsearch-client-server-mocks"
"@kbn/core-elasticsearch-client-server-mocks",
"@kbn/safer-lodash-set"
],
"exclude": [
"target/**/*",

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { ActionsCompletion } from '../types';
import { ActionsConfigMap } from './get_actions_config_map';
import { SearchMetrics } from './types';

View file

@ -4,7 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { set, get, isEqual } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { get, isEqual } from 'lodash';
import type { BulkEditOperation, BulkEditFields } from '../types';
// defining an union type that will passed directly to generic function as a workaround for the issue similar to

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { cloneDeep, get, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep, get } from 'lodash';
import { NewPackagePolicy } from '@kbn/fleet-plugin/common';
import { AgentConfiguration } from '../../../common/agent_configuration/configuration_types';
import { AGENT_NAME } from '../../../common/es_fields/apm';

View file

@ -78,6 +78,7 @@
"@kbn/core-elasticsearch-server",
"@kbn/shared-ux-prompt-not-found",
"@kbn/core-saved-objects-api-server",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -25,7 +25,7 @@ import {
EuiText,
} from '@elastic/eui';
import { ExpressionAstExpression } from '@kbn/expressions-plugin/common';
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { defaultExpression } from './default_expression';
import { Fields } from './types';
import { getFieldPath, getFieldValue } from './utils';

View file

@ -9,7 +9,7 @@ import React, { FunctionComponent, useCallback, useEffect } from 'react';
import PropTypes from 'prop-types';
import { EuiSwitch, EuiSwitchEvent } from '@elastic/eui';
import { ExpressionAstExpression } from '@kbn/expressions-plugin/common';
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { defaultExpression } from './default_expression';
import { getFieldPath, getFieldValue } from './utils';

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { isArray, set, camelCase, isObject, omit, get } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { isArray, camelCase, isObject, omit, get } from 'lodash';
import {
isCommentRequestTypeExternalReference,
isCommentRequestTypePersistableState,

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import type { ActionConnector, ActionTypeConnector } from '../../../common/api';
import { basicPush } from '../../containers/mock';
import type { CaseConnectors } from '../../containers/types';

View file

@ -62,7 +62,8 @@ import {
import { DEFAULT_FILTER_OPTIONS, DEFAULT_QUERY_PARAMS } from './use_get_cases';
import { getCasesStatus } from '../api';
import { getCaseConnectorsMockResponse } from '../common/mock/connectors';
import { cloneDeep, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep } from 'lodash';
const abortCtrl = new AbortController();
const mockKibanaServices = KibanaServices.get as jest.Mock;

View file

@ -10,7 +10,8 @@ import type {
SavedObjectMigrationContext,
SavedObjectsMigrationLogger,
} from '@kbn/core/server';
import { cloneDeep, omit, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep, omit } from 'lodash';
import { migrationMocks } from '@kbn/core/server/mocks';
import { removeRuleInformation } from './alerts';

View file

@ -9,7 +9,8 @@ import { setMockValues } from '../../../../../__mocks__/kea_logic';
import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { AccordionList } from '../../../../../shared/accordion_list/accordion_list';

View file

@ -11,7 +11,8 @@ import { setMockValues } from '../../../../__mocks__/kea_logic';
import React from 'react';
import { shallow } from 'enzyme';
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { SuggestionsCallout } from '../components/suggestions_callout';

View file

@ -14,9 +14,8 @@ import React from 'react';
import { shallow } from 'enzyme';
import { set } from 'lodash/fp';
import { EuiTab } from '@elastic/eui';
import { set } from '@kbn/safer-lodash-set/fp';
import { getPageHeaderTabs, getPageTitle } from '../../../../test_helpers';

View file

@ -12,7 +12,8 @@ import '../../../__mocks__/engine_logic.mock';
import React from 'react';
import { shallow } from 'enzyme';
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { CurationsTable, EmptyState } from '../components';

View file

@ -11,7 +11,8 @@ import { setMockValues } from '../../../../__mocks__/kea_logic';
import React from 'react';
import { shallow } from 'enzyme';
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { SuggestionsCallout } from '../../curations/components/suggestions_callout';

View file

@ -9,7 +9,8 @@ import { setMockValues } from '../../../../../__mocks__/kea_logic';
import React from 'react';
import { shallow, ShallowWrapper } from 'enzyme';
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { AccordionList } from '../../../../../shared/accordion_list/accordion_list';

View file

@ -47,5 +47,6 @@
"@kbn/cypress-config",
"@kbn/discover-plugin",
"@kbn/guided-onboarding",
"@kbn/safer-lodash-set",
]
}

View file

@ -4,7 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { set, uniq, cloneDeep } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { uniq, cloneDeep } from 'lodash';
import { i18n } from '@kbn/i18n';
import moment from 'moment-timezone';
import type { Serializable } from '@kbn/utility-types';

View file

@ -63,6 +63,7 @@
"@kbn/core-saved-objects-common",
"@kbn/core-ui-settings-browser",
"@kbn/core-saved-objects-server",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -6,7 +6,8 @@
*/
import moment from 'moment';
import { set, unset } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { unset } from 'lodash';
import { STANDALONE_CLUSTER_CLUSTER_UUID } from '../../../common/constants';
import { handleResponse, getNodeInfo } from './get_node_info';
import { LegacyRequest } from '../../types';

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { pickBy, get, isEmpty, isString, unset, set, intersection } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { pickBy, get, isEmpty, isString, unset, intersection } from 'lodash';
import satisfies from 'semver/functions/satisfies';
import {
EuiFlexGroup,

View file

@ -6,7 +6,8 @@
*/
import type { SavedObjectsClient, SavedObjectsFindResponse } from '@kbn/core/server';
import { has, map, mapKeys, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { has, map, mapKeys } from 'lodash';
import type { NewPackagePolicy } from '@kbn/fleet-plugin/common';
import { AGENT_POLICY_SAVED_OBJECT_TYPE } from '@kbn/fleet-plugin/common';
import produce from 'immer';

View file

@ -6,7 +6,8 @@
*/
import moment from 'moment-timezone';
import { has, set, unset, find, some, mapKeys } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { has, unset, find, some, mapKeys } from 'lodash';
import { schema } from '@kbn/config-schema';
import { produce } from 'immer';
import type { PackagePolicy } from '@kbn/fleet-plugin/common';

View file

@ -6,19 +6,8 @@
*/
import moment from 'moment-timezone';
import {
set,
unset,
has,
difference,
filter,
find,
map,
mapKeys,
uniq,
some,
isEmpty,
} from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { unset, has, difference, filter, find, map, mapKeys, uniq, some, isEmpty } from 'lodash';
import { schema } from '@kbn/config-schema';
import { produce } from 'immer';
import type { PackagePolicy } from '@kbn/fleet-plugin/common';

View file

@ -7,7 +7,8 @@
import { produce } from 'immer';
import { satisfies } from 'semver';
import { filter, reduce, mapKeys, each, set, unset, uniq, map, has } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { filter, reduce, mapKeys, each, unset, uniq, map, has } from 'lodash';
import type { PackagePolicyInputStream } from '@kbn/fleet-plugin/common';
import {
PACKAGE_POLICY_SAVED_OBJECT_TYPE,

View file

@ -68,5 +68,6 @@
"@kbn/core-elasticsearch-server",
"@kbn/core-saved-objects-api-server",
"@kbn/logging",
"@kbn/safer-lodash-set",
]
}

View file

@ -6,7 +6,7 @@
*/
import type { Logger } from '@kbn/core/server';
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { elasticsearchServiceMock, loggingSystemMock } from '@kbn/core/server/mocks';
import { ContentStream } from './content_stream';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { ElasticsearchClient } from '@kbn/core/server';
import { elasticsearchServiceMock } from '@kbn/core/server/mocks';
import { statuses } from '../../lib';

View file

@ -36,6 +36,7 @@
"@kbn/core-http-server",
"@kbn/core-test-helpers-test-utils",
"@kbn/expressions-plugin",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { cloneDeep, set, upperFirst } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep, upperFirst } from 'lodash';
import type { Logger } from '@kbn/core/server';
import { getDefaultChromiumSandboxDisabled } from './default_chromium_sandbox_disabled';
import { ConfigType } from './schema';

View file

@ -21,6 +21,7 @@
"@kbn/std",
"@kbn/i18n",
"@kbn/utils",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -5,11 +5,13 @@
* 2.0.
*/
import { cloneDeep, cloneDeepWith, get, set } from 'lodash';
import { cloneDeep, cloneDeepWith, get } from 'lodash';
import type { ChangeEventHandler, FocusEventHandler, ReactEventHandler } from 'react';
import { useState } from 'react';
import useAsyncFn from 'react-use/lib/useAsyncFn';
import { set } from '@kbn/safer-lodash-set';
export type FormReturnTuple<Values, Result> = [FormState<Values, Result>, FormProps];
export interface FormProps {

View file

@ -52,6 +52,7 @@
"@kbn/core-custom-branding-browser-mocks",
"@kbn/core-custom-branding-common",
"@kbn/core-custom-branding-server-mocks",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { mount } from 'enzyme';
import { omit, set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { omit } from 'lodash/fp';
import React from 'react';
import type { BUILT_IN_SCHEMA } from './helpers';

View file

@ -7,7 +7,7 @@
import sinon from 'sinon';
import moment from 'moment';
import set from 'lodash/set';
import set from '@kbn/safer-lodash-set/set';
import cloneDeep from 'lodash/cloneDeep';
import type { ExceptionListItemSchema } from '@kbn/securitysolution-io-ts-list-types';

View file

@ -6,7 +6,8 @@
*/
import { reducerWithInitialState } from 'typescript-fsa-reducers';
import { get, set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { get } from 'lodash/fp';
import {
Direction,
FlowTarget,

View file

@ -6,7 +6,7 @@
*/
import { reducerWithInitialState } from 'typescript-fsa-reducers';
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { DEFAULT_TABLE_ACTIVE_PAGE, DEFAULT_TABLE_LIMIT } from '../../../common/store/constants';
import {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import type { Client } from '@elastic/elasticsearch';
import type { ToolingLog } from '@kbn/tooling-log';
import type { KbnClient } from '@kbn/test';

View file

@ -4,7 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { set, cloneDeep } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep } from 'lodash';
import { getHostRiskIndex } from '../../../../../../common/search_strategy/security_solution/risk_score/common';
import { RiskScoreFields } from '../../../../../../common/search_strategy/security_solution/risk_score/all';

View file

@ -4,7 +4,8 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { set, cloneDeep } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep } from 'lodash';
import { getUserRiskIndex } from '../../../../../../common/search_strategy/security_solution/risk_score/common';
import { RiskScoreFields } from '../../../../../../common/search_strategy/security_solution/risk_score/all';
import { createSingleFieldMatchEnrichment } from '../create_single_field_match_enrichment';

View file

@ -9,7 +9,7 @@ import { applyEnrichmentsToEvents, mergeEnrichments } from './transforms';
import { ruleExecutionLogMock } from '../../../rule_monitoring/mocks';
import { createAlert } from '../__mocks__/alerts';
import type { EnrichmentFunction } from '../types';
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
const createEnrichment =
(field: string, value: string): EnrichmentFunction =>

View file

@ -28,7 +28,8 @@ import {
} from './helpers';
import type { ESClusterInfo, ESLicense, ExceptionListItem } from './types';
import type { PolicyConfig, PolicyData } from '../../../common/endpoint/types';
import { cloneDeep, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep } from 'lodash';
import { loggingSystemMock } from '@kbn/core/server/mocks';
describe('test diagnostic telemetry scheduled task timing helper', () => {

View file

@ -8,7 +8,8 @@
import { renderMustacheObject } from '@kbn/actions-plugin/server/lib/mustache_renderer';
import { ExecutorParams } from '@kbn/actions-plugin/server/sub_action_framework/types';
import { RenderParameterTemplates } from '@kbn/actions-plugin/server/types';
import { set, cloneDeep, get, isString } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { cloneDeep, get, isString } from 'lodash';
import { RULE_TAGS_TEMPLATE } from '../../../common/opsgenie';
import { OpsgenieSubActions } from '../../../common';
import { CreateAlertSubActionParams } from './types';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { renderParameterTemplates } from './render';
const params = {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { set } from 'lodash/fp';
import { set } from '@kbn/safer-lodash-set/fp';
import { ExecutorParams } from '@kbn/actions-plugin/server/sub_action_framework/types';
import { RenderParameterTemplates } from '@kbn/actions-plugin/server/types';
import { SUB_ACTION } from '../../../common/tines/constants';

View file

@ -26,6 +26,7 @@
"@kbn/kibana-react-plugin",
"@kbn/test-jest-helpers",
"@kbn/securitysolution-io-ts-utils",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import mockChartsData from './__fixtures__/monitor_charts_mock.json';
import { getMonitorDurationChart } from './get_monitor_duration';
import { getUptimeESMockClient } from './test_helpers';

View file

@ -6,7 +6,7 @@
*/
import { getPings } from './get_pings';
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { DYNAMIC_SETTINGS_DEFAULTS } from '../../../../common/constants';
import { getUptimeESMockClient } from './test_helpers';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { getQueryStringFilter } from './get_query_string_filter';
import { QueryContext } from './query_context';
import {

View file

@ -72,6 +72,7 @@
"@kbn/core-saved-objects-api-server-mocks",
"@kbn/core-saved-objects-server",
"@kbn/shared-ux-prompt-not-found",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",

View file

@ -5,7 +5,8 @@
* 2.0.
*/
import { constant, get, set } from 'lodash';
import { set } from '@kbn/safer-lodash-set';
import { constant, get } from 'lodash';
import { UserConfiguredActionConnector, IErrorObject, Rule } from '../../types';
export function throwIfAbsent<T>(message: string) {

View file

@ -45,6 +45,7 @@
"@kbn/datemath",
"@kbn/core-capabilities-common",
"@kbn/alerts-ui-shared",
"@kbn/safer-lodash-set",
],
"exclude": [
"target/**/*",