From 0d76d5524fca04635c1751de6c3a449f427416c1 Mon Sep 17 00:00:00 2001 From: Brittany Joiner Date: Thu, 24 Sep 2020 11:38:11 -0500 Subject: [PATCH] Adding comment about importing lodash library (#78156) * added comment about importing lodash library * fixed space with prefer * cleaned up extra space and removed comments for lodash/fp * took out the comment in server files * Remove newlines Co-authored-by: Nathan L Smith --- .eslintrc.js | 15 +++++++++++++++ packages/kbn-std/src/merge.ts | 2 ++ .../components/app/ServiceMap/Cytoscape.tsx | 2 ++ .../ServiceMap/use_cytoscape_event_handlers.ts | 2 ++ .../components/shared/source_icon/source_icon.tsx | 2 ++ .../components/shared/source_row/source_row.tsx | 2 ++ .../components/grok_debugger/grok_debugger.js | 2 ++ .../policies/policy_serialization.test.ts | 2 ++ .../shared/serialize_phase_with_allocation.ts | 2 ++ .../pages/link_to/redirect_to_node_logs.tsx | 2 ++ .../public/services/feature_usage_service.ts | 2 ++ x-pack/plugins/ml/common/util/job_utils.ts | 8 ++++++++ .../annotations_table/annotations_table.js | 2 ++ .../components/anomalies_table/anomalies_table.js | 2 ++ .../anomalies_table/anomalies_table_columns.js | 2 ++ .../components/anomalies_table/anomaly_details.js | 4 ++++ .../anomalies_table/influencers_cell.js | 2 ++ .../components/anomalies_table/links_menu.js | 2 ++ .../analytics_list/use_table_settings.ts | 4 ++++ .../components/combined_fields/geo_point.tsx | 2 ++ .../explorer_charts_container_service.js | 12 ++++++++++++ .../explorer_charts_container_service.test.js | 2 ++ .../application/explorer/explorer_swimlane.tsx | 6 ++++++ .../jobs_list/components/jobs_list/jobs_list.js | 2 ++ .../application/services/forecast_service.js | 6 ++++++ .../ml/public/application/services/job_service.js | 10 ++++++++++ .../application/services/mapping_service.js | 2 ++ .../services/results_service/result_service_rx.ts | 4 ++++ .../services/results_service/results_service.js | 4 ++++ .../forecasting_modal/forecasting_modal.js | 2 ++ .../timeseries_chart/timeseries_chart.js | 8 ++++++++ .../timeseries_search_service.ts | 8 ++++++++ .../timeseriesexplorer_utils.js | 6 ++++++ .../application/util/chart_config_builder.js | 2 ++ .../ml/public/application/util/time_buckets.js | 10 ++++++++++ .../anomaly_detection_urls_generator.ts | 2 ++ .../plugins/ml/public/ml_url_generator/common.ts | 2 ++ .../public/common/containers/sourcerer/index.tsx | 2 ++ .../public/common/store/sourcerer/reducer.ts | 2 ++ .../components/rules/step_define_rule/index.tsx | 2 ++ .../public/timelines/containers/api.ts | 2 ++ .../advanced_pivot_editor.tsx | 2 ++ .../components/aggregation_list/popover_form.tsx | 2 ++ .../apply_transform_config_to_define_state.ts | 2 ++ .../filter_agg/components/filter_term_form.tsx | 2 ++ .../use_edit_transform_flyout.ts | 4 ++++ .../transform_list/use_table_settings.ts | 4 ++++ .../connected_flyout_manage_drilldowns.tsx | 2 ++ .../url_drilldown/url_drilldown_scope.ts | 2 ++ 49 files changed, 179 insertions(+) diff --git a/.eslintrc.js b/.eslintrc.js index 0d71fd0a99f778..74e3e42cbd1ac0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -1233,5 +1233,20 @@ module.exports = { '@typescript-eslint/prefer-ts-expect-error': 'error', }, }, + { + files: [ + '**/public/**/*.{js,mjs,ts,tsx}', + '**/common/**/*.{js,mjs,ts,tsx}', + 'packages/**/*.{js,mjs,ts,tsx}', + ], + rules: { + 'no-restricted-imports': [ + 'error', + { + patterns: ['lodash/*', '!lodash/fp'], + }, + ], + }, + }, ], }; diff --git a/packages/kbn-std/src/merge.ts b/packages/kbn-std/src/merge.ts index c0de50544a34e1..dca80774356576 100644 --- a/packages/kbn-std/src/merge.ts +++ b/packages/kbn-std/src/merge.ts @@ -16,6 +16,8 @@ * specific language governing permissions and limitations * under the License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isPlainObject from 'lodash/isPlainObject'; /** * Deeply merges two objects, omitting undefined values, and not deeply merging Arrays. diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx b/x-pack/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx index 41dacfd8b588af..5fa74f927d2dea 100644 --- a/x-pack/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx +++ b/x-pack/plugins/apm/public/components/app/ServiceMap/Cytoscape.tsx @@ -6,6 +6,8 @@ import cytoscape from 'cytoscape'; import dagre from 'cytoscape-dagre'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; import React, { createContext, diff --git a/x-pack/plugins/apm/public/components/app/ServiceMap/use_cytoscape_event_handlers.ts b/x-pack/plugins/apm/public/components/app/ServiceMap/use_cytoscape_event_handlers.ts index 3f879196f2a4f7..e77fc4dfb2f513 100644 --- a/x-pack/plugins/apm/public/components/app/ServiceMap/use_cytoscape_event_handlers.ts +++ b/x-pack/plugins/apm/public/components/app/ServiceMap/use_cytoscape_event_handlers.ts @@ -5,6 +5,8 @@ */ import cytoscape from 'cytoscape'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import debounce from 'lodash/debounce'; import { useEffect } from 'react'; import { EuiTheme, useUiTracker } from '../../../../../observability/public'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx index ddbe327a40a305..67d435e330c3df 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_icon/source_icon.tsx @@ -6,6 +6,8 @@ import React from 'react'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import _camelCase from 'lodash/camelCase'; import { images } from '../assets'; diff --git a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx index 17ca8e58a80fab..a2e252c8863548 100644 --- a/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/workplace_search/components/shared/source_row/source_row.tsx @@ -7,6 +7,8 @@ import React from 'react'; import classNames from 'classnames'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import _kebabCase from 'lodash/kebabCase'; import { Link } from 'react-router-dom'; diff --git a/x-pack/plugins/grokdebugger/public/components/grok_debugger/grok_debugger.js b/x-pack/plugins/grokdebugger/public/components/grok_debugger/grok_debugger.js index 75569f472e2198..b523dc3c1ba6c4 100644 --- a/x-pack/plugins/grokdebugger/public/components/grok_debugger/grok_debugger.js +++ b/x-pack/plugins/grokdebugger/public/components/grok_debugger/grok_debugger.js @@ -5,6 +5,8 @@ */ import React from 'react'; import { i18n } from '@kbn/i18n'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEmpty from 'lodash/isEmpty'; import './brace_imports'; diff --git a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/policy_serialization.test.ts b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/policy_serialization.test.ts index 753ffb111cf130..222887069a0dc0 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/policy_serialization.test.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/policy_serialization.test.ts @@ -3,6 +3,8 @@ * or more contributor license agreements. Licensed under the Elastic License; * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import cloneDeep from 'lodash/cloneDeep'; import { serializePolicy } from './policy_serialization'; import { diff --git a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/shared/serialize_phase_with_allocation.ts b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/shared/serialize_phase_with_allocation.ts index 5a9db3069aea61..c29ae3ab228315 100644 --- a/x-pack/plugins/index_lifecycle_management/public/application/services/policies/shared/serialize_phase_with_allocation.ts +++ b/x-pack/plugins/index_lifecycle_management/public/application/services/policies/shared/serialize_phase_with_allocation.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import cloneDeep from 'lodash/cloneDeep'; import { diff --git a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx index a32e1e68141b5c..0541b811508eea 100644 --- a/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx +++ b/x-pack/plugins/infra/public/pages/link_to/redirect_to_node_logs.tsx @@ -5,6 +5,8 @@ */ import { i18n } from '@kbn/i18n'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import flowRight from 'lodash/flowRight'; import React from 'react'; import { Redirect, RouteComponentProps } from 'react-router-dom'; diff --git a/x-pack/plugins/licensing/public/services/feature_usage_service.ts b/x-pack/plugins/licensing/public/services/feature_usage_service.ts index c076bff58359fb..d8fe892a2f684c 100644 --- a/x-pack/plugins/licensing/public/services/feature_usage_service.ts +++ b/x-pack/plugins/licensing/public/services/feature_usage_service.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isDate from 'lodash/isDate'; import type { HttpSetup, HttpStart } from 'src/core/public'; import { LicenseType } from '../../common/types'; diff --git a/x-pack/plugins/ml/common/util/job_utils.ts b/x-pack/plugins/ml/common/util/job_utils.ts index 9729240567c249..04a460251cb6f9 100644 --- a/x-pack/plugins/ml/common/util/job_utils.ts +++ b/x-pack/plugins/ml/common/util/job_utils.ts @@ -4,9 +4,17 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEmpty from 'lodash/isEmpty'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import pick from 'lodash/pick'; import semver from 'semver'; diff --git a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js index d5025fd3c36492..67db378fb7951a 100644 --- a/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js +++ b/x-pack/plugins/ml/public/application/components/annotations/annotations_table/annotations_table.js @@ -10,6 +10,8 @@ * getting the annotations via props (used in Anomaly Explorer and Single Series Viewer). */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import uniq from 'lodash/uniq'; import PropTypes from 'prop-types'; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js index 378ee82805173f..d6eb0afed753df 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table.js @@ -9,6 +9,8 @@ */ import PropTypes from 'prop-types'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import React, { Component } from 'react'; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js index 57f3a08713ffe0..299173fc4436d2 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomalies_table_columns.js @@ -7,6 +7,8 @@ import { EuiButtonIcon, EuiLink, EuiScreenReaderOnly } from '@elastic/eui'; import React from 'react'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js index c4ef45800dc3df..e0b20ab7317492 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/anomaly_details.js @@ -11,7 +11,11 @@ import PropTypes from 'prop-types'; import React, { Component, Fragment } from 'react'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import pick from 'lodash/pick'; import { i18n } from '@kbn/i18n'; import { FormattedMessage } from '@kbn/i18n/react'; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js b/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js index abdb0961351abc..505ccf46c5a625 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/influencers_cell.js @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; import PropTypes from 'prop-types'; import React, { Component } from 'react'; diff --git a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js index 6025dd1c7433e7..114dc463fa3a6d 100644 --- a/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js +++ b/x-pack/plugins/ml/public/application/components/anomalies_table/links_menu.js @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import cloneDeep from 'lodash/cloneDeep'; import moment from 'moment'; import rison from 'rison-node'; diff --git a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_table_settings.ts b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_table_settings.ts index 052068c30b84c9..71e503998ed47d 100644 --- a/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_table_settings.ts +++ b/x-pack/plugins/ml/public/application/data_frame_analytics/pages/analytics_management/components/analytics_list/use_table_settings.ts @@ -6,7 +6,11 @@ import { useState } from 'react'; import { Direction, EuiBasicTableProps, EuiTableSortingType } from '@elastic/eui'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import sortBy from 'lodash/sortBy'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; const PAGE_SIZE = 10; diff --git a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/geo_point.tsx b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/geo_point.tsx index 831ae8de8081a9..0f6ffe44cc9f82 100644 --- a/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/geo_point.tsx +++ b/x-pack/plugins/ml/public/application/datavisualizer/file_based/components/combined_fields/geo_point.tsx @@ -5,6 +5,8 @@ */ import { i18n } from '@kbn/i18n'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import debounce from 'lodash/debounce'; import { FormattedMessage } from '@kbn/i18n/react'; import React, { ChangeEvent, Component, Fragment } from 'react'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js index a6fda86f27a7c3..9ca1d935c6e1e4 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.js @@ -11,11 +11,23 @@ * and manages the layout of the charts in the containing div. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import find from 'lodash/find'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import sortBy from 'lodash/sortBy'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import map from 'lodash/map'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import reduce from 'lodash/reduce'; import { buildConfig } from './explorer_chart_config_builder'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js index a7d422d1611080..8e9e8a03929c31 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js +++ b/x-pack/plugins/ml/public/application/explorer/explorer_charts/explorer_charts_container_service.test.js @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import cloneDeep from 'lodash/cloneDeep'; import mockAnomalyChartRecords from './__mocks__/mock_anomaly_chart_records.json'; diff --git a/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx b/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx index 05e082711f6197..f464eaf362c3a6 100644 --- a/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx +++ b/x-pack/plugins/ml/public/application/explorer/explorer_swimlane.tsx @@ -10,8 +10,14 @@ import React from 'react'; import './_explorer.scss'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import uniq from 'lodash/uniq'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import d3 from 'd3'; import moment from 'moment'; diff --git a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js index 21eed1ed768236..b52923727ea264 100644 --- a/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js +++ b/x-pack/plugins/ml/public/application/jobs/jobs_list/components/jobs_list/jobs_list.js @@ -7,6 +7,8 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import sortBy from 'lodash/sortBy'; import moment from 'moment'; diff --git a/x-pack/plugins/ml/public/application/services/forecast_service.js b/x-pack/plugins/ml/public/application/services/forecast_service.js index c13e265b4655c1..a99c82015df4d1 100644 --- a/x-pack/plugins/ml/public/application/services/forecast_service.js +++ b/x-pack/plugins/ml/public/application/services/forecast_service.js @@ -6,8 +6,14 @@ // Service for carrying out requests to run ML forecasts and to obtain // data on forecasts that have been performed. +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import find from 'lodash/find'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; import { map } from 'rxjs/operators'; diff --git a/x-pack/plugins/ml/public/application/services/job_service.js b/x-pack/plugins/ml/public/application/services/job_service.js index ea97492ae0f5ad..eef760fb5d017e 100644 --- a/x-pack/plugins/ml/public/application/services/job_service.js +++ b/x-pack/plugins/ml/public/application/services/job_service.js @@ -4,10 +4,20 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import cloneDeep from 'lodash/cloneDeep'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import find from 'lodash/find'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isNumber from 'lodash/isNumber'; import moment from 'moment'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/plugins/ml/public/application/services/mapping_service.js b/x-pack/plugins/ml/public/application/services/mapping_service.js index 251bb0bce56907..76ed4949954770 100644 --- a/x-pack/plugins/ml/public/application/services/mapping_service.js +++ b/x-pack/plugins/ml/public/application/services/mapping_service.js @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; import { ml } from './ml_api_service'; diff --git a/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts b/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts index 22f878a337f516..8ba71ba948b150 100644 --- a/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts +++ b/x-pack/plugins/ml/public/application/services/results_service/result_service_rx.ts @@ -13,7 +13,11 @@ // Returned response contains a results property containing the requested aggregation. import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import { Dictionary } from '../../../../common/types/common'; import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils'; diff --git a/x-pack/plugins/ml/public/application/services/results_service/results_service.js b/x-pack/plugins/ml/public/application/services/results_service/results_service.js index fd48845494dfd2..fac1ee1480172e 100644 --- a/x-pack/plugins/ml/public/application/services/results_service/results_service.js +++ b/x-pack/plugins/ml/public/application/services/results_service/results_service.js @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import { ML_MEDIAN_PERCENTS } from '../../../../common/util/job_utils'; diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js index d825844ffa14bc..9f18eb1f4fed67 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/forecasting_modal/forecasting_modal.js @@ -9,6 +9,8 @@ */ import PropTypes from 'prop-types'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import React, { Component } from 'react'; diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js index c1afb2994c92f9..78583fc4872b2d 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/components/timeseries_chart/timeseries_chart.js @@ -12,9 +12,17 @@ import PropTypes from 'prop-types'; import React, { Component } from 'react'; import useObservable from 'react-use/lib/useObservable'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import reduce from 'lodash/reduce'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import d3 from 'd3'; import moment from 'moment'; diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts index 5149fecb0ec26e..b8f5f088227663 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseries_search_service.ts @@ -4,9 +4,17 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import find from 'lodash/find'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import filter from 'lodash/filter'; import { Observable } from 'rxjs'; diff --git a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js index 7d14bb43ef8117..c8c1c98e758b88 100644 --- a/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js +++ b/x-pack/plugins/ml/public/application/timeseriesexplorer/timeseriesexplorer_utils/timeseriesexplorer_utils.js @@ -10,8 +10,14 @@ * Viewer dashboard. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import each from 'lodash/each'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import find from 'lodash/find'; import moment from 'moment-timezone'; diff --git a/x-pack/plugins/ml/public/application/util/chart_config_builder.js b/x-pack/plugins/ml/public/application/util/chart_config_builder.js index bc63404a106db0..0c4aa4f717dbe2 100644 --- a/x-pack/plugins/ml/public/application/util/chart_config_builder.js +++ b/x-pack/plugins/ml/public/application/util/chart_config_builder.js @@ -9,6 +9,8 @@ * in the source metric data. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; import { mlFunctionToESAggregation } from '../../../common/util/job_utils'; diff --git a/x-pack/plugins/ml/public/application/util/time_buckets.js b/x-pack/plugins/ml/public/application/util/time_buckets.js index 15b8f24804ec84..f859b465f5de12 100644 --- a/x-pack/plugins/ml/public/application/util/time_buckets.js +++ b/x-pack/plugins/ml/public/application/util/time_buckets.js @@ -4,10 +4,20 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isPlainObject from 'lodash/isPlainObject'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isString from 'lodash/isString'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import ary from 'lodash/ary'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import sortBy from 'lodash/sortBy'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import assign from 'lodash/assign'; import moment from 'moment'; import dateMath from '@elastic/datemath'; diff --git a/x-pack/plugins/ml/public/ml_url_generator/anomaly_detection_urls_generator.ts b/x-pack/plugins/ml/public/ml_url_generator/anomaly_detection_urls_generator.ts index 6a44756412fe39..97ee083bedaa69 100644 --- a/x-pack/plugins/ml/public/ml_url_generator/anomaly_detection_urls_generator.ts +++ b/x-pack/plugins/ml/public/ml_url_generator/anomaly_detection_urls_generator.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEmpty from 'lodash/isEmpty'; import { AnomalyDetectionQueryState, diff --git a/x-pack/plugins/ml/public/ml_url_generator/common.ts b/x-pack/plugins/ml/public/ml_url_generator/common.ts index f929e513e618a0..59dddeed298885 100644 --- a/x-pack/plugins/ml/public/ml_url_generator/common.ts +++ b/x-pack/plugins/ml/public/ml_url_generator/common.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEmpty from 'lodash/isEmpty'; import { MlGenericUrlState } from '../../common/types/ml_url_generator'; import { setStateToKbnUrl } from '../../../../../src/plugins/kibana_utils/public'; diff --git a/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx b/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx index afacd68d715920..b02a09625ccf3e 100644 --- a/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx +++ b/x-pack/plugins/security_solution/public/common/containers/sourcerer/index.tsx @@ -5,6 +5,8 @@ */ import deepEqual from 'fast-deep-equal'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; import { useEffect, useMemo } from 'react'; import { useDispatch, useSelector } from 'react-redux'; diff --git a/x-pack/plugins/security_solution/public/common/store/sourcerer/reducer.ts b/x-pack/plugins/security_solution/public/common/store/sourcerer/reducer.ts index b65d4d6338e504..221244aaf9200e 100644 --- a/x-pack/plugins/security_solution/public/common/store/sourcerer/reducer.ts +++ b/x-pack/plugins/security_solution/public/common/store/sourcerer/reducer.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEmpty from 'lodash/isEmpty'; import { reducerWithInitialState } from 'typescript-fsa-reducers'; diff --git a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx index 99999ddbf19767..dc31db76c39112 100644 --- a/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx +++ b/x-pack/plugins/security_solution/public/detections/components/rules/step_define_rule/index.tsx @@ -7,6 +7,8 @@ import { EuiButtonEmpty, EuiFormRow } from '@elastic/eui'; import React, { FC, memo, useCallback, useState, useEffect } from 'react'; import styled from 'styled-components'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; import { DEFAULT_INDEX_KEY } from '../../../../../common/constants'; diff --git a/x-pack/plugins/security_solution/public/timelines/containers/api.ts b/x-pack/plugins/security_solution/public/timelines/containers/api.ts index c6794d125368e7..6350b36daa268f 100644 --- a/x-pack/plugins/security_solution/public/timelines/containers/api.ts +++ b/x-pack/plugins/security_solution/public/timelines/containers/api.ts @@ -6,6 +6,8 @@ import { fold } from 'fp-ts/lib/Either'; import { identity } from 'fp-ts/lib/function'; import { pipe } from 'fp-ts/lib/pipeable'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEmpty from 'lodash/isEmpty'; import { throwErrors } from '../../../../case/common/api'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor/advanced_pivot_editor.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor/advanced_pivot_editor.tsx index cb888444ca867b..afb0f49a8c816c 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor/advanced_pivot_editor.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/advanced_pivot_editor/advanced_pivot_editor.tsx @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; import React, { memo, FC } from 'react'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx index 6204aeff0306e8..3cfab74f421112 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/aggregation_list/popover_form.tsx @@ -18,6 +18,8 @@ import { EuiSelectOption, } from '@elastic/eui'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import cloneDeep from 'lodash/cloneDeep'; import { useUpdateEffect } from 'react-use'; import { AggName } from '../../../../../../common/types/aggregations'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts index f00102a2f87c00..0235cdcf8b5e46 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/apply_transform_config_to_define_state.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; import { Dictionary } from '../../../../../../../common/types/common'; diff --git a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx index f27d50ac2773c4..416d34481451e8 100644 --- a/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx +++ b/x-pack/plugins/transform/public/app/sections/create_transform/components/step_define/common/filter_agg/components/filter_term_form.tsx @@ -7,6 +7,8 @@ import React, { useCallback, useContext, useEffect, useState } from 'react'; import { EuiComboBox, EuiFormRow } from '@elastic/eui'; import { FormattedMessage } from '@kbn/i18n/react'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import debounce from 'lodash/debounce'; import { useUpdateEffect } from 'react-use'; import { i18n } from '@kbn/i18n'; diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/edit_transform_flyout/use_edit_transform_flyout.ts b/x-pack/plugins/transform/public/app/sections/transform_management/components/edit_transform_flyout/use_edit_transform_flyout.ts index c3430ed94c6284..b0e1770c50d531 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/edit_transform_flyout/use_edit_transform_flyout.ts +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/edit_transform_flyout/use_edit_transform_flyout.ts @@ -4,7 +4,11 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import isEqual from 'lodash/isEqual'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import merge from 'lodash/merge'; import { useReducer } from 'react'; diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_table_settings.ts b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_table_settings.ts index ad40a3f8103b9a..b3aafbd187c914 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_table_settings.ts +++ b/x-pack/plugins/transform/public/app/sections/transform_management/components/transform_list/use_table_settings.ts @@ -6,7 +6,11 @@ import { useState } from 'react'; import { Direction, EuiBasicTableProps, EuiTableSortingType } from '@elastic/eui'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import sortBy from 'lodash/sortBy'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import get from 'lodash/get'; const PAGE_SIZE = 10; diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx index 28a0990cf75262..e048eeed9534a9 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/components/connected_flyout_manage_drilldowns/connected_flyout_manage_drilldowns.tsx @@ -7,6 +7,8 @@ import React, { useEffect, useState, useMemo } from 'react'; import { ToastsStart } from 'kibana/public'; import useMountedState from 'react-use/lib/useMountedState'; +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import intersection from 'lodash/intersection'; import { DrilldownWizardConfig, FlyoutDrilldownWizard } from '../flyout_drilldown_wizard'; import { FlyoutListManageDrilldowns } from '../flyout_list_manage_drilldowns'; diff --git a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/url_drilldown_scope.ts b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/url_drilldown_scope.ts index 2c9237fac593fe..4a6de4e26e8a7d 100644 --- a/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/url_drilldown_scope.ts +++ b/x-pack/plugins/ui_actions_enhanced/public/drilldowns/url_drilldown/url_drilldown_scope.ts @@ -4,6 +4,8 @@ * you may not use this file except in compliance with the Elastic License. */ +// Prefer importing entire lodash library, e.g. import { get } from "lodash" +// eslint-disable-next-line no-restricted-imports import partition from 'lodash/partition'; import { getFlattenedObject } from '@kbn/std'; import { UrlDrilldownGlobalScope, UrlDrilldownScope } from './types';