From 80efa799458768a661ceba308d53bd30c5a46c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20St=C3=BCrmer?= Date: Tue, 9 Jun 2020 20:30:19 +0200 Subject: [PATCH] Colocate default exports with definition --- .../metric_threshold/components/expression.tsx | 4 ++++ .../metric_threshold/components/expression_lazy.ts | 10 ---------- .../infra/public/alerting/metric_threshold/index.ts | 2 +- .../components/alerting/inventory/expression.tsx | 4 ++++ .../components/alerting/inventory/expression_lazy.ts | 10 ---------- .../inventory/metric_inventory_threshold_alert_type.ts | 2 +- .../alerting/logs/expression_editor/editor.tsx | 4 ++++ .../alerting/logs/expression_editor/editor_lazy.ts | 10 ---------- .../alerting/logs/log_threshold_alert_type.ts | 2 +- 9 files changed, 15 insertions(+), 33 deletions(-) delete mode 100644 x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_lazy.ts delete mode 100644 x-pack/plugins/infra/public/components/alerting/inventory/expression_lazy.ts delete mode 100644 x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor_lazy.ts diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx index 7a71bb68bc54f..d5d61733e8717 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression.tsx @@ -384,3 +384,7 @@ export const Expressions: React.FC = (props) => { ); }; + +// required for dynamic import +// eslint-disable-next-line import/no-default-export +export default Expressions; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_lazy.ts b/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_lazy.ts deleted file mode 100644 index 30641eb0dbed9..0000000000000 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/components/expression_lazy.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { Expressions } from './expression'; - -// eslint-disable-next-line import/no-default-export -export default Expressions; diff --git a/x-pack/plugins/infra/public/alerting/metric_threshold/index.ts b/x-pack/plugins/infra/public/alerting/metric_threshold/index.ts index 732adfee76aba..6a999a86c99d1 100644 --- a/x-pack/plugins/infra/public/alerting/metric_threshold/index.ts +++ b/x-pack/plugins/infra/public/alerting/metric_threshold/index.ts @@ -18,7 +18,7 @@ export function createMetricThresholdAlertType(): AlertTypeModel { defaultMessage: 'Metric threshold', }), iconClass: 'bell', - alertParamsExpression: React.lazy(() => import('./components/expression_lazy')), + alertParamsExpression: React.lazy(() => import('./components/expression')), validate: validateMetricThreshold, defaultActionMessage: i18n.translate( 'xpack.infra.metrics.alerting.threshold.defaultActionMessage', diff --git a/x-pack/plugins/infra/public/components/alerting/inventory/expression.tsx b/x-pack/plugins/infra/public/components/alerting/inventory/expression.tsx index 074464fb55414..ce14897991e60 100644 --- a/x-pack/plugins/infra/public/components/alerting/inventory/expression.tsx +++ b/x-pack/plugins/infra/public/components/alerting/inventory/expression.tsx @@ -336,6 +336,10 @@ export const Expressions: React.FC = (props) => { ); }; +// required for dynamic import +// eslint-disable-next-line import/no-default-export +export default Expressions; + interface ExpressionRowProps { nodeType: InventoryItemType; expressionId: number; diff --git a/x-pack/plugins/infra/public/components/alerting/inventory/expression_lazy.ts b/x-pack/plugins/infra/public/components/alerting/inventory/expression_lazy.ts deleted file mode 100644 index 30641eb0dbed9..0000000000000 --- a/x-pack/plugins/infra/public/components/alerting/inventory/expression_lazy.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { Expressions } from './expression'; - -// eslint-disable-next-line import/no-default-export -export default Expressions; diff --git a/x-pack/plugins/infra/public/components/alerting/inventory/metric_inventory_threshold_alert_type.ts b/x-pack/plugins/infra/public/components/alerting/inventory/metric_inventory_threshold_alert_type.ts index 8d1cb13dfd10e..0cb564ec2194e 100644 --- a/x-pack/plugins/infra/public/components/alerting/inventory/metric_inventory_threshold_alert_type.ts +++ b/x-pack/plugins/infra/public/components/alerting/inventory/metric_inventory_threshold_alert_type.ts @@ -18,7 +18,7 @@ export function getInventoryMetricAlertType(): AlertTypeModel { defaultMessage: 'Inventory', }), iconClass: 'bell', - alertParamsExpression: React.lazy(() => import('./expression_lazy')), + alertParamsExpression: React.lazy(() => import('./expression')), validate: validateMetricThreshold, defaultActionMessage: i18n.translate( 'xpack.infra.metrics.alerting.inventory.threshold.defaultActionMessage', diff --git a/x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor.tsx b/x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor.tsx index 609f99805fe9c..a3a48d477425b 100644 --- a/x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor.tsx +++ b/x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor.tsx @@ -236,3 +236,7 @@ export const Editor: React.FC = (props) => { ); }; + +// required for dynamic import +// eslint-disable-next-line import/no-default-export +export default Editor; diff --git a/x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor_lazy.ts b/x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor_lazy.ts deleted file mode 100644 index b404a21d70392..0000000000000 --- a/x-pack/plugins/infra/public/components/alerting/logs/expression_editor/editor_lazy.ts +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License; - * you may not use this file except in compliance with the Elastic License. - */ - -import { Editor } from './editor'; - -// eslint-disable-next-line import/no-default-export -export default Editor; diff --git a/x-pack/plugins/infra/public/components/alerting/logs/log_threshold_alert_type.ts b/x-pack/plugins/infra/public/components/alerting/logs/log_threshold_alert_type.ts index adac91f0f34d0..4c7811f0d9666 100644 --- a/x-pack/plugins/infra/public/components/alerting/logs/log_threshold_alert_type.ts +++ b/x-pack/plugins/infra/public/components/alerting/logs/log_threshold_alert_type.ts @@ -17,7 +17,7 @@ export function getAlertType(): AlertTypeModel { defaultMessage: 'Log threshold', }), iconClass: 'bell', - alertParamsExpression: React.lazy(() => import('./expression_editor/editor_lazy')), + alertParamsExpression: React.lazy(() => import('./expression_editor/editor')), validate: validateExpression, defaultActionMessage: i18n.translate( 'xpack.infra.logs.alerting.threshold.defaultActionMessage',