From f663e18cb88596100c16cd796c858fe0e8fd9131 Mon Sep 17 00:00:00 2001 From: spalger Date: Wed, 3 Jul 2019 13:00:44 -0700 Subject: [PATCH] [7.x] [prettier] upgrade to 1.18.2 (#40229) * [prettier] upgrade to 1.18.2 * autofix prettier violations (cherry picked from commit a95ae8c037b77caeb85158b6de513cb5b5ef3e55) --- package.json | 4 +- packages/elastic-datemath/src/index.d.ts | 2 +- .../kbn-dev-utils/src/proc_runner/proc.js | 4 +- packages/kbn-pm/src/utils/project.ts | 4 +- packages/kbn-test/src/es/es_test_cluster.js | 4 +- packages/kbn-test/src/es/es_test_config.js | 4 +- packages/kbn-test/src/kbn/kbn_test_config.js | 4 +- packages/kbn-test/types/ftr.d.ts | 2 +- src/core/public/chrome/chrome_service.tsx | 2 +- .../chrome/ui/header/header_extension.tsx | 2 +- src/core/public/core_system.test.ts | 10 +- .../frozen_object_mutation/index.ts | 38 +++--- src/core/server/config/__mocks__/env.ts | 2 +- src/core/server/http/router/router.ts | 4 +- .../server/logging/layouts/pattern_layout.ts | 4 +- .../discovery/plugin_manifest_parser.ts | 18 +-- .../plugins/discovery/plugins_discovery.ts | 4 +- .../migrations/kibana/kibana_migrator.ts | 2 +- .../service/lib/scoped_client_provider.ts | 8 +- src/dev/run/run.ts | 8 +- src/es_archiver/lib/stats.ts | 4 +- .../expressions/expression_renderer.tsx | 21 ++- .../filter/filter_manager/filter_manager.ts | 18 ++- .../embeddables/contact_card/contact_card.tsx | 6 +- .../kibana/public/dashboard/dashboard_app.tsx | 10 +- .../public/dashboard/top_nav/save_modal.tsx | 18 ++- .../visualize_embeddable_factory.ts | 4 +- src/legacy/server/index_patterns/mixin.d.ts | 6 +- .../controls/components/input_list.tsx | 18 +-- .../public/agg_types/controls/date_ranges.tsx | 30 ++--- .../agg_types/controls/extended_bounds.tsx | 11 +- .../ui/public/agg_types/controls/field.tsx | 15 +-- .../ui/public/agg_types/controls/filters.tsx | 21 ++- .../controls/has_extended_bounds.tsx | 9 +- .../public/agg_types/controls/metric_agg.tsx | 117 ++++++++-------- .../agg_types/controls/missing_bucket.tsx | 13 +- .../agg_types/controls/number_interval.tsx | 9 +- .../ui/public/agg_types/controls/order.tsx | 9 +- .../public/agg_types/controls/order_agg.tsx | 25 ++-- .../ui/public/agg_types/controls/order_by.tsx | 32 ++--- .../ui/public/agg_types/controls/ranges.tsx | 21 ++- .../ui/public/agg_types/controls/raw_json.tsx | 9 +- .../ui/public/agg_types/controls/size.tsx | 9 +- .../ui/public/agg_types/controls/string.tsx | 9 +- .../ui/public/agg_types/controls/sub_agg.tsx | 19 ++- .../agg_types/controls/time_interval.tsx | 9 +- .../agg_types/controls/top_aggregate.tsx | 40 +++--- .../agg_types/number_list/number_list.tsx | 40 +++--- .../public/autocomplete_providers/index.d.ts | 28 ++-- .../registry/chrome_header_nav_controls.ts | 2 +- .../components/default_editor_agg_param.tsx | 13 +- .../components/default_editor_agg_params.tsx | 84 +++++------- .../components/default_editor_agg_select.tsx | 22 ++- .../public/util/use_observable.ts | 11 +- test/common/services/retry/retry.ts | 4 +- test/functional/services/apps_menu.ts | 4 +- test/functional/services/browser.ts | 4 +- .../services/visual_testing/visual_testing.ts | 4 +- typings/index.d.ts | 2 +- .../plugins/alerting/server/alerts_client.ts | 4 +- .../app/ErrorGroupDetails/index.tsx | 50 +++---- .../app/ErrorGroupOverview/index.tsx | 50 +++---- .../components/app/ServiceDetails/index.tsx | 13 +- .../components/app/ServiceOverview/index.tsx | 80 ++++++----- .../components/app/TraceOverview/index.tsx | 13 +- .../TransactionDetails/Distribution/index.tsx | 70 +++++----- .../Transaction/ErrorCountBadge.tsx | 4 +- .../SpanFlyout/TruncateHeightSection.tsx | 17 +-- .../shared/EnvironmentFilter/index.tsx | 21 ++- .../TransactionBreakdownGraph/index.tsx | 25 ++-- .../shared/TransactionBreakdown/index.tsx | 83 ++++++------ .../TransactionLineChart/index.tsx | 55 ++++---- .../shared/useDelayedVisibility/index.ts | 48 +++---- .../apm/public/context/ChartsTimeContext.tsx | 15 +-- .../public/context/MatchedRouteContext.tsx | 15 +-- .../public/context/UrlParamsContext/index.tsx | 17 +-- .../hooks/useFetcher.integration.test.tsx | 15 +-- .../plugins/apm/public/hooks/useFetcher.tsx | 87 ++++++------ .../public/hooks/useServiceMetricCharts.ts | 25 ++-- .../public/hooks/useTransactionBreakdown.ts | 29 ++-- .../hooks/useTransactionDetailsCharts.ts | 27 ++-- .../hooks/useTransactionDistribution.ts | 49 ++++--- .../apm/public/hooks/useTransactionList.ts | 25 ++-- .../hooks/useTransactionOverviewCharts.ts | 25 ++-- .../plugins/apm/public/hooks/useWaterfall.ts | 13 +- .../plugins/apm/typings/elasticsearch.ts | 4 +- .../public/components/layouts/primary.tsx | 2 +- .../beats_management/server/lib/framework.ts | 4 +- .../plugins/beats_management/types/eui.d.ts | 4 +- .../elements/horizontal_progress_bar/index.ts | 4 +- .../horizontal_progress_pill/index.ts | 4 +- .../elements/progress_gauge/index.ts | 4 +- .../elements/progress_semicircle/index.ts | 4 +- .../elements/progress_wheel/index.ts | 4 +- .../elements/vertical_progress_bar/index.ts | 4 +- .../elements/vertical_progress_pill/index.ts | 4 +- .../functions/common/metric.ts | 4 +- .../workpad/workpad_app/workpad_telemetry.tsx | 2 +- .../canvas/public/lib/aeroelastic/index.d.ts | 2 +- .../plugins/canvas/server/lib/query_es_sql.js | 4 +- .../plugins/code/public/components/routes.ts | 4 +- .../plugins/code/server/lib/esqueue/job.d.ts | 9 +- .../code/server/lsp/abstract_launcher.ts | 2 +- .../legacy/plugins/code/server/lsp/proxy.ts | 5 +- .../plugins/code/server/repository_service.ts | 4 +- .../plugins/infra/common/utility_types.ts | 4 +- .../logging/log_highlights_menu.tsx | 9 +- .../logging/log_text_stream/log_entry_row.tsx | 4 +- .../scrollable_log_text_stream_view.tsx | 23 ++-- .../log_text_stream/vertical_scroll_panel.tsx | 16 +-- .../metrics_explorer/chart_context_menu.tsx | 19 ++- .../components/metrics_explorer/kuery_bar.tsx | 13 +- .../components/metrics_explorer/metrics.tsx | 15 +-- .../source_configuration_flyout.tsx | 33 +++-- .../source_configuration_form_state.tsx | 11 +- .../public/containers/logs/log_flyout.tsx | 22 ++- .../logs/log_highlights/log_highlights.tsx | 25 ++-- .../logs/log_highlights/redux_bridges.tsx | 20 +-- .../logs/log_summary/log_summary.tsx | 23 ++-- .../containers/logs/with_stream_items.ts | 9 +- .../containers/metrics/with_metrics_time.tsx | 34 ++--- .../use_metrics_explorer_data.ts | 125 +++++++++--------- .../infra/public/containers/source/source.tsx | 9 +- .../infra/public/hooks/use_interval.ts | 30 ++--- .../use_metric_explorer_state.ts | 11 +- .../pages/link_to/use_host_ip_to_name.ts | 37 +++--- .../plugins/infra/public/utils/typed_redux.ts | 4 +- .../infra/public/utils/use_observable.ts | 11 +- .../infra/public/utils/use_url_state.ts | 15 +-- .../metrics/kibana_metrics_adapter.ts | 4 +- .../ml/public/data_frame/common/pivot_aggs.ts | 2 +- .../define_pivot/define_pivot_form.tsx | 47 +++---- .../define_pivot/use_pivot_preview_data.ts | 14 +- .../components/job_create/job_create_form.tsx | 9 +- .../job_details/job_details_form.tsx | 31 ++--- .../use_source_index_data.ts | 9 +- .../server/routes/api/get_route.ts | 26 ++-- .../server/lib/generate_csv_search.ts | 4 +- .../plugins/reporting/server/routes/legacy.ts | 4 +- x-pack/legacy/plugins/reporting/types.d.ts | 17 ++- .../plugins/siem/common/utility_types.ts | 2 +- .../components/event_details/columns.tsx | 4 +- .../public/components/flyout/button/index.tsx | 4 +- .../public/components/flyout/header/index.tsx | 28 ++-- .../siem/public/components/flyout/index.tsx | 28 ++-- .../public/components/markdown/index.test.tsx | 4 +- .../ml/anomaly/use_anomalies_table_data.ts | 11 +- .../ml/tables/create_compound_key.ts | 8 +- .../ml_popover/hooks/use_job_summary_data.tsx | 11 +- .../ml_popover/hooks/use_siem_jobs.tsx | 11 +- .../public/components/open_timeline/types.ts | 10 +- .../public/components/page/manage_query.tsx | 14 +- .../page/overview/overview_host/index.tsx | 24 ++-- .../page/overview/overview_network/index.tsx | 24 ++-- .../public/components/resize_handle/index.tsx | 10 +- .../public/components/stat_items/index.tsx | 35 +++-- .../body/renderers/column_renderer.ts | 28 ++-- .../body/renderers/plain_column_renderer.tsx | 16 +-- .../timeline/body/renderers/row_renderer.ts | 19 +-- .../siem/public/components/timeline/events.ts | 91 +++++-------- .../public/components/timeline/helpers.tsx | 14 +- .../search_or_filter/search_or_filter.tsx | 10 +- .../url_state/index_mocked.test.tsx | 4 +- .../events/last_event_time/index.ts | 19 ++- .../public/containers/global_time/index.tsx | 24 ++-- .../siem/public/lib/clipboard/clipboard.tsx | 10 +- .../snapshot_restore/public/app/app.tsx | 15 +-- .../repository_details/repository_details.tsx | 11 +- .../restore_table/restore_table.tsx | 28 ++-- .../snapshot_details/snapshot_details.tsx | 9 +- .../repository_edit/repository_edit.tsx | 13 +- .../restore_snapshot/restore_snapshot.tsx | 13 +- .../public/app/services/http/use_request.ts | 39 +++--- .../spaces/public/components/space_avatar.tsx | 4 +- .../legacy/plugins/task_manager/task_store.ts | 8 +- .../monitor_list/condensed_check_list.tsx | 6 +- .../components/functional/ping_list.tsx | 9 +- .../higher_order/uptime_graphql_query.tsx | 33 +++-- .../plugins/uptime/public/pages/monitor.tsx | 41 +++--- .../plugins/uptime/public/pages/overview.tsx | 7 +- .../plugins/watcher/public/lib/use_request.ts | 33 +++-- .../watch_visualization.tsx | 45 +++---- .../watch_edit/components/watch_edit.tsx | 17 +-- .../watch_status/components/watch_detail.tsx | 27 ++-- .../watch_status/components/watch_status.tsx | 9 +- .../lib/feature_registry/feature_registry.ts | 4 +- .../functional/page_objects/uptime_page.ts | 4 +- .../common/suites/delete.ts | 4 +- .../common/suites/export.ts | 12 +- .../common/suites/find.ts | 20 +-- .../common/suites/get.ts | 8 +- .../security_and_spaces/apis/get.ts | 4 +- .../security_and_spaces/apis/select.ts | 20 +-- x-pack/test/typings/index.d.ts | 2 +- x-pack/typings/index.d.ts | 2 +- yarn.lock | 15 +-- 196 files changed, 1447 insertions(+), 1980 deletions(-) diff --git a/package.json b/package.json index 7d58daea0760..8be6c89f05f3 100644 --- a/package.json +++ b/package.json @@ -358,7 +358,7 @@ "enzyme-adapter-utils": "^1.12.0", "enzyme-to-json": "^3.3.4", "eslint": "5.16.0", - "eslint-config-prettier": "4.3.0", + "eslint-config-prettier": "6.0.0", "eslint-plugin-babel": "5.3.0", "eslint-plugin-ban": "1.2.0", "eslint-plugin-import": "2.18.0", @@ -418,7 +418,7 @@ "pngjs": "^3.4.0", "postcss": "^7.0.5", "postcss-url": "^8.0.0", - "prettier": "^1.14.3", + "prettier": "1.18.2", "proxyquire": "1.8.0", "regenerate": "^1.4.0", "sass-lint": "^1.12.1", diff --git a/packages/elastic-datemath/src/index.d.ts b/packages/elastic-datemath/src/index.d.ts index ea63dadd8115..319c598e3e4a 100644 --- a/packages/elastic-datemath/src/index.d.ts +++ b/packages/elastic-datemath/src/index.d.ts @@ -26,7 +26,7 @@ declare const datemath: { weight: number; type: 'calendar' | 'fixed' | 'mixed'; base: number; - } + }; }; units: Unit[]; unitsAsc: Unit[]; diff --git a/packages/kbn-dev-utils/src/proc_runner/proc.js b/packages/kbn-dev-utils/src/proc_runner/proc.js index c2548bccfac7..2fdba9b38ac6 100644 --- a/packages/kbn-dev-utils/src/proc_runner/proc.js +++ b/packages/kbn-dev-utils/src/proc_runner/proc.js @@ -78,7 +78,7 @@ export function createProc(name, { cmd, args, cwd, env, stdin, log }) { childProcess.stdin.end(); } - return new class Proc { + return new (class Proc { name = name; lines$ = Rx.merge(observeLines(childProcess.stdout), observeLines(childProcess.stderr)).pipe( @@ -156,5 +156,5 @@ export function createProc(name, { cmd, args, cwd, env, stdin, log }) { } ); } - }(); + })(); } diff --git a/packages/kbn-pm/src/utils/project.ts b/packages/kbn-pm/src/utils/project.ts index d6168525ff39..66257fdea7dd 100644 --- a/packages/kbn-pm/src/utils/project.ts +++ b/packages/kbn-pm/src/utils/project.ts @@ -115,9 +115,7 @@ export class Project { } throw new CliError( - `[${this.name}] depends on [${ - project.name - }] ${problemMsg}. Update its package.json to the expected value below.`, + `[${this.name}] depends on [${project.name}] ${problemMsg}. Update its package.json to the expected value below.`, { actual: `"${project.name}": "${versionInPackageJson}"`, expected: `"${project.name}": "${expectedVersionInPackageJson}"`, diff --git a/packages/kbn-test/src/es/es_test_cluster.js b/packages/kbn-test/src/es/es_test_cluster.js index 53153a21e153..be24c6dbf0f3 100644 --- a/packages/kbn-test/src/es/es_test_cluster.js +++ b/packages/kbn-test/src/es/es_test_cluster.js @@ -54,7 +54,7 @@ export function createEsTestCluster(options = {}) { const cluster = new Cluster(log); - return new class EsTestCluster { + return new (class EsTestCluster { getStartTimeout() { const second = 1000; const minute = second * 60; @@ -121,7 +121,7 @@ export function createEsTestCluster(options = {}) { return format(parts); } - }(); + })(); } /** diff --git a/packages/kbn-test/src/es/es_test_config.js b/packages/kbn-test/src/es/es_test_config.js index e273172ef614..76282098119f 100644 --- a/packages/kbn-test/src/es/es_test_config.js +++ b/packages/kbn-test/src/es/es_test_config.js @@ -21,7 +21,7 @@ import url, { format as formatUrl } from 'url'; import pkg from '../../../../package.json'; import { adminTestUser } from '../kbn'; -export const esTestConfig = new class EsTestConfig { +export const esTestConfig = new (class EsTestConfig { getVersion() { return process.env.TEST_ES_BRANCH || pkg.version; } @@ -67,4 +67,4 @@ export const esTestConfig = new class EsTestConfig { password: password, }; } -}(); +})(); diff --git a/packages/kbn-test/src/kbn/kbn_test_config.js b/packages/kbn-test/src/kbn/kbn_test_config.js index 920865fcfc6b..c43efabb4b74 100644 --- a/packages/kbn-test/src/kbn/kbn_test_config.js +++ b/packages/kbn-test/src/kbn/kbn_test_config.js @@ -20,7 +20,7 @@ import { kibanaTestUser } from './users'; import url from 'url'; -export const kbnTestConfig = new class KbnTestConfig { +export const kbnTestConfig = new (class KbnTestConfig { getPort() { return this.getUrlParts().port; } @@ -50,4 +50,4 @@ export const kbnTestConfig = new class KbnTestConfig { password, }; } -}(); +})(); diff --git a/packages/kbn-test/types/ftr.d.ts b/packages/kbn-test/types/ftr.d.ts index 13d2b0498859..279234369f6b 100644 --- a/packages/kbn-test/types/ftr.d.ts +++ b/packages/kbn-test/types/ftr.d.ts @@ -43,7 +43,7 @@ type MaybeAsyncInstance = T extends Promise ? AsyncInstance & X : type ProvidedTypeMap = { [K in keyof T]: T[K] extends (...args: any[]) => any ? MaybeAsyncInstance> - : unknown + : unknown; }; export interface GenericFtrProviderContext< diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 4e469a15fabc..da57667efa4f 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -66,7 +66,7 @@ export interface ChromeBreadcrumb { } /** @public */ -export type ChromeHelpExtension = (element: HTMLDivElement) => (() => void); +export type ChromeHelpExtension = (element: HTMLDivElement) => () => void; interface ConstructorParams { browserSupportsCsp: boolean; diff --git a/src/core/public/chrome/ui/header/header_extension.tsx b/src/core/public/chrome/ui/header/header_extension.tsx index da00d6344420..90e7907b0068 100644 --- a/src/core/public/chrome/ui/header/header_extension.tsx +++ b/src/core/public/chrome/ui/header/header_extension.tsx @@ -20,7 +20,7 @@ import React from 'react'; interface Props { - extension?: (el: HTMLDivElement) => (() => void); + extension?: (el: HTMLDivElement) => () => void; } export class HeaderExtension extends React.Component { diff --git a/src/core/public/core_system.test.ts b/src/core/public/core_system.test.ts index cc8333cdafaf..044a40b27599 100644 --- a/src/core/public/core_system.test.ts +++ b/src/core/public/core_system.test.ts @@ -379,12 +379,10 @@ describe('Notifications targetDomElement', () => { }); let targetDomElementParentInStart: HTMLElement | null; - MockNotificationsService.start.mockImplementation( - ({ targetDomElement }): any => { - expect(targetDomElement.parentElement).not.toBeNull(); - targetDomElementParentInStart = targetDomElement.parentElement; - } - ); + MockNotificationsService.start.mockImplementation(({ targetDomElement }): any => { + expect(targetDomElement.parentElement).not.toBeNull(); + targetDomElementParentInStart = targetDomElement.parentElement; + }); // Starting the core system should pass the targetDomElement as a child of the rootDomElement await core.setup(); diff --git a/src/core/public/utils/integration_tests/__fixtures__/frozen_object_mutation/index.ts b/src/core/public/utils/integration_tests/__fixtures__/frozen_object_mutation/index.ts index fd5e16987e2e..43ba627e0b5c 100644 --- a/src/core/public/utils/integration_tests/__fixtures__/frozen_object_mutation/index.ts +++ b/src/core/public/utils/integration_tests/__fixtures__/frozen_object_mutation/index.ts @@ -19,31 +19,25 @@ import { deepFreeze } from '../../../../../utils/deep_freeze'; -deepFreeze( - { - foo: { - bar: { - baz: 1, - }, +deepFreeze({ + foo: { + bar: { + baz: 1, }, - } -).foo.bar.baz = 2; + }, +}).foo.bar.baz = 2; -deepFreeze( - { - foo: [ - { - bar: 1, - }, - ], - } -).foo[0].bar = 2; +deepFreeze({ + foo: [ + { + bar: 1, + }, + ], +}).foo[0].bar = 2; -deepFreeze( - { - foo: [1], - } -).foo[0] = 2; +deepFreeze({ + foo: [1], +}).foo[0] = 2; deepFreeze({ foo: [1], diff --git a/src/core/server/config/__mocks__/env.ts b/src/core/server/config/__mocks__/env.ts index 9b2ad4e35f1f..644b499ff56d 100644 --- a/src/core/server/config/__mocks__/env.ts +++ b/src/core/server/config/__mocks__/env.ts @@ -22,7 +22,7 @@ import { EnvOptions } from '../env'; type DeepPartial = { - [P in keyof T]?: T[P] extends Array ? Array> : DeepPartial + [P in keyof T]?: T[P] extends Array ? Array> : DeepPartial; }; export function getEnvOptions(options: DeepPartial = {}): EnvOptions { diff --git a/src/core/server/http/router/router.ts b/src/core/server/http/router/router.ts index 817832bdc59d..9d3295a7f3bf 100644 --- a/src/core/server/http/router/router.ts +++ b/src/core/server/http/router/router.ts @@ -132,9 +132,7 @@ export class Router { // happen when it's used from JavaScript. if (route.validate === undefined) { throw new Error( - `The [${routeMethod}] at [${ - route.path - }] does not have a 'validate' specified. Use 'false' as the value if you want to bypass validation.` + `The [${routeMethod}] at [${route.path}] does not have a 'validate' specified. Use 'false' as the value if you want to bypass validation.` ); } diff --git a/src/core/server/logging/layouts/pattern_layout.ts b/src/core/server/logging/layouts/pattern_layout.ts index c259a29dc686..8be47dbcdd09 100644 --- a/src/core/server/logging/layouts/pattern_layout.ts +++ b/src/core/server/logging/layouts/pattern_layout.ts @@ -58,9 +58,7 @@ const LEVEL_COLORS = new Map([ /** * Default pattern used by PatternLayout if it's not overridden in the configuration. */ -const DEFAULT_PATTERN = `[${Parameters.Timestamp}][${Parameters.Level}][${Parameters.Context}] ${ - Parameters.Message -}`; +const DEFAULT_PATTERN = `[${Parameters.Timestamp}][${Parameters.Level}][${Parameters.Context}] ${Parameters.Message}`; const patternLayoutSchema = schema.object({ highlight: schema.maybe(schema.boolean()), diff --git a/src/core/server/plugins/discovery/plugin_manifest_parser.ts b/src/core/server/plugins/discovery/plugin_manifest_parser.ts index 12aa2b2a802a..aedda9e3c92e 100644 --- a/src/core/server/plugins/discovery/plugin_manifest_parser.ts +++ b/src/core/server/plugins/discovery/plugin_manifest_parser.ts @@ -118,9 +118,7 @@ export async function parseManifest(pluginPath: string, packageInfo: PackageInfo throw PluginDiscoveryError.invalidManifest( manifestPath, new Error( - `The "configPath" in plugin manifest for "${ - manifest.id - }" should either be a string or an array of strings.` + `The "configPath" in plugin manifest for "${manifest.id}" should either be a string or an array of strings.` ) ); } @@ -133,11 +131,7 @@ export async function parseManifest(pluginPath: string, packageInfo: PackageInfo throw PluginDiscoveryError.incompatibleVersion( manifestPath, new Error( - `Plugin "${ - manifest.id - }" is only compatible with Kibana version "${expectedKibanaVersion}", but used Kibana version is "${ - packageInfo.version - }".` + `Plugin "${manifest.id}" is only compatible with Kibana version "${expectedKibanaVersion}", but used Kibana version is "${packageInfo.version}".` ) ); } @@ -148,9 +142,7 @@ export async function parseManifest(pluginPath: string, packageInfo: PackageInfo throw PluginDiscoveryError.invalidManifest( manifestPath, new Error( - `Both "server" and "ui" are missing or set to "false" in plugin manifest for "${ - manifest.id - }", but at least one of these must be set to "true".` + `Both "server" and "ui" are missing or set to "false" in plugin manifest for "${manifest.id}", but at least one of these must be set to "true".` ) ); } @@ -160,9 +152,7 @@ export async function parseManifest(pluginPath: string, packageInfo: PackageInfo throw PluginDiscoveryError.invalidManifest( manifestPath, new Error( - `Manifest for plugin "${ - manifest.id - }" contains the following unrecognized properties: ${unknownManifestKeys}.` + `Manifest for plugin "${manifest.id}" contains the following unrecognized properties: ${unknownManifestKeys}.` ) ); } diff --git a/src/core/server/plugins/discovery/plugins_discovery.ts b/src/core/server/plugins/discovery/plugins_discovery.ts index f9ab37913bcc..a4874f498325 100644 --- a/src/core/server/plugins/discovery/plugins_discovery.ts +++ b/src/core/server/plugins/discovery/plugins_discovery.ts @@ -48,9 +48,7 @@ export function discover(config: PluginsConfig, coreContext: CoreContext) { if (config.additionalPluginPaths.length) { log.warn( - `Explicit plugin paths [${ - config.additionalPluginPaths - }] are only supported in development. Relative imports will not work in production.` + `Explicit plugin paths [${config.additionalPluginPaths}] are only supported in development. Relative imports will not work in production.` ); } diff --git a/src/core/server/saved_objects/migrations/kibana/kibana_migrator.ts b/src/core/server/saved_objects/migrations/kibana/kibana_migrator.ts index ebc8e9087197..b2a03a7623bf 100644 --- a/src/core/server/saved_objects/migrations/kibana/kibana_migrator.ts +++ b/src/core/server/saved_objects/migrations/kibana/kibana_migrator.ts @@ -56,7 +56,7 @@ interface Server { } interface ElasticsearchPlugin { - getCluster: ((name: 'admin') => { callWithInternalUser: CallCluster }); + getCluster: (name: 'admin') => { callWithInternalUser: CallCluster }; waitUntilReady: () => Promise; } diff --git a/src/core/server/saved_objects/service/lib/scoped_client_provider.ts b/src/core/server/saved_objects/service/lib/scoped_client_provider.ts index 201b316005d7..16924faf6cf7 100644 --- a/src/core/server/saved_objects/service/lib/scoped_client_provider.ts +++ b/src/core/server/saved_objects/service/lib/scoped_client_provider.ts @@ -28,9 +28,11 @@ export type SavedObjectsClientWrapperFactory = ( options: SavedObjectsClientWrapperOptions ) => SavedObjectsClientContract; -export type SavedObjectsClientFactory = ( - { request }: { request: Request } -) => SavedObjectsClientContract; +export type SavedObjectsClientFactory = ({ + request, +}: { + request: Request; +}) => SavedObjectsClientContract; /** * Provider for the Scoped Saved Object Client. diff --git a/src/dev/run/run.ts b/src/dev/run/run.ts index 4c213ecd648b..6eb1bd973519 100644 --- a/src/dev/run/run.ts +++ b/src/dev/run/run.ts @@ -25,9 +25,11 @@ import { createFlagError, isFailError } from './fail'; import { Flags, getFlags, getHelp } from './flags'; type CleanupTask = () => void; -type RunFn = ( - args: { log: ToolingLog; flags: Flags; addCleanupTask: (task: CleanupTask) => void } -) => Promise | void; +type RunFn = (args: { + log: ToolingLog; + flags: Flags; + addCleanupTask: (task: CleanupTask) => void; +}) => Promise | void; export interface Options { usage?: string; diff --git a/src/es_archiver/lib/stats.ts b/src/es_archiver/lib/stats.ts index 965981af3dc8..5f73304abf9a 100644 --- a/src/es_archiver/lib/stats.ts +++ b/src/es_archiver/lib/stats.ts @@ -64,7 +64,7 @@ export function createStats(name: string, log: ToolingLog) { return indices[index]; }; - return new class Stats { + return new (class Stats { /** * Record that an index was not restored because it already existed * @param index @@ -149,5 +149,5 @@ export function createStats(name: string, log: ToolingLog) { fn(index, clone[index]); }); } - }(); + })(); } diff --git a/src/legacy/core_plugins/data/public/expressions/expression_renderer.tsx b/src/legacy/core_plugins/data/public/expressions/expression_renderer.tsx index 78fb43772504..310a3b11a845 100644 --- a/src/legacy/core_plugins/data/public/expressions/expression_renderer.tsx +++ b/src/legacy/core_plugins/data/public/expressions/expression_renderer.tsx @@ -48,18 +48,15 @@ export const createRenderer = (run: ExpressionRunner): ExpressionRenderer => ({ }: ExpressionRendererProps) => { const mountpoint: React.MutableRefObject = useRef(null); - useEffect( - () => { - if (mountpoint.current) { - run(expression, { ...options, element: mountpoint.current }).catch(result => { - if (onRenderFailure) { - onRenderFailure(result); - } - }); - } - }, - [expression, mountpoint.current] - ); + useEffect(() => { + if (mountpoint.current) { + run(expression, { ...options, element: mountpoint.current }).catch(result => { + if (onRenderFailure) { + onRenderFailure(result); + } + }); + } + }, [expression, mountpoint.current]); return (
{ - if (a.$state && a.$state.store === FilterStateStore.GLOBAL_STATE) { - return -1; - } else if (b.$state && b.$state.store === FilterStateStore.GLOBAL_STATE) { - return 1; - } else { - return 0; - } + newFilters.sort((a: Filter, b: Filter): number => { + if (a.$state && a.$state.store === FilterStateStore.GLOBAL_STATE) { + return -1; + } else if (b.$state && b.$state.store === FilterStateStore.GLOBAL_STATE) { + return 1; + } else { + return 0; } - ); + }); const filtersUpdated = !_.isEqual(this.filters, newFilters); diff --git a/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card.tsx b/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card.tsx index 4a0136137bc8..715018cdb942 100644 --- a/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card.tsx +++ b/src/legacy/core_plugins/embeddable_api/public/test_samples/embeddables/contact_card/contact_card.tsx @@ -85,9 +85,9 @@ export class ContactCardEmbeddableComponent extends React.Component - {`Contact ${ - this.state.firstName - }`} + {`Contact ${this.state.firstName}`} diff --git a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx index 68a293de167f..4605a49d18c1 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/dashboard_app.tsx @@ -87,9 +87,13 @@ export interface DashboardAppScope extends ng.IScope { getShouldShowEditHelp: () => boolean; getShouldShowViewHelp: () => boolean; updateQueryAndFetch: ({ query, dateRange }: { query: Query; dateRange?: TimeRange }) => void; - onRefreshChange: ( - { isPaused, refreshInterval }: { isPaused: boolean; refreshInterval: any } - ) => void; + onRefreshChange: ({ + isPaused, + refreshInterval, + }: { + isPaused: boolean; + refreshInterval: any; + }) => void; onFiltersUpdated: (filters: Filter[]) => void; $listenAndDigestAsync: any; onCancelApplyFilters: () => void; diff --git a/src/legacy/core_plugins/kibana/public/dashboard/top_nav/save_modal.tsx b/src/legacy/core_plugins/kibana/public/dashboard/top_nav/save_modal.tsx index ad0954da1f7a..d889d4be16fc 100644 --- a/src/legacy/core_plugins/kibana/public/dashboard/top_nav/save_modal.tsx +++ b/src/legacy/core_plugins/kibana/public/dashboard/top_nav/save_modal.tsx @@ -33,16 +33,14 @@ interface SaveOptions { } interface Props { - onSave: ( - { - newTitle, - newDescription, - newCopyOnSave, - newTimeRestore, - isTitleDuplicateConfirmed, - onTitleDuplicate, - }: SaveOptions - ) => void; + onSave: ({ + newTitle, + newDescription, + newCopyOnSave, + newTimeRestore, + isTitleDuplicateConfirmed, + onTitleDuplicate, + }: SaveOptions) => void; onClose: () => void; title: string; description: string; diff --git a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.ts b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.ts index 910a99a703ab..d5b09dff2a65 100644 --- a/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.ts +++ b/src/legacy/core_plugins/kibana/public/visualize/embeddable/visualize_embeddable_factory.ts @@ -59,9 +59,7 @@ export class VisualizeEmbeddableFactory extends EmbeddableFactory { - return `${savedObject.attributes.title} (${ - visTypes.byName[JSON.parse(savedObject.attributes.visState).type].title - })`; + return `${savedObject.attributes.title} (${visTypes.byName[JSON.parse(savedObject.attributes.visState).type].title})`; }, showSavedObject: savedObject => { const typeName: string = JSON.parse(savedObject.attributes.visState).type; diff --git a/src/legacy/server/index_patterns/mixin.d.ts b/src/legacy/server/index_patterns/mixin.d.ts index 4241cdfcaabf..0ebbc41608b1 100644 --- a/src/legacy/server/index_patterns/mixin.d.ts +++ b/src/legacy/server/index_patterns/mixin.d.ts @@ -19,6 +19,6 @@ import { IndexPatternsService } from './service'; -export type IndexPatternsServiceFactory = ( - args: { callCluster: (endpoint: string, clientParams: any, options: any) => Promise } -) => IndexPatternsService; +export type IndexPatternsServiceFactory = (args: { + callCluster: (endpoint: string, clientParams: any, options: any) => Promise; +}) => IndexPatternsService; diff --git a/src/legacy/ui/public/agg_types/controls/components/input_list.tsx b/src/legacy/ui/public/agg_types/controls/components/input_list.tsx index 68960ca396b3..60dad59b3d37 100644 --- a/src/legacy/ui/public/agg_types/controls/components/input_list.tsx +++ b/src/legacy/ui/public/agg_types/controls/components/input_list.tsx @@ -172,19 +172,13 @@ function InputList({ config, list, onChange, setValidity }: InputListProps) { }; // responsible for discarding changes - useEffect( - () => { - setModels(getUpdatedModels(list, models)); - }, - [list] - ); + useEffect(() => { + setModels(getUpdatedModels(list, models)); + }, [list]); - useEffect( - () => { - setValidity(!hasInvalidValues(models)); - }, - [models] - ); + useEffect(() => { + setValidity(!hasInvalidValues(models)); + }, [models]); // resposible for setting up an initial value when there is no default value useEffect(() => { diff --git a/src/legacy/ui/public/agg_types/controls/date_ranges.tsx b/src/legacy/ui/public/agg_types/controls/date_ranges.tsx index 896fd5b8a852..2a985dce6f61 100644 --- a/src/legacy/ui/public/agg_types/controls/date_ranges.tsx +++ b/src/legacy/ui/public/agg_types/controls/date_ranges.tsx @@ -76,25 +76,19 @@ function DateRangesParamEditor({ } }, []); - useEffect( - () => { - // responsible for discarding changes - if ( - value.length !== ranges.length || - value.some((range, index) => !isEqual(range, omit(ranges[index], 'id'))) - ) { - setRanges(value.map(range => ({ ...range, id: generateId() }))); - } - }, - [value] - ); + useEffect(() => { + // responsible for discarding changes + if ( + value.length !== ranges.length || + value.some((range, index) => !isEqual(range, omit(ranges[index], 'id'))) + ) { + setRanges(value.map(range => ({ ...range, id: generateId() }))); + } + }, [value]); - useEffect( - () => { - setValidity(!hasInvalidRange); - }, - [hasInvalidRange] - ); + useEffect(() => { + setValidity(!hasInvalidRange); + }, [hasInvalidRange]); const updateRanges = (rangeValues: DateRangeValuesModel[]) => { // do not set internal id parameter into saved object diff --git a/src/legacy/ui/public/agg_types/controls/extended_bounds.tsx b/src/legacy/ui/public/agg_types/controls/extended_bounds.tsx index 3362bee76bd8..86b0c012d242 100644 --- a/src/legacy/ui/public/agg_types/controls/extended_bounds.tsx +++ b/src/legacy/ui/public/agg_types/controls/extended_bounds.tsx @@ -61,14 +61,11 @@ function ExtendedBoundsParamEditor({ }); } - useEffect( - () => { - setValidity(isValid); + useEffect(() => { + setValidity(isValid); - return () => setValidity(true); - }, - [isValid] - ); + return () => setValidity(true); + }, [isValid]); const handleChange = (ev: ChangeEvent, name: string) => { setValue({ diff --git a/src/legacy/ui/public/agg_types/controls/field.tsx b/src/legacy/ui/public/agg_types/controls/field.tsx index 9eaa8384ddbf..3b8df4a28ee3 100644 --- a/src/legacy/ui/public/agg_types/controls/field.tsx +++ b/src/legacy/ui/public/agg_types/controls/field.tsx @@ -78,16 +78,13 @@ function FieldParamEditor({ const isValid = !!value && !errors.length; - useEffect( - () => { - setValidity(isValid); + useEffect(() => { + setValidity(isValid); - if (!!errors.length) { - setTouched(); - } - }, - [isValid] - ); + if (!!errors.length) { + setTouched(); + } + }, [isValid]); useEffect(() => { // set field if only one available diff --git a/src/legacy/ui/public/agg_types/controls/filters.tsx b/src/legacy/ui/public/agg_types/controls/filters.tsx index 5c8d38e5a4e8..a731f07bc866 100644 --- a/src/legacy/ui/public/agg_types/controls/filters.tsx +++ b/src/legacy/ui/public/agg_types/controls/filters.tsx @@ -45,18 +45,15 @@ function FiltersParamEditor({ agg, value, setValue }: AggParamEditorProps omit({ ...filter, input: filter.input }, 'id'))); }, []); - useEffect( - () => { - // responsible for discarding changes - if ( - value.length !== filters.length || - value.some((filter, index) => !isEqual(filter, omit(filters[index], 'id'))) - ) { - setFilters(value.map(filter => ({ ...filter, id: generateId() }))); - } - }, - [value] - ); + useEffect(() => { + // responsible for discarding changes + if ( + value.length !== filters.length || + value.some((filter, index) => !isEqual(filter, omit(filters[index], 'id'))) + ) { + setFilters(value.map(filter => ({ ...filter, id: generateId() }))); + } + }, [value]); const updateFilters = (updatedFilters: FilterValue[]) => { // do not set internal id parameter into saved object diff --git a/src/legacy/ui/public/agg_types/controls/has_extended_bounds.tsx b/src/legacy/ui/public/agg_types/controls/has_extended_bounds.tsx index dc205d049fcf..1698b5258212 100644 --- a/src/legacy/ui/public/agg_types/controls/has_extended_bounds.tsx +++ b/src/legacy/ui/public/agg_types/controls/has_extended_bounds.tsx @@ -24,12 +24,9 @@ import { SwitchParamEditor } from './switch'; import { isType } from '../buckets/migrate_include_exclude_format'; function HasExtendedBoundsParamEditor(props: AggParamEditorProps) { - useEffect( - () => { - props.setValue(props.value && props.agg.params.min_doc_count); - }, - [props.agg.params.min_doc_count] - ); + useEffect(() => { + props.setValue(props.value && props.agg.params.min_doc_count); + }, [props.agg.params.min_doc_count]); return ( { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); - useEffect( - () => { - if (responseValueAggs && value && value !== 'custom') { - // ensure that metricAgg is set to a valid agg - const respAgg = responseValueAggs - .filter(isCompatibleAgg) - .find(aggregation => aggregation.id === value); + useEffect(() => { + if (responseValueAggs && value && value !== 'custom') { + // ensure that metricAgg is set to a valid agg + const respAgg = responseValueAggs + .filter(isCompatibleAgg) + .find(aggregation => aggregation.id === value); - if (!respAgg) { - setValue(); - } + if (!respAgg) { + setValue(); } - }, - [responseValueAggs] - ); + } + }, [responseValueAggs]); - useEffect( - () => { - // check buckets - const lastBucket: AggConfig = findLast( - state.aggs, - aggr => aggr.type && aggr.type.type === 'buckets' + useEffect(() => { + // check buckets + const lastBucket: AggConfig = findLast( + state.aggs, + aggr => aggr.type && aggr.type.type === 'buckets' + ); + const bucketHasType = lastBucket && lastBucket.type; + const bucketIsHistogram = + bucketHasType && ['date_histogram', 'histogram'].includes(lastBucket.type.name); + const canUseAggregation = lastBucket && bucketIsHistogram; + + // remove errors on all buckets + state.aggs.forEach((aggr: AggConfig) => { + if (aggr.error) { + subAggParams.onAggErrorChanged(aggr); + } + }); + + if (canUseAggregation) { + subAggParams.onAggParamsChange( + lastBucket.params, + 'min_doc_count', + lastBucket.type.name === 'histogram' ? 1 : 0 ); - const bucketHasType = lastBucket && lastBucket.type; - const bucketIsHistogram = - bucketHasType && ['date_histogram', 'histogram'].includes(lastBucket.type.name); - const canUseAggregation = lastBucket && bucketIsHistogram; - - // remove errors on all buckets - state.aggs.forEach((aggr: AggConfig) => { - if (aggr.error) { - subAggParams.onAggErrorChanged(aggr); - } - }); - - if (canUseAggregation) { - subAggParams.onAggParamsChange( - lastBucket.params, - 'min_doc_count', - lastBucket.type.name === 'histogram' ? 1 : 0 + } else { + if (lastBucket) { + subAggParams.onAggErrorChanged( + lastBucket, + i18n.translate('common.ui.aggTypes.metrics.wrongLastBucketTypeErrorMessage', { + defaultMessage: + 'Last bucket aggregation must be "Date Histogram" or "Histogram" when using "{type}" metric aggregation.', + values: { type: agg.type.title }, + description: 'Date Histogram and Histogram should not be translated', + }) ); - } else { - if (lastBucket) { - subAggParams.onAggErrorChanged( - lastBucket, - i18n.translate('common.ui.aggTypes.metrics.wrongLastBucketTypeErrorMessage', { - defaultMessage: - 'Last bucket aggregation must be "Date Histogram" or "Histogram" when using "{type}" metric aggregation.', - values: { type: agg.type.title }, - description: 'Date Histogram and Histogram should not be translated', - }) - ); - } } + } - return () => { - // clear errors in last bucket before component destroyed - if (lastBucket && lastBucket.error) { - subAggParams.onAggErrorChanged(lastBucket); - } - }; - }, - [value, responseValueAggs] - ); + return () => { + // clear errors in last bucket before component destroyed + if (lastBucket && lastBucket.error) { + subAggParams.onAggErrorChanged(lastBucket); + } + }; + }, [value, responseValueAggs]); const options = responseValueAggs ? responseValueAggs diff --git a/src/legacy/ui/public/agg_types/controls/missing_bucket.tsx b/src/legacy/ui/public/agg_types/controls/missing_bucket.tsx index eee6b8f16963..03d75d9b8b3f 100644 --- a/src/legacy/ui/public/agg_types/controls/missing_bucket.tsx +++ b/src/legacy/ui/public/agg_types/controls/missing_bucket.tsx @@ -26,14 +26,11 @@ import { isStringType } from '../buckets/migrate_include_exclude_format'; function MissingBucketParamEditor(props: AggParamEditorProps) { const fieldTypeIsNotString = !isStringType(props.agg); - useEffect( - () => { - if (fieldTypeIsNotString) { - props.setValue(false); - } - }, - [fieldTypeIsNotString] - ); + useEffect(() => { + if (fieldTypeIsNotString) { + props.setValue(false); + } + }, [fieldTypeIsNotString]); return ( = min; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); const onChange = (event: React.ChangeEvent) => { const numberValue = parseFloat(event.target.value); diff --git a/src/legacy/ui/public/agg_types/controls/order.tsx b/src/legacy/ui/public/agg_types/controls/order.tsx index 388449bf2656..9ce33e7a46c6 100644 --- a/src/legacy/ui/public/agg_types/controls/order.tsx +++ b/src/legacy/ui/public/agg_types/controls/order.tsx @@ -37,12 +37,9 @@ function OrderParamEditor({ }); const isValid = !!value; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); return ( ) { - useEffect( - () => { - if (responseValueAggs) { - const orderBy = agg.params.orderBy; + useEffect(() => { + if (responseValueAggs) { + const orderBy = agg.params.orderBy; - // we aren't creating a custom aggConfig - if (!orderBy || orderBy !== 'custom') { - setValue(null); - } else { - const paramDef = agg.type.params.byName.orderAgg; - setValue(value || paramDef.makeOrderAgg(agg)); - } + // we aren't creating a custom aggConfig + if (!orderBy || orderBy !== 'custom') { + setValue(null); + } else { + const paramDef = agg.type.params.byName.orderAgg; + setValue(value || paramDef.makeOrderAgg(agg)); } - }, - [agg.params.orderBy, responseValueAggs] - ); + } + }, [agg.params.orderBy, responseValueAggs]); const [innerState, setInnerState] = useState(true); diff --git a/src/legacy/ui/public/agg_types/controls/order_by.tsx b/src/legacy/ui/public/agg_types/controls/order_by.tsx index 0ea896e0b092..21ccf784f7f0 100644 --- a/src/legacy/ui/public/agg_types/controls/order_by.tsx +++ b/src/legacy/ui/public/agg_types/controls/order_by.tsx @@ -53,12 +53,9 @@ function OrderByParamEditor({ }); const isValid = !!value; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); useEffect(() => { // setup the initial value of orderBy @@ -73,21 +70,18 @@ function OrderByParamEditor({ } }, []); - useEffect( - () => { - if (responseValueAggs && value && value !== 'custom') { - // ensure that orderBy is set to a valid agg - const respAgg = responseValueAggs - .filter(isCompatibleAgg) - .find(aggregation => aggregation.id === value); + useEffect(() => { + if (responseValueAggs && value && value !== 'custom') { + // ensure that orderBy is set to a valid agg + const respAgg = responseValueAggs + .filter(isCompatibleAgg) + .find(aggregation => aggregation.id === value); - if (!respAgg) { - setValue('_key'); - } + if (!respAgg) { + setValue('_key'); } - }, - [responseValueAggs] - ); + } + }, [responseValueAggs]); const defaultOptions = [ { diff --git a/src/legacy/ui/public/agg_types/controls/ranges.tsx b/src/legacy/ui/public/agg_types/controls/ranges.tsx index 59c7a502b3a9..91bc4eb50997 100644 --- a/src/legacy/ui/public/agg_types/controls/ranges.tsx +++ b/src/legacy/ui/public/agg_types/controls/ranges.tsx @@ -58,18 +58,15 @@ function RangesParamEditor({ agg, value = [], setValue }: AggParamEditorProps { - // responsible for discarding changes - if ( - value.length !== ranges.length || - value.some((range, index) => !isEqual(range, omit(ranges[index], 'id'))) - ) { - setRanges(value.map(range => ({ ...range, id: generateId() }))); - } - }, - [value] - ); + useEffect(() => { + // responsible for discarding changes + if ( + value.length !== ranges.length || + value.some((range, index) => !isEqual(range, omit(ranges[index], 'id'))) + ) { + setRanges(value.map(range => ({ ...range, id: generateId() }))); + } + }, [value]); const updateRanges = (rangeValues: RangeValuesModel[]) => { // do not set internal id parameter into saved object diff --git a/src/legacy/ui/public/agg_types/controls/raw_json.tsx b/src/legacy/ui/public/agg_types/controls/raw_json.tsx index 9f5fdb0edf9c..b910b6e72042 100644 --- a/src/legacy/ui/public/agg_types/controls/raw_json.tsx +++ b/src/legacy/ui/public/agg_types/controls/raw_json.tsx @@ -54,12 +54,9 @@ function RawJsonParamEditor({ setValidity(isValidJson(textValue)); }; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); return ( 0; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); return ( ) { const isValid = aggParam.required ? !!value : true; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); return ( ) { - useEffect( - () => { - // we aren't creating a custom aggConfig - if (agg.params.metricAgg !== 'custom') { - setValue(null); - } else if (!agg.params.customMetric) { - setValue(agg.type.params.byName.customMetric.makeAgg(agg)); - } - }, - [value, responseValueAggs] - ); + useEffect(() => { + // we aren't creating a custom aggConfig + if (agg.params.metricAgg !== 'custom') { + setValue(null); + } else if (!agg.params.customMetric) { + setValue(agg.type.params.byName.customMetric.makeAgg(agg)); + } + }, [value, responseValueAggs]); const [innerState, setInnerState] = useState(true); diff --git a/src/legacy/ui/public/agg_types/controls/time_interval.tsx b/src/legacy/ui/public/agg_types/controls/time_interval.tsx index 60d5c19e2493..e5f714b6be3a 100644 --- a/src/legacy/ui/public/agg_types/controls/time_interval.tsx +++ b/src/legacy/ui/public/agg_types/controls/time_interval.tsx @@ -115,12 +115,9 @@ function TimeIntervalParamEditor({ } }; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); return ( ); - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); - useEffect( - () => { - if (isFirstRun.current) { - isFirstRun.current = false; + useEffect(() => { + if (isFirstRun.current) { + isFirstRun.current = false; + return; + } + + if (value) { + if (aggParam.options.byValue[value.value]) { return; } - if (value) { - if (aggParam.options.byValue[value.value]) { - return; - } + setValue(); + } - setValue(); - } - - if (filteredOptions.length === 1) { - setValue(aggParam.options.byValue[filteredOptions[0].value]); - } - }, - [fieldType] - ); + if (filteredOptions.length === 1) { + setValue(aggParam.options.byValue[filteredOptions[0].value]); + } + }, [fieldType]); const handleChange = (event: React.ChangeEvent) => { if (event.target.value === emptyValue.value) { diff --git a/src/legacy/ui/public/agg_types/number_list/number_list.tsx b/src/legacy/ui/public/agg_types/number_list/number_list.tsx index 4a075fe399e6..54040814028f 100644 --- a/src/legacy/ui/public/agg_types/number_list/number_list.tsx +++ b/src/legacy/ui/public/agg_types/number_list/number_list.tsx @@ -67,30 +67,24 @@ function NumberList({ const [ascendingError, setAscendingError] = useState(EMPTY_STRING); // responsible for discarding changes - useEffect( - () => { - const updatedModels = getUpdatedModels(numberArray, models, numberRange); - if (validateAscendingOrder) { - const isOrderValid = validateOrder(updatedModels); - setAscendingError( - isOrderValid - ? i18n.translate('common.ui.aggTypes.numberList.invalidAscOrderErrorMessage', { - defaultMessage: 'The values should be in ascending order.', - }) - : EMPTY_STRING - ); - } - setModels(updatedModels); - }, - [numberArray] - ); + useEffect(() => { + const updatedModels = getUpdatedModels(numberArray, models, numberRange); + if (validateAscendingOrder) { + const isOrderValid = validateOrder(updatedModels); + setAscendingError( + isOrderValid + ? i18n.translate('common.ui.aggTypes.numberList.invalidAscOrderErrorMessage', { + defaultMessage: 'The values should be in ascending order.', + }) + : EMPTY_STRING + ); + } + setModels(updatedModels); + }, [numberArray]); - useEffect( - () => { - setValidity(!hasInvalidValues(models)); - }, - [models] - ); + useEffect(() => { + setValidity(!hasInvalidValues(models)); + }, [models]); // resposible for setting up an initial value ([0]) when there is no default value useEffect(() => { diff --git a/src/legacy/ui/public/autocomplete_providers/index.d.ts b/src/legacy/ui/public/autocomplete_providers/index.d.ts index 9c252bb05e52..92061051b1b0 100644 --- a/src/legacy/ui/public/autocomplete_providers/index.d.ts +++ b/src/legacy/ui/public/autocomplete_providers/index.d.ts @@ -22,23 +22,19 @@ */ import { StaticIndexPattern } from 'ui/index_patterns'; -export type AutocompleteProvider = ( - args: { - config: { - get(configKey: string): any; - }; - indexPatterns: StaticIndexPattern[]; - boolFilter?: any; - } -) => GetSuggestions; +export type AutocompleteProvider = (args: { + config: { + get(configKey: string): any; + }; + indexPatterns: StaticIndexPattern[]; + boolFilter?: any; +}) => GetSuggestions; -export type GetSuggestions = ( - args: { - query: string; - selectionStart: number; - selectionEnd: number; - } -) => Promise; +export type GetSuggestions = (args: { + query: string; + selectionStart: number; + selectionEnd: number; +}) => Promise; export type AutocompleteSuggestionType = | 'field' diff --git a/src/legacy/ui/public/registry/chrome_header_nav_controls.ts b/src/legacy/ui/public/registry/chrome_header_nav_controls.ts index bdf6f287b576..7e6c80692cd6 100644 --- a/src/legacy/ui/public/registry/chrome_header_nav_controls.ts +++ b/src/legacy/ui/public/registry/chrome_header_nav_controls.ts @@ -33,7 +33,7 @@ export interface NavControl { name: string; order: number; side: NavControlSide; - render: (targetDomElement: HTMLDivElement) => (() => void); + render: (targetDomElement: HTMLDivElement) => () => void; } export type ChromeHeaderNavControlsRegistry = UIRegistry & diff --git a/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_param.tsx b/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_param.tsx index 101507af342a..e2f2e5b90acb 100644 --- a/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_param.tsx +++ b/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_param.tsx @@ -30,14 +30,11 @@ interface DefaultEditorAggParamProps extends AggParamCommonProps { function DefaultEditorAggParam(props: DefaultEditorAggParamProps) { const { agg, aggParam, paramEditor: ParamEditor, onChange, setValidity, ...rest } = props; - useEffect( - () => { - if (aggParam.shouldShow && !aggParam.shouldShow(agg)) { - setValidity(true); - } - }, - [agg, agg.params.field] - ); + useEffect(() => { + if (aggParam.shouldShow && !aggParam.shouldShow(agg)) { + setValidity(true); + } + }, [agg, agg.params.field]); if (aggParam.shouldShow && !aggParam.shouldShow(agg)) { return null; diff --git a/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_params.tsx b/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_params.tsx index 0a14a9adf5ef..f1fcd6e93637 100644 --- a/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_params.tsx +++ b/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_params.tsx @@ -115,60 +115,48 @@ function DefaultEditorAggParams({ // reset validity before component destroyed useUnmount(() => setValidity(true)); - useEffect( - () => { - Object.entries(editorConfig).forEach(([param, paramConfig]) => { - const paramOptions = agg.type.params.find( - (paramOption: AggParam) => paramOption.name === param - ); + useEffect(() => { + Object.entries(editorConfig).forEach(([param, paramConfig]) => { + const paramOptions = agg.type.params.find( + (paramOption: AggParam) => paramOption.name === param + ); - const hasFixedValue = paramConfig.hasOwnProperty(FIXED_VALUE_PROP); - const hasDefault = paramConfig.hasOwnProperty(DEFAULT_PROP); - // If the parameter has a fixed value in the config, set this value. - // Also for all supported configs we should freeze the editor for this param. - if (hasFixedValue || hasDefault) { - let newValue; - let property = FIXED_VALUE_PROP; - let typedParamConfig: EditorParamConfigType = paramConfig as FixedParam; + const hasFixedValue = paramConfig.hasOwnProperty(FIXED_VALUE_PROP); + const hasDefault = paramConfig.hasOwnProperty(DEFAULT_PROP); + // If the parameter has a fixed value in the config, set this value. + // Also for all supported configs we should freeze the editor for this param. + if (hasFixedValue || hasDefault) { + let newValue; + let property = FIXED_VALUE_PROP; + let typedParamConfig: EditorParamConfigType = paramConfig as FixedParam; - if (hasDefault) { - property = DEFAULT_PROP; - typedParamConfig = paramConfig as TimeIntervalParam; - } - - if (paramOptions && paramOptions.deserialize) { - newValue = paramOptions.deserialize(typedParamConfig[property]); - } else { - newValue = typedParamConfig[property]; - } - onAggParamsChange(agg.params, param, newValue); + if (hasDefault) { + property = DEFAULT_PROP; + typedParamConfig = paramConfig as TimeIntervalParam; } - }); - }, - [agg.type] - ); - useEffect( - () => { - setTouched(false); - }, - [agg.type] - ); + if (paramOptions && paramOptions.deserialize) { + newValue = paramOptions.deserialize(typedParamConfig[property]); + } else { + newValue = typedParamConfig[property]; + } + onAggParamsChange(agg.params, param, newValue); + } + }); + }, [agg.type]); - useEffect( - () => { - setValidity(isFormValid); - }, - [isFormValid, agg.type] - ); + useEffect(() => { + setTouched(false); + }, [agg.type]); - useEffect( - () => { - // when all invalid controls were touched or they are untouched - setTouched(isAllInvalidParamsTouched); - }, - [isAllInvalidParamsTouched] - ); + useEffect(() => { + setValidity(isFormValid); + }, [isFormValid, agg.type]); + + useEffect(() => { + // when all invalid controls were touched or they are untouched + setTouched(isAllInvalidParamsTouched); + }, [isAllInvalidParamsTouched]); const renderParam = (paramInstance: ParamInstance, model: AggParamsItem) => { return ( diff --git a/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_select.tsx b/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_select.tsx index 38b3c3596242..dd8b886089ea 100644 --- a/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_select.tsx +++ b/src/legacy/ui/public/vis/editors/default/components/default_editor_agg_select.tsx @@ -102,21 +102,15 @@ function DefaultEditorAggSelect({ const isValid = !!value && !errors.length; - useEffect( - () => { - setValidity(isValid); - }, - [isValid] - ); + useEffect(() => { + setValidity(isValid); + }, [isValid]); - useEffect( - () => { - if (errors.length) { - setTouched(); - } - }, - [errors.length] - ); + useEffect(() => { + if (errors.length) { + setTouched(); + } + }, [errors.length]); const onChange = (options: EuiComboBoxOptionProps[]) => { const selectedOption = get(options, '0.value'); diff --git a/src/plugins/kibana_react/public/util/use_observable.ts b/src/plugins/kibana_react/public/util/use_observable.ts index 00086a8e1082..6a7ce1f5290d 100644 --- a/src/plugins/kibana_react/public/util/use_observable.ts +++ b/src/plugins/kibana_react/public/util/use_observable.ts @@ -25,13 +25,10 @@ export function useObservable(observable$: Observable, initialValue: T): T export function useObservable(observable$: Observable, initialValue?: T): T | undefined { const [value, update] = useState(initialValue); - useLayoutEffect( - () => { - const s = observable$.subscribe(update); - return () => s.unsubscribe(); - }, - [observable$] - ); + useLayoutEffect(() => { + const s = observable$.subscribe(update); + return () => s.unsubscribe(); + }, [observable$]); return value; } diff --git a/test/common/services/retry/retry.ts b/test/common/services/retry/retry.ts index 8bfc7514fdad..980c25b72b41 100644 --- a/test/common/services/retry/retry.ts +++ b/test/common/services/retry/retry.ts @@ -25,7 +25,7 @@ export function RetryProvider({ getService }: FtrProviderContext) { const config = getService('config'); const log = getService('log'); - return new class Retry { + return new (class Retry { public async tryForTime( timeout: number, block: () => Promise, @@ -76,5 +76,5 @@ export function RetryProvider({ getService }: FtrProviderContext) { onFailureBlock, }); } - }(); + })(); } diff --git a/test/functional/services/apps_menu.ts b/test/functional/services/apps_menu.ts index 39a50adc1fd2..93858cdb4452 100644 --- a/test/functional/services/apps_menu.ts +++ b/test/functional/services/apps_menu.ts @@ -23,7 +23,7 @@ export function AppsMenuProvider({ getService }: FtrProviderContext) { const testSubjects = getService('testSubjects'); const log = getService('log'); - return new class AppsMenu { + return new (class AppsMenu { /** * Get the text and href from each of the links in the apps menu */ @@ -69,5 +69,5 @@ export function AppsMenuProvider({ getService }: FtrProviderContext) { // Intentionally empty } } - }(); + })(); } diff --git a/test/functional/services/browser.ts b/test/functional/services/browser.ts index ade89733c96d..55b3d52e1d8e 100644 --- a/test/functional/services/browser.ts +++ b/test/functional/services/browser.ts @@ -52,7 +52,7 @@ export async function BrowserProvider({ getService }: FtrProviderContext) { }); } - return new class BrowserService { + return new (class BrowserService { /** * Keyboard events */ @@ -490,5 +490,5 @@ export async function BrowserProvider({ getService }: FtrProviderContext) { await driver.executeScript('document.body.scrollLeft = ' + scrollSize); return this.getScrollLeft(); } - }(); + })(); } diff --git a/test/visual_regression/services/visual_testing/visual_testing.ts b/test/visual_regression/services/visual_testing/visual_testing.ts index 05bad7ebc192..2b05f666a350 100644 --- a/test/visual_regression/services/visual_testing/visual_testing.ts +++ b/test/visual_regression/services/visual_testing/visual_testing.ts @@ -52,7 +52,7 @@ export async function VisualTestingProvider({ getService }: FtrProviderContext) return statsCache.get(test)!; } - return new class VisualTesting { + return new (class VisualTesting { public async snapshot(name?: string) { log.debug('Capturing percy snapshot'); @@ -84,5 +84,5 @@ export async function VisualTestingProvider({ getService }: FtrProviderContext) ? snapshot : await browser.execute<[], string>(takePercySnapshotWithAgent); } - }(); + })(); } diff --git a/typings/index.d.ts b/typings/index.d.ts index 02770874b070..c9eb02dbedcf 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -24,7 +24,7 @@ declare module '*.html' { } type MethodKeysOf = { - [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never + [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never; }[keyof T]; type PublicMethodsOf = Pick>; diff --git a/x-pack/legacy/plugins/alerting/server/alerts_client.ts b/x-pack/legacy/plugins/alerting/server/alerts_client.ts index d1b2c5b9b8ef..494f4ec466af 100644 --- a/x-pack/legacy/plugins/alerting/server/alerts_client.ts +++ b/x-pack/legacy/plugins/alerting/server/alerts_client.ts @@ -95,9 +95,7 @@ export class AlertsClient { // Skip the cleanup error and throw the task manager error to avoid confusion this.log( ['alerting', 'error'], - `Failed to cleanup alert "${createdAlert.id}" after scheduling task failed. Error: ${ - err.message - }` + `Failed to cleanup alert "${createdAlert.id}" after scheduling task failed. Error: ${err.message}` ); } throw e; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx index 5711b7cc62ed..5225fdc209df 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupDetails/index.tsx @@ -65,35 +65,29 @@ export function ErrorGroupDetails() { const { urlParams, uiFilters } = useUrlParams(); const { serviceName, start, end, errorGroupId } = urlParams; - const { data: errorGroupData } = useFetcher( - () => { - if (serviceName && start && end && errorGroupId) { - return loadErrorGroupDetails({ - serviceName, - start, - end, - errorGroupId, - uiFilters - }); - } - }, - [serviceName, start, end, errorGroupId, uiFilters] - ); + const { data: errorGroupData } = useFetcher(() => { + if (serviceName && start && end && errorGroupId) { + return loadErrorGroupDetails({ + serviceName, + start, + end, + errorGroupId, + uiFilters + }); + } + }, [serviceName, start, end, errorGroupId, uiFilters]); - const { data: errorDistributionData } = useFetcher( - () => { - if (serviceName && start && end && errorGroupId) { - return loadErrorDistribution({ - serviceName, - start, - end, - errorGroupId, - uiFilters - }); - } - }, - [serviceName, start, end, errorGroupId, uiFilters] - ); + const { data: errorDistributionData } = useFetcher(() => { + if (serviceName && start && end && errorGroupId) { + return loadErrorDistribution({ + serviceName, + start, + end, + errorGroupId, + uiFilters + }); + } + }, [serviceName, start, end, errorGroupId, uiFilters]); if (!errorGroupData || !errorDistributionData) { return null; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx index 34a3eb4d95b4..4d6edde79d35 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ErrorGroupOverview/index.tsx @@ -35,35 +35,29 @@ const ErrorGroupOverview: React.SFC = ({ }) => { const { serviceName, start, end, sortField, sortDirection } = urlParams; const uiFilters = useUiFilters(urlParams); - const { data: errorDistributionData } = useFetcher( - () => { - if (serviceName && start && end) { - return loadErrorDistribution({ - serviceName, - start, - end, - uiFilters - }); - } - }, - [serviceName, start, end, uiFilters] - ); + const { data: errorDistributionData } = useFetcher(() => { + if (serviceName && start && end) { + return loadErrorDistribution({ + serviceName, + start, + end, + uiFilters + }); + } + }, [serviceName, start, end, uiFilters]); - const { data: errorGroupListData } = useFetcher( - () => { - if (serviceName && start && end) { - return loadErrorGroupList({ - serviceName, - start, - end, - sortField, - sortDirection, - uiFilters - }); - } - }, - [serviceName, start, end, sortField, sortDirection, uiFilters] - ); + const { data: errorGroupListData } = useFetcher(() => { + if (serviceName && start && end) { + return loadErrorGroupList({ + serviceName, + start, + end, + sortField, + sortDirection, + uiFilters + }); + } + }, [serviceName, start, end, sortField, sortDirection, uiFilters]); if (!errorDistributionData || !errorGroupListData) { return null; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/index.tsx index 74be99906efd..c8aaa6fa242b 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceDetails/index.tsx @@ -17,14 +17,11 @@ import { useUrlParams } from '../../../hooks/useUrlParams'; export function ServiceDetails() { const { urlParams, uiFilters } = useUrlParams(); const { serviceName, start, end } = urlParams; - const { data: serviceDetailsData } = useFetcher( - () => { - if (serviceName && start && end) { - return loadServiceDetails({ serviceName, start, end, uiFilters }); - } - }, - [serviceName, start, end, uiFilters] - ); + const { data: serviceDetailsData } = useFetcher(() => { + if (serviceName && start && end) { + return loadServiceDetails({ serviceName, start, end, uiFilters }); + } + }, [serviceName, start, end, uiFilters]); if (!serviceDetailsData) { return null; diff --git a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx index d66c1b0a35ac..154203586040 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/ServiceOverview/index.tsx @@ -30,51 +30,45 @@ export function ServiceOverview() { urlParams: { start, end }, uiFilters } = useUrlParams(); - const { data = initalData } = useFetcher( - () => { - if (start && end) { - return loadServiceList({ start, end, uiFilters }); - } - }, - [start, end, uiFilters] - ); + const { data = initalData } = useFetcher(() => { + if (start && end) { + return loadServiceList({ start, end, uiFilters }); + } + }, [start, end, uiFilters]); - useEffect( - () => { - if (data.hasLegacyData && !hasDisplayedToast) { - hasDisplayedToast = true; - toastNotifications.addWarning({ - title: i18n.translate('xpack.apm.serviceOverview.toastTitle', { - defaultMessage: - 'Legacy data was detected within the selected time range' - }), - text: ( -

- {i18n.translate('xpack.apm.serviceOverview.toastText', { - defaultMessage: - "You're running Elastic Stack 7.0+ and we've detected incompatible data from a previous 6.x version. If you want to view this data in APM, you should migrate it. See more in " + useEffect(() => { + if (data.hasLegacyData && !hasDisplayedToast) { + hasDisplayedToast = true; + toastNotifications.addWarning({ + title: i18n.translate('xpack.apm.serviceOverview.toastTitle', { + defaultMessage: + 'Legacy data was detected within the selected time range' + }), + text: ( +

+ {i18n.translate('xpack.apm.serviceOverview.toastText', { + defaultMessage: + "You're running Elastic Stack 7.0+ and we've detected incompatible data from a previous 6.x version. If you want to view this data in APM, you should migrate it. See more in " + })} + + - {i18n.translate( - 'xpack.apm.serviceOverview.upgradeAssistantLink', - { - defaultMessage: 'the upgrade assistant' - } - )} - -

- ) - }); - } - }, - [data.hasLegacyData] - ); + > + {i18n.translate( + 'xpack.apm.serviceOverview.upgradeAssistantLink', + { + defaultMessage: 'the upgrade assistant' + } + )} + +

+ ) + }); + } + }, [data.hasLegacyData]); return ( diff --git a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx index 1717c9cacdc5..89f23f15b3ed 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TraceOverview/index.tsx @@ -14,14 +14,11 @@ import { useUrlParams } from '../../../hooks/useUrlParams'; export function TraceOverview() { const { urlParams, uiFilters } = useUrlParams(); const { start, end } = urlParams; - const { status, data = [] } = useFetcher( - () => { - if (start && end) { - return loadTraceList({ start, end, uiFilters }); - } - }, - [start, end, uiFilters] - ); + const { status, data = [] } = useFetcher(() => { + if (start && end) { + return loadTraceList({ start, end, uiFilters }); + } + }, [start, end, uiFilters]); return ( diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx index 230fcbd5aaca..e7e048e78d7c 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Distribution/index.tsx @@ -110,48 +110,42 @@ export const TransactionDistribution: FunctionComponent = ( transactionType ]); - const redirectToDefaultSample = useCallback( - () => { - const defaultSample = - distribution && distribution.defaultSample - ? distribution.defaultSample - : {}; + const redirectToDefaultSample = useCallback(() => { + const defaultSample = + distribution && distribution.defaultSample + ? distribution.defaultSample + : {}; - const parsedQueryParams = toQuery(history.location.search); + const parsedQueryParams = toQuery(history.location.search); - history.replace({ - ...history.location, - search: fromQuery({ - ...omit(parsedQueryParams, 'transactionId', 'traceId'), - ...defaultSample - }) - }); - }, - [distribution, loading] - ); + history.replace({ + ...history.location, + search: fromQuery({ + ...omit(parsedQueryParams, 'transactionId', 'traceId'), + ...defaultSample + }) + }); + }, [distribution, loading]); - useEffect( - () => { - if (loading) { - return; - } - const selectedSampleIsAvailable = distribution - ? !!distribution.buckets.find( - bucket => - !!( - bucket.sample && - bucket.sample.transactionId === transactionId && - bucket.sample.traceId === traceId - ) - ) - : false; + useEffect(() => { + if (loading) { + return; + } + const selectedSampleIsAvailable = distribution + ? !!distribution.buckets.find( + bucket => + !!( + bucket.sample && + bucket.sample.transactionId === transactionId && + bucket.sample.traceId === traceId + ) + ) + : false; - if (!selectedSampleIsAvailable && !!distribution) { - redirectToDefaultSample(); - } - }, - [distribution, transactionId, traceId, redirectToDefaultSample, loading] - ); + if (!selectedSampleIsAvailable && !!distribution) { + redirectToDefaultSample(); + } + }, [distribution, transactionId, traceId, redirectToDefaultSample, loading]); if (!distribution || !distribution.totalHits || !traceId || !transactionId) { return ( diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/ErrorCountBadge.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/ErrorCountBadge.tsx index 45b97ee80551..35b99a68ece7 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/ErrorCountBadge.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/ErrorCountBadge.tsx @@ -55,9 +55,7 @@ export const ErrorCountBadge: React.SFC = ({ path={`/${idx(transaction, _ => _.service.name)}/errors`} query={{ kuery: encodeURIComponent( - `trace.id : "${transaction.trace.id}" and transaction.id : "${ - transaction.transaction.id - }"` + `trace.id : "${transaction.trace.id}" and transaction.id : "${transaction.transaction.id}"` ) }} color="danger" diff --git a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/SpanFlyout/TruncateHeightSection.tsx b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/SpanFlyout/TruncateHeightSection.tsx index aba8d991f5d1..d101dd287411 100644 --- a/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/SpanFlyout/TruncateHeightSection.tsx +++ b/x-pack/legacy/plugins/apm/public/components/app/TransactionDetails/Transaction/WaterfallContainer/Waterfall/SpanFlyout/TruncateHeightSection.tsx @@ -29,16 +29,13 @@ export const TruncateHeightSection: React.SFC = ({ const [showToggle, setShowToggle] = useState(true); const [isOpen, setIsOpen] = useState(false); - useEffect( - () => { - if (contentContainerEl.current) { - const shouldShow = - contentContainerEl.current.scrollHeight > previewHeight; - setShowToggle(shouldShow); - } - }, - [children, previewHeight] - ); + useEffect(() => { + if (contentContainerEl.current) { + const shouldShow = + contentContainerEl.current.scrollHeight > previewHeight; + setShowToggle(shouldShow); + } + }, [children, previewHeight]); return ( diff --git a/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx index 855aa0d5f11c..d22ba15ae92c 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/EnvironmentFilter/index.tsx @@ -79,18 +79,15 @@ export const EnvironmentFilter: React.FC = () => { const { start, end, serviceName } = urlParams; const { environment } = uiFilters; - const { data: environments = [], status = 'loading' } = useFetcher( - () => { - if (start && end) { - return loadEnvironmentsFilter({ - start, - end, - serviceName - }); - } - }, - [start, end, serviceName] - ); + const { data: environments = [], status = 'loading' } = useFetcher(() => { + if (start && end) { + return loadEnvironmentsFilter({ + start, + end, + serviceName + }); + } + }, [start, end, serviceName]); return ( = props => { const series: React.ComponentProps< typeof TransactionLineChart - >['series'] = useMemo( - () => { - return timeseries.map(timeseriesConfig => { - return { - title: timeseriesConfig.name, - color: timeseriesConfig.color, - data: timeseriesConfig.values, - type: 'area', - hideLegend: true - }; - }, {}); - }, - [timeseries] - ); + >['series'] = useMemo(() => { + return timeseries.map(timeseriesConfig => { + return { + title: timeseriesConfig.name, + color: timeseriesConfig.color, + data: timeseriesConfig.values, + type: 'area', + hideLegend: true + }; + }, {}); + }, [timeseries]); const tickFormatY = useCallback((y: number | null) => { return numeral(y || 0).format('0 %'); diff --git a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx index b682246fbab0..d04376a18986 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/TransactionBreakdown/index.tsx @@ -51,62 +51,53 @@ const TransactionBreakdown: React.FC<{ const kpis = data ? data.kpis : undefined; const timeseriesPerSubtype = data ? data.timeseries_per_subtype : undefined; - const legends = useMemo( - () => { - const names = kpis ? kpis.map(kpi => kpi.name).sort() : []; + const legends = useMemo(() => { + const names = kpis ? kpis.map(kpi => kpi.name).sort() : []; - return names.map((name, index) => { - return { - name, - color: COLORS[index % COLORS.length] - }; - }); - }, - [kpis] - ); + return names.map((name, index) => { + return { + name, + color: COLORS[index % COLORS.length] + }; + }); + }, [kpis]); - const sortedAndColoredKpis = useMemo( - () => { - if (!kpis) { - return null; - } + const sortedAndColoredKpis = useMemo(() => { + if (!kpis) { + return null; + } - return legends.map(legend => { - const { color } = legend; + return legends.map(legend => { + const { color } = legend; - const breakdown = kpis.find( - b => b.name === legend.name - ) as typeof kpis[0]; + const breakdown = kpis.find( + b => b.name === legend.name + ) as typeof kpis[0]; - return { - ...breakdown, - color - }; - }); - }, - [kpis, legends] - ); + return { + ...breakdown, + color + }; + }); + }, [kpis, legends]); const loading = status === FETCH_STATUS.LOADING || status === undefined; const hasHits = data && data.kpis.length > 0; - const timeseries = useMemo( - () => { - if (!timeseriesPerSubtype) { - return []; - } - return legends.map(legend => { - const series = timeseriesPerSubtype[legend.name]; + const timeseries = useMemo(() => { + if (!timeseriesPerSubtype) { + return []; + } + return legends.map(legend => { + const series = timeseriesPerSubtype[legend.name]; - return { - name: legend.name, - values: series, - color: legend.color - }; - }); - }, - [timeseriesPerSubtype, legends] - ); + return { + name: legend.name, + values: series, + color: legend.color + }; + }); + }, [timeseriesPerSubtype, legends]); return receivedDataDuringLifetime ? ( diff --git a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx b/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx index 9ab6aa8496eb..c8b61de02c1b 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx +++ b/x-pack/legacy/plugins/apm/public/components/shared/charts/TransactionCharts/TransactionLineChart/index.tsx @@ -56,37 +56,34 @@ const TransactionLineChart: React.FC = (props: Props) => { ); const { time, setTime } = useChartsTime(); - const hoverXHandlers = useMemo( - () => { - return { - onHover: (hoverX: number) => { - setTime(hoverX); - }, - onMouseLeave: () => { - setTime(null); - }, - onSelectionEnd: (range: { start: number; end: number }) => { - setTime(null); + const hoverXHandlers = useMemo(() => { + return { + onHover: (hoverX: number) => { + setTime(hoverX); + }, + onMouseLeave: () => { + setTime(null); + }, + onSelectionEnd: (range: { start: number; end: number }) => { + setTime(null); - const currentSearch = toQuery(history.location.search); - const nextSearch = { - rangeFrom: new Date(range.start).toISOString(), - rangeTo: new Date(range.end).toISOString() - }; + const currentSearch = toQuery(history.location.search); + const nextSearch = { + rangeFrom: new Date(range.start).toISOString(), + rangeTo: new Date(range.end).toISOString() + }; - history.push({ - ...history.location, - search: fromQuery({ - ...currentSearch, - ...nextSearch - }) - }); - }, - hoverX: time - }; - }, - [time, setTime] - ); + history.push({ + ...history.location, + search: fromQuery({ + ...currentSearch, + ...nextSearch + }) + }); + }, + hoverX: time + }; + }, [time, setTime]); if (!start || !end) { return null; diff --git a/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.ts b/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.ts index ecd4c7c9323f..5acbbd1d4573 100644 --- a/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.ts +++ b/x-pack/legacy/plugins/apm/public/components/shared/useDelayedVisibility/index.ts @@ -16,35 +16,29 @@ export function useDelayedVisibility( const [isVisible, setIsVisible] = useState(false); const delayedRef = useRef(null); - useEffect( - () => { - const delayed = new Delayed({ - hideDelayMs, - showDelayMs, - minimumVisibleDuration - }); - delayed.onChange(visibility => { - setIsVisible(visibility); - }); - delayedRef.current = delayed; - }, - [hideDelayMs, showDelayMs, minimumVisibleDuration] - ); + useEffect(() => { + const delayed = new Delayed({ + hideDelayMs, + showDelayMs, + minimumVisibleDuration + }); + delayed.onChange(visibility => { + setIsVisible(visibility); + }); + delayedRef.current = delayed; + }, [hideDelayMs, showDelayMs, minimumVisibleDuration]); - useEffect( - () => { - if (!delayedRef.current) { - return; - } + useEffect(() => { + if (!delayedRef.current) { + return; + } - if (visible) { - delayedRef.current.show(); - } else { - delayedRef.current.hide(); - } - }, - [visible] - ); + if (visible) { + delayedRef.current.show(); + } else { + delayedRef.current.hide(); + } + }, [visible]); return isVisible; } diff --git a/x-pack/legacy/plugins/apm/public/context/ChartsTimeContext.tsx b/x-pack/legacy/plugins/apm/public/context/ChartsTimeContext.tsx index acfbb65df4de..d1639848b69b 100644 --- a/x-pack/legacy/plugins/apm/public/context/ChartsTimeContext.tsx +++ b/x-pack/legacy/plugins/apm/public/context/ChartsTimeContext.tsx @@ -14,15 +14,12 @@ const ChartsTimeContext = React.createContext<{ const ChartsTimeContextProvider: React.FC = ({ children }) => { const [time, setTime] = useState(null); - const value = useMemo( - () => { - return { - time, - setTime - }; - }, - [time, setTime] - ); + const value = useMemo(() => { + return { + time, + setTime + }; + }, [time, setTime]); return ; }; diff --git a/x-pack/legacy/plugins/apm/public/context/MatchedRouteContext.tsx b/x-pack/legacy/plugins/apm/public/context/MatchedRouteContext.tsx index 2dc0cd56f794..bfa49fbcbc35 100644 --- a/x-pack/legacy/plugins/apm/public/context/MatchedRouteContext.tsx +++ b/x-pack/legacy/plugins/apm/public/context/MatchedRouteContext.tsx @@ -15,16 +15,13 @@ export const MatchedRouteContext = React.createContext>( export const MatchedRouteProvider: React.FC = ({ children }) => { const { pathname } = useLocation(); - const contextValue = useMemo( - () => { - return routes.filter(route => { - return matchPath(pathname, { - path: route.path - }); + const contextValue = useMemo(() => { + return routes.filter(route => { + return matchPath(pathname, { + path: route.path }); - }, - [pathname] - ); + }); + }, [pathname]); return ( diff --git a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx index d33a984589c7..383163e8e239 100644 --- a/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx +++ b/x-pack/legacy/plugins/apm/public/context/UrlParamsContext/index.tsx @@ -69,16 +69,13 @@ const UrlParamsProvider: React.ComponentClass<{}> = withRouter( const uiFilters = useUiFilters(urlParams); - const contextValue = useMemo( - () => { - return { - urlParams, - refreshTimeRange, - uiFilters - }; - }, - [urlParams, refreshTimeRange, uiFilters] - ); + const contextValue = useMemo(() => { + return { + urlParams, + refreshTimeRange, + uiFilters + }; + }, [urlParams, refreshTimeRange, uiFilters]); return ( diff --git a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.integration.test.tsx b/x-pack/legacy/plugins/apm/public/hooks/useFetcher.integration.test.tsx index 917edd034b1c..a47e8e03d572 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.integration.test.tsx +++ b/x-pack/legacy/plugins/apm/public/hooks/useFetcher.integration.test.tsx @@ -43,15 +43,12 @@ describe('when simulating race condition', () => { ms: number; renderFn: any; }) { - const { data, status, error } = useFetcher( - async () => { - requestCallOrder.push(['request', name, ms]); - const res = await asyncFn(name, ms); - requestCallOrder.push(['response', name, ms]); - return res; - }, - [name, ms] - ); + const { data, status, error } = useFetcher(async () => { + requestCallOrder.push(['request', name, ms]); + const res = await asyncFn(name, ms); + requestCallOrder.push(['response', name, ms]); + return res; + }, [name, ms]); renderFn({ data, status, error }); return null; } diff --git a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.tsx b/x-pack/legacy/plugins/apm/public/hooks/useFetcher.tsx index 6baf07768ba5..0ff770e25707 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useFetcher.tsx +++ b/x-pack/legacy/plugins/apm/public/hooks/useFetcher.tsx @@ -29,55 +29,52 @@ export function useFetcher( }>({}); const [counter, setCounter] = useState(0); - useEffect( - () => { - let didCancel = false; + useEffect(() => { + let didCancel = false; - async function doFetch() { - const promise = fn(); - if (!promise) { - return; - } - - dispatchStatus({ id, isLoading: true }); - - setResult({ - data: preservePreviousResponse ? result.data : undefined, // preserve data from previous state while loading next state - status: FETCH_STATUS.LOADING, - error: undefined - }); - - try { - const data = await promise; - if (!didCancel) { - dispatchStatus({ id, isLoading: false }); - setResult({ - data, - status: FETCH_STATUS.SUCCESS, - error: undefined - }); - } - } catch (e) { - if (!didCancel) { - dispatchStatus({ id, isLoading: false }); - setResult({ - data: undefined, - status: FETCH_STATUS.FAILURE, - error: e - }); - } - } + async function doFetch() { + const promise = fn(); + if (!promise) { + return; } - doFetch(); + dispatchStatus({ id, isLoading: true }); - return () => { - dispatchStatus({ id, isLoading: false }); - didCancel = true; - }; - }, - [...effectKey, counter] - ); + setResult({ + data: preservePreviousResponse ? result.data : undefined, // preserve data from previous state while loading next state + status: FETCH_STATUS.LOADING, + error: undefined + }); + + try { + const data = await promise; + if (!didCancel) { + dispatchStatus({ id, isLoading: false }); + setResult({ + data, + status: FETCH_STATUS.SUCCESS, + error: undefined + }); + } + } catch (e) { + if (!didCancel) { + dispatchStatus({ id, isLoading: false }); + setResult({ + data: undefined, + status: FETCH_STATUS.FAILURE, + error: e + }); + } + } + } + + doFetch(); + + return () => { + dispatchStatus({ id, isLoading: false }); + didCancel = true; + }; + }, [...effectKey, counter]); return useMemo( () => ({ diff --git a/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts b/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts index 863eccfe3211..cc4be9c519ce 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useServiceMetricCharts.ts @@ -22,20 +22,17 @@ export function useServiceMetricCharts( const uiFilters = useUiFilters(urlParams); const { data = INITIAL_DATA, error, status } = useFetcher< MetricsChartsByAgentAPIResponse - >( - () => { - if (serviceName && start && end && agentName) { - return loadMetricsChartData({ - serviceName, - start, - end, - agentName, - uiFilters - }); - } - }, - [serviceName, start, end, agentName, uiFilters] - ); + >(() => { + if (serviceName && start && end && agentName) { + return loadMetricsChartData({ + serviceName, + start, + end, + agentName, + uiFilters + }); + } + }, [serviceName, start, end, agentName, uiFilters]); return { data, diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionBreakdown.ts b/x-pack/legacy/plugins/apm/public/hooks/useTransactionBreakdown.ts index 23d0df2bf28e..573a405519d7 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionBreakdown.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useTransactionBreakdown.ts @@ -17,22 +17,19 @@ export function useTransactionBreakdown() { uiFilters } = useUrlParams(); - const { data, error, status } = useFetcher( - async () => { - if (serviceName && start && end) { - return callApi({ - pathname: `/api/apm/services/${serviceName}/transaction_groups/breakdown`, - query: { - start, - end, - transactionName, - uiFiltersES: await getUiFiltersES(uiFilters) - } - }); - } - }, - [serviceName, start, end, uiFilters] - ); + const { data, error, status } = useFetcher(async () => { + if (serviceName && start && end) { + return callApi({ + pathname: `/api/apm/services/${serviceName}/transaction_groups/breakdown`, + query: { + start, + end, + transactionName, + uiFiltersES: await getUiFiltersES(uiFilters) + } + }); + } + }, [serviceName, start, end, uiFilters]); const receivedDataDuringLifetime = useRef(false); diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDetailsCharts.ts b/x-pack/legacy/plugins/apm/public/hooks/useTransactionDetailsCharts.ts index b8c521741017..ed30d85c8939 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDetailsCharts.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useTransactionDetailsCharts.ts @@ -21,21 +21,18 @@ export function useTransactionDetailsCharts(urlParams: IUrlParams) { } = urlParams; const uiFilters = useUiFilters(urlParams); - const { data, error, status } = useFetcher( - () => { - if (serviceName && start && end && transactionName && transactionType) { - return loadTransactionCharts({ - serviceName, - start, - end, - transactionName, - transactionType, - uiFilters - }); - } - }, - [serviceName, start, end, transactionName, transactionType, uiFilters] - ); + const { data, error, status } = useFetcher(() => { + if (serviceName && start && end && transactionName && transactionType) { + return loadTransactionCharts({ + serviceName, + start, + end, + transactionName, + transactionType, + uiFilters + }); + } + }, [serviceName, start, end, transactionName, transactionType, uiFilters]); const memoizedData = useMemo(() => getTransactionCharts(urlParams, data), [ data diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts b/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts index 73413ac0e4c6..0d5a1ffe3477 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useTransactionDistribution.ts @@ -28,32 +28,29 @@ export function useTransactionDistribution(urlParams: IUrlParams) { } = urlParams; const uiFilters = useUiFilters(urlParams); - const { data = INITIAL_DATA, status, error } = useFetcher( - () => { - if (serviceName && start && end && transactionType && transactionName) { - return loadTransactionDistribution({ - serviceName, - start, - end, - transactionType, - transactionName, - transactionId, - traceId, - uiFilters - }); - } - }, - [ - serviceName, - start, - end, - transactionType, - transactionName, - transactionId, - traceId, - uiFilters - ] - ); + const { data = INITIAL_DATA, status, error } = useFetcher(() => { + if (serviceName && start && end && transactionType && transactionName) { + return loadTransactionDistribution({ + serviceName, + start, + end, + transactionType, + transactionName, + transactionId, + traceId, + uiFilters + }); + } + }, [ + serviceName, + start, + end, + transactionType, + transactionName, + transactionId, + traceId, + uiFilters + ]); return { data, status, error }; } diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts b/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts index 423d4c69953f..cda9213cf619 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useTransactionList.ts @@ -43,20 +43,17 @@ function getWithRelativeImpact(items: TransactionListAPIResponse) { export function useTransactionList(urlParams: IUrlParams) { const { serviceName, transactionType, start, end } = urlParams; const uiFilters = useUiFilters(urlParams); - const { data = [], error, status } = useFetcher( - () => { - if (serviceName && start && end && transactionType) { - return loadTransactionList({ - serviceName, - start, - end, - transactionType, - uiFilters - }); - } - }, - [serviceName, start, end, transactionType, uiFilters] - ); + const { data = [], error, status } = useFetcher(() => { + if (serviceName && start && end && transactionType) { + return loadTransactionList({ + serviceName, + start, + end, + transactionType, + uiFilters + }); + } + }, [serviceName, start, end, transactionType, uiFilters]); const memoizedData = useMemo(() => getWithRelativeImpact(data), [data]); return { diff --git a/x-pack/legacy/plugins/apm/public/hooks/useTransactionOverviewCharts.ts b/x-pack/legacy/plugins/apm/public/hooks/useTransactionOverviewCharts.ts index db253706e92f..62bdf0ffa77c 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useTransactionOverviewCharts.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useTransactionOverviewCharts.ts @@ -15,20 +15,17 @@ export function useTransactionOverviewCharts(urlParams: IUrlParams) { const { serviceName, start, end, transactionType } = urlParams; const uiFilters = useUiFilters(urlParams); - const { data, error, status } = useFetcher( - () => { - if (serviceName && start && end) { - return loadTransactionCharts({ - serviceName, - start, - end, - transactionType, - uiFilters - }); - } - }, - [serviceName, start, end, transactionType, uiFilters] - ); + const { data, error, status } = useFetcher(() => { + if (serviceName && start && end) { + return loadTransactionCharts({ + serviceName, + start, + end, + transactionType, + uiFilters + }); + } + }, [serviceName, start, end, transactionType, uiFilters]); const memoizedData = useMemo(() => getTransactionCharts(urlParams, data), [ data diff --git a/x-pack/legacy/plugins/apm/public/hooks/useWaterfall.ts b/x-pack/legacy/plugins/apm/public/hooks/useWaterfall.ts index d8bcee62d277..050041724a90 100644 --- a/x-pack/legacy/plugins/apm/public/hooks/useWaterfall.ts +++ b/x-pack/legacy/plugins/apm/public/hooks/useWaterfall.ts @@ -14,14 +14,11 @@ const INITIAL_DATA = { trace: [], errorsPerTransaction: {} }; export function useWaterfall(urlParams: IUrlParams) { const { traceId, start, end, transactionId } = urlParams; - const { data = INITIAL_DATA, status, error } = useFetcher( - () => { - if (traceId && start && end) { - return loadTrace({ traceId, start, end }); - } - }, - [traceId, start, end] - ); + const { data = INITIAL_DATA, status, error } = useFetcher(() => { + if (traceId && start && end) { + return loadTrace({ traceId, start, end }); + } + }, [traceId, start, end]); const waterfall = useMemo(() => getWaterfall(data, transactionId), [ data, diff --git a/x-pack/legacy/plugins/apm/typings/elasticsearch.ts b/x-pack/legacy/plugins/apm/typings/elasticsearch.ts index 4ba936f48015..0550bdbc2283 100644 --- a/x-pack/legacy/plugins/apm/typings/elasticsearch.ts +++ b/x-pack/legacy/plugins/apm/typings/elasticsearch.ts @@ -29,7 +29,7 @@ declare module 'elasticsearch' { export type AggregationOptionMap = { aggs?: { [aggregationName: string]: { - [T in AggregationType]?: AggOptions & AggregationOptionMap + [T in AggregationType]?: AggOptions & AggregationOptionMap; }; }; }; @@ -99,7 +99,7 @@ declare module 'elasticsearch' { lower: number; }; }; - }[AggregationType & keyof AggregationOption[AggregationName]] + }[AggregationType & keyof AggregationOption[AggregationName]]; } >; diff --git a/x-pack/legacy/plugins/beats_management/public/components/layouts/primary.tsx b/x-pack/legacy/plugins/beats_management/public/components/layouts/primary.tsx index f7106668f7b1..c44e81c575a0 100644 --- a/x-pack/legacy/plugins/beats_management/public/components/layouts/primary.tsx +++ b/x-pack/legacy/plugins/beats_management/public/components/layouts/primary.tsx @@ -20,7 +20,7 @@ import React, { Component, ReactNode } from 'react'; import styled from 'styled-components'; import { BreadcrumbConsumer } from '../navigation/breadcrumb'; -type RenderCallback = ((component: () => JSX.Element) => void); +type RenderCallback = (component: () => JSX.Element) => void; interface PrimaryLayoutProps { title: string | React.ReactNode; actionSection?: React.ReactNode; diff --git a/x-pack/legacy/plugins/beats_management/server/lib/framework.ts b/x-pack/legacy/plugins/beats_management/server/lib/framework.ts index 6dc345f0cc78..6e3f92953291 100644 --- a/x-pack/legacy/plugins/beats_management/server/lib/framework.ts +++ b/x-pack/legacy/plugins/beats_management/server/lib/framework.ts @@ -86,9 +86,7 @@ export class BackendFrameworkLib { ) { return { error: { - message: `Your ${ - this.license.type - } license does not support this API or is expired. Please upgrade your license.`, + message: `Your ${this.license.type} license does not support this API or is expired. Please upgrade your license.`, code: 403, }, success: false, diff --git a/x-pack/legacy/plugins/beats_management/types/eui.d.ts b/x-pack/legacy/plugins/beats_management/types/eui.d.ts index 1b5ad7aa0a37..553f10aaf4d1 100644 --- a/x-pack/legacy/plugins/beats_management/types/eui.d.ts +++ b/x-pack/legacy/plugins/beats_management/types/eui.d.ts @@ -13,6 +13,4 @@ import * as eui from '@elastic/eui'; import { Moment } from 'moment'; import { ChangeEventHandler, MouseEventHandler, ReactType, Ref, SFC } from 'react'; -declare module '@elastic/eui' { - -} +declare module '@elastic/eui' {} diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_bar/index.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_bar/index.ts index 8ef7eee56257..92efa9b33f91 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_bar/index.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_bar/index.ts @@ -19,8 +19,6 @@ export const horizontalProgressBar: ElementFactory = () => ({ expression: `filters | demodata | math "mean(percent_uptime)" -| progress shape="horizontalBar" label={formatnumber 0%} font={font size=24 family="${ - openSans.value - }" color="#000000" align=center} +| progress shape="horizontalBar" label={formatnumber 0%} font={font size=24 family="${openSans.value}" color="#000000" align=center} | render`, }); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_pill/index.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_pill/index.ts index 1533092a1601..c49e62f01d1b 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_pill/index.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/horizontal_progress_pill/index.ts @@ -19,8 +19,6 @@ export const horizontalProgressPill: ElementFactory = () => ({ expression: `filters | demodata | math "mean(percent_uptime)" -| progress shape="horizontalPill" label={formatnumber 0%} font={font size=24 family="${ - openSans.value - }" color="#000000" align=center} +| progress shape="horizontalPill" label={formatnumber 0%} font={font size=24 family="${openSans.value}" color="#000000" align=center} | render`, }); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_gauge/index.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_gauge/index.ts index d55c6410885b..1e194c49ebc0 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_gauge/index.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_gauge/index.ts @@ -19,8 +19,6 @@ export const progressGauge: ElementFactory = () => ({ expression: `filters | demodata | math "mean(percent_uptime)" -| progress shape="gauge" label={formatnumber 0%} font={font size=24 family="${ - openSans.value - }" color="#000000" align=center} +| progress shape="gauge" label={formatnumber 0%} font={font size=24 family="${openSans.value}" color="#000000" align=center} | render`, }); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_semicircle/index.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_semicircle/index.ts index 9324e9c2f516..867b31a18ac3 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_semicircle/index.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_semicircle/index.ts @@ -19,8 +19,6 @@ export const progressSemicircle: ElementFactory = () => ({ expression: `filters | demodata | math "mean(percent_uptime)" -| progress shape="semicircle" label={formatnumber 0%} font={font size=24 family="${ - openSans.value - }" color="#000000" align=center} +| progress shape="semicircle" label={formatnumber 0%} font={font size=24 family="${openSans.value}" color="#000000" align=center} | render`, }); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_wheel/index.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_wheel/index.ts index a047a8fc9c24..999563611d3a 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_wheel/index.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/progress_wheel/index.ts @@ -19,8 +19,6 @@ export const progressWheel: ElementFactory = () => ({ expression: `filters | demodata | math "mean(percent_uptime)" -| progress shape="wheel" label={formatnumber 0%} font={font size=24 family="${ - openSans.value - }" color="#000000" align=center} +| progress shape="wheel" label={formatnumber 0%} font={font size=24 family="${openSans.value}" color="#000000" align=center} | render`, }); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_bar/index.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_bar/index.ts index b7ba3fb9b2b2..1b1a2b4b489c 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_bar/index.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_bar/index.ts @@ -19,8 +19,6 @@ export const verticalProgressBar: ElementFactory = () => ({ expression: `filters | demodata | math "mean(percent_uptime)" -| progress shape="verticalBar" label={formatnumber 0%} font={font size=24 family="${ - openSans.value - }" color="#000000" align=center} +| progress shape="verticalBar" label={formatnumber 0%} font={font size=24 family="${openSans.value}" color="#000000" align=center} | render`, }); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_pill/index.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_pill/index.ts index 61a02447de92..75a6bacc76ae 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_pill/index.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/elements/vertical_progress_pill/index.ts @@ -19,8 +19,6 @@ export const verticalProgressPill: ElementFactory = () => ({ expression: `filters | demodata | math "mean(percent_uptime)" -| progress shape="verticalPill" label={formatnumber 0%} font={font size=24 family="${ - openSans.value - }" color="#000000" align=center} +| progress shape="verticalPill" label={formatnumber 0%} font={font size=24 family="${openSans.value}" color="#000000" align=center} | render`, }); diff --git a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/metric.ts b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/metric.ts index 06898c2f54ec..6b93aa1f42a2 100644 --- a/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/metric.ts +++ b/x-pack/legacy/plugins/canvas/canvas_plugin_src/functions/common/metric.ts @@ -38,9 +38,7 @@ export function metric(): ExpressionFunction<'metric', Context, Arguments, Rende metricFont: { types: ['style'], help: argHelp.metricFont, - default: `{font size=48 family="${ - openSans.value - }" color="#000000" align=center lHeight=48}`, + default: `{font size=48 family="${openSans.value}" color="#000000" align=center lHeight=48}`, }, labelFont: { types: ['style'], diff --git a/x-pack/legacy/plugins/canvas/public/apps/workpad/workpad_app/workpad_telemetry.tsx b/x-pack/legacy/plugins/canvas/public/apps/workpad/workpad_app/workpad_telemetry.tsx index 0727f7a52842..59375d3d0ef0 100644 --- a/x-pack/legacy/plugins/canvas/public/apps/workpad/workpad_app/workpad_telemetry.tsx +++ b/x-pack/legacy/plugins/canvas/public/apps/workpad/workpad_app/workpad_telemetry.tsx @@ -126,7 +126,7 @@ export const withUnconnectedElementsLoadedTelemetry = function

} }); - return ; + return ; }; }; diff --git a/x-pack/legacy/plugins/canvas/public/lib/aeroelastic/index.d.ts b/x-pack/legacy/plugins/canvas/public/lib/aeroelastic/index.d.ts index aeeb3b0c7446..3163e318b25d 100644 --- a/x-pack/legacy/plugins/canvas/public/lib/aeroelastic/index.d.ts +++ b/x-pack/legacy/plugins/canvas/public/lib/aeroelastic/index.d.ts @@ -37,7 +37,7 @@ interface WithActionId { // reselect-based data flow export type PlainFun = (...args: Json[]) => Json; export type Selector = (...fns: Resolve[]) => Resolve; -export type Resolve = ((obj: State) => Json); +export type Resolve = (obj: State) => Json; export type TypeName = string; export type Payload = JsonMap; diff --git a/x-pack/legacy/plugins/canvas/server/lib/query_es_sql.js b/x-pack/legacy/plugins/canvas/server/lib/query_es_sql.js index 7078552aaa9e..15d3dc52ee31 100644 --- a/x-pack/legacy/plugins/canvas/server/lib/query_es_sql.js +++ b/x-pack/legacy/plugins/canvas/server/lib/query_es_sql.js @@ -39,9 +39,7 @@ export const queryEsSQL = (elasticsearchClient, { count, query, filter, timezone .catch(e => { if (e.message.indexOf('parsing_exception') > -1) { throw new Error( - `Couldn't parse Elasticsearch SQL query. You may need to add double quotes to names containing special characters. Check your query and try again. Error: ${ - e.message - }` + `Couldn't parse Elasticsearch SQL query. You may need to add double quotes to names containing special characters. Check your query and try again. Error: ${e.message}` ); } throw new Error(`Unexpected error from Elasticsearch: ${e.message}`); diff --git a/x-pack/legacy/plugins/code/public/components/routes.ts b/x-pack/legacy/plugins/code/public/components/routes.ts index 873e1b7f5e30..0d4ccf4e5e82 100644 --- a/x-pack/legacy/plugins/code/public/components/routes.ts +++ b/x-pack/legacy/plugins/code/public/components/routes.ts @@ -8,9 +8,7 @@ import { PathTypes } from '../common/types'; export const ROOT = '/'; export const SETUP = '/setup-guide'; -const pathTypes = `:pathType(${PathTypes.blob}|${PathTypes.tree}|${PathTypes.blame}|${ - PathTypes.commits -})`; +const pathTypes = `:pathType(${PathTypes.blob}|${PathTypes.tree}|${PathTypes.blame}|${PathTypes.commits})`; export const MAIN = `/:resource/:org/:repo/${pathTypes}/:revision/:path*:goto(!.*)?`; export const DIFF = '/:resource/:org/:repo/commit/:commitId'; export const REPO = `/:resource/:org/:repo`; diff --git a/x-pack/legacy/plugins/code/server/lib/esqueue/job.d.ts b/x-pack/legacy/plugins/code/server/lib/esqueue/job.d.ts index d554f2832a13..5d8784a9acf5 100644 --- a/x-pack/legacy/plugins/code/server/lib/esqueue/job.d.ts +++ b/x-pack/legacy/plugins/code/server/lib/esqueue/job.d.ts @@ -88,14 +88,7 @@ export class Job

extends EventEmitter { public on( name: typeof events['EVENT_JOB_CREATED'], - handler: ( - info: { - id: string; - type: string; - index: string; - version: number; - } - ) => void + handler: (info: { id: string; type: string; index: string; version: number }) => void ): this; public on(name: typeof events['EVENT_JOB_CREATE_ERROR'], handler: (error: Error) => void): this; public on(name: string, ...args: any[]): this; diff --git a/x-pack/legacy/plugins/code/server/lsp/abstract_launcher.ts b/x-pack/legacy/plugins/code/server/lsp/abstract_launcher.ts index 96d8be785a05..d449ec5e31ef 100644 --- a/x-pack/legacy/plugins/code/server/lsp/abstract_launcher.ts +++ b/x-pack/legacy/plugins/code/server/lsp/abstract_launcher.ts @@ -33,7 +33,7 @@ export abstract class AbstractLauncher implements ILanguageServerLauncher { private proxyConnected: boolean = false; protected readonly log: Logger; private spawnTimes: number = 0; - private launchReject?: ((reason?: any) => void); + private launchReject?: (reason?: any) => void; protected constructor( readonly name: string, readonly targetHost: string, diff --git a/x-pack/legacy/plugins/code/server/lsp/proxy.ts b/x-pack/legacy/plugins/code/server/lsp/proxy.ts index 798192ce2e32..8b3bf15aa5c3 100644 --- a/x-pack/legacy/plugins/code/server/lsp/proxy.ts +++ b/x-pack/legacy/plugins/code/server/lsp/proxy.ts @@ -240,10 +240,7 @@ export class LanguageServerProxy implements ILanguageServerHandler { this.socket.on('error', () => void 0); this.socket.on('timeout', () => void 0); this.socket.on('drain', () => void 0); - this.socket.connect( - this.targetPort, - this.targetHost - ); + this.socket.connect(this.targetPort, this.targetHost); } public unloadWorkspace(workspaceDir: string): Promise { diff --git a/x-pack/legacy/plugins/code/server/repository_service.ts b/x-pack/legacy/plugins/code/server/repository_service.ts index 802f6d74ef32..e0a39efb5eb2 100644 --- a/x-pack/legacy/plugins/code/server/repository_service.ts +++ b/x-pack/legacy/plugins/code/server/repository_service.ts @@ -280,9 +280,7 @@ export class RepositoryService { const currentBranch = await gitRepo.getCurrentBranch(); const currentBranchName = currentBranch.shorthand(); this.log.info( - `Clone repository from ${ - repo.url - } done with head revision ${headRevision} and default branch ${currentBranchName}` + `Clone repository from ${repo.url} done with head revision ${headRevision} and default branch ${currentBranchName}` ); return { uri: repo.uri, diff --git a/x-pack/legacy/plugins/infra/common/utility_types.ts b/x-pack/legacy/plugins/infra/common/utility_types.ts index 6bcef43d7601..e2c1a5aaf885 100644 --- a/x-pack/legacy/plugins/infra/common/utility_types.ts +++ b/x-pack/legacy/plugins/infra/common/utility_types.ts @@ -5,10 +5,10 @@ */ export type Pick2 = { - [P1 in K1]: { [P2 in K2]: (T[K1])[P2] } + [P1 in K1]: { [P2 in K2]: (T[K1])[P2] }; }; export type Pick3 = { - [P1 in K1]: { [P2 in K2]: { [P3 in K3]: ((T[K1])[K2])[P3] } } + [P1 in K1]: { [P2 in K2]: { [P3 in K3]: ((T[K1])[K2])[P3] } }; }; /** diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_highlights_menu.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_highlights_menu.tsx index e563db5e43a7..0582df7f55bb 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_highlights_menu.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_highlights_menu.tsx @@ -49,12 +49,9 @@ export const LogHighlightsMenu: React.FC = ({ [setHighlightTerm] ); const clearHighlightTerm = useCallback(() => setHighlightTerm(''), [setHighlightTerm]); - useEffect( - () => { - debouncedOnChange([highlightTerm]); - }, - [highlightTerm] - ); + useEffect(() => { + debouncedOnChange([highlightTerm]); + }, [highlightTerm]); const button = ( diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx index b21c31666140..7d91a948ff2d 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/log_entry_row.tsx @@ -156,9 +156,7 @@ export const LogEntryRow = ({ return ( diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx index 1069bd7a9a45..75e0917cd696 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/scrollable_log_text_stream_view.tsx @@ -38,15 +38,13 @@ interface ScrollableLogTextStreamViewProps { lastLoadedTime: number | null; target: TimeKey | null; jumpToTarget: (target: TimeKey) => any; - reportVisibleInterval: ( - params: { - pagesBeforeStart: number; - pagesAfterEnd: number; - startKey: TimeKey | null; - middleKey: TimeKey | null; - endKey: TimeKey | null; - } - ) => any; + reportVisibleInterval: (params: { + pagesBeforeStart: number; + pagesAfterEnd: number; + startKey: TimeKey | null; + middleKey: TimeKey | null; + endKey: TimeKey | null; + }) => any; loadNewerItems: () => void; setFlyoutItem: (id: string) => void; setFlyoutVisibility: (visible: boolean) => void; @@ -281,9 +279,10 @@ export const ScrollableLogTextStreamView = injectI18n(ScrollableLogTextStreamVie * written as a hook. */ const WithColumnWidths: React.FunctionComponent<{ - children: ( - params: { columnWidths: LogEntryColumnWidths; CharacterDimensionsProbe: React.ComponentType } - ) => React.ReactElement | null; + children: (params: { + columnWidths: LogEntryColumnWidths; + CharacterDimensionsProbe: React.ComponentType; + }) => React.ReactElement | null; columnConfigurations: LogColumnConfiguration[]; scale: TextScale; }> = ({ children, columnConfigurations, scale }) => { diff --git a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx index 59f412268712..5505a2ef75a3 100644 --- a/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx +++ b/x-pack/legacy/plugins/infra/public/components/logging/log_text_stream/vertical_scroll_panel.tsx @@ -16,15 +16,13 @@ interface VerticalScrollPanelProps { children?: ( registerChild: (key: Child, element: MeasurableChild | null) => void ) => React.ReactNode; - onVisibleChildrenChange?: ( - visibleChildren: { - topChild: Child; - middleChild: Child; - bottomChild: Child; - pagesAbove: number; - pagesBelow: number; - } - ) => void; + onVisibleChildrenChange?: (visibleChildren: { + topChild: Child; + middleChild: Child; + bottomChild: Child; + pagesAbove: number; + pagesBelow: number; + }) => void; target: Child | undefined; height: number; width: number; diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx index fa26273908b7..01d44d446392 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx +++ b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/chart_context_menu.tsx @@ -69,17 +69,14 @@ export const MetricsExplorerChartContextMenu = injectI18n( ({ intl, onFilter, options, series, source, timeRange, uiCapabilities }: Props) => { const [isPopoverOpen, setPopoverState] = useState(false); const supportFiltering = options.groupBy != null && onFilter != null; - const handleFilter = useCallback( - () => { - // onFilter needs check for Typescript even though it's - // covered by supportFiltering variable - if (supportFiltering && onFilter) { - onFilter(`${options.groupBy}: "${series.id}"`); - } - setPopoverState(false); - }, - [supportFiltering, options.groupBy, series.id, onFilter] - ); + const handleFilter = useCallback(() => { + // onFilter needs check for Typescript even though it's + // covered by supportFiltering variable + if (supportFiltering && onFilter) { + onFilter(`${options.groupBy}: "${series.id}"`); + } + setPopoverState(false); + }, [supportFiltering, options.groupBy, series.id, onFilter]); const tsvbUrl = createTSVBLink(source, options, series, timeRange); diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx index fd981fe2c565..48d57f682a11 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx +++ b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/kuery_bar.tsx @@ -33,14 +33,11 @@ export const MetricsExplorerKueryBar = injectI18n( const [isValid, setValidation] = useState(true); // This ensures that if value changes out side this component it will update. - useEffect( - () => { - if (value) { - setDraftQuery(value); - } - }, - [value] - ); + useEffect(() => { + if (value) { + setDraftQuery(value); + } + }, [value]); const handleChange = (query: string) => { setValidation(validateQuery(query)); diff --git a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/metrics.tsx b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/metrics.tsx index 0e07595afb9a..cfe24b51113e 100644 --- a/x-pack/legacy/plugins/infra/public/components/metrics_explorer/metrics.tsx +++ b/x-pack/legacy/plugins/infra/public/components/metrics_explorer/metrics.tsx @@ -34,15 +34,12 @@ export const MetricsExplorerMetrics = injectI18n( const [inputRef, setInputRef] = useState(null); const [focusOnce, setFocusState] = useState(false); - useEffect( - () => { - if (inputRef && autoFocus && !focusOnce) { - inputRef.focus(); - setFocusState(true); - } - }, - [inputRef] - ); + useEffect(() => { + if (inputRef && autoFocus && !focusOnce) { + inputRef.focus(); + setFocusState(true); + } + }, [inputRef]); // I tried to use useRef originally but the EUIComboBox component's type definition // would only accept an actual input element or a callback function (with the same type). diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_flyout.tsx b/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_flyout.tsx index c7a6ba38aa59..799c207b94be 100644 --- a/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_flyout.tsx +++ b/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_flyout.tsx @@ -67,24 +67,21 @@ export const SourceConfigurationFlyout = injectI18n( formStateChanges, } = useSourceConfigurationFormState(source && source.configuration); - const persistUpdates = useCallback( - async () => { - if (sourceExists) { - await updateSourceConfiguration(formStateChanges); - } else { - await createSourceConfiguration(formState); - } - resetForm(); - }, - [ - sourceExists, - updateSourceConfiguration, - createSourceConfiguration, - resetForm, - formState, - formStateChanges, - ] - ); + const persistUpdates = useCallback(async () => { + if (sourceExists) { + await updateSourceConfiguration(formStateChanges); + } else { + await createSourceConfiguration(formState); + } + resetForm(); + }, [ + sourceExists, + updateSourceConfiguration, + createSourceConfiguration, + resetForm, + formState, + formStateChanges, + ]); const isWriteable = useMemo(() => shouldAllowEdit && source && source.origin !== 'internal', [ shouldAllowEdit, diff --git a/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx b/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx index e3bed7773eb8..9ab642276907 100644 --- a/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx +++ b/x-pack/legacy/plugins/infra/public/components/source_configuration/source_configuration_form_state.tsx @@ -49,13 +49,10 @@ export const useSourceConfigurationFormState = (configuration?: SourceConfigurat [indicesConfigurationFormState.errors, logColumnsConfigurationFormState.errors] ); - const resetForm = useCallback( - () => { - indicesConfigurationFormState.resetForm(); - logColumnsConfigurationFormState.resetForm(); - }, - [indicesConfigurationFormState.resetForm, logColumnsConfigurationFormState.formState] - ); + const resetForm = useCallback(() => { + indicesConfigurationFormState.resetForm(); + logColumnsConfigurationFormState.resetForm(); + }, [indicesConfigurationFormState.resetForm, logColumnsConfigurationFormState.formState]); const isFormDirty = useMemo( () => indicesConfigurationFormState.isFormDirty || logColumnsConfigurationFormState.isFormDirty, diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_flyout.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_flyout.tsx index 104c94f8f26a..cf1cbe3bf14e 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_flyout.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_flyout.tsx @@ -66,21 +66,15 @@ export const useLogFlyout = () => { [apolloClient, sourceId, flyoutId] ); - const isLoading = useMemo( - () => { - return loadFlyoutItemRequest.state === 'pending'; - }, - [loadFlyoutItemRequest.state] - ); + const isLoading = useMemo(() => { + return loadFlyoutItemRequest.state === 'pending'; + }, [loadFlyoutItemRequest.state]); - useEffect( - () => { - if (flyoutId) { - loadFlyoutItem(); - } - }, - [loadFlyoutItem, flyoutId] - ); + useEffect(() => { + if (flyoutId) { + loadFlyoutItem(); + } + }, [loadFlyoutItem, flyoutId]); return { flyoutVisible, diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx index 384a94e8e344..a6bf421536db 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/log_highlights.tsx @@ -71,20 +71,17 @@ export const useLogHighlightsState = ({ [apolloClient, sourceId, startKey, endKey, filterQuery, highlightTerms] ); - useEffect( - () => { - if ( - highlightTerms.filter(highlightTerm => highlightTerm.length > 0).length && - startKey && - endKey - ) { - loadLogEntryHighlights(); - } else { - setLogEntryHighlights(undefined); - } - }, - [highlightTerms, startKey, endKey, filterQuery, sourceVersion] - ); + useEffect(() => { + if ( + highlightTerms.filter(highlightTerm => highlightTerm.length > 0).length && + startKey && + endKey + ) { + loadLogEntryHighlights(); + } else { + setLogEntryHighlights(undefined); + } + }, [highlightTerms, startKey, endKey, filterQuery, sourceVersion]); const logEntryHighlightsById = useMemo( () => diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/redux_bridges.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/redux_bridges.tsx index 1a833c24ac98..b5f4419d5e0b 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/redux_bridges.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_highlights/redux_bridges.tsx @@ -16,13 +16,10 @@ import { LogHighlightsState } from './log_highlights'; export const LogHighlightsPositionBridge = withStreamItems( ({ entriesStart, entriesEnd }: { entriesStart: TimeKey | null; entriesEnd: TimeKey | null }) => { const { setStartKey, setEndKey } = useContext(LogHighlightsState.Context); - useEffect( - () => { - setStartKey(entriesStart); - setEndKey(entriesEnd); - }, - [entriesStart, entriesEnd] - ); + useEffect(() => { + setStartKey(entriesStart); + setEndKey(entriesEnd); + }, [entriesStart, entriesEnd]); return null; } @@ -32,12 +29,9 @@ export const LogHighlightsFilterQueryBridge = withLogFilter( ({ serializedFilterQuery }: { serializedFilterQuery: string | null }) => { const { setFilterQuery } = useContext(LogHighlightsState.Context); - useEffect( - () => { - setFilterQuery(serializedFilterQuery); - }, - [serializedFilterQuery] - ); + useEffect(() => { + setFilterQuery(serializedFilterQuery); + }, [serializedFilterQuery]); return null; } diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.tsx b/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.tsx index c6bcb3f13059..b5c765c2c2a2 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/logs/log_summary/log_summary.tsx @@ -24,20 +24,17 @@ export const useLogSummary = ( const [logSummaryBetween, setLogSummaryBetween] = useState({ buckets: [] }); const apolloClient = useApolloClient(); - const [bufferStart, bufferEnd] = useMemo( - () => { - if (midpointTime === null || intervalSize <= 0) { - return [null, null]; - } + const [bufferStart, bufferEnd] = useMemo(() => { + if (midpointTime === null || intervalSize <= 0) { + return [null, null]; + } - const halfIntervalSize = intervalSize / 2; - return [ - (Math.floor((midpointTime - halfIntervalSize) / intervalSize) - 0.5) * intervalSize, - (Math.ceil((midpointTime + halfIntervalSize) / intervalSize) + 0.5) * intervalSize, - ]; - }, - [midpointTime, intervalSize] - ); + const halfIntervalSize = intervalSize / 2; + return [ + (Math.floor((midpointTime - halfIntervalSize) / intervalSize) - 0.5) * intervalSize, + (Math.ceil((midpointTime + halfIntervalSize) / intervalSize) + 0.5) * intervalSize, + ]; + }, [midpointTime, intervalSize]); useCancellableEffect( getIsCancelled => { diff --git a/x-pack/legacy/plugins/infra/public/containers/logs/with_stream_items.ts b/x-pack/legacy/plugins/infra/public/containers/logs/with_stream_items.ts index 27c9025460cf..3288253e8ba3 100644 --- a/x-pack/legacy/plugins/infra/public/containers/logs/with_stream_items.ts +++ b/x-pack/legacy/plugins/infra/public/containers/logs/with_stream_items.ts @@ -116,12 +116,9 @@ const createLogEntryStreamItem = ( */ export const ReduxSourceIdBridge = withStreamItems( ({ setSourceId, sourceId }: { setSourceId: (sourceId: string) => void; sourceId: string }) => { - useEffect( - () => { - setSourceId(sourceId); - }, - [setSourceId, sourceId] - ); + useEffect(() => { + setSourceId(sourceId); + }, [setSourceId, sourceId]); return null; } diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics/with_metrics_time.tsx b/x-pack/legacy/plugins/infra/public/containers/metrics/with_metrics_time.tsx index 0da141ffdf97..bd081c2dfe8f 100644 --- a/x-pack/legacy/plugins/infra/public/containers/metrics/with_metrics_time.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/metrics/with_metrics_time.tsx @@ -31,29 +31,23 @@ export const useMetricsTime = () => { interval: '>=1m', }); - const setTimeRangeToNow = useCallback( - () => { - const range = timeRange.to - timeRange.from; - const nowInMs = moment().valueOf(); - setTimeRange({ - from: nowInMs - range, - to: nowInMs, - interval: '>=1m', - }); - }, - [timeRange.from, timeRange.to] - ); + const setTimeRangeToNow = useCallback(() => { + const range = timeRange.to - timeRange.from; + const nowInMs = moment().valueOf(); + setTimeRange({ + from: nowInMs - range, + to: nowInMs, + interval: '>=1m', + }); + }, [timeRange.from, timeRange.to]); useInterval(setTimeRangeToNow, isAutoReloading ? refreshInterval : null); - useEffect( - () => { - if (isAutoReloading) { - setTimeRangeToNow(); - } - }, - [isAutoReloading] - ); + useEffect(() => { + if (isAutoReloading) { + setTimeRangeToNow(); + } + }, [isAutoReloading]); return { timeRange, diff --git a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts b/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts index 6fbb7696f36e..f514c1a7e052 100644 --- a/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts +++ b/x-pack/legacy/plugins/infra/public/containers/metrics_explorer/use_metrics_explorer_data.ts @@ -35,70 +35,67 @@ export function useMetricsExplorerData( const [lastOptions, setLastOptions] = useState(null); const [lastTimerange, setLastTimerange] = useState(null); - useEffect( - () => { - (async () => { - setLoading(true); - try { - const from = DateMath.parse(timerange.from); - const to = DateMath.parse(timerange.to, { roundUp: true }); - if (!from || !to) { - throw new Error('Unalble to parse timerange'); - } - const response = await fetch.post( - '../api/infra/metrics_explorer', - { - metrics: - options.aggregation === MetricsExplorerAggregation.count - ? [{ aggregation: MetricsExplorerAggregation.count }] - : options.metrics.map(metric => ({ - aggregation: metric.aggregation, - field: metric.field, - })), - groupBy: options.groupBy, - afterKey, - limit: options.limit, - indexPattern: source.metricAlias, - filterQuery: - (options.filterQuery && - convertKueryToElasticSearchQuery(options.filterQuery, derivedIndexPattern)) || - void 0, - timerange: { - ...timerange, - field: source.fields.timestamp, - from: from.valueOf(), - to: to.valueOf(), - }, - } - ); - if (response.data) { - if ( - data && - lastOptions && - data.pageInfo.afterKey !== response.data.pageInfo.afterKey && - isSameOptions(lastOptions, options) && - isEqual(timerange, lastTimerange) && - afterKey - ) { - const { series } = data; - setData({ - ...response.data, - series: [...series, ...response.data.series], - }); - } else { - setData(response.data); - } - setLastOptions(options); - setLastTimerange(timerange); - setError(null); - } - } catch (e) { - setError(e); + useEffect(() => { + (async () => { + setLoading(true); + try { + const from = DateMath.parse(timerange.from); + const to = DateMath.parse(timerange.to, { roundUp: true }); + if (!from || !to) { + throw new Error('Unalble to parse timerange'); } - setLoading(false); - })(); - }, - [options, source, timerange, signal, afterKey] - ); + const response = await fetch.post( + '../api/infra/metrics_explorer', + { + metrics: + options.aggregation === MetricsExplorerAggregation.count + ? [{ aggregation: MetricsExplorerAggregation.count }] + : options.metrics.map(metric => ({ + aggregation: metric.aggregation, + field: metric.field, + })), + groupBy: options.groupBy, + afterKey, + limit: options.limit, + indexPattern: source.metricAlias, + filterQuery: + (options.filterQuery && + convertKueryToElasticSearchQuery(options.filterQuery, derivedIndexPattern)) || + void 0, + timerange: { + ...timerange, + field: source.fields.timestamp, + from: from.valueOf(), + to: to.valueOf(), + }, + } + ); + if (response.data) { + if ( + data && + lastOptions && + data.pageInfo.afterKey !== response.data.pageInfo.afterKey && + isSameOptions(lastOptions, options) && + isEqual(timerange, lastTimerange) && + afterKey + ) { + const { series } = data; + setData({ + ...response.data, + series: [...series, ...response.data.series], + }); + } else { + setData(response.data); + } + setLastOptions(options); + setLastTimerange(timerange); + setError(null); + } + } catch (e) { + setError(e); + } + setLoading(false); + })(); + }, [options, source, timerange, signal, afterKey]); return { error, loading, data }; } diff --git a/x-pack/legacy/plugins/infra/public/containers/source/source.tsx b/x-pack/legacy/plugins/infra/public/containers/source/source.tsx index 4a9bab0f40a3..9632a5bda079 100644 --- a/x-pack/legacy/plugins/infra/public/containers/source/source.tsx +++ b/x-pack/legacy/plugins/infra/public/containers/source/source.tsx @@ -140,12 +140,9 @@ export const useSource = ({ sourceId }: { sourceId: string }) => { [source] ); - useEffect( - () => { - loadSource(); - }, - [loadSource, sourceId] - ); + useEffect(() => { + loadSource(); + }, [loadSource, sourceId]); return { createSourceConfiguration, diff --git a/x-pack/legacy/plugins/infra/public/hooks/use_interval.ts b/x-pack/legacy/plugins/infra/public/hooks/use_interval.ts index 4e063d6d51ce..f8a98c53652c 100644 --- a/x-pack/legacy/plugins/infra/public/hooks/use_interval.ts +++ b/x-pack/legacy/plugins/infra/public/hooks/use_interval.ts @@ -9,24 +9,18 @@ import { useEffect, useRef } from 'react'; export function useInterval(callback: () => void, delay: number | null) { const savedCallback = useRef(callback); - useEffect( - () => { - savedCallback.current = callback; - }, - [callback] - ); + useEffect(() => { + savedCallback.current = callback; + }, [callback]); - useEffect( - () => { - function tick() { - savedCallback.current(); - } + useEffect(() => { + function tick() { + savedCallback.current(); + } - if (delay !== null) { - const id = setInterval(tick, delay); - return () => clearInterval(id); - } - }, - [delay] - ); + if (delay !== null) { + const id = setInterval(tick, delay); + return () => clearInterval(id); + } + }, [delay]); } diff --git a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts b/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts index 452e5523c391..a507b29ed60b 100644 --- a/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts +++ b/x-pack/legacy/plugins/infra/public/pages/infrastructure/metrics_explorer/use_metric_explorer_state.ts @@ -32,13 +32,10 @@ export const useMetricsExplorerState = ( refreshSignal ); - const handleRefresh = useCallback( - () => { - setAfterKey(null); - setRefreshSignal(refreshSignal + 1); - }, - [refreshSignal] - ); + const handleRefresh = useCallback(() => { + setAfterKey(null); + setRefreshSignal(refreshSignal + 1); + }, [refreshSignal]); const handleTimeChange = useCallback( (start: string, end: string) => { diff --git a/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts b/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts index b1d5bfddfb1b..7b4b56f34a67 100644 --- a/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts +++ b/x-pack/legacy/plugins/infra/public/pages/link_to/use_host_ip_to_name.ts @@ -13,27 +13,24 @@ export const useHostIpToName = (ipAddress: string | null, indexPattern: string | const [loading, setLoadingState] = useState(true); const [data, setData] = useState(null); - useEffect( - () => { - (async () => { - setLoadingState(true); - setError(null); - try { - if (ipAddress && indexPattern) { - const response = await fetch.post('../api/infra/ip_to_host', { - ip: ipAddress, - index_pattern: indexPattern, - }); - setLoadingState(false); - setData(response.data); - } - } catch (err) { + useEffect(() => { + (async () => { + setLoadingState(true); + setError(null); + try { + if (ipAddress && indexPattern) { + const response = await fetch.post('../api/infra/ip_to_host', { + ip: ipAddress, + index_pattern: indexPattern, + }); setLoadingState(false); - setError(err); + setData(response.data); } - })(); - }, - [ipAddress, indexPattern] - ); + } catch (err) { + setLoadingState(false); + setError(err); + } + })(); + }, [ipAddress, indexPattern]); return { name: (data && data.host) || null, loading, error }; }; diff --git a/x-pack/legacy/plugins/infra/public/utils/typed_redux.ts b/x-pack/legacy/plugins/infra/public/utils/typed_redux.ts index 5976148db3e9..1eef1b888aab 100644 --- a/x-pack/legacy/plugins/infra/public/utils/typed_redux.ts +++ b/x-pack/legacy/plugins/infra/public/utils/typed_redux.ts @@ -19,7 +19,7 @@ export type GlobalSelectors = { [selectorName in keyof LocalSelectors]: Selector< GlobalState, ReturnType - > + >; }; export const globalizeSelector = < @@ -66,5 +66,5 @@ export const bindPlainActionCreators = (dispatch: Dispatch) => (bindActionCreators(actionCreators, dispatch) as unknown) as { - [P in keyof WrappedActionCreators]: PlainActionCreator + [P in keyof WrappedActionCreators]: PlainActionCreator; }; diff --git a/x-pack/legacy/plugins/infra/public/utils/use_observable.ts b/x-pack/legacy/plugins/infra/public/utils/use_observable.ts index 08255b3e3320..536b6b2723ae 100644 --- a/x-pack/legacy/plugins/infra/public/utils/use_observable.ts +++ b/x-pack/legacy/plugins/infra/public/utils/use_observable.ts @@ -12,13 +12,10 @@ export function useObservable(observable$: Observable, initialValue: T): T export function useObservable(observable$: Observable, initialValue?: T): T | undefined { const [value, update] = useState(initialValue); - useEffect( - () => { - const s = observable$.subscribe(update); - return () => s.unsubscribe(); - }, - [observable$] - ); + useEffect(() => { + const s = observable$.subscribe(update); + return () => s.unsubscribe(); + }, [observable$]); return value; } diff --git a/x-pack/legacy/plugins/infra/public/utils/use_url_state.ts b/x-pack/legacy/plugins/infra/public/utils/use_url_state.ts index 1526bc82f398..d03a5aaa9d69 100644 --- a/x-pack/legacy/plugins/infra/public/utils/use_url_state.ts +++ b/x-pack/legacy/plugins/infra/public/utils/use_url_state.ts @@ -24,16 +24,13 @@ export const useUrlState = ({ }) => { const history = useHistory(); - const urlStateString = useMemo( - () => { - if (!history) { - return; - } + const urlStateString = useMemo(() => { + if (!history) { + return; + } - return getParamFromQueryString(getQueryStringFromLocation(history.location), urlStateKey); - }, - [history && history.location, urlStateKey] - ); + return getParamFromQueryString(getQueryStringFromLocation(history.location), urlStateKey); + }, [history && history.location, urlStateKey]); const decodedState = useMemo(() => decodeUrlState(decodeRisonUrlState(urlStateString)), [ decodeUrlState, diff --git a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts b/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts index 569cf55b532d..b91c2912188c 100644 --- a/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts +++ b/x-pack/legacy/plugins/infra/server/lib/adapters/metrics/kibana_metrics_adapter.ts @@ -30,9 +30,7 @@ export class KibanaMetricsAdapter implements InfraMetricsAdapter { [InfraNodeType.container]: options.sourceConfiguration.fields.container, [InfraNodeType.pod]: options.sourceConfiguration.fields.pod, }; - const indexPattern = `${options.sourceConfiguration.metricAlias},${ - options.sourceConfiguration.logAlias - }`; + const indexPattern = `${options.sourceConfiguration.metricAlias},${options.sourceConfiguration.logAlias}`; const timeField = options.sourceConfiguration.fields.timestamp; const interval = options.timerange.interval; const nodeField = fields[options.nodeType]; diff --git a/x-pack/legacy/plugins/ml/public/data_frame/common/pivot_aggs.ts b/x-pack/legacy/plugins/ml/public/data_frame/common/pivot_aggs.ts index 79f1fa7532e7..8403edc73ba1 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame/common/pivot_aggs.ts +++ b/x-pack/legacy/plugins/ml/public/data_frame/common/pivot_aggs.ts @@ -57,7 +57,7 @@ export const pivotAggsFieldSupport = { export type PivotAgg = { [key in PIVOT_SUPPORTED_AGGS]?: { field: FieldName; - } + }; }; export type PivotAggDict = { [key in AggName]: PivotAgg }; diff --git a/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/define_pivot_form.tsx b/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/define_pivot_form.tsx index 1d2869f161aa..498e207fa25e 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/define_pivot_form.tsx +++ b/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/define_pivot_form.tsx @@ -353,9 +353,7 @@ export const DefinePivotForm: SFC = React.memo(({ overrides = {}, onChang }; // metadata.branch corresponds to the version used in documentation links. - const docsUrl = `https://www.elastic.co/guide/en/elasticsearch/reference/${ - metadata.branch - }/data-frame-transform-pivot.html`; + const docsUrl = `https://www.elastic.co/guide/en/elasticsearch/reference/${metadata.branch}/data-frame-transform-pivot.html`; const advancedEditorHelpText = ( {i18n.translate('xpack.ml.dataframe.definePivotForm.advancedEditorHelpText', { @@ -372,34 +370,31 @@ export const DefinePivotForm: SFC = React.memo(({ overrides = {}, onChang const valid = pivotGroupByArr.length > 0 && pivotAggsArr.length > 0; - useEffect( - () => { - const previewRequestUpdate = getDataFramePreviewRequest( - indexPattern.title, - pivotQuery, - pivotGroupByArr, - pivotAggsArr - ); + useEffect(() => { + const previewRequestUpdate = getDataFramePreviewRequest( + indexPattern.title, + pivotQuery, + pivotGroupByArr, + pivotAggsArr + ); - const stringifiedPivotConfigUpdate = JSON.stringify(previewRequestUpdate.pivot, null, 2); - setAdvancedEditorConfig(stringifiedPivotConfigUpdate); + const stringifiedPivotConfigUpdate = JSON.stringify(previewRequestUpdate.pivot, null, 2); + setAdvancedEditorConfig(stringifiedPivotConfigUpdate); - onChange({ - aggList, - groupByList, - isAdvancedEditorEnabled, - search, - valid, - }); - }, - [ - JSON.stringify(pivotAggsArr), - JSON.stringify(pivotGroupByArr), + onChange({ + aggList, + groupByList, isAdvancedEditorEnabled, search, valid, - ] - ); + }); + }, [ + JSON.stringify(pivotAggsArr), + JSON.stringify(pivotGroupByArr), + isAdvancedEditorEnabled, + search, + valid, + ]); // TODO This should use the actual value of `indices.query.bool.max_clause_count` const maxIndexFields = 1024; diff --git a/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/use_pivot_preview_data.ts b/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/use_pivot_preview_data.ts index 448dfedcea25..ed2b85a8f50c 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/use_pivot_preview_data.ts +++ b/x-pack/legacy/plugins/ml/public/data_frame/components/define_pivot/use_pivot_preview_data.ts @@ -69,11 +69,13 @@ export const usePivotPreviewData = ( } }; - useEffect( - () => { - getDataFramePreviewData(); - }, - [indexPattern.title, JSON.stringify(aggsArr), JSON.stringify(groupByArr), JSON.stringify(query)] - ); + useEffect(() => { + getDataFramePreviewData(); + }, [ + indexPattern.title, + JSON.stringify(aggsArr), + JSON.stringify(groupByArr), + JSON.stringify(query), + ]); return { errorMessage, status, dataFramePreviewData, previewRequest }; }; diff --git a/x-pack/legacy/plugins/ml/public/data_frame/components/job_create/job_create_form.tsx b/x-pack/legacy/plugins/ml/public/data_frame/components/job_create/job_create_form.tsx index f645740cd44b..03f1db02a9a9 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame/components/job_create/job_create_form.tsx +++ b/x-pack/legacy/plugins/ml/public/data_frame/components/job_create/job_create_form.tsx @@ -75,12 +75,9 @@ export const JobCreateForm: SFC = React.memo( return null; } - useEffect( - () => { - onChange({ created, started, indexPatternId }); - }, - [created, started, indexPatternId] - ); + useEffect(() => { + onChange({ created, started, indexPatternId }); + }, [created, started, indexPatternId]); async function createDataFrame() { setCreated(true); diff --git a/x-pack/legacy/plugins/ml/public/data_frame/components/job_details/job_details_form.tsx b/x-pack/legacy/plugins/ml/public/data_frame/components/job_details/job_details_form.tsx index 6d2510bbeb04..51e65a1a101d 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame/components/job_details/job_details_form.tsx +++ b/x-pack/legacy/plugins/ml/public/data_frame/components/job_details/job_details_form.tsx @@ -135,21 +135,8 @@ export const JobDetailsForm: SFC = React.memo(({ overrides = {}, onChange (!isContinuousModeAvailable || (isContinuousModeAvailable && isContinuousModeDelayValid)); // expose state to wizard - useEffect( - () => { - onChange({ - continuousModeDateField, - continuousModeDelay, - createIndexPattern, - isContinuousModeEnabled, - jobId, - jobDescription, - destinationIndex, - touched: true, - valid, - }); - }, - [ + useEffect(() => { + onChange({ continuousModeDateField, continuousModeDelay, createIndexPattern, @@ -157,9 +144,19 @@ export const JobDetailsForm: SFC = React.memo(({ overrides = {}, onChange jobId, jobDescription, destinationIndex, + touched: true, valid, - ] - ); + }); + }, [ + continuousModeDateField, + continuousModeDelay, + createIndexPattern, + isContinuousModeEnabled, + jobId, + jobDescription, + destinationIndex, + valid, + ]); return ( diff --git a/x-pack/legacy/plugins/ml/public/data_frame/components/source_index_preview/use_source_index_data.ts b/x-pack/legacy/plugins/ml/public/data_frame/components/source_index_preview/use_source_index_data.ts index 0772c0c388f2..e6a9776faa99 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame/components/source_index_preview/use_source_index_data.ts +++ b/x-pack/legacy/plugins/ml/public/data_frame/components/source_index_preview/use_source_index_data.ts @@ -90,11 +90,8 @@ export const useSourceIndexData = ( } }; - useEffect( - () => { - getSourceIndexData(); - }, - [indexPattern.title, JSON.stringify(query)] - ); + useEffect(() => { + getSourceIndexData(); + }, [indexPattern.title, JSON.stringify(query)]); return { errorMessage, status, tableItems }; }; diff --git a/x-pack/legacy/plugins/remote_clusters/server/routes/api/get_route.ts b/x-pack/legacy/plugins/remote_clusters/server/routes/api/get_route.ts index a55fc623106c..d37f98cdb9e0 100644 --- a/x-pack/legacy/plugins/remote_clusters/server/routes/api/get_route.ts +++ b/x-pack/legacy/plugins/remote_clusters/server/routes/api/get_route.ts @@ -24,19 +24,17 @@ export const getAllHandler: RouterRouteHandler = async (req, callWithRequest): P const clustersByName = await callWithRequest('cluster.remoteInfo'); const clusterNames = (clustersByName && Object.keys(clustersByName)) || []; - return clusterNames.map( - (clusterName: string): any => { - const cluster = clustersByName[clusterName]; - const isTransient = transientClusterNames.includes(clusterName); - const isPersistent = persistentClusterNames.includes(clusterName); - // If the cluster hasn't been stored in the cluster state, then it's defined by the - // node's config file. - const isConfiguredByNode = !isTransient && !isPersistent; + return clusterNames.map((clusterName: string): any => { + const cluster = clustersByName[clusterName]; + const isTransient = transientClusterNames.includes(clusterName); + const isPersistent = persistentClusterNames.includes(clusterName); + // If the cluster hasn't been stored in the cluster state, then it's defined by the + // node's config file. + const isConfiguredByNode = !isTransient && !isPersistent; - return { - ...deserializeCluster(clusterName, cluster), - isConfiguredByNode, - }; - } - ); + return { + ...deserializeCluster(clusterName, cluster), + isConfiguredByNode, + }; + }); }; diff --git a/x-pack/legacy/plugins/reporting/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts b/x-pack/legacy/plugins/reporting/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts index 9d0b588b02da..43eedd92f144 100644 --- a/x-pack/legacy/plugins/reporting/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts +++ b/x-pack/legacy/plugins/reporting/export_types/csv_from_savedobject/server/lib/generate_csv_search.ts @@ -86,7 +86,9 @@ export async function generateCsvSearch( let payloadSort: any[] = []; if (jobParams.post && jobParams.post.state) { ({ - post: { state: { query: payloadQuery, sort: payloadSort = [] } }, + post: { + state: { query: payloadQuery, sort: payloadSort = [] }, + }, } = jobParams); } diff --git a/x-pack/legacy/plugins/reporting/server/routes/legacy.ts b/x-pack/legacy/plugins/reporting/server/routes/legacy.ts index d95791fea8b9..24caf8003b7d 100644 --- a/x-pack/legacy/plugins/reporting/server/routes/legacy.ts +++ b/x-pack/legacy/plugins/reporting/server/routes/legacy.ts @@ -29,9 +29,7 @@ export function registerLegacy( method: 'POST', config: getStaticFeatureConfig(getRouteConfig, exportTypeId), handler: async (request: Request, h: ResponseToolkit) => { - const message = `The following URL is deprecated and will stop working in the next major version: ${ - request.url.path - }`; + const message = `The following URL is deprecated and will stop working in the next major version: ${request.url.path}`; server.log(['warning', 'reporting', 'deprecation'], message); try { diff --git a/x-pack/legacy/plugins/reporting/types.d.ts b/x-pack/legacy/plugins/reporting/types.d.ts index 62f83bc93d98..c5d2b86467f8 100644 --- a/x-pack/legacy/plugins/reporting/types.d.ts +++ b/x-pack/legacy/plugins/reporting/types.d.ts @@ -20,13 +20,16 @@ export interface KbnServer { log: any; fieldFormatServiceFactory: (uiConfig: any) => any; savedObjects: { - getScopedSavedObjectsClient: ( - fakeRequest: { headers: object; getBasePath: () => string } - ) => SavedObjectClient; + getScopedSavedObjectsClient: (fakeRequest: { + headers: object; + getBasePath: () => string; + }) => SavedObjectClient; }; - uiSettingsServiceFactory: ( - { savedObjectsClient }: { savedObjectsClient: SavedObjectClient } - ) => UiSettings; + uiSettingsServiceFactory: ({ + savedObjectsClient, + }: { + savedObjectsClient: SavedObjectClient; + }) => UiSettings; } export interface ExportTypeDefinition { @@ -66,7 +69,7 @@ export interface ViewZoomWidthHeight { } export type EvalArgs = any[]; -export type EvalFn = ((...evalArgs: EvalArgs) => T); +export type EvalFn = (...evalArgs: EvalArgs) => T; export interface EvaluateOptions { fn: EvalFn; diff --git a/x-pack/legacy/plugins/siem/common/utility_types.ts b/x-pack/legacy/plugins/siem/common/utility_types.ts index 7aca1f79e17f..619ccc7e408f 100644 --- a/x-pack/legacy/plugins/siem/common/utility_types.ts +++ b/x-pack/legacy/plugins/siem/common/utility_types.ts @@ -7,7 +7,7 @@ import { ReactNode } from 'react'; export type Pick3 = { - [P1 in K1]: { [P2 in K2]: { [P3 in K3]: ((T[K1])[K2])[P3] } } + [P1 in K1]: { [P2 in K2]: { [P3 in K3]: ((T[K1])[K2])[P3] } }; }; export type Omit = Pick>; diff --git a/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx b/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx index b14456dd5e52..e0accfc96433 100644 --- a/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx +++ b/x-pack/legacy/plugins/siem/public/components/event_details/columns.tsx @@ -87,9 +87,7 @@ export const getColumns = ({ > theme.eui.euiColorLightShade}; border-radius: 6px 0 0 6px; box-shadow: ${({ theme }) => - `0 3px 3px -1px ${theme.eui.euiColorLightestShade}, 0 5px 7px -2px ${ - theme.eui.euiColorLightestShade - }`}; + `0 3px 3px -1px ${theme.eui.euiColorLightestShade}, 0 5px 7px -2px ${theme.eui.euiColorLightestShade}`}; background-color: inherit; cursor: pointer; `; diff --git a/x-pack/legacy/plugins/siem/public/components/flyout/header/index.tsx b/x-pack/legacy/plugins/siem/public/components/flyout/header/index.tsx index 8cd303efe0ad..289bedeb61ec 100644 --- a/x-pack/legacy/plugins/siem/public/components/flyout/header/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/flyout/header/index.tsx @@ -48,21 +48,19 @@ interface StateReduxProps { interface DispatchProps { associateNote: (noteId: string) => void; - applyDeltaToWidth?: ( - { - id, - delta, - bodyClientWidthPixels, - maxWidthPercent, - minWidthPixels, - }: { - id: string; - delta: number; - bodyClientWidthPixels: number; - maxWidthPercent: number; - minWidthPixels: number; - } - ) => void; + applyDeltaToWidth?: ({ + id, + delta, + bodyClientWidthPixels, + maxWidthPercent, + minWidthPixels, + }: { + id: string; + delta: number; + bodyClientWidthPixels: number; + maxWidthPercent: number; + minWidthPixels: number; + }) => void; createTimeline: ActionCreator<{ id: string; show?: boolean }>; toggleLock: ActionCreator<{ linkToId: InputsModelId }>; updateDescription: ActionCreator<{ id: string; description: string }>; diff --git a/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx b/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx index 90e675f06754..531894b5e487 100644 --- a/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/flyout/index.tsx @@ -47,21 +47,19 @@ interface OwnProps { interface DispatchProps { showTimeline?: ActionCreator<{ id: string; show: boolean }>; - applyDeltaToWidth?: ( - { - id, - delta, - bodyClientWidthPixels, - maxWidthPercent, - minWidthPixels, - }: { - id: string; - delta: number; - bodyClientWidthPixels: number; - maxWidthPercent: number; - minWidthPixels: number; - } - ) => void; + applyDeltaToWidth?: ({ + id, + delta, + bodyClientWidthPixels, + maxWidthPercent, + minWidthPixels, + }: { + id: string; + delta: number; + bodyClientWidthPixels: number; + maxWidthPercent: number; + minWidthPixels: number; + }) => void; } interface StateReduxProps { diff --git a/x-pack/legacy/plugins/siem/public/components/markdown/index.test.tsx b/x-pack/legacy/plugins/siem/public/components/markdown/index.test.tsx index 1bbb76001155..56c215218ad5 100644 --- a/x-pack/legacy/plugins/siem/public/components/markdown/index.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/markdown/index.test.tsx @@ -42,9 +42,7 @@ describe('Markdown', () => { describe('markdown tables', () => { const headerColumns = ['we', 'support', 'markdown', 'tables']; - const header = `| ${headerColumns[0]} | ${headerColumns[1]} | ${headerColumns[2]} | ${ - headerColumns[3] - } |`; + const header = `| ${headerColumns[0]} | ${headerColumns[1]} | ${headerColumns[2]} | ${headerColumns[3]} |`; const rawTable = `${header}\n|---------|---------|------------|--------|\n| because | tables | are | pretty |\n| useful | for | formatting | data |`; diff --git a/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts b/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts index 1eb815c9e171..41df4da3cb21 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts +++ b/x-pack/legacy/plugins/siem/public/components/ml/anomaly/use_anomalies_table_data.ts @@ -86,13 +86,10 @@ export const useAnomaliesTableData = ({ } }; - useEffect( - () => { - setLoading(true); - fetchFunc(influencers, startDate, endDate); - }, - [influencersToString(influencers), startDate, endDate, skip] - ); + useEffect(() => { + setLoading(true); + fetchFunc(influencers, startDate, endDate); + }, [influencersToString(influencers), startDate, endDate, skip]); return [loading, tableData]; }; diff --git a/x-pack/legacy/plugins/siem/public/components/ml/tables/create_compound_key.ts b/x-pack/legacy/plugins/siem/public/components/ml/tables/create_compound_key.ts index 48de86abad16..84ba4d5ff143 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml/tables/create_compound_key.ts +++ b/x-pack/legacy/plugins/siem/public/components/ml/tables/create_compound_key.ts @@ -7,13 +7,9 @@ import { AnomaliesByHost, AnomaliesByNetwork } from '../types'; export const createCompoundHostKey = (anomaliesByHost: AnomaliesByHost): string => { - return `${anomaliesByHost.hostName}-${anomaliesByHost.anomaly.entityName}-${ - anomaliesByHost.anomaly.entityValue - }-${anomaliesByHost.anomaly.severity}-${anomaliesByHost.anomaly.jobId}`; + return `${anomaliesByHost.hostName}-${anomaliesByHost.anomaly.entityName}-${anomaliesByHost.anomaly.entityValue}-${anomaliesByHost.anomaly.severity}-${anomaliesByHost.anomaly.jobId}`; }; export const createCompoundNetworkKey = (anomaliesByNetwork: AnomaliesByNetwork): string => { - return `${anomaliesByNetwork.ip}-${anomaliesByNetwork.anomaly.entityName}-${ - anomaliesByNetwork.anomaly.entityValue - }-${anomaliesByNetwork.anomaly.severity}-${anomaliesByNetwork.anomaly.jobId}`; + return `${anomaliesByNetwork.ip}-${anomaliesByNetwork.anomaly.entityName}-${anomaliesByNetwork.anomaly.entityValue}-${anomaliesByNetwork.anomaly.severity}-${anomaliesByNetwork.anomaly.jobId}`; }; diff --git a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_job_summary_data.tsx b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_job_summary_data.tsx index 35389c06e77e..e809e885b056 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_job_summary_data.tsx +++ b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_job_summary_data.tsx @@ -41,13 +41,10 @@ export const useJobSummaryData = (jobIds: string[], refetchSummaryData = false): setLoading(false); }; - useEffect( - () => { - setLoading(true); - fetchFunc(); - }, - [jobIds.join(','), refetchSummaryData] - ); + useEffect(() => { + setLoading(true); + fetchFunc(); + }, [jobIds.join(','), refetchSummaryData]); return [loading, jobSummaryData]; }; diff --git a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx index accf2e9ed800..802c68610da6 100644 --- a/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx +++ b/x-pack/legacy/plugins/siem/public/components/ml_popover/hooks/use_siem_jobs.tsx @@ -38,13 +38,10 @@ export const useSiemJobs = (refetchData: boolean): Return => { setLoading(false); }; - useEffect( - () => { - setLoading(true); - fetchFunc(); - }, - [refetchData] - ); + useEffect(() => { + setLoading(true); + fetchFunc(); + }, [refetchData]); return [loading, siemJobs]; }; diff --git a/x-pack/legacy/plugins/siem/public/components/open_timeline/types.ts b/x-pack/legacy/plugins/siem/public/components/open_timeline/types.ts index a1d701eb3867..2a73bbb3af60 100644 --- a/x-pack/legacy/plugins/siem/public/components/open_timeline/types.ts +++ b/x-pack/legacy/plugins/siem/public/components/open_timeline/types.ts @@ -61,9 +61,13 @@ export type OnDeleteSelected = () => void; export type OnDeleteOneTimeline = (timelineIds: string[]) => void; /** Invoked when the user clicks on the name of a timeline to open it */ -export type OnOpenTimeline = ( - { duplicate, timelineId }: { duplicate: boolean; timelineId: string } -) => void; +export type OnOpenTimeline = ({ + duplicate, + timelineId, +}: { + duplicate: boolean; + timelineId: string; +}) => void; /** Invoked when the user presses enters to submit the text in the search input */ export type OnQueryChange = (query: EuiSearchBarQuery) => void; diff --git a/x-pack/legacy/plugins/siem/public/components/page/manage_query.tsx b/x-pack/legacy/plugins/siem/public/components/page/manage_query.tsx index 3a5f99592164..5873f58a56b2 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/manage_query.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/manage_query.tsx @@ -13,14 +13,12 @@ interface OwnProps { id: string; loading: boolean; refetch: inputsModel.Refetch; - setQuery: ( - params: { - id: string; - inspect: inputsModel.InspectQuery | null; - loading: boolean; - refetch: inputsModel.Refetch; - } - ) => void; + setQuery: (params: { + id: string; + inspect: inputsModel.InspectQuery | null; + loading: boolean; + refetch: inputsModel.Refetch; + }) => void; inspect?: inputsModel.InspectQuery; } diff --git a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.tsx index a30e9d1c0942..b4ed59f71220 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_host/index.tsx @@ -21,19 +21,17 @@ import { OverviewHostStats } from '../overview_host_stats'; export interface OwnProps { startDate: number; endDate: number; - setQuery: ( - { - id, - inspect, - loading, - refetch, - }: { - id: string; - inspect: inputsModel.InspectQuery | null; - loading: boolean; - refetch: inputsModel.Refetch; - } - ) => void; + setQuery: ({ + id, + inspect, + loading, + refetch, + }: { + id: string; + inspect: inputsModel.InspectQuery | null; + loading: boolean; + refetch: inputsModel.Refetch; + }) => void; } const OverviewHostStatsManage = manageQuery(OverviewHostStats); diff --git a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx index 303c663dc250..fb197010709f 100644 --- a/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/page/overview/overview_network/index.tsx @@ -21,19 +21,17 @@ import { OverviewNetworkStats } from '../overview_network_stats'; export interface OwnProps { startDate: number; endDate: number; - setQuery: ( - { - id, - inspect, - loading, - refetch, - }: { - id: string; - inspect: inputsModel.InspectQuery | null; - loading: boolean; - refetch: inputsModel.Refetch; - } - ) => void; + setQuery: ({ + id, + inspect, + loading, + refetch, + }: { + id: string; + inspect: inputsModel.InspectQuery | null; + loading: boolean; + refetch: inputsModel.Refetch; + }) => void; } const OverviewNetworkStatsManage = manageQuery(OverviewNetworkStats); diff --git a/x-pack/legacy/plugins/siem/public/components/resize_handle/index.tsx b/x-pack/legacy/plugins/siem/public/components/resize_handle/index.tsx index 2fee2df40a19..f0a9e32d5b10 100644 --- a/x-pack/legacy/plugins/siem/public/components/resize_handle/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/resize_handle/index.tsx @@ -9,15 +9,7 @@ import { fromEvent, Observable, Subscription } from 'rxjs'; import { concatMap, takeUntil } from 'rxjs/operators'; import styled, { injectGlobal } from 'styled-components'; -export type OnResize = ( - { - delta, - id, - }: { - delta: number; - id: string; - } -) => void; +export type OnResize = ({ delta, id }: { delta: number; id: string }) => void; export const resizeCursorStyle = 'col-resize'; export const globalResizeCursorClassName = 'global-resize-cursor'; diff --git a/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx b/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx index d713f6277648..3caee78ce677 100644 --- a/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx +++ b/x-pack/legacy/plugins/siem/public/components/stat_items/index.tsx @@ -141,25 +141,22 @@ export const useKpiMatrixStatus = ( ): StatItemsProps[] => { const [statItemsProps, setStatItemsProps] = useState(mappings as StatItemsProps[]); - useEffect( - () => { - setStatItemsProps( - mappings.map(stat => { - return { - ...stat, - areaChart: stat.enableAreaChart ? addValueToAreaChart(stat.fields, data) : undefined, - barChart: stat.enableBarChart ? addValueToBarChart(stat.fields, data) : undefined, - fields: addValueToFields(stat.fields, data), - id, - key: `kpi-summary-${stat.key}`, - from, - to, - }; - }) - ); - }, - [data] - ); + useEffect(() => { + setStatItemsProps( + mappings.map(stat => { + return { + ...stat, + areaChart: stat.enableAreaChart ? addValueToAreaChart(stat.fields, data) : undefined, + barChart: stat.enableBarChart ? addValueToBarChart(stat.fields, data) : undefined, + fields: addValueToFields(stat.fields, data), + id, + key: `kpi-summary-${stat.key}`, + from, + to, + }; + }) + ); + }, [data]); return statItemsProps; }; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/column_renderer.ts b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/column_renderer.ts index fc814562abc3..62fd7f522930 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/column_renderer.ts +++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/column_renderer.ts @@ -9,19 +9,17 @@ import { ColumnHeader } from '../column_headers/column_header'; export interface ColumnRenderer { isInstance: (columnName: string, data: TimelineNonEcsData[]) => boolean; - renderColumn: ( - { - columnName, - eventId, - values, - field, - width, - }: { - columnName: string; - eventId: string; - values: string[] | null | undefined; - field: ColumnHeader; - width?: string; - } - ) => React.ReactNode; + renderColumn: ({ + columnName, + eventId, + values, + field, + width, + }: { + columnName: string; + eventId: string; + values: string[] | null | undefined; + field: ColumnHeader; + width?: string; + }) => React.ReactNode; } diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/plain_column_renderer.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/plain_column_renderer.tsx index c6f700ab1607..f7ad4c3164bb 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/plain_column_renderer.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/plain_column_renderer.tsx @@ -70,9 +70,7 @@ export const plainColumnRenderer: ColumnRenderer = { // since ip fields may contain multiple IP addresses, return a FormattedIp here to avoid a "draggable of draggables" return ( snapshot.isDragging ? ( diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/row_renderer.ts b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/row_renderer.ts index dd4f05d27ff5..f6929d461d55 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/row_renderer.ts +++ b/x-pack/legacy/plugins/siem/public/components/timeline/body/renderers/row_renderer.ts @@ -15,12 +15,15 @@ export const RowRendererContainer = styled.div<{ width: number }>` export interface RowRenderer { isInstance: (data: Ecs) => boolean; - renderRow: ( - { - browserFields, - data, - width, - children, - }: { browserFields: BrowserFields; data: Ecs; width: number; children: React.ReactNode } - ) => React.ReactNode; + renderRow: ({ + browserFields, + data, + width, + children, + }: { + browserFields: BrowserFields; + data: Ecs; + width: number; + children: React.ReactNode; + }) => React.ReactNode; } diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/events.ts b/x-pack/legacy/plugins/siem/public/components/timeline/events.ts index 303415977291..253be41a009c 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/events.ts +++ b/x-pack/legacy/plugins/siem/public/components/timeline/events.ts @@ -13,82 +13,53 @@ import { QueryOperator } from './data_providers/data_provider'; export type OnDataProviderRemoved = (providerId: string, andProviderId?: string) => void; /** Invoked when a user temporarily disables or re-enables a data provider */ -export type OnToggleDataProviderEnabled = ( - toggled: { - providerId: string; - enabled: boolean; - andProviderId?: string; - } -) => void; +export type OnToggleDataProviderEnabled = (toggled: { + providerId: string; + enabled: boolean; + andProviderId?: string; +}) => void; /** Invoked when a user toggles negation ("boolean NOT") of a data provider */ -export type OnToggleDataProviderExcluded = ( - excluded: { - providerId: string; - excluded: boolean; - andProviderId?: string; - } -) => void; +export type OnToggleDataProviderExcluded = (excluded: { + providerId: string; + excluded: boolean; + andProviderId?: string; +}) => void; /** Invoked when a user edits the properties of a data provider */ -export type OnDataProviderEdited = ( - { - andProviderId, - excluded, - field, - id, - operator, - providerId, - value, - }: { - andProviderId?: string; - excluded: boolean; - field: string; - id: string; - operator: QueryOperator; - providerId: string; - value: string | number; - } -) => void; +export type OnDataProviderEdited = ({ + andProviderId, + excluded, + field, + id, + operator, + providerId, + value, +}: { + andProviderId?: string; + excluded: boolean; + field: string; + id: string; + operator: QueryOperator; + providerId: string; + value: string | number; +}) => void; /** Invoked when a user change the kql query of our data provider */ -export type OnChangeDataProviderKqlQuery = ( - edit: { - providerId: string; - kqlQuery: string; - } -) => void; +export type OnChangeDataProviderKqlQuery = (edit: { providerId: string; kqlQuery: string }) => void; /** Invoked when a user selects a new minimap time range */ export type OnRangeSelected = (range: string) => void; /** Invoked when a user updates a column's filter */ -export type OnFilterChange = ( - filter: { - columnId: ColumnId; - filter: string; - } -) => void; +export type OnFilterChange = (filter: { columnId: ColumnId; filter: string }) => void; /** Invoked when a column is sorted */ -export type OnColumnSorted = ( - sorted: { - columnId: ColumnId; - sortDirection: SortDirection; - } -) => void; +export type OnColumnSorted = (sorted: { columnId: ColumnId; sortDirection: SortDirection }) => void; export type OnColumnRemoved = (columnId: ColumnId) => void; -export type OnColumnResized = ( - { - columnId, - delta, - }: { - columnId: ColumnId; - delta: number; - } -) => void; +export type OnColumnResized = ({ columnId, delta }: { columnId: ColumnId; delta: number }) => void; /** Invoked when a user clicks to change the number items to show per page */ export type OnChangeItemsPerPage = (itemsPerPage: number) => void; diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx index efa6c2df6800..72a3f8db1c96 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/helpers.tsx @@ -16,15 +16,13 @@ import { BrowserFields } from '../../containers/source'; const convertDateFieldToQuery = (field: string, value: string | number) => `${field}: ${isNumber(value) ? value : new Date(value).valueOf()}`; -const getBaseFields = memoizeOne( - (browserFields: BrowserFields): string[] => { - const baseFields = get('base', browserFields); - if (baseFields != null && baseFields.fields != null) { - return Object.keys(baseFields.fields); - } - return []; +const getBaseFields = memoizeOne((browserFields: BrowserFields): string[] => { + const baseFields = get('base', browserFields); + if (baseFields != null && baseFields.fields != null) { + return Object.keys(baseFields.fields); } -); + return []; +}); const getBrowserFieldPath = (field: string, browserFields: BrowserFields) => { const splitFields = field.split('.'); diff --git a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx index 1776c87f09a9..7b790266b572 100644 --- a/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx +++ b/x-pack/legacy/plugins/siem/public/components/timeline/search_or_filter/search_or_filter.tsx @@ -35,15 +35,7 @@ interface Props { isFilterQueryDraftValid: boolean; kqlMode: KqlMode; timelineId: string; - updateKqlMode: ( - { - id, - kqlMode, - }: { - id: string; - kqlMode: KqlMode; - } - ) => void; + updateKqlMode: ({ id, kqlMode }: { id: string; kqlMode: KqlMode }) => void; setKqlFilterQueryDraft: (expression: string) => void; } diff --git a/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx b/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx index 04d23835aeb9..5a1963f6d9e8 100644 --- a/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx +++ b/x-pack/legacy/plugins/siem/public/components/url_state/index_mocked.test.tsx @@ -162,9 +162,7 @@ describe('UrlStateContainer - lodash.throttle mocked to test update url', () => expect(mockHistory.replace.mock.calls[2][0]).toEqual({ hash: '', pathname: '/network', - search: `?_g=()&kqlQuery=(filterQuery:!n,queryLocation:${CONSTANTS.networkPage},type:${ - networkModel.NetworkType.page - })`, + search: `?_g=()&kqlQuery=(filterQuery:!n,queryLocation:${CONSTANTS.networkPage},type:${networkModel.NetworkType.page})`, state: '', }); // sets same timeline diff --git a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts index 2131a730f65d..f7489a44ff06 100644 --- a/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts +++ b/x-pack/legacy/plugins/siem/public/containers/events/last_event_time/index.ts @@ -68,17 +68,14 @@ export function useLastEventTimeQuery( ); } - useEffect( - () => { - try { - fetchLastEventTime(); - } catch (err) { - updateLastSeen(null); - updateErrorMessage(err.toString()); - } - }, - [indexKey, details.hostName, details.ip] - ); + useEffect(() => { + try { + fetchLastEventTime(); + } catch (err) { + updateLastSeen(null); + updateErrorMessage(err.toString()); + } + }, [indexKey, details.hostName, details.ip]); return { lastSeen, loading, errorMessage }; } diff --git a/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx b/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx index 85ddbfa151d8..28e1122abf23 100644 --- a/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx +++ b/x-pack/legacy/plugins/siem/public/containers/global_time/index.tsx @@ -15,19 +15,17 @@ import { InputsModelId } from '../../store/inputs/constants'; interface GlobalTimeArgs { from: number; to: number; - setQuery: ( - { - id, - inspect, - loading, - refetch, - }: { - id: string; - inspect: inputsModel.InspectQuery | null; - loading: boolean; - refetch: inputsModel.Refetch; - } - ) => void; + setQuery: ({ + id, + inspect, + loading, + refetch, + }: { + id: string; + inspect: inputsModel.InspectQuery | null; + loading: boolean; + refetch: inputsModel.Refetch; + }) => void; } interface OwnProps { diff --git a/x-pack/legacy/plugins/siem/public/lib/clipboard/clipboard.tsx b/x-pack/legacy/plugins/siem/public/lib/clipboard/clipboard.tsx index 44ee4ce69633..0038f6166ac1 100644 --- a/x-pack/legacy/plugins/siem/public/lib/clipboard/clipboard.tsx +++ b/x-pack/legacy/plugins/siem/public/lib/clipboard/clipboard.tsx @@ -11,9 +11,13 @@ import uuid from 'uuid'; import * as i18n from './translations'; -export type OnCopy = ( - { content, isSuccess }: { content: string | number; isSuccess: boolean } -) => void; +export type OnCopy = ({ + content, + isSuccess, +}: { + content: string | number; + isSuccess: boolean; +}) => void; interface GetSuccessToastParams { titleSummary?: string; diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/app.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/app.tsx index 4212c2613366..90e7dc3f5d32 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/app.tsx +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/app.tsx @@ -43,15 +43,12 @@ export const App: React.FunctionComponent = () => { const { hasPermission, missingClusterPrivileges } = permissionsData; // Update app state with permissions data - useEffect( - () => { - dispatch({ - type: 'updatePermissions', - permissions: permissionsData, - }); - }, - [permissionsData] - ); + useEffect(() => { + dispatch({ + type: 'updatePermissions', + permissions: permissionsData, + }); + }, [permissionsData]); if (loadingPermissions) { return ( diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/repository_list/repository_details/repository_details.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/repository_list/repository_details/repository_details.tsx index d450a6712716..136b59c00b9e 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/repository_list/repository_details/repository_details.tsx +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/repository_list/repository_details/repository_details.tsx @@ -72,13 +72,10 @@ export const RepositoryDetails: React.FunctionComponent = ({ // Reset verification state when repository name changes, either from adjust URL or clicking // into a different repository in table list. - useEffect( - () => { - setVerification(undefined); - setIsLoadingVerification(false); - }, - [repositoryName] - ); + useEffect(() => { + setVerification(undefined); + setIsLoadingVerification(false); + }, [repositoryName]); const renderBody = () => { if (repositoryDetails) { diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/restore_list/restore_table/restore_table.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/restore_list/restore_table/restore_table.tsx index 79460bab94ea..c958c50ef688 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/restore_list/restore_table/restore_table.tsx +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/restore_list/restore_table/restore_table.tsx @@ -111,26 +111,20 @@ export const RestoreTable: React.FunctionComponent = ({ restores }) => { }; // Update current restores to show if table changes - useEffect( - () => { - setCurrentRestores(getCurrentRestores()); - }, - [sorting, pagination] - ); + useEffect(() => { + setCurrentRestores(getCurrentRestores()); + }, [sorting, pagination]); // Update current restores to show if data changes // as well as any expanded index details - useEffect( - () => { - setPagination({ - ...pagination, - totalItemCount: restores.length, - }); - setCurrentRestores(getCurrentRestores()); - refreshIndexRestoreDetails(); - }, - [restores] - ); + useEffect(() => { + setPagination({ + ...pagination, + totalItemCount: restores.length, + }); + setCurrentRestores(getCurrentRestores()); + refreshIndexRestoreDetails(); + }, [restores]); const columns = [ { diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/snapshot_list/snapshot_details/snapshot_details.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/snapshot_list/snapshot_details/snapshot_details.tsx index a8721007101c..b9f193fb18e6 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/snapshot_list/snapshot_details/snapshot_details.tsx +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/home/snapshot_list/snapshot_details/snapshot_details.tsx @@ -66,12 +66,9 @@ export const SnapshotDetails: React.FunctionComponent = ({ const [activeTab, setActiveTab] = useState(TAB_SUMMARY); // Reset tab when we look at a different snapshot. - useEffect( - () => { - setActiveTab(TAB_SUMMARY); - }, - [repositoryName, snapshotId] - ); + useEffect(() => { + setActiveTab(TAB_SUMMARY); + }, [repositoryName, snapshotId]); let tabs; diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/repository_edit/repository_edit.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/repository_edit/repository_edit.tsx index dd60ad768ea3..f58fa40fe067 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/repository_edit/repository_edit.tsx +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/repository_edit/repository_edit.tsx @@ -51,14 +51,11 @@ export const RepositoryEdit: React.FunctionComponent { - if (repositoryData && repositoryData.repository) { - setRepository(repositoryData.repository); - } - }, - [repositoryData] - ); + useEffect(() => { + if (repositoryData && repositoryData.repository) { + setRepository(repositoryData.repository); + } + }, [repositoryData]); // Saving repository states const [isSaving, setIsSaving] = useState(false); diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/restore_snapshot/restore_snapshot.tsx b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/restore_snapshot/restore_snapshot.tsx index 74c2dfa52daa..8b3c74211e76 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/sections/restore_snapshot/restore_snapshot.tsx +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/sections/restore_snapshot/restore_snapshot.tsx @@ -45,14 +45,11 @@ export const RestoreSnapshot: React.FunctionComponent { - if (snapshotData) { - setSnapshotDetails(snapshotData); - } - }, - [snapshotData] - ); + useEffect(() => { + if (snapshotData) { + setSnapshotDetails(snapshotData); + } + }, [snapshotData]); // Saving repository states const [isSaving, setIsSaving] = useState(false); diff --git a/x-pack/legacy/plugins/snapshot_restore/public/app/services/http/use_request.ts b/x-pack/legacy/plugins/snapshot_restore/public/app/services/http/use_request.ts index 8d88d8e06eb8..edae4751b864 100644 --- a/x-pack/legacy/plugins/snapshot_restore/public/app/services/http/use_request.ts +++ b/x-pack/legacy/plugins/snapshot_restore/public/app/services/http/use_request.ts @@ -122,31 +122,28 @@ export const useRequest = ({ isOutdatedRequest = true; }; - useEffect( - () => { - // Perform request - request(); + useEffect(() => { + // Perform request + request(); - // Clear current interval + // Clear current interval + if (intervalRequest.current) { + clearInterval(intervalRequest.current); + } + + // Set new interval + if (currentInterval) { + intervalRequest.current = setInterval(request, currentInterval); + } + + // Cleanup intervals and inflight requests and corresponding state changes + return () => { + cancelOutdatedRequest(); if (intervalRequest.current) { clearInterval(intervalRequest.current); } - - // Set new interval - if (currentInterval) { - intervalRequest.current = setInterval(request, currentInterval); - } - - // Cleanup intervals and inflight requests and corresponding state changes - return () => { - cancelOutdatedRequest(); - if (intervalRequest.current) { - clearInterval(intervalRequest.current); - } - }; - }, - [path, currentInterval] - ); + }; + }, [path, currentInterval]); return { error, diff --git a/x-pack/legacy/plugins/spaces/public/components/space_avatar.tsx b/x-pack/legacy/plugins/spaces/public/components/space_avatar.tsx index 7e37f6a05110..29c63e7aaa72 100644 --- a/x-pack/legacy/plugins/spaces/public/components/space_avatar.tsx +++ b/x-pack/legacy/plugins/spaces/public/components/space_avatar.tsx @@ -28,11 +28,11 @@ export const SpaceAvatar: SFC = (props: Props) => { type="space" data-test-subj={`space-avatar-${space.id}`} name={spaceName} - {...!announceSpaceName && { + {...(!announceSpaceName && { // provide empty aria-label so EUI doesn't try to provide its own 'aria-label': '', 'aria-hidden': true, - }} + })} size={size || 'm'} initialsLength={MAX_SPACE_INITIALS} initials={getSpaceInitials(space)} diff --git a/x-pack/legacy/plugins/task_manager/task_store.ts b/x-pack/legacy/plugins/task_manager/task_store.ts index d650f3125dc1..80e8d6558e29 100644 --- a/x-pack/legacy/plugins/task_manager/task_store.ts +++ b/x-pack/legacy/plugins/task_manager/task_store.ts @@ -158,9 +158,7 @@ export class TaskStore { // Activate template creation / update if (existingVersion > 0) { this.logger.info( - `Upgrading ${ - this.index - } index template. Old version: ${existingVersion}, New version: ${TEMPLATE_VERSION}.` + `Upgrading ${this.index} index template. Old version: ${existingVersion}, New version: ${TEMPLATE_VERSION}.` ); } else { this.logger.info(`Installing ${this.index} index template version: ${TEMPLATE_VERSION}.`); @@ -207,9 +205,7 @@ export class TaskStore { this._isInitialized = true; this.logger.info( - `Installed ${ - this.index - } index template: version ${TEMPLATE_VERSION} (API version ${API_VERSION})` + `Installed ${this.index} index template: version ${TEMPLATE_VERSION} (API version ${API_VERSION})` ); return templateResult; diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_list/condensed_check_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_list/condensed_check_list.tsx index 498adc4df3de..7ac4b6e82602 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/monitor_list/condensed_check_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/monitor_list/condensed_check_list.tsx @@ -83,9 +83,9 @@ export const CondensedCheckList = ({ ) : null )} > - {`${ - childStatuses.length - } checks`} + {`${childStatuses.length} checks`} diff --git a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list.tsx b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list.tsx index b46cdb6342ee..f2bfb2c73c38 100644 --- a/x-pack/legacy/plugins/uptime/public/components/functional/ping_list.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/functional/ping_list.tsx @@ -163,12 +163,9 @@ export const PingListComponent = ({ ), }, ]; - useEffect( - () => { - onUpdateApp(); - }, - [selectedOption] - ); + useEffect(() => { + onUpdateApp(); + }, [selectedOption]); let pings: Ping[] = []; let total: number = 0; if (data && data.allPings && data.allPings.pings) { diff --git a/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx b/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx index a37e3a2e3f40..56a3fb645999 100644 --- a/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx +++ b/x-pack/legacy/plugins/uptime/public/components/higher_order/uptime_graphql_query.tsx @@ -55,25 +55,22 @@ export function withUptimeGraphQL(WrappedComponent: any, query: any) updateState(result.loading, result.data, result.errors); }); }; - useEffect( - () => { - fetch(); + useEffect(() => { + fetch(); - /** - * If the `then` handler in `fetch`'s promise is fired after - * this component has unmounted, it will try to set state on an - * unmounted component, which indicates a memory leak and will trigger - * React warnings. - * - * We counteract this side effect by providing a cleanup function that will - * reassign the update function to do nothing with the returned values. - */ - return () => { - updateState = () => {}; - }; - }, - [variables, lastRefresh] - ); + /** + * If the `then` handler in `fetch`'s promise is fired after + * this component has unmounted, it will try to set state on an + * unmounted component, which indicates a memory leak and will trigger + * React warnings. + * + * We counteract this side effect by providing a cleanup function that will + * reassign the update function to do nothing with the returned values. + */ + return () => { + updateState = () => {}; + }; + }, [variables, lastRefresh]); if (!implementsCustomErrorState && errors && errors.length > 0) { return {formatUptimeGraphQLErrorList(errors)}; } diff --git a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx index 5c6865116240..508ab51aa8e5 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/monitor.tsx @@ -50,30 +50,27 @@ export const MonitorPage = ({ const [params, updateUrlParams] = useUrlParams(history, location); const { dateRangeStart, dateRangeEnd, selectedPingStatus } = params; - useEffect( - () => { - query({ - query: gql` - query MonitorPageTitle($monitorId: String!) { - monitorPageTitle: getMonitorPageTitle(monitorId: $monitorId) { - id - url - name - } + useEffect(() => { + query({ + query: gql` + query MonitorPageTitle($monitorId: String!) { + monitorPageTitle: getMonitorPageTitle(monitorId: $monitorId) { + id + url + name } - `, - variables: { monitorId }, - }).then((result: any) => { - const { name, url, id } = result.data.monitorPageTitle; - const heading: string = name || url || id; - setBreadcrumbs(getMonitorPageBreadcrumb(heading, stringifyUrlParams(params))); - if (setHeadingText) { - setHeadingText(heading); } - }); - }, - [params] - ); + `, + variables: { monitorId }, + }).then((result: any) => { + const { name, url, id } = result.data.monitorPageTitle; + const heading: string = name || url || id; + setBreadcrumbs(getMonitorPageBreadcrumb(heading, stringifyUrlParams(params))); + if (setHeadingText) { + setHeadingText(heading); + } + }); + }, [params]); const [selectedLocation, setSelectedLocation] = useState( BaseLocationOptions diff --git a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx index b3d6f53036c9..a3b946b77065 100644 --- a/x-pack/legacy/plugins/uptime/public/pages/overview.tsx +++ b/x-pack/legacy/plugins/uptime/public/pages/overview.tsx @@ -34,9 +34,10 @@ interface OverviewPageProps { type Props = OverviewPageProps; -export type UptimeSearchBarQueryChangeHandler = ( - queryChangedEvent: { query?: { text: string }; queryText?: string } -) => void; +export type UptimeSearchBarQueryChangeHandler = (queryChangedEvent: { + query?: { text: string }; + queryText?: string; +}) => void; export const OverviewPage = ({ basePath, diff --git a/x-pack/legacy/plugins/watcher/public/lib/use_request.ts b/x-pack/legacy/plugins/watcher/public/lib/use_request.ts index d13990f7d5cc..4bc000043034 100644 --- a/x-pack/legacy/plugins/watcher/public/lib/use_request.ts +++ b/x-pack/legacy/plugins/watcher/public/lib/use_request.ts @@ -94,28 +94,25 @@ export const useRequest = ({ setIsLoading(false); }; - useEffect( - () => { - function cancelOutdatedRequest() { - isOutdatedRequest = true; - } + useEffect(() => { + function cancelOutdatedRequest() { + isOutdatedRequest = true; + } - createRequest(); + createRequest(); - if (interval) { - const intervalRequest = setInterval(createRequest.bind(null, false), interval); + if (interval) { + const intervalRequest = setInterval(createRequest.bind(null, false), interval); - return () => { - cancelOutdatedRequest(); - clearInterval(intervalRequest); - }; - } + return () => { + cancelOutdatedRequest(); + clearInterval(intervalRequest); + }; + } - // Called when a new render will trigger this effect. - return cancelOutdatedRequest; - }, - [path] - ); + // Called when a new render will trigger this effect. + return cancelOutdatedRequest; + }, [path]); return { error, diff --git a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/watch_visualization.tsx b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/watch_visualization.tsx index d9254c3692ee..e0a78aed7ac8 100644 --- a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/watch_visualization.tsx +++ b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/threshold_watch_edit/watch_visualization.tsx @@ -139,30 +139,27 @@ export const WatchVisualization = () => { createRequest: reload, } = getWatchVisualizationData(watchWithoutActions, visualizeOptions); - useEffect( - () => { - // Prevents refetch on initial render - if (isInitialRequest) { - return setIsInitialRequest(false); - } - reload(false); - }, - [ - index, - timeField, - triggerIntervalSize, - triggerIntervalUnit, - aggType, - aggField, - termSize, - termField, - thresholdComparator, - timeWindowSize, - timeWindowUnit, - groupBy, - threshold, - ] - ); + useEffect(() => { + // Prevents refetch on initial render + if (isInitialRequest) { + return setIsInitialRequest(false); + } + reload(false); + }, [ + index, + timeField, + triggerIntervalSize, + triggerIntervalUnit, + aggType, + aggField, + termSize, + termField, + thresholdComparator, + timeWindowSize, + timeWindowUnit, + groupBy, + threshold, + ]); if (isLoading) { return ( diff --git a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx index b6946c8cc54f..f3ebee479b66 100644 --- a/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx +++ b/x-pack/legacy/plugins/watcher/public/sections/watch_edit/components/watch_edit.tsx @@ -127,16 +127,13 @@ export const WatchEdit = ({ getWatch(); }, []); - useEffect( - () => { - chrome.breadcrumbs.set([ - MANAGEMENT_BREADCRUMB, - listBreadcrumb, - id ? editBreadcrumb : createBreadcrumb, - ]); - }, - [id] - ); + useEffect(() => { + chrome.breadcrumbs.set([ + MANAGEMENT_BREADCRUMB, + listBreadcrumb, + id ? editBreadcrumb : createBreadcrumb, + ]); + }, [id]); const errorCode = getPageErrorCode(loadError); if (errorCode) { diff --git a/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_detail.tsx b/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_detail.tsx index e871641fe0d5..aba4fd0c52a2 100644 --- a/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_detail.tsx +++ b/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_detail.tsx @@ -49,21 +49,18 @@ export const WatchDetail = () => { const hasActionErrors = actionErrors && Object.keys(actionErrors).length > 0; - useEffect( - () => { - const actionStatusesWithErrors = - currentActionStatuses && - currentActionStatuses.map((currentActionStatus: ActionStatus) => { - const errors = actionErrors && actionErrors[currentActionStatus.id]; - return { - ...currentActionStatus, - errors: errors || [], - }; - }); - setActionStatuses(actionStatusesWithErrors); - }, - [watchDetail] - ); + useEffect(() => { + const actionStatusesWithErrors = + currentActionStatuses && + currentActionStatuses.map((currentActionStatus: ActionStatus) => { + const errors = actionErrors && actionErrors[currentActionStatus.id]; + return { + ...currentActionStatus, + errors: errors || [], + }; + }); + setActionStatuses(actionStatusesWithErrors); + }, [watchDetail]); const baseColumns = [ { diff --git a/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_status.tsx b/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_status.tsx index 409cea68628f..413e8f638887 100644 --- a/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_status.tsx +++ b/x-pack/legacy/plugins/watcher/public/sections/watch_status/components/watch_status.tsx @@ -80,12 +80,9 @@ export const WatchStatus = ({ const [watchesToDelete, setWatchesToDelete] = useState([]); const [isTogglingActivation, setIsTogglingActivation] = useState(false); - useEffect( - () => { - chrome.breadcrumbs.set([MANAGEMENT_BREADCRUMB, listBreadcrumb, statusBreadcrumb]); - }, - [id] - ); + useEffect(() => { + chrome.breadcrumbs.set([MANAGEMENT_BREADCRUMB, listBreadcrumb, statusBreadcrumb]); + }, [id]); const errorCode = getPageErrorCode(watchDetailError); diff --git a/x-pack/legacy/plugins/xpack_main/server/lib/feature_registry/feature_registry.ts b/x-pack/legacy/plugins/xpack_main/server/lib/feature_registry/feature_registry.ts index 48397a87b8d2..d7d009ce97cb 100644 --- a/x-pack/legacy/plugins/xpack_main/server/lib/feature_registry/feature_registry.ts +++ b/x-pack/legacy/plugins/xpack_main/server/lib/feature_registry/feature_registry.ts @@ -335,9 +335,7 @@ function validateFeature(feature: FeatureWithAllOrReadPrivileges) { ([managementSectionId, managementEntry]) => { if (!management[managementSectionId]) { throw new Error( - `Feature privilege ${ - feature.id - }.${privilegeId} has unknown management section: ${managementSectionId}` + `Feature privilege ${feature.id}.${privilegeId} has unknown management section: ${managementSectionId}` ); } diff --git a/x-pack/test/functional/page_objects/uptime_page.ts b/x-pack/test/functional/page_objects/uptime_page.ts index ce8c60708985..42c4625e9867 100644 --- a/x-pack/test/functional/page_objects/uptime_page.ts +++ b/x-pack/test/functional/page_objects/uptime_page.ts @@ -13,7 +13,7 @@ export const UptimePageProvider = ({ const pageObjects = getPageObjects(['common', 'timePicker']); const uptimeService = getService('uptime'); - return new class UptimePage { + return new (class UptimePage { public async goToUptimeOverviewAndLoadData( datePickerStartValue: string, datePickerEndValue: string, @@ -48,5 +48,5 @@ export const UptimePageProvider = ({ await uptimeService.setFilterText(filterQuery); await uptimeService.monitorIdExists('monitor-page-link-auto-http-0X131221E73F825974'); } - }(); + })(); }; diff --git a/x-pack/test/saved_object_api_integration/common/suites/delete.ts b/x-pack/test/saved_object_api_integration/common/suites/delete.ts index d7729c91bc34..eac0a83b9347 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/delete.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/delete.ts @@ -90,9 +90,7 @@ export function deleteTestSuiteFactory(esArchiver: any, supertest: SuperTest + it(`should return ${tests.notSpaceAware.statusCode} when deleting a non-space-aware doc`, async () => await supertest .delete( `${getUrlPrefix( diff --git a/x-pack/test/saved_object_api_integration/common/suites/export.ts b/x-pack/test/saved_object_api_integration/common/suites/export.ts index 50b982bfaf71..1f40928789aa 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/export.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/export.ts @@ -86,9 +86,7 @@ export function exportTestSuiteFactory(esArchiver: any, supertest: SuperTest esArchiver.load('saved_objects/spaces')); after(() => esArchiver.unload('saved_objects/spaces')); - it(`space aware type should return ${tests.spaceAwareType.statusCode} with ${ - tests.spaceAwareType.description - } when querying by type`, async () => { + it(`space aware type should return ${tests.spaceAwareType.statusCode} with ${tests.spaceAwareType.description} when querying by type`, async () => { await supertest .post(`${getUrlPrefix(spaceId)}/api/saved_objects/_export`) .send({ @@ -99,9 +97,7 @@ export function exportTestSuiteFactory(esArchiver: any, supertest: SuperTest { + it(`space aware type should return ${tests.spaceAwareType.statusCode} with ${tests.spaceAwareType.description} when querying by objects`, async () => { await supertest .post(`${getUrlPrefix(spaceId)}/api/saved_objects/_export`) .send({ @@ -118,9 +114,7 @@ export function exportTestSuiteFactory(esArchiver: any, supertest: SuperTest { - it(`should return ${tests.noTypeOrObjects.statusCode} with ${ - tests.noTypeOrObjects.description - }`, async () => { + it(`should return ${tests.noTypeOrObjects.statusCode} with ${tests.noTypeOrObjects.description}`, async () => { await supertest .post(`${getUrlPrefix(spaceId)}/api/saved_objects/_export`) .auth(user.username, user.password) diff --git a/x-pack/test/saved_object_api_integration/common/suites/find.ts b/x-pack/test/saved_object_api_integration/common/suites/find.ts index 1454c5689b3c..e09ce59cfd6b 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/find.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/find.ts @@ -123,18 +123,14 @@ export function findTestSuiteFactory(esArchiver: any, supertest: SuperTest) before(() => esArchiver.load('saved_objects/spaces')); after(() => esArchiver.unload('saved_objects/spaces')); - it(`space aware type should return ${tests.spaceAwareType.statusCode} with ${ - tests.spaceAwareType.description - }`, async () => + it(`space aware type should return ${tests.spaceAwareType.statusCode} with ${tests.spaceAwareType.description}`, async () => await supertest .get(`${getUrlPrefix(spaceId)}/api/saved_objects/_find?type=visualization&fields=title`) .auth(user.username, user.password) .expect(tests.spaceAwareType.statusCode) .then(tests.spaceAwareType.response)); - it(`not space aware type should return ${tests.notSpaceAwareType.statusCode} with ${ - tests.notSpaceAwareType.description - }`, async () => + it(`not space aware type should return ${tests.notSpaceAwareType.statusCode} with ${tests.notSpaceAwareType.description}`, async () => await supertest .get(`${getUrlPrefix(spaceId)}/api/saved_objects/_find?type=globaltype&fields=name`) .auth(user.username, user.password) @@ -142,9 +138,7 @@ export function findTestSuiteFactory(esArchiver: any, supertest: SuperTest) .then(tests.notSpaceAwareType.response)); describe('unknown type', () => { - it(`should return ${tests.unknownType.statusCode} with ${ - tests.unknownType.description - }`, async () => + it(`should return ${tests.unknownType.statusCode} with ${tests.unknownType.description}`, async () => await supertest .get(`${getUrlPrefix(spaceId)}/api/saved_objects/_find?type=wigwags`) .auth(user.username, user.password) @@ -153,9 +147,7 @@ export function findTestSuiteFactory(esArchiver: any, supertest: SuperTest) }); describe('page beyond total', () => { - it(`should return ${tests.pageBeyondTotal.statusCode} with ${ - tests.pageBeyondTotal.description - }`, async () => + it(`should return ${tests.pageBeyondTotal.statusCode} with ${tests.pageBeyondTotal.description}`, async () => await supertest .get( `${getUrlPrefix( @@ -168,9 +160,7 @@ export function findTestSuiteFactory(esArchiver: any, supertest: SuperTest) }); describe('unknown search field', () => { - it(`should return ${tests.unknownSearchField.statusCode} with ${ - tests.unknownSearchField.description - }`, async () => + it(`should return ${tests.unknownSearchField.statusCode} with ${tests.unknownSearchField.description}`, async () => await supertest .get(`${getUrlPrefix(spaceId)}/api/saved_objects/_find?type=url&search_fields=a`) .auth(user.username, user.password) diff --git a/x-pack/test/saved_object_api_integration/common/suites/get.ts b/x-pack/test/saved_object_api_integration/common/suites/get.ts index 0db0b452e6b3..b60de1c07914 100644 --- a/x-pack/test/saved_object_api_integration/common/suites/get.ts +++ b/x-pack/test/saved_object_api_integration/common/suites/get.ts @@ -127,9 +127,7 @@ export function getTestSuiteFactory(esArchiver: any, supertest: SuperTest) before(() => esArchiver.load('saved_objects/spaces')); after(() => esArchiver.unload('saved_objects/spaces')); - it(`should return ${ - tests.spaceAware.statusCode - } when getting a space aware doc`, async () => { + it(`should return ${tests.spaceAware.statusCode} when getting a space aware doc`, async () => { await supertest .get( `${getUrlPrefix(spaceId)}/api/saved_objects/visualization/${getIdPrefix( @@ -141,9 +139,7 @@ export function getTestSuiteFactory(esArchiver: any, supertest: SuperTest) .then(tests.spaceAware.response); }); - it(`should return ${ - tests.notSpaceAware.statusCode - } when deleting a non-space-aware doc`, async () => { + it(`should return ${tests.notSpaceAware.statusCode} when deleting a non-space-aware doc`, async () => { await supertest .get(`${getUrlPrefix(spaceId)}/api/saved_objects/globaltype/${notSpaceAwareId}`) .auth(user.username, user.password) diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/get.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/get.ts index 9bb4450aef7a..90f27567436d 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/get.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/get.ts @@ -154,9 +154,7 @@ export default function getSpaceTestSuite({ getService }: TestInvoker) { }); getTest( - `rbac user with all at other space from the ${scenario.otherSpaceId} getting the ${ - scenario.spaceId - }`, + `rbac user with all at other space from the ${scenario.otherSpaceId} getting the ${scenario.spaceId}`, { currentSpaceId: scenario.otherSpaceId, spaceId: scenario.spaceId, diff --git a/x-pack/test/spaces_api_integration/security_and_spaces/apis/select.ts b/x-pack/test/spaces_api_integration/security_and_spaces/apis/select.ts index b11613819e47..a905fe623a7c 100644 --- a/x-pack/test/spaces_api_integration/security_and_spaces/apis/select.ts +++ b/x-pack/test/spaces_api_integration/security_and_spaces/apis/select.ts @@ -53,9 +53,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { }, ].forEach(scenario => { selectTest( - `user with no access selects ${scenario.selectSpaceId} space from the ${ - scenario.currentSpaceId - } space`, + `user with no access selects ${scenario.selectSpaceId} space from the ${scenario.currentSpaceId} space`, { currentSpaceId: scenario.currentSpaceId, selectSpaceId: scenario.selectSpaceId, @@ -70,9 +68,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `superuser selects ${scenario.selectSpaceId} space from the ${ - scenario.currentSpaceId - } space`, + `superuser selects ${scenario.selectSpaceId} space from the ${scenario.currentSpaceId} space`, { currentSpaceId: scenario.currentSpaceId, selectSpaceId: scenario.selectSpaceId, @@ -87,9 +83,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `rbac user with all globally selects ${scenario.selectSpaceId} space from the ${ - scenario.currentSpaceId - } space`, + `rbac user with all globally selects ${scenario.selectSpaceId} space from the ${scenario.currentSpaceId} space`, { currentSpaceId: scenario.currentSpaceId, selectSpaceId: scenario.selectSpaceId, @@ -104,9 +98,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `dual-privileges user selects ${scenario.selectSpaceId} space from the ${ - scenario.currentSpaceId - }`, + `dual-privileges user selects ${scenario.selectSpaceId} space from the ${scenario.currentSpaceId}`, { currentSpaceId: scenario.currentSpaceId, selectSpaceId: scenario.selectSpaceId, @@ -284,9 +276,7 @@ export default function selectSpaceTestSuite({ getService }: TestInvoker) { ); selectTest( - `rbac user with all at ${scenario.currentSpaceId} space cannot select ${ - scenario.selectSpaceId - } + `rbac user with all at ${scenario.currentSpaceId} space cannot select ${scenario.selectSpaceId} from ${scenario.currentSpaceId}`, { currentSpaceId: scenario.currentSpaceId, diff --git a/x-pack/test/typings/index.d.ts b/x-pack/test/typings/index.d.ts index c6a46632139e..db6b2d38b2c2 100644 --- a/x-pack/test/typings/index.d.ts +++ b/x-pack/test/typings/index.d.ts @@ -22,7 +22,7 @@ declare module '*.json' { } type MethodKeysOf = { - [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never + [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never; }[keyof T]; type PublicMethodsOf = Pick>; diff --git a/x-pack/typings/index.d.ts b/x-pack/typings/index.d.ts index 66006f66ccab..c40ff7f86fe4 100644 --- a/x-pack/typings/index.d.ts +++ b/x-pack/typings/index.d.ts @@ -16,7 +16,7 @@ declare module 'lodash/internal/toPath' { } type MethodKeysOf = { - [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never + [K in keyof T]: T[K] extends (...args: any[]) => any ? K : never; }[keyof T]; type PublicMethodsOf = Pick>; diff --git a/yarn.lock b/yarn.lock index 61dcfb531faf..ab285fd5a13a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11159,10 +11159,10 @@ escope@^3.6.0: esrecurse "^4.1.0" estraverse "^4.1.1" -eslint-config-prettier@4.3.0: - version "4.3.0" - resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-4.3.0.tgz#c55c1fcac8ce4518aeb77906984e134d9eb5a4f0" - integrity sha512-sZwhSTHVVz78+kYD3t5pCWSYEdVSBR0PXnwjDRsUs8ytIrK8PLXw+6FKp8r3Z7rx4ZszdetWlXYKOHoUrrwPlA== +eslint-config-prettier@6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz#f429a53bde9fc7660e6353910fd996d6284d3c25" + integrity sha512-vDrcCFE3+2ixNT5H83g28bO/uYAwibJxerXPj+E7op4qzBCsAV36QfvdAyVOoNxKAH2Os/e01T/2x++V0LPukA== dependencies: get-stdin "^6.0.0" @@ -21614,12 +21614,7 @@ prettier@1.14.3: resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" integrity sha512-qZDVnCrnpsRJJq5nSsiHCE3BYMED2OtsI+cmzIzF1QIfqm5ALf8tEJcO27zV1gKNKRPdhjO0dNWnrzssDQ1tFg== -prettier@^1.13.7, prettier@^1.14.3: - version "1.15.2" - resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.2.tgz#d31abe22afa4351efa14c7f8b94b58bb7452205e" - integrity sha512-YgPLFFA0CdKL4Eg2IHtUSjzj/BWgszDHiNQAe0VAIBse34148whfdzLagRL+QiKS+YfK5ftB6X4v/MBw8yCoug== - -prettier@^1.17.0: +prettier@1.18.2, prettier@^1.13.7, prettier@^1.14.3, prettier@^1.17.0: version "1.18.2" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw==