Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spacetime] Enforce consistent type import rule in team's owned plugins #204412

Closed
miloszmarcinkowski opened this issue Dec 16, 2024 · 2 comments · Fixed by #204549
Closed

[Spacetime] Enforce consistent type import rule in team's owned plugins #204412

miloszmarcinkowski opened this issue Dec 16, 2024 · 2 comments · Fixed by #204549
Assignees
Labels
Spacetime Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team

Comments

@miloszmarcinkowski
Copy link
Contributor

We recognize inconsistency in using Type-Only Imports across team's owned plugins. To enforce the same code standards, add consistent-type-imports eslint rule and apply to exisisting imports.

@botelastic botelastic bot added the needs-team Issues missing a team label label Dec 16, 2024
@miloszmarcinkowski miloszmarcinkowski self-assigned this Dec 16, 2024
@miloszmarcinkowski miloszmarcinkowski added the Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team label Dec 16, 2024
@elasticmachine
Copy link
Contributor

Pinging @elastic/obs-ux-infra_services-team (Team:obs-ux-infra_services)

@miloszmarcinkowski
Copy link
Contributor Author

See results in PR #204549

viduni94 pushed a commit to viduni94/kibana that referenced this issue Jan 2, 2025
…eam` owned plugins (elastic#204549)

Closes elastic#204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.
cqliu1 pushed a commit to cqliu1/kibana that referenced this issue Jan 2, 2025
…eam` owned plugins (elastic#204549)

Closes elastic#204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.
miloszmarcinkowski added a commit to miloszmarcinkowski/kibana that referenced this issue Jan 9, 2025
…eam` owned plugins (elastic#204549)

Closes elastic#204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.

(cherry picked from commit 6461b7e)

# Conflicts:
#	x-pack/solutions/observability/plugins/apm/public/assistant_functions/get_apm_timeseries.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/alerting/rule_types/transaction_duration_rule_type/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/alerting/rule_types/transaction_error_rate_rule_type/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/alerting/ui_components/alert_details_app_section/failed_transaction_chart.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/alerting/ui_components/chart_preview/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/correlations/correlations_table.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/entities/entity_link/entity_link.test.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/entities/entity_link/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/error_group_details/distribution/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/error_group_details/error_sampler/sample_summary.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/help_popover/help_popover.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/mobile/service_overview/geo_map/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_http_requests_map_layer_list.ts
#	x-pack/solutions/observability/plugins/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_layer_list.ts
#	x-pack/solutions/observability/plugins/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_map_layer_style.ts
#	x-pack/solutions/observability/plugins/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_session_map_layer_list.ts
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_groups/service_groups_list/service_group_card.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_inventory/service_list/health_badge.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_map/cytoscape.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_map/cytoscape_options.ts
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_map/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_map/popover/anomaly_detection.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_map/popover/externals_list_contents.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_map/popover/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_map/popover/resource_contents.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/service_overview/service_overview_instances_table/intance_details.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/top_traces_overview/trace_list.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/accordion_waterfall.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/failure_badge.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/responsive_flyout.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/truncate_height_section.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_item.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/fleet_integration/apm_agents/agent_instructions_accordion.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/routing/app_root/apm_header_action_menu/anomaly_detection_setup_link.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/breakdown_chart/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/duration_distribution_chart/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/spark_plot/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/timeline/marker/agent_marker.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/timeline/marker/error_marker.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/timeline/marker/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/timeline/timeline_axis.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/charts/timeline/vertical_lines.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/links/apm/service_link/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/overview_table_container/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/service_icons/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/stacktrace/context.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/stacktrace/frame_heading.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/stacktrace/library_stacktrace.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/stacktrace/stackframe.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/stacktrace/variables.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/shared/summary/user_agent_summary_item.tsx
#	x-pack/solutions/observability/plugins/apm/public/tutorial/config_agent/index.tsx
#	x-pack/solutions/observability/plugins/apm/public/tutorial/tutorial_fleet_instructions/index.tsx
#	x-pack/solutions/observability/plugins/apm/server/deprecations/apm_user_role.test.ts
#	x-pack/solutions/observability/plugins/apm/server/deprecations/apm_user_role.ts
#	x-pack/solutions/observability/plugins/apm/server/deprecations/index.ts
#	x-pack/solutions/observability/plugins/apm/server/lib/deprecations/index.ts
#	x-pack/solutions/observability/plugins/apm/server/plugin.ts
#	x-pack/solutions/observability/plugins/apm/server/routes/alerts/rule_types/anomaly/register_anomaly_rule_type.ts
#	x-pack/solutions/observability/plugins/apm/server/routes/alerts/rule_types/error_count/register_error_count_rule_type.ts
#	x-pack/solutions/observability/plugins/apm/server/routes/alerts/rule_types/transaction_duration/register_transaction_duration_rule_type.ts
#	x-pack/solutions/observability/plugins/apm/server/routes/alerts/rule_types/transaction_error_rate/register_transaction_error_rate_rule_type.ts
#	x-pack/solutions/observability/plugins/infra/public/alerting/metric_threshold/components/expression_row.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/autocomplete_field/autocomplete_field.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/autocomplete_field/suggestion_item.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/fixed_datepicker.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/loading_overlay_wrapper.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/log_stream/log_stream_react_embeddable.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/logging/log_analysis_job_status/quality_warning_notices.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/logging/log_entry_examples/log_entry_examples.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/logging/log_minimap/density_chart.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/logging/log_minimap/log_minimap.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/logging/log_minimap/search_marker.tsx
#	x-pack/solutions/observability/plugins/infra/public/components/logs_deprecation_callout.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_list.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/logs/settings/add_log_column_popover.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/logs/stream/page_logs_content.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/logs/stream/page_view_log_in_context.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/index.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/layout.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/nodes_overview.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/timeline/timeline.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/gradient_legend.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/group_name.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/group_of_groups.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/group_of_nodes.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/legend.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/legend_controls.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/map.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node_context_menu.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/node_square.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/stepped_gradient_legend.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/steps_legend.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/metric_detail/components/gauges_section_vis.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/metric_detail/components/metadata_details.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/metric_detail/components/time_controls.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/metric_detail/types.ts
#	x-pack/solutions/observability/plugins/infra/public/plugin.ts
#	x-pack/solutions/observability/plugins/infra/public/test_utils/entries.ts
#	x-pack/solutions/observability/plugins/infra/public/utils/theme_utils/with_attrs.tsx
#	x-pack/solutions/observability/plugins/infra/server/lib/alerting/common/utils.ts
#	x-pack/solutions/observability/plugins/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_rule_type.ts
#	x-pack/solutions/observability/plugins/infra/server/lib/alerting/metric_threshold/register_metric_threshold_rule_type.ts
#	x-pack/solutions/observability/plugins/metrics_data_access/common/inventory_models/host/metrics/index.ts
#	x-pack/solutions/observability/plugins/profiling/public/components/topn_functions/function_row.tsx
miloszmarcinkowski added a commit to miloszmarcinkowski/kibana that referenced this issue Jan 9, 2025
…eam` owned plugins (elastic#204549)

Closes elastic#204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.

(cherry picked from commit 6461b7e)

# Conflicts:
#	x-pack/plugins/observability_solution/apm/public/components/alerting/ui_components/alert_details_app_section/failed_transaction_chart.tsx
#	x-pack/plugins/observability_solution/apm/public/components/alerting/ui_components/chart_preview/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/alerts_overview/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/correlations/correlations_table.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_failed_transactions_correlations.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_latency_correlations.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/entities/entity_link/entity_link.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/entities/entity_link/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/error_group_details/distribution/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/error_group_details/error_sampler/sample_summary.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/help_popover/help_popover.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/infra_overview/infra_tabs/use_tabs.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_http_requests_map_layer_list.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_layer_list.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_map_layer_style.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_session_map_layer_list.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/service_groups/service_groups_list/service_group_card.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/service_list/health_badge.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_logs/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/cytoscape.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/cytoscape_options.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/anomaly_detection.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/externals_list_contents.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/resource_contents.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_overview/service_overview_instances_table/intance_details.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/top_traces_overview/trace_list.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/accordion_waterfall.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/failure_badge.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/truncate_height_section.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_item.tsx
#	x-pack/plugins/observability_solution/apm/public/components/fleet_integration/apm_agents/agent_instructions_accordion.tsx
#	x-pack/plugins/observability_solution/apm/public/components/routing/app_root/apm_header_action_menu/anomaly_detection_setup_link.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/breakdown_chart/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/duration_distribution_chart/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/log_rates/log_error_rate_chart.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/log_rates/log_rate_chart.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/spark_plot/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/agent_marker.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/timeline_axis.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/vertical_lines.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/service_link/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/overview_table_container/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/service_icons/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/context.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/frame_heading.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/library_stacktrace.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/stackframe.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/variables.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/summary/user_agent_summary_item.tsx
#	x-pack/plugins/observability_solution/apm/public/context/apm_plugin/apm_plugin_context.tsx
#	x-pack/plugins/observability_solution/apm/public/hooks/use_breakpoints.test.tsx
#	x-pack/plugins/observability_solution/apm/public/hooks/use_fetcher.test.tsx
#	x-pack/plugins/observability_solution/apm/public/hooks/use_time_range.test.ts
#	x-pack/plugins/observability_solution/apm/public/plugin.ts
#	x-pack/plugins/observability_solution/apm/public/tutorial/config_agent/index.tsx
#	x-pack/plugins/observability_solution/apm/public/tutorial/tutorial_fleet_instructions/index.tsx
#	x-pack/plugins/observability_solution/apm/server/feature.ts
#	x-pack/plugins/observability_solution/apm/server/lib/helpers/get_random_sampler/index.ts
#	x-pack/plugins/observability_solution/apm/server/plugin.ts
#	x-pack/plugins/observability_solution/apm/server/routes/agent_keys/get_agent_keys_privileges.ts
#	x-pack/plugins/observability_solution/apm/server/routes/alerts/register_apm_rule_types.ts
#	x-pack/plugins/observability_solution/apm/server/routes/alerts/test_utils/index.ts
#	x-pack/plugins/observability_solution/apm/server/routes/apm_routes/register_apm_server_routes.ts
#	x-pack/plugins/observability_solution/apm/server/routes/assistant_functions/get_apm_service_summary/index.ts
#	x-pack/plugins/observability_solution/apm/server/routes/assistant_functions/get_observability_alert_details_context/index.ts
#	x-pack/plugins/observability_solution/apm/server/routes/fleet/is_superuser.ts
#	x-pack/plugins/observability_solution/apm/server/routes/service_groups/get_service_group_alerts.ts
#	x-pack/plugins/observability_solution/apm/server/routes/services/get_service_metadata_details.ts
#	x-pack/plugins/observability_solution/apm/server/routes/services/get_services/get_service_transaction_stats.ts
#	x-pack/plugins/observability_solution/apm/server/routes/services/get_services/get_services_without_transactions.ts
#	x-pack/plugins/observability_solution/apm/server/types.ts
#	x-pack/plugins/observability_solution/infra/common/alerting/metrics/types.ts
#	x-pack/plugins/observability_solution/infra/common/constants.ts
#	x-pack/plugins/observability_solution/infra/public/alerting/metric_threshold/components/expression_row.tsx
#	x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_container_metrics_charts.test.ts
#	x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_container_metrics_charts.ts
#	x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_host_metrics_charts.test.ts
#	x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_host_metrics_charts.ts
#	x-pack/plugins/observability_solution/infra/public/components/autocomplete_field/autocomplete_field.tsx
#	x-pack/plugins/observability_solution/infra/public/components/autocomplete_field/suggestion_item.tsx
#	x-pack/plugins/observability_solution/infra/public/components/fixed_datepicker.tsx
#	x-pack/plugins/observability_solution/infra/public/components/loading_overlay_wrapper.tsx
#	x-pack/plugins/observability_solution/infra/public/components/log_stream/log_stream_react_embeddable.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_analysis_job_status/quality_warning_notices.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_entry_examples/log_entry_examples.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_minimap/density_chart.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_minimap/log_minimap.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_minimap/search_marker.tsx
#	x-pack/plugins/observability_solution/infra/public/components/shared/alerts/alerts_overview.tsx
#	x-pack/plugins/observability_solution/infra/public/hooks/use_inventory_views.ts
#	x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.ts
#	x-pack/plugins/observability_solution/infra/public/hooks/use_metrics_explorer_views.ts
#	x-pack/plugins/observability_solution/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_list.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/log_entry_rate/use_log_entry_rate_results_url_state.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/settings/add_log_column_popover.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/stream/page_logs_content.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/stream/page_view_log_in_context.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/components/search_bar/controls_content.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/components/tabs/alerts/alerts_tab_content.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_hosts_table.test.ts
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/index.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/layout.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/nodes_overview.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/table_view.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/timeline/timeline.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/gradient_legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/group_name.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/group_of_groups.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/group_of_nodes.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/legend_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/map.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/node_context_menu.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/node_square.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/stepped_gradient_legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/steps_legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_filters.test.ts
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_options.ts
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/components/gauges_section_vis.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/components/metadata_details.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/components/time_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/types.ts
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_data.test.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_options.test.tsx
#	x-pack/plugins/observability_solution/infra/public/plugin.ts
#	x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts
#	x-pack/plugins/observability_solution/infra/server/index.ts
#	x-pack/plugins/observability_solution/infra/server/lib/adapters/framework/adapter_types.ts
#	x-pack/plugins/observability_solution/infra/server/lib/adapters/framework/kibana_framework_adapter.ts
#	x-pack/plugins/observability_solution/infra/server/lib/alerting/inventory_metric_threshold/inventory_metric_threshold_executor.test.ts
#	x-pack/plugins/observability_solution/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_rule_type.ts
#	x-pack/plugins/observability_solution/infra/server/lib/alerting/register_rule_types.ts
#	x-pack/plugins/observability_solution/infra/server/plugin.ts
#	x-pack/plugins/observability_solution/infra/server/routes/entities/get_data_stream_types.ts
#	x-pack/plugins/observability_solution/infra/server/routes/infra/lib/host/get_hosts_alerts_count.ts
#	x-pack/plugins/observability_solution/infra/server/services/rules/rules_service.ts
#	x-pack/plugins/observability_solution/infra/server/services/rules/types.ts
#	x-pack/plugins/observability_solution/inventory/.storybook/storybook_decorator.tsx
#	x-pack/plugins/observability_solution/inventory/public/components/app_root/index.tsx
#	x-pack/plugins/observability_solution/inventory/public/components/entities_grid/entities_grid.stories.tsx
#	x-pack/plugins/observability_solution/inventory/public/components/entities_grid/index.tsx
#	x-pack/plugins/observability_solution/inventory/public/context/inventory_search_bar_context_provider/index.tsx
#	x-pack/plugins/observability_solution/inventory/public/services/telemetry/telemetry_service.test.ts
#	x-pack/plugins/observability_solution/inventory/server/lib/create_alerts_client.ts/create_alerts_client.ts
#	x-pack/plugins/observability_solution/inventory/server/routes/entities/get_latest_entities_alerts.ts
#	x-pack/plugins/observability_solution/inventory/server/routes/entities/route.ts
#	x-pack/plugins/observability_solution/metrics_data_access/common/inventory_models/host/metrics/index.ts
#	x-pack/plugins/observability_solution/metrics_data_access/server/lib/adapters/framework/adapter_types.ts
#	x-pack/plugins/observability_solution/profiling/public/components/topn_functions/function_row.tsx
#	x-pack/plugins/observability_solution/profiling/public/types.ts
#	x-pack/plugins/observability_solution/profiling/server/lib/setup/get_has_setup_privileges.ts
#	x-pack/plugins/observability_solution/uptime/e2e/config.ts
#	x-pack/solutions/observability/plugins/apm/public/assistant_functions/get_apm_timeseries.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/responsive_flyout.tsx
#	x-pack/solutions/observability/plugins/apm/server/deprecations/apm_user_role.test.ts
#	x-pack/solutions/observability/plugins/apm/server/deprecations/apm_user_role.ts
#	x-pack/solutions/observability/plugins/apm/server/deprecations/index.ts
#	x-pack/solutions/observability/plugins/apm/server/lib/deprecations/index.ts
#	x-pack/solutions/observability/plugins/apm/server/routes/entities/utils/merge_entities.test.ts
#	x-pack/solutions/observability/plugins/infra/public/components/asset_details/hooks/use_log_charts.ts
#	x-pack/solutions/observability/plugins/infra/public/components/logs_deprecation_callout.tsx
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/components/search_bar/control_panels_config.ts
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/hooks/use_host_count.test.ts
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx
#	x-pack/solutions/observability/plugins/infra/public/utils/theme_utils/with_attrs.tsx
#	x-pack/solutions/observability/plugins/infra/server/config.ts
#	x-pack/solutions/observability/plugins/inventory/e2e/cypress_test_runner.ts
#	x-pack/solutions/observability/plugins/inventory/public/components/entity_group_accordion/mock/inventory_component_wrapper_mock.tsx
#	x-pack/solutions/observability/plugins/inventory/public/components/search_bar/entity_types_multi_select.tsx
#	x-pack/solutions/observability/plugins/inventory/public/utils/group_entity_types_by_status.ts
miloszmarcinkowski added a commit to miloszmarcinkowski/kibana that referenced this issue Jan 9, 2025
…eam` owned plugins (elastic#204549)

Closes elastic#204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.

(cherry picked from commit 6461b7e)

# Conflicts:
#	x-pack/plugins/observability_solution/apm/public/components/alerting/ui_components/alert_details_app_section/failed_transaction_chart.tsx
#	x-pack/plugins/observability_solution/apm/public/components/alerting/ui_components/chart_preview/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/alerts_overview/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/correlations/correlations_table.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_failed_transactions_correlations.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/correlations/use_latency_correlations.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/entities/entity_link/entity_link.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/entities/entity_link/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/error_group_details/distribution/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/error_group_details/error_sampler/sample_summary.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/help_popover/help_popover.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/infra_overview/infra_tabs/use_tabs.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/embedded_map.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_http_requests_map_layer_list.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_layer_list.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_map_layer_style.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/mobile/service_overview/geo_map/map_layers/get_session_map_layer_list.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/service_groups/service_groups_list/service_group_card.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_inventory/service_list/health_badge.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_logs/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/cytoscape.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/cytoscape_options.ts
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/anomaly_detection.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/externals_list_contents.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_map/popover/resource_contents.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/service_overview/service_overview_instances_table/intance_details.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/top_traces_overview/trace_list.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/accordion_waterfall.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/failure_badge.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/span_flyout/truncate_height_section.tsx
#	x-pack/plugins/observability_solution/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/waterfall_item.tsx
#	x-pack/plugins/observability_solution/apm/public/components/fleet_integration/apm_agents/agent_instructions_accordion.tsx
#	x-pack/plugins/observability_solution/apm/public/components/routing/app_root/apm_header_action_menu/anomaly_detection_setup_link.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/breakdown_chart/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/duration_distribution_chart/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/instances_latency_distribution_chart/custom_tooltip.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/instances_latency_distribution_chart/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/spark_plot/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/agent_marker.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.test.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/error_marker.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/marker/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/timeline_axis.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/charts/timeline/vertical_lines.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/links/apm/service_link/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/overview_table_container/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/service_icons/index.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/context.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/frame_heading.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/library_stacktrace.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/stackframe.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/stacktrace/variables.tsx
#	x-pack/plugins/observability_solution/apm/public/components/shared/summary/user_agent_summary_item.tsx
#	x-pack/plugins/observability_solution/apm/public/context/apm_plugin/apm_plugin_context.tsx
#	x-pack/plugins/observability_solution/apm/public/hooks/use_breakpoints.test.tsx
#	x-pack/plugins/observability_solution/apm/public/hooks/use_fetcher.test.tsx
#	x-pack/plugins/observability_solution/apm/public/hooks/use_time_range.test.ts
#	x-pack/plugins/observability_solution/apm/public/plugin.ts
#	x-pack/plugins/observability_solution/apm/public/tutorial/config_agent/index.tsx
#	x-pack/plugins/observability_solution/apm/public/tutorial/tutorial_fleet_instructions/index.tsx
#	x-pack/plugins/observability_solution/apm/server/feature.ts
#	x-pack/plugins/observability_solution/apm/server/lib/helpers/get_random_sampler/index.ts
#	x-pack/plugins/observability_solution/apm/server/plugin.ts
#	x-pack/plugins/observability_solution/apm/server/routes/agent_keys/get_agent_keys_privileges.ts
#	x-pack/plugins/observability_solution/apm/server/routes/alerts/register_apm_rule_types.ts
#	x-pack/plugins/observability_solution/apm/server/routes/alerts/test_utils/index.ts
#	x-pack/plugins/observability_solution/apm/server/routes/apm_routes/register_apm_server_routes.ts
#	x-pack/plugins/observability_solution/apm/server/routes/assistant_functions/get_observability_alert_details_context/index.ts
#	x-pack/plugins/observability_solution/apm/server/routes/fleet/is_superuser.ts
#	x-pack/plugins/observability_solution/apm/server/types.ts
#	x-pack/plugins/observability_solution/infra/common/alerting/metrics/types.ts
#	x-pack/plugins/observability_solution/infra/common/constants.ts
#	x-pack/plugins/observability_solution/infra/public/alerting/metric_threshold/components/expression_row.tsx
#	x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_container_metrics_charts.test.ts
#	x-pack/plugins/observability_solution/infra/public/components/asset_details/hooks/use_host_metrics_charts.test.ts
#	x-pack/plugins/observability_solution/infra/public/components/autocomplete_field/autocomplete_field.tsx
#	x-pack/plugins/observability_solution/infra/public/components/autocomplete_field/suggestion_item.tsx
#	x-pack/plugins/observability_solution/infra/public/components/fixed_datepicker.tsx
#	x-pack/plugins/observability_solution/infra/public/components/loading_overlay_wrapper.tsx
#	x-pack/plugins/observability_solution/infra/public/components/log_stream/log_stream_react_embeddable.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_analysis_job_status/quality_warning_notices.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_entry_examples/log_entry_examples.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_minimap/density_chart.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_minimap/log_minimap.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logging/log_minimap/search_marker.tsx
#	x-pack/plugins/observability_solution/infra/public/components/logs_deprecation_callout.tsx
#	x-pack/plugins/observability_solution/infra/public/components/shared/alerts/alerts_overview.tsx
#	x-pack/plugins/observability_solution/infra/public/hooks/use_lens_attributes.ts
#	x-pack/plugins/observability_solution/infra/public/pages/logs/log_entry_categories/sections/top_categories/datasets_list.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/log_entry_categories/sections/top_categories/top_categories_table.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/settings/add_log_column_popover.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/stream/page_logs_content.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/logs/stream/page_view_log_in_context.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/components/tabs/alerts/alerts_tab_content.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/hosts/hooks/use_hosts_table.test.ts
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/index.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/dropdown_button.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/layout.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/nodes_overview.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/table_view.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/timeline/timeline.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/gradient_legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/group_name.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/group_of_groups.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/group_of_nodes.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/legend_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/map.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/node.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/node_context_menu.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/node_square.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/stepped_gradient_legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/steps_legend.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/waffle_sort_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/components/waffle/waffle_time_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/inventory_view/hooks/use_waffle_filters.test.ts
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/components/gauges_section_vis.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/components/metadata_details.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/components/time_controls.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metric_detail/types.ts
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_data.test.tsx
#	x-pack/plugins/observability_solution/infra/public/pages/metrics/metrics_explorer/hooks/use_metrics_explorer_options.test.tsx
#	x-pack/plugins/observability_solution/infra/public/plugin.ts
#	x-pack/plugins/observability_solution/infra/public/test_utils/entries.ts
#	x-pack/plugins/observability_solution/infra/server/index.ts
#	x-pack/plugins/observability_solution/infra/server/lib/adapters/framework/adapter_types.ts
#	x-pack/plugins/observability_solution/infra/server/lib/adapters/framework/kibana_framework_adapter.ts
#	x-pack/plugins/observability_solution/infra/server/lib/alerting/inventory_metric_threshold/register_inventory_metric_threshold_rule_type.ts
#	x-pack/plugins/observability_solution/infra/server/lib/alerting/register_rule_types.ts
#	x-pack/plugins/observability_solution/infra/server/plugin.ts
#	x-pack/plugins/observability_solution/infra/server/routes/infra/lib/host/get_hosts_alerts_count.ts
#	x-pack/plugins/observability_solution/infra/server/services/rules/types.ts
#	x-pack/plugins/observability_solution/inventory/public/components/grouped_inventory/grouped_entities_grid.tsx
#	x-pack/plugins/observability_solution/inventory/server/lib/create_alerts_client.ts/create_alerts_client.ts
#	x-pack/plugins/observability_solution/inventory/server/routes/entities/get_latest_entities_alerts.ts
#	x-pack/plugins/observability_solution/inventory/server/routes/entities/route.ts
#	x-pack/plugins/observability_solution/metrics_data_access/common/inventory_models/host/metrics/index.ts
#	x-pack/plugins/observability_solution/metrics_data_access/server/lib/adapters/framework/adapter_types.ts
#	x-pack/plugins/observability_solution/profiling/public/components/topn_functions/function_row.tsx
#	x-pack/plugins/observability_solution/profiling/public/types.ts
#	x-pack/plugins/observability_solution/profiling/server/lib/setup/get_has_setup_privileges.ts
#	x-pack/solutions/observability/plugins/apm/public/assistant_functions/get_apm_timeseries.tsx
#	x-pack/solutions/observability/plugins/apm/public/components/app/transaction_details/waterfall_with_summary/waterfall_container/waterfall/responsive_flyout.tsx
#	x-pack/solutions/observability/plugins/apm/server/deprecations/apm_user_role.test.ts
#	x-pack/solutions/observability/plugins/apm/server/deprecations/apm_user_role.ts
#	x-pack/solutions/observability/plugins/apm/server/deprecations/index.ts
#	x-pack/solutions/observability/plugins/apm/server/lib/deprecations/index.ts
#	x-pack/solutions/observability/plugins/apm/server/routes/entities/utils/merge_entities.test.ts
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/hosts/hooks/use_host_count.test.ts
#	x-pack/solutions/observability/plugins/infra/public/pages/metrics/inventory_view/components/waffle/metric_control/custom_metric_form.tsx
#	x-pack/solutions/observability/plugins/infra/public/utils/theme_utils/with_attrs.tsx
#	x-pack/solutions/observability/plugins/infra/server/config.ts
#	x-pack/solutions/observability/plugins/inventory/public/components/search_bar/entity_types_multi_select.tsx
#	x-pack/solutions/observability/plugins/inventory/public/utils/group_entity_types_by_status.ts
miloszmarcinkowski added a commit that referenced this issue Jan 9, 2025
…ices-team` owned plugins (#204549) (#206047)

# Backport

This will backport the following commits from `main` to `8.x`:
- [Add `consistent-type-imports` eslint rule in
`obs-ux-infra_services-team` owned plugins
(#204549)](#204549)

<!--- Backport version: 8.9.8 -->

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

<!--BACKPORT [{"author":{"name":"Milosz
Marcinkowski","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-01-02T13:30:47Z","message":"Add
`consistent-type-imports` eslint rule in `obs-ux-infra_services-team`
owned plugins (#204549)\n\nCloses #204412\r\n\r\n## Summary\r\n\r\nThis
PR enforces `consistent-type-imports` eslint rule
in\r\n`x-pack/solutions/observability/plugins/*` plugins owned
by\r\n`obs-ux-infra_services-team`.\r\n\r\nDetailed list of
plugins:\r\n- `x-pack/solutions/observability/plugins/apm`,\r\n-
`x-pack/solutions/observability/plugins/apm_data_access`,\r\n-
`x-pack/solutions/observability/plugins/infra`,\r\n-
`x-pack/solutions/observability/plugins/inventory`,\r\n-
`x-pack/solutions/observability/plugins/metrics_data_access`,\r\n-
`x-pack/solutions/observability/plugins/profiling`,\r\n-
`x-pack/solutions/observability/plugins/profiling_data_access`\r\n\r\nScript
for fixing eslint rules in above plugins:\r\n```bash\r\nyarn eslint
--no-error-on-unmatched-pattern --quiet --fix
\"x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}\"\r\n```\r\n\r\n##
Results\r\n\r\nThe affected plugins have been profiled using
`node\r\nscripts/build_kibana_platform_plugins.js --dist --profile
--focus=apm\r\n--no-cache` command and bundle size checked manually (`du
-s` command).\r\n\r\n#### APM plugin\r\nZero benefits in terms of
size.\r\n<img width=\"1728\" alt=\"Screenshot 2024-12-19 at 12 18
36\"\r\nsrc=\"https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81\"\r\n/>\r\n\r\n####
Infra plugin\r\nZero benefits in terms of size.\r\n<img width=\"1728\"
alt=\"Screenshot 2024-12-19 at 12 56
08\"\r\nsrc=\"https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59\"\r\n/>\r\n\r\n####
Profiling plugin\r\nZero benefits in terms of size.\r\n<img
width=\"1725\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251\"\r\n/>\r\n\r\n##
Conclusions\r\n\r\n- Using
[type-only\r\nimports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)\r\nin
Kibana doesn't provide any benefits in terms of bundle size,\r\n-
Possible safeguarding against edge-case TS errors\r\n- avoiding
unintentional side
effects\r\n([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))\r\n-
circular dependency reference
error\r\n[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)\r\n-
Better ground for incoming tooling (improving performance,
reliability\r\nwith type definition analysis),\r\n- Clearer code
intent.","sha":"6461b7e26a9afb2710353c0a84a67e4935504da4","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport:skip","v9.0.0","ci:project-deploy-observability","Team:obs-ux-infra_services"],"number":204549,"url":"https://github.com/elastic/kibana/pull/204549","mergeCommit":{"message":"Add
`consistent-type-imports` eslint rule in `obs-ux-infra_services-team`
owned plugins (#204549)\n\nCloses #204412\r\n\r\n## Summary\r\n\r\nThis
PR enforces `consistent-type-imports` eslint rule
in\r\n`x-pack/solutions/observability/plugins/*` plugins owned
by\r\n`obs-ux-infra_services-team`.\r\n\r\nDetailed list of
plugins:\r\n- `x-pack/solutions/observability/plugins/apm`,\r\n-
`x-pack/solutions/observability/plugins/apm_data_access`,\r\n-
`x-pack/solutions/observability/plugins/infra`,\r\n-
`x-pack/solutions/observability/plugins/inventory`,\r\n-
`x-pack/solutions/observability/plugins/metrics_data_access`,\r\n-
`x-pack/solutions/observability/plugins/profiling`,\r\n-
`x-pack/solutions/observability/plugins/profiling_data_access`\r\n\r\nScript
for fixing eslint rules in above plugins:\r\n```bash\r\nyarn eslint
--no-error-on-unmatched-pattern --quiet --fix
\"x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}\"\r\n```\r\n\r\n##
Results\r\n\r\nThe affected plugins have been profiled using
`node\r\nscripts/build_kibana_platform_plugins.js --dist --profile
--focus=apm\r\n--no-cache` command and bundle size checked manually (`du
-s` command).\r\n\r\n#### APM plugin\r\nZero benefits in terms of
size.\r\n<img width=\"1728\" alt=\"Screenshot 2024-12-19 at 12 18
36\"\r\nsrc=\"https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81\"\r\n/>\r\n\r\n####
Infra plugin\r\nZero benefits in terms of size.\r\n<img width=\"1728\"
alt=\"Screenshot 2024-12-19 at 12 56
08\"\r\nsrc=\"https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59\"\r\n/>\r\n\r\n####
Profiling plugin\r\nZero benefits in terms of size.\r\n<img
width=\"1725\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251\"\r\n/>\r\n\r\n##
Conclusions\r\n\r\n- Using
[type-only\r\nimports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)\r\nin
Kibana doesn't provide any benefits in terms of bundle size,\r\n-
Possible safeguarding against edge-case TS errors\r\n- avoiding
unintentional side
effects\r\n([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))\r\n-
circular dependency reference
error\r\n[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)\r\n-
Better ground for incoming tooling (improving performance,
reliability\r\nwith type definition analysis),\r\n- Clearer code
intent.","sha":"6461b7e26a9afb2710353c0a84a67e4935504da4"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/204549","number":204549,"mergeCommit":{"message":"Add
`consistent-type-imports` eslint rule in `obs-ux-infra_services-team`
owned plugins (#204549)\n\nCloses #204412\r\n\r\n## Summary\r\n\r\nThis
PR enforces `consistent-type-imports` eslint rule
in\r\n`x-pack/solutions/observability/plugins/*` plugins owned
by\r\n`obs-ux-infra_services-team`.\r\n\r\nDetailed list of
plugins:\r\n- `x-pack/solutions/observability/plugins/apm`,\r\n-
`x-pack/solutions/observability/plugins/apm_data_access`,\r\n-
`x-pack/solutions/observability/plugins/infra`,\r\n-
`x-pack/solutions/observability/plugins/inventory`,\r\n-
`x-pack/solutions/observability/plugins/metrics_data_access`,\r\n-
`x-pack/solutions/observability/plugins/profiling`,\r\n-
`x-pack/solutions/observability/plugins/profiling_data_access`\r\n\r\nScript
for fixing eslint rules in above plugins:\r\n```bash\r\nyarn eslint
--no-error-on-unmatched-pattern --quiet --fix
\"x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}\"
\"x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}\"\r\n```\r\n\r\n##
Results\r\n\r\nThe affected plugins have been profiled using
`node\r\nscripts/build_kibana_platform_plugins.js --dist --profile
--focus=apm\r\n--no-cache` command and bundle size checked manually (`du
-s` command).\r\n\r\n#### APM plugin\r\nZero benefits in terms of
size.\r\n<img width=\"1728\" alt=\"Screenshot 2024-12-19 at 12 18
36\"\r\nsrc=\"https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81\"\r\n/>\r\n\r\n####
Infra plugin\r\nZero benefits in terms of size.\r\n<img width=\"1728\"
alt=\"Screenshot 2024-12-19 at 12 56
08\"\r\nsrc=\"https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59\"\r\n/>\r\n\r\n####
Profiling plugin\r\nZero benefits in terms of size.\r\n<img
width=\"1725\"
alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251\"\r\n/>\r\n\r\n##
Conclusions\r\n\r\n- Using
[type-only\r\nimports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)\r\nin
Kibana doesn't provide any benefits in terms of bundle size,\r\n-
Possible safeguarding against edge-case TS errors\r\n- avoiding
unintentional side
effects\r\n([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))\r\n-
circular dependency reference
error\r\n[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)\r\n-
Better ground for incoming tooling (improving performance,
reliability\r\nwith type definition analysis),\r\n- Clearer code
intent.","sha":"6461b7e26a9afb2710353c0a84a67e4935504da4"}}]}]
BACKPORT-->
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this issue Jan 13, 2025
…eam` owned plugins (elastic#204549)

Closes elastic#204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.
viduni94 pushed a commit to viduni94/kibana that referenced this issue Jan 23, 2025
…eam` owned plugins (elastic#204549)

Closes elastic#204412

## Summary

This PR enforces `consistent-type-imports` eslint rule in
`x-pack/solutions/observability/plugins/*` plugins owned by
`obs-ux-infra_services-team`.

Detailed list of plugins:
- `x-pack/solutions/observability/plugins/apm`,
- `x-pack/solutions/observability/plugins/apm_data_access`,
- `x-pack/solutions/observability/plugins/infra`,
- `x-pack/solutions/observability/plugins/inventory`,
- `x-pack/solutions/observability/plugins/metrics_data_access`,
- `x-pack/solutions/observability/plugins/profiling`,
- `x-pack/solutions/observability/plugins/profiling_data_access`

Script for fixing eslint rules in above plugins:
```bash
yarn eslint --no-error-on-unmatched-pattern --quiet --fix "x-pack/solutions/observability/plugins/apm/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/apm_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/infra/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/inventory/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/metrics_data_access/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling/**/*.{js,mjs,ts,tsx}" "x-pack/solutions/observability/plugins/profiling_data_access/**/*.{js,mjs,ts,tsx}"
```

## Results

The affected plugins have been profiled using `node
scripts/build_kibana_platform_plugins.js --dist --profile --focus=apm
--no-cache` command and bundle size checked manually (`du -s` command).

#### APM plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 18 36"
src="https://github.com/user-attachments/assets/d86be5d8-a4ad-4d9c-bac1-110a0c6bba81"
/>

#### Infra plugin
Zero benefits in terms of size.
<img width="1728" alt="Screenshot 2024-12-19 at 12 56 08"
src="https://github.com/user-attachments/assets/410bc068-1f20-4de8-ac4e-89c74478ec59"
/>

#### Profiling plugin
Zero benefits in terms of size.
<img width="1725" alt="image"
src="https://github.com/user-attachments/assets/bf47c319-0716-4a5b-9858-94ce7d2a3251"
/>

## Conclusions

- Using [type-only
imports](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html#type-only-imports-and-export)
in Kibana doesn't provide any benefits in terms of bundle size,
- Possible safeguarding against edge-case TS errors
- avoiding unintentional side effects
([source](https://typescript-eslint.io/blog/consistent-type-imports-and-exports-why-and-how/#avoiding-unintentional-side-effects))
- circular dependency reference error
[(source)](https://stackoverflow.com/questions/40982927/using-import-type-statement-to-fix-circular-dependency-reference-error)
- Better ground for incoming tooling (improving performance, reliability
with type definition analysis),
- Clearer code intent.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Spacetime Team:obs-ux-infra_services Observability Infrastructure & Services User Experience Team
Projects
None yet
2 participants