Commit graph

39 commits

Author SHA1 Message Date
Gerard Soldevila
5acb5506ac
[8.x] SKA: Relocate "platform" packages that remain on /packages (#208704) (#212474)
# Backport

This will backport the following commits from `main` to `8.x`:
- [SKA: Relocate "platform" packages that remain on `/packages`
(#208704)](https://github.com/elastic/kibana/pull/208704)

<!--- Backport version: 9.6.6 -->

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-02-24T11:03:30Z","message":"SKA:
Relocate \"platform\" packages that remain on `/packages`
(#208704)\n\n## Summary\n\nThe `/packages` folder at the root of the
Kibana repository used to\ncontain a lot of packages.\nIn the context of
SKA, they have been gradually moved to various\nlocations:\n*
`src/platform/packages`\n* `x-pack/platform/packages`\n*
`src/core/packages`\n\nCurrently, only `devOnly: true` packages are left
in this folder. This\ncomprises libraries for CLI scripts as well as
testing utilities.\n\nWith this PR, we are moving ~half of these
packages under\n`src/platform/packages/(private|shared)/`.\nIn
particular, we are moving those packages that are being used
from\nplatform and/or solutions.\n\nSince they are `\"devOnly\": true`,
this means they are ONLY used from\ntests, cypress tests, storybook
configs, ./scripts/ folders inside some\nmodules, or other non-prod-time
logic. Nonetheless, they are effectively\nreferenced from platform
and/or solutions code, hence I decided they\nshould be placed under
`platform` folders.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6a7c904f921434fe21dfa00eceabfb5e64e915dc","branchLabelMapping":{"^v9.1.0$":"main","^v8.19.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","ci:project-deploy-observability","Team:obs-ux-infra_services","backport:version","v8.18.0","v9.1.0","v8.19.0"],"title":"SKA:
Relocate \"platform\" packages that remain on
`/packages`","number":208704,"url":"https://github.com/elastic/kibana/pull/208704","mergeCommit":{"message":"SKA:
Relocate \"platform\" packages that remain on `/packages`
(#208704)\n\n## Summary\n\nThe `/packages` folder at the root of the
Kibana repository used to\ncontain a lot of packages.\nIn the context of
SKA, they have been gradually moved to various\nlocations:\n*
`src/platform/packages`\n* `x-pack/platform/packages`\n*
`src/core/packages`\n\nCurrently, only `devOnly: true` packages are left
in this folder. This\ncomprises libraries for CLI scripts as well as
testing utilities.\n\nWith this PR, we are moving ~half of these
packages under\n`src/platform/packages/(private|shared)/`.\nIn
particular, we are moving those packages that are being used
from\nplatform and/or solutions.\n\nSince they are `\"devOnly\": true`,
this means they are ONLY used from\ntests, cypress tests, storybook
configs, ./scripts/ folders inside some\nmodules, or other non-prod-time
logic. Nonetheless, they are effectively\nreferenced from platform
and/or solutions code, hence I decided they\nshould be placed under
`platform` folders.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6a7c904f921434fe21dfa00eceabfb5e64e915dc"}},"sourceBranch":"main","suggestedTargetBranches":["8.18","8.x"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"url":"https://github.com/elastic/kibana/pull/212224","number":212224,"state":"OPEN"},{"branch":"8.18","label":"v8.18.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/208704","number":208704,"mergeCommit":{"message":"SKA:
Relocate \"platform\" packages that remain on `/packages`
(#208704)\n\n## Summary\n\nThe `/packages` folder at the root of the
Kibana repository used to\ncontain a lot of packages.\nIn the context of
SKA, they have been gradually moved to various\nlocations:\n*
`src/platform/packages`\n* `x-pack/platform/packages`\n*
`src/core/packages`\n\nCurrently, only `devOnly: true` packages are left
in this folder. This\ncomprises libraries for CLI scripts as well as
testing utilities.\n\nWith this PR, we are moving ~half of these
packages under\n`src/platform/packages/(private|shared)/`.\nIn
particular, we are moving those packages that are being used
from\nplatform and/or solutions.\n\nSince they are `\"devOnly\": true`,
this means they are ONLY used from\ntests, cypress tests, storybook
configs, ./scripts/ folders inside some\nmodules, or other non-prod-time
logic. Nonetheless, they are effectively\nreferenced from platform
and/or solutions code, hence I decided they\nshould be placed under
`platform` folders.\n\n---------\n\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6a7c904f921434fe21dfa00eceabfb5e64e915dc"}},{"branch":"8.x","label":"v8.19.0","branchLabelMappingKey":"^v8.19.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2025-02-28 10:12:01 +00:00
Lene Gadewoll
1384cedd84
[8.x] Upgrade EUI to v98.2.1-borealis.1 (#204783)
>[!IMPORTANT]
This PR introduces the Borealis enabled EUI package to `8.x`.
The intention is to support new features being developed that need to
live in `main` as well as `8.x`.


>[!IMPORTANT]
All `8.x` versions should continue to use the current Amsterdam theme.
To ensure this even with upcoming changes to the default theme for EUI,
we're adding `euiThemeAmsterdam` on `EuiProvider` usages manually.

## Description

This PR introduces all previous Borealis related PR changes but excludes
the specific changes to support `@elastic/eui-theme-borealis` as only
Amsterdam is supported as theme in `8.x`.

Previous PRs

- https://github.com/elastic/kibana/pull/199993
- https://github.com/elastic/kibana/pull/201049
- https://github.com/elastic/kibana/pull/202073

---

`v97.3.1``v98.2.1-borealis.1`

_[Questions? Please see our Kibana upgrade
FAQ.](https://github.com/elastic/eui/blob/main/wiki/eui-team-processes/upgrading-kibana.md#faq-for-kibana-teams)_

---

# `@elastic/eui`

## [`v98.2.1`](https://github.com/elastic/eui/releases/v98.2.1)

- Updated the EUI theme color values to use a full 6 char hex code
format ([#8244](https://github.com/elastic/eui/pull/8244))

## [`v98.2.0`](https://github.com/elastic/eui/releases/v98.2.0)

- Added two new icons: `contrast` and `contrastHigh`
([#8216](https://github.com/elastic/eui/pull/8216))
- Updated `EuiDataGrid` content to have a transparent background.
([#8220](https://github.com/elastic/eui/pull/8220))

**Accessibility**

- When the tooltips components (`EuiTooltip`, `EuiIconTip`) are used
inside components that handle the Escape key (like `EuiFlyout` or
`EuiModal`), pressing the Escape key will now only close the tooltip and
not the entire wrapping component.
([#8140](https://github.com/elastic/eui/pull/8140))
- Improved the accessibility of `EuiCodeBlock`s by
([#8195](https://github.com/elastic/eui/pull/8195))
  - adding screen reader only labels
  - adding `role="dialog"` on in fullscreen mode
  - ensuring focus is returned on closing fullscreen mode
  
# Borealis updates
  
- [Visual Refresh] Update color token mappings
([#8211](https://github.com/elastic/eui/pull/8211))
- [Visual Refresh] Introduce shared popover arrow styles to Borealis
([#8212](https://github.com/elastic/eui/pull/8212))
- [Visual Refresh] Add forms.maxWidth token
([#8221](https://github.com/elastic/eui/pull/8221))
- [Visual Refresh] Set darker shade for subdued text
([#8224](https://github.com/elastic/eui/pull/8224))
- [Visual Refresh] Remove support for accentSecondary badges
([#8224](https://github.com/elastic/eui/pull/8227))
- [Visual Refresh] Add severity vis colors
([#8247](https://github.com/elastic/eui/pull/8247))

---

# `@elastic/eui`

## [`v98.1.0`](https://github.com/elastic/eui/releases/v98.1.0)

- Updated `EuiBetaBadge` with a new `warning` color variant
([#8177](https://github.com/elastic/eui/pull/8177))

**Accessibility**

- Ensures `autoFocus` on `EuiSelectableList` triggers initial focus
([#8091](https://github.com/elastic/eui/pull/8091))
- Improved the accessibility of `EuiSearchBarFilters` by:
([#8091](https://github.com/elastic/eui/pull/8091))
  - adding a more descriptive `aria-label` to selection filter buttons
- ensuring the selection listbox is initially focused when opening a
selection popover
- Improved the accessibility experience of tabs (EuiTab, EuiTabs): tab
group is a tab stop and tabs can be traversed with arrow keys.
([#8116](https://github.com/elastic/eui/pull/8116))
- Updated `EuiCodeBlock` with a new `copyAriaLabel` prop, which allows
setting a custom screen reader label on the copy button.
([#8176](https://github.com/elastic/eui/pull/8176))

**CSS-in-JS conversions**

- Removed the following global Sass variables:
([#8169](https://github.com/elastic/eui/pull/8169))
  - `$euiButtonMinWidth`
  - `$euiDatePickerCalendarWidth`
- Removed the following Sass animations:
([#8169](https://github.com/elastic/eui/pull/8169))
  - `euiAnimFadeIn`
  - `euiGrow`
  - `focusRingAnimate`
  - `focusRingAnimateLarge`
  - `euiButtonActive`
- Removed the following Sass mixins:
([#8169](https://github.com/elastic/eui/pull/8169))
  - `euiFullHeight`
  - `euiSlightShadowHover`
  - `datePickerArrow`

# Borealis updates

- [Visual Refresh] Fix euiColorFullShade Sass variable mapping
(https://github.com/elastic/eui/pull/8178)

---

# `@elastic/eui`

## [`v98.0.0`](https://github.com/elastic/eui/releases/v98.0.0)

**Bug fixes**

- Fixed an `EuiDataGrid` bug where column actions where not clickable
when `EuiDataGrid` with `columnVisibility.canDragAndDropColumns` was
used inside a modal ([#8135](https://github.com/elastic/eui/pull/8135))

**Breaking changes**

- Removed `EuiFormRow`'s deprecated `columnCompressedSwitch` display
prop. Use `columnCompressed` instead
([#8113](https://github.com/elastic/eui/pull/8113))

# Borealis updates

**Bug fixes**

- Fixed computed border token mapping
(https://github.com/elastic/eui/pull/8170)
2025-01-08 09:59:50 +00:00
Michael Dokolin
861c2de3e5
[8.x] Sustainable Kibana Architecture: Move modules owned by @elastic/kibana-core (#201653) (#205563)
# Backport

This will backport the following commits from `main` to `8.x`:
- [Sustainable Kibana Architecture: Move modules owned by
`@elastic/kibana-core`
(#201653)](https://github.com/elastic/kibana/pull/201653)

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

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2025-01-04T18:47:24Z","message":"Sustainable
Kibana Architecture: Move modules owned by `@elastic/kibana-core`
(#201653)\n\n## Summary\n\nStart relocating Kibana modules (packages and
plugins) to the new folder\nstructure, according to the _Kibana
Sustainable Architecture_\ninitiative.\n#### 16 plugin(s) are going to
be relocated:\n\n| Id | Target folder |\n| -- | ------------- |\n|
`@kbn/cloud-chat-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_chat` |\n|
`@kbn/cloud-experiments-plugin`
|\n`x-pack/platform/plugins/shared/cloud_integrations/cloud_experiments`
|\n| `@kbn/cloud-full-story-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_full_story`
|\n| `@kbn/cloud-links-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_links` |\n|
`@kbn/cloud-plugin` | `x-pack/platform/plugins/shared/cloud` |\n|
`@kbn/features-plugin` | `x-pack/platform/plugins/shared/features` |\n|
`@kbn/ftr-apis-plugin` | `src/platform/plugins/private/ftr_apis` |\n|
`@kbn/kibana-usage-collection-plugin`
|\n`src/platform/plugins/private/kibana_usage_collection` |\n|
`@kbn/licensing-plugin` | `x-pack/platform/plugins/shared/licensing`
|\n| `@kbn/newsfeed-plugin` | `src/platform/plugins/shared/newsfeed`
|\n| `@kbn/saved-objects-management-plugin`
|\n`src/platform/plugins/shared/saved_objects_management` |\n|
`@kbn/telemetry-collection-manager-plugin`
|\n`src/platform/plugins/shared/telemetry_collection_manager` |\n|
`@kbn/telemetry-collection-xpack-plugin`
|\n`x-pack/platform/plugins/private/telemetry_collection_xpack` |\n|
`@kbn/telemetry-management-section-plugin`
|\n`src/platform/plugins/shared/telemetry_management_section` |\n|
`@kbn/telemetry-plugin` | `src/platform/plugins/shared/telemetry` |\n|
`@kbn/usage-collection-plugin`
|\n`src/platform/plugins/shared/usage_collection` |\n\n#### 22
package(s) are going to be relocated:\n\n| Id | Target folder |\n| -- |
------------- |\n| `@kbn/analytics` |
`src/platform/packages/shared/kbn-analytics` |\n|
`@kbn/analytics-collection-utils`
|\n`src/platform/packages/private/analytics/utils/analytics_collection_utils`\n|\n|
`@kbn/apm-config-loader`
|\n`src/platform/packages/private/kbn-apm-config-loader` |\n|
`@kbn/cloud` | `src/platform/packages/shared/cloud` |\n| `@kbn/config` |
`src/platform/packages/shared/kbn-config` |\n| `@kbn/config-mocks` |
`src/platform/packages/private/kbn-config-mocks`\n|\n|
`@kbn/config-schema` |\n`src/platform/packages/shared/kbn-config-schema`
|\n| `@kbn/crypto-browser`
|\n`src/platform/packages/shared/kbn-crypto-browser` |\n|
`@kbn/ebt-tools` | `src/platform/packages/shared/kbn-ebt-tools` |\n|
`@kbn/es-errors` | `src/platform/packages/shared/kbn-es-errors` |\n|
`@kbn/es-types` | `src/platform/packages/shared/kbn-es-types` |\n|
`@kbn/hapi-mocks` | `src/platform/packages/private/kbn-hapi-mocks` |\n|
`@kbn/health-gateway-server`
|\n`src/platform/packages/private/kbn-health-gateway-server` |\n|
`@kbn/i18n` | `src/platform/packages/shared/kbn-i18n` |\n|
`@kbn/i18n-react` | `src/platform/packages/shared/kbn-i18n-react` |\n|
`@kbn/logging` | `src/platform/packages/shared/kbn-logging` |\n|
`@kbn/logging-mocks` |\n`src/platform/packages/shared/kbn-logging-mocks`
|\n| `@kbn/router-to-openapispec`
|\n`src/platform/packages/shared/kbn-router-to-openapispec` |\n|
`@kbn/server-http-tools`
|\n`src/platform/packages/shared/kbn-server-http-tools` |\n| `@kbn/std`
| `src/platform/packages/shared/kbn-std` |\n| `@kbn/utility-types`
|\n`src/platform/packages/shared/kbn-utility-types` |\n| `@kbn/zod` |
`src/platform/packages/shared/kbn-zod` |\n\n---------\n\nCo-authored-by:
Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6049493e4a2372ea22986b231ad2bd59584fe9b8","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","release_note:skip","v9.0.0","backport:prev-minor","ci:project-deploy-observability","plugin
groups"],"number":201653,"url":"https://github.com/elastic/kibana/pull/201653","mergeCommit":{"message":"Sustainable
Kibana Architecture: Move modules owned by `@elastic/kibana-core`
(#201653)\n\n## Summary\n\nStart relocating Kibana modules (packages and
plugins) to the new folder\nstructure, according to the _Kibana
Sustainable Architecture_\ninitiative.\n#### 16 plugin(s) are going to
be relocated:\n\n| Id | Target folder |\n| -- | ------------- |\n|
`@kbn/cloud-chat-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_chat` |\n|
`@kbn/cloud-experiments-plugin`
|\n`x-pack/platform/plugins/shared/cloud_integrations/cloud_experiments`
|\n| `@kbn/cloud-full-story-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_full_story`
|\n| `@kbn/cloud-links-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_links` |\n|
`@kbn/cloud-plugin` | `x-pack/platform/plugins/shared/cloud` |\n|
`@kbn/features-plugin` | `x-pack/platform/plugins/shared/features` |\n|
`@kbn/ftr-apis-plugin` | `src/platform/plugins/private/ftr_apis` |\n|
`@kbn/kibana-usage-collection-plugin`
|\n`src/platform/plugins/private/kibana_usage_collection` |\n|
`@kbn/licensing-plugin` | `x-pack/platform/plugins/shared/licensing`
|\n| `@kbn/newsfeed-plugin` | `src/platform/plugins/shared/newsfeed`
|\n| `@kbn/saved-objects-management-plugin`
|\n`src/platform/plugins/shared/saved_objects_management` |\n|
`@kbn/telemetry-collection-manager-plugin`
|\n`src/platform/plugins/shared/telemetry_collection_manager` |\n|
`@kbn/telemetry-collection-xpack-plugin`
|\n`x-pack/platform/plugins/private/telemetry_collection_xpack` |\n|
`@kbn/telemetry-management-section-plugin`
|\n`src/platform/plugins/shared/telemetry_management_section` |\n|
`@kbn/telemetry-plugin` | `src/platform/plugins/shared/telemetry` |\n|
`@kbn/usage-collection-plugin`
|\n`src/platform/plugins/shared/usage_collection` |\n\n#### 22
package(s) are going to be relocated:\n\n| Id | Target folder |\n| -- |
------------- |\n| `@kbn/analytics` |
`src/platform/packages/shared/kbn-analytics` |\n|
`@kbn/analytics-collection-utils`
|\n`src/platform/packages/private/analytics/utils/analytics_collection_utils`\n|\n|
`@kbn/apm-config-loader`
|\n`src/platform/packages/private/kbn-apm-config-loader` |\n|
`@kbn/cloud` | `src/platform/packages/shared/cloud` |\n| `@kbn/config` |
`src/platform/packages/shared/kbn-config` |\n| `@kbn/config-mocks` |
`src/platform/packages/private/kbn-config-mocks`\n|\n|
`@kbn/config-schema` |\n`src/platform/packages/shared/kbn-config-schema`
|\n| `@kbn/crypto-browser`
|\n`src/platform/packages/shared/kbn-crypto-browser` |\n|
`@kbn/ebt-tools` | `src/platform/packages/shared/kbn-ebt-tools` |\n|
`@kbn/es-errors` | `src/platform/packages/shared/kbn-es-errors` |\n|
`@kbn/es-types` | `src/platform/packages/shared/kbn-es-types` |\n|
`@kbn/hapi-mocks` | `src/platform/packages/private/kbn-hapi-mocks` |\n|
`@kbn/health-gateway-server`
|\n`src/platform/packages/private/kbn-health-gateway-server` |\n|
`@kbn/i18n` | `src/platform/packages/shared/kbn-i18n` |\n|
`@kbn/i18n-react` | `src/platform/packages/shared/kbn-i18n-react` |\n|
`@kbn/logging` | `src/platform/packages/shared/kbn-logging` |\n|
`@kbn/logging-mocks` |\n`src/platform/packages/shared/kbn-logging-mocks`
|\n| `@kbn/router-to-openapispec`
|\n`src/platform/packages/shared/kbn-router-to-openapispec` |\n|
`@kbn/server-http-tools`
|\n`src/platform/packages/shared/kbn-server-http-tools` |\n| `@kbn/std`
| `src/platform/packages/shared/kbn-std` |\n| `@kbn/utility-types`
|\n`src/platform/packages/shared/kbn-utility-types` |\n| `@kbn/zod` |
`src/platform/packages/shared/kbn-zod` |\n\n---------\n\nCo-authored-by:
Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6049493e4a2372ea22986b231ad2bd59584fe9b8"}},"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/201653","number":201653,"mergeCommit":{"message":"Sustainable
Kibana Architecture: Move modules owned by `@elastic/kibana-core`
(#201653)\n\n## Summary\n\nStart relocating Kibana modules (packages and
plugins) to the new folder\nstructure, according to the _Kibana
Sustainable Architecture_\ninitiative.\n#### 16 plugin(s) are going to
be relocated:\n\n| Id | Target folder |\n| -- | ------------- |\n|
`@kbn/cloud-chat-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_chat` |\n|
`@kbn/cloud-experiments-plugin`
|\n`x-pack/platform/plugins/shared/cloud_integrations/cloud_experiments`
|\n| `@kbn/cloud-full-story-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_full_story`
|\n| `@kbn/cloud-links-plugin`
|\n`x-pack/platform/plugins/private/cloud_integrations/cloud_links` |\n|
`@kbn/cloud-plugin` | `x-pack/platform/plugins/shared/cloud` |\n|
`@kbn/features-plugin` | `x-pack/platform/plugins/shared/features` |\n|
`@kbn/ftr-apis-plugin` | `src/platform/plugins/private/ftr_apis` |\n|
`@kbn/kibana-usage-collection-plugin`
|\n`src/platform/plugins/private/kibana_usage_collection` |\n|
`@kbn/licensing-plugin` | `x-pack/platform/plugins/shared/licensing`
|\n| `@kbn/newsfeed-plugin` | `src/platform/plugins/shared/newsfeed`
|\n| `@kbn/saved-objects-management-plugin`
|\n`src/platform/plugins/shared/saved_objects_management` |\n|
`@kbn/telemetry-collection-manager-plugin`
|\n`src/platform/plugins/shared/telemetry_collection_manager` |\n|
`@kbn/telemetry-collection-xpack-plugin`
|\n`x-pack/platform/plugins/private/telemetry_collection_xpack` |\n|
`@kbn/telemetry-management-section-plugin`
|\n`src/platform/plugins/shared/telemetry_management_section` |\n|
`@kbn/telemetry-plugin` | `src/platform/plugins/shared/telemetry` |\n|
`@kbn/usage-collection-plugin`
|\n`src/platform/plugins/shared/usage_collection` |\n\n#### 22
package(s) are going to be relocated:\n\n| Id | Target folder |\n| -- |
------------- |\n| `@kbn/analytics` |
`src/platform/packages/shared/kbn-analytics` |\n|
`@kbn/analytics-collection-utils`
|\n`src/platform/packages/private/analytics/utils/analytics_collection_utils`\n|\n|
`@kbn/apm-config-loader`
|\n`src/platform/packages/private/kbn-apm-config-loader` |\n|
`@kbn/cloud` | `src/platform/packages/shared/cloud` |\n| `@kbn/config` |
`src/platform/packages/shared/kbn-config` |\n| `@kbn/config-mocks` |
`src/platform/packages/private/kbn-config-mocks`\n|\n|
`@kbn/config-schema` |\n`src/platform/packages/shared/kbn-config-schema`
|\n| `@kbn/crypto-browser`
|\n`src/platform/packages/shared/kbn-crypto-browser` |\n|
`@kbn/ebt-tools` | `src/platform/packages/shared/kbn-ebt-tools` |\n|
`@kbn/es-errors` | `src/platform/packages/shared/kbn-es-errors` |\n|
`@kbn/es-types` | `src/platform/packages/shared/kbn-es-types` |\n|
`@kbn/hapi-mocks` | `src/platform/packages/private/kbn-hapi-mocks` |\n|
`@kbn/health-gateway-server`
|\n`src/platform/packages/private/kbn-health-gateway-server` |\n|
`@kbn/i18n` | `src/platform/packages/shared/kbn-i18n` |\n|
`@kbn/i18n-react` | `src/platform/packages/shared/kbn-i18n-react` |\n|
`@kbn/logging` | `src/platform/packages/shared/kbn-logging` |\n|
`@kbn/logging-mocks` |\n`src/platform/packages/shared/kbn-logging-mocks`
|\n| `@kbn/router-to-openapispec`
|\n`src/platform/packages/shared/kbn-router-to-openapispec` |\n|
`@kbn/server-http-tools`
|\n`src/platform/packages/shared/kbn-server-http-tools` |\n| `@kbn/std`
| `src/platform/packages/shared/kbn-std` |\n| `@kbn/utility-types`
|\n`src/platform/packages/shared/kbn-utility-types` |\n| `@kbn/zod` |
`src/platform/packages/shared/kbn-zod` |\n\n---------\n\nCo-authored-by:
Alejandro Fernández Haro <alejandro.haro@elastic.co>\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"6049493e4a2372ea22986b231ad2bd59584fe9b8"}}]}]
BACKPORT-->

---------

Co-authored-by: Gerard Soldevila <gerard.soldevila@elastic.co>
2025-01-05 16:32:00 +01:00
Eyo O. Eyo
f535325378
[8.x] ES Lint rules for css-in-js declarations within Kibana (#200703) (#204620)
# Backport

This will backport the following commits from `main` to `8.x`:
- [ES Lint rules for css-in-js declarations within Kibana
(#200703)](https://github.com/elastic/kibana/pull/200703)

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

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

<!--BACKPORT [{"author":{"name":"Eyo O.
Eyo","email":"7893459+eokoneyo@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-12-16T15:56:52Z","message":"ES
Lint rules for css-in-js declarations within Kibana (#200703)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/kibana-team/issues/1272\r\n\r\nThis PR adds
implementation for eslint rules to help facilitate the\r\nmigration away
from SASS files to leveraging the design tokens EUI\r\nprovides for
styling.\r\n\r\nThe introduced rules in this PR are as follows;\r\n\r\n-
#### No CSS Color values\r\n Consider; \r\n\r\n ```tsx\r\n <EuiCode
style={{ color: '#dd4040' }}>Hello World!</EuiCode>\r\n ```\r\n\r\nthis
expression because it specifies the css color property, with a\r\nvalid
[CSS
color\r\nvalue](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value),\r\nwhen
the aforementioned rule is enabled depending on the set report\r\nlevel
set the user would get a feedback, see screenshot below;\r\n\r\n\r\n<img
width=\"735\" alt=\"Screenshot 2024-11-20 at 12 46
17\"\r\nsrc=\"https://github.com/user-attachments/assets/d2f608dc-782c-4d83-88e6-92dfdd8f6101\">\r\n\r\nThis
rule also works for variables defined elsewhere in the code
and\r\nreferenced as a value to the style prop, see screenshot
below;\r\n\r\n<img width=\"1658\" alt=\"Screenshot 2024-11-26 at 13 29
45\"\r\nsrc=\"https://github.com/user-attachments/assets/f8aadf6b-318b-4c6a-b7c9-bb44fb867b58\">\r\n\r\nfeedback
will also be provided when some variable that is a literal\r\nvalue is
specified as a value for any earmarked property that should
not\r\nspecify literal values.\r\n\r\n<img width=\"1730\"
alt=\"Screenshot 2024-11-28 at 19 00
08\"\r\nsrc=\"https://github.com/user-attachments/assets/bc3a8674-9469-4c7a-b0c9-7a2bfa7f08dc\">\r\n\r\nfeedback
will be provided for referencing a member prop of some object\r\ndefined
elsewhere as a value to any earmarked property that we have\r\ndeemed to
not specify literal values\r\n\r\n<img width=\"1676\" alt=\"Screenshot
2024-11-29 at 11 36
44\"\r\nsrc=\"https://github.com/user-attachments/assets/c4537fbf-b2d8-46bb-ad5f-8582e8c9a932\">\r\n\r\n\tSupports;\r\n\t-
object values\r\n\t- object references\r\n\t- template literals\r\n\t-
tagged templates \r\n\r\nThis approach does not penalize variable
declarations, only the usages\r\nof any said variable when it doesn't
conform to expectation\r\n\r\n- #### Prefer CSS attributes for EUI
components (optional)\r\n Consider; \r\n\r\n ```tsx\r\n<EuiCode style={{
someCSSProperty: 'propertyValue' }}>Hello\r\nWorld!</EuiCode>\r\n
```\r\nA declaration like the one above, will be regarded as an error
and can\r\nbe fixed, when it's fixed it will be re-written as\r\n \r\n
```tsx\r\n<EuiCode css={{ someCSSProperty: 'propertyValue'
}}>Hello\r\nWorld!</EuiCode>\r\n ```\r\n\r\n\t\r\n<!--\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [ ] [See some
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n-
[ ] ...\r\n\r\n\r\n-->\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"7370cc712ee2bf23f4cf53eef2e74942340f761c","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","v9.0.0","Team:SharedUX","backport:prev-minor"],"number":200703,"url":"https://github.com/elastic/kibana/pull/200703","mergeCommit":{"message":"ES
Lint rules for css-in-js declarations within Kibana (#200703)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/kibana-team/issues/1272\r\n\r\nThis PR adds
implementation for eslint rules to help facilitate the\r\nmigration away
from SASS files to leveraging the design tokens EUI\r\nprovides for
styling.\r\n\r\nThe introduced rules in this PR are as follows;\r\n\r\n-
#### No CSS Color values\r\n Consider; \r\n\r\n ```tsx\r\n <EuiCode
style={{ color: '#dd4040' }}>Hello World!</EuiCode>\r\n ```\r\n\r\nthis
expression because it specifies the css color property, with a\r\nvalid
[CSS
color\r\nvalue](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value),\r\nwhen
the aforementioned rule is enabled depending on the set report\r\nlevel
set the user would get a feedback, see screenshot below;\r\n\r\n\r\n<img
width=\"735\" alt=\"Screenshot 2024-11-20 at 12 46
17\"\r\nsrc=\"https://github.com/user-attachments/assets/d2f608dc-782c-4d83-88e6-92dfdd8f6101\">\r\n\r\nThis
rule also works for variables defined elsewhere in the code
and\r\nreferenced as a value to the style prop, see screenshot
below;\r\n\r\n<img width=\"1658\" alt=\"Screenshot 2024-11-26 at 13 29
45\"\r\nsrc=\"https://github.com/user-attachments/assets/f8aadf6b-318b-4c6a-b7c9-bb44fb867b58\">\r\n\r\nfeedback
will also be provided when some variable that is a literal\r\nvalue is
specified as a value for any earmarked property that should
not\r\nspecify literal values.\r\n\r\n<img width=\"1730\"
alt=\"Screenshot 2024-11-28 at 19 00
08\"\r\nsrc=\"https://github.com/user-attachments/assets/bc3a8674-9469-4c7a-b0c9-7a2bfa7f08dc\">\r\n\r\nfeedback
will be provided for referencing a member prop of some object\r\ndefined
elsewhere as a value to any earmarked property that we have\r\ndeemed to
not specify literal values\r\n\r\n<img width=\"1676\" alt=\"Screenshot
2024-11-29 at 11 36
44\"\r\nsrc=\"https://github.com/user-attachments/assets/c4537fbf-b2d8-46bb-ad5f-8582e8c9a932\">\r\n\r\n\tSupports;\r\n\t-
object values\r\n\t- object references\r\n\t- template literals\r\n\t-
tagged templates \r\n\r\nThis approach does not penalize variable
declarations, only the usages\r\nof any said variable when it doesn't
conform to expectation\r\n\r\n- #### Prefer CSS attributes for EUI
components (optional)\r\n Consider; \r\n\r\n ```tsx\r\n<EuiCode style={{
someCSSProperty: 'propertyValue' }}>Hello\r\nWorld!</EuiCode>\r\n
```\r\nA declaration like the one above, will be regarded as an error
and can\r\nbe fixed, when it's fixed it will be re-written as\r\n \r\n
```tsx\r\n<EuiCode css={{ someCSSProperty: 'propertyValue'
}}>Hello\r\nWorld!</EuiCode>\r\n ```\r\n\r\n\t\r\n<!--\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [ ] [See some
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n-
[ ] ...\r\n\r\n\r\n-->\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"7370cc712ee2bf23f4cf53eef2e74942340f761c"}},"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/200703","number":200703,"mergeCommit":{"message":"ES
Lint rules for css-in-js declarations within Kibana (#200703)\n\n##
Summary\r\n\r\nCloses
https://github.com/elastic/kibana-team/issues/1272\r\n\r\nThis PR adds
implementation for eslint rules to help facilitate the\r\nmigration away
from SASS files to leveraging the design tokens EUI\r\nprovides for
styling.\r\n\r\nThe introduced rules in this PR are as follows;\r\n\r\n-
#### No CSS Color values\r\n Consider; \r\n\r\n ```tsx\r\n <EuiCode
style={{ color: '#dd4040' }}>Hello World!</EuiCode>\r\n ```\r\n\r\nthis
expression because it specifies the css color property, with a\r\nvalid
[CSS
color\r\nvalue](https://developer.mozilla.org/en-US/docs/Web/CSS/color_value),\r\nwhen
the aforementioned rule is enabled depending on the set report\r\nlevel
set the user would get a feedback, see screenshot below;\r\n\r\n\r\n<img
width=\"735\" alt=\"Screenshot 2024-11-20 at 12 46
17\"\r\nsrc=\"https://github.com/user-attachments/assets/d2f608dc-782c-4d83-88e6-92dfdd8f6101\">\r\n\r\nThis
rule also works for variables defined elsewhere in the code
and\r\nreferenced as a value to the style prop, see screenshot
below;\r\n\r\n<img width=\"1658\" alt=\"Screenshot 2024-11-26 at 13 29
45\"\r\nsrc=\"https://github.com/user-attachments/assets/f8aadf6b-318b-4c6a-b7c9-bb44fb867b58\">\r\n\r\nfeedback
will also be provided when some variable that is a literal\r\nvalue is
specified as a value for any earmarked property that should
not\r\nspecify literal values.\r\n\r\n<img width=\"1730\"
alt=\"Screenshot 2024-11-28 at 19 00
08\"\r\nsrc=\"https://github.com/user-attachments/assets/bc3a8674-9469-4c7a-b0c9-7a2bfa7f08dc\">\r\n\r\nfeedback
will be provided for referencing a member prop of some object\r\ndefined
elsewhere as a value to any earmarked property that we have\r\ndeemed to
not specify literal values\r\n\r\n<img width=\"1676\" alt=\"Screenshot
2024-11-29 at 11 36
44\"\r\nsrc=\"https://github.com/user-attachments/assets/c4537fbf-b2d8-46bb-ad5f-8582e8c9a932\">\r\n\r\n\tSupports;\r\n\t-
object values\r\n\t- object references\r\n\t- template literals\r\n\t-
tagged templates \r\n\r\nThis approach does not penalize variable
declarations, only the usages\r\nof any said variable when it doesn't
conform to expectation\r\n\r\n- #### Prefer CSS attributes for EUI
components (optional)\r\n Consider; \r\n\r\n ```tsx\r\n<EuiCode style={{
someCSSProperty: 'propertyValue' }}>Hello\r\nWorld!</EuiCode>\r\n
```\r\nA declaration like the one above, will be regarded as an error
and can\r\nbe fixed, when it's fixed it will be re-written as\r\n \r\n
```tsx\r\n<EuiCode css={{ someCSSProperty: 'propertyValue'
}}>Hello\r\nWorld!</EuiCode>\r\n ```\r\n\r\n\t\r\n<!--\r\n\r\n###
Checklist\r\n\r\nCheck the PR satisfies following conditions.
\r\n\r\nReviewers should verify this PR satisfies this list as
well.\r\n\r\n- [ ] Any text added follows [EUI's
writing\r\nguidelines](https://elastic.github.io/eui/#/guidelines/writing),
uses\r\nsentence case text and includes
[i18n\r\nsupport](https://github.com/elastic/kibana/blob/main/packages/kbn-i18n/README.md)\r\n-
[
]\r\n[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)\r\nwas
added for features that require explanation or tutorials\r\n- [ ] [Unit
or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common scenarios\r\n- [ ] If a plugin
configuration key changed, check if it needs to be\r\nallowlisted in the
cloud and added to the
[docker\r\nlist](https://github.com/elastic/kibana/blob/main/src/dev/build/tasks/os_packages/docker_generator/resources/base/bin/kibana-docker)\r\n-
[ ] This was checked for breaking HTTP API changes, and any
breaking\r\nchanges have been approved by the breaking-change committee.
The\r\n`release_note:breaking` label should be applied in these
situations.\r\n- [ ] [Flaky
Test\r\nRunner](https://ci-stats.kibana.dev/trigger_flaky_test_runner/1)
was\r\nused on any tests changed\r\n- [ ] The PR description includes
the appropriate Release Notes section,\r\nand the correct
`release_node:*` label is applied per
the\r\n[guidelines](https://www.elastic.co/guide/en/kibana/master/contributing.html#kibana-release-notes-process)\r\n\r\n###
Identify risks\r\n\r\nDoes this PR introduce any risks? For example,
consider risks like hard\r\nto test bugs, performance regression,
potential of data loss.\r\n\r\nDescribe the risk, its severity, and
mitigation for each identified\r\nrisk. Invite stakeholders and evaluate
how to proceed before merging.\r\n\r\n- [ ] [See some
risk\r\nexamples](https://github.com/elastic/kibana/blob/main/RISK_MATRIX.mdx)\r\n-
[ ] ...\r\n\r\n\r\n-->\r\n\r\n---------\r\n\r\nCo-authored-by:
kibanamachine
<42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by:
Elastic Machine
<elasticmachine@users.noreply.github.com>","sha":"7370cc712ee2bf23f4cf53eef2e74942340f761c"}}]}]
BACKPORT-->
2024-12-18 09:18:14 +01:00
Gerard Soldevila
7b820130ab
[8.x] Add ESLINT constraints to detect inter-group dependencies (#194810) (#197670)
# Backport

This will backport the following commits from `main` to `8.x`:
- [Add ESLINT constraints to detect inter-group dependencies
(#194810)](https://github.com/elastic/kibana/pull/194810)

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

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

<!--BACKPORT [{"author":{"name":"Gerard
Soldevila","email":"gerard.soldevila@elastic.co"},"sourceCommit":{"committedDate":"2024-10-22T11:34:19Z","message":"Add
ESLINT constraints to detect inter-group dependencies (#194810)\n\n##
Summary\r\n\r\nAddresses
https://github.com/elastic/kibana-team/issues/1175\r\n\r\nAs part of the
**Sustainable Kibana Architecture** initiative, this PR\r\nsets the
foundation to start classifying plugins in isolated groups,\r\nmatching
our current solutions / project types:\r\n\r\n* It adds support for the
following fields in the packages' manifests\r\n(kibana.jsonc):\r\n*
`group?: 'search' | 'security' | 'observability' | 'platform'
|\r\n'common'`\r\n * `visibility?: 'private' | 'shared'`\r\n\r\n* It
proposes a folder structure to automatically infer
groups:\r\n```javascript\r\n 'src/platform/plugins/shared': {\r\n group:
'platform',\r\n visibility: 'shared',\r\n },\r\n
'src/platform/plugins/internal': {\r\n group: 'platform',\r\n
visibility: 'private',\r\n },\r\n 'x-pack/platform/plugins/shared':
{\r\n group: 'platform',\r\n visibility: 'shared',\r\n },\r\n
'x-pack/platform/plugins/internal': {\r\n group: 'platform',\r\n
visibility: 'private',\r\n },\r\n
'x-pack/solutions/observability/plugins': {\r\n group:
'observability',\r\n visibility: 'private',\r\n },\r\n
'x-pack/solutions/security/plugins': {\r\n group: 'security',\r\n
visibility: 'private',\r\n },\r\n 'x-pack/solutions/search/plugins':
{\r\n group: 'search',\r\n visibility: 'private',\r\n },\r\n```\r\n\r\n*
If a plugin is moved to one of the specific locations above, the
group\r\nand visibility in the manifest (if specified) must match those
inferred\r\nfrom the path.\r\n* Plugins that are not relocated are
considered: `group: 'common',\r\nvisibility: 'shared'` by default. As
soon as we specify a custom\r\n`group`, the ESLINT rules will check
violations against dependencies /\r\ndependants.\r\n\r\nThe ESLINT rules
are pretty simple:\r\n* Plugins can only depend on:\r\n * Plugins in the
same group\r\n * OR plugins with `'shared'` visibility\r\n* Plugins in
`'observability', 'security', 'search'` groups are\r\nmandatorily
`'private'`.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2a085e103afe8c7bdfb626d0dc683fc8be0e6c05","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:Core","backport
missing","v9.0.0","release_note:feature","backport:prev-minor"],"number":194810,"url":"https://github.com/elastic/kibana/pull/194810","mergeCommit":{"message":"Add
ESLINT constraints to detect inter-group dependencies (#194810)\n\n##
Summary\r\n\r\nAddresses
https://github.com/elastic/kibana-team/issues/1175\r\n\r\nAs part of the
**Sustainable Kibana Architecture** initiative, this PR\r\nsets the
foundation to start classifying plugins in isolated groups,\r\nmatching
our current solutions / project types:\r\n\r\n* It adds support for the
following fields in the packages' manifests\r\n(kibana.jsonc):\r\n*
`group?: 'search' | 'security' | 'observability' | 'platform'
|\r\n'common'`\r\n * `visibility?: 'private' | 'shared'`\r\n\r\n* It
proposes a folder structure to automatically infer
groups:\r\n```javascript\r\n 'src/platform/plugins/shared': {\r\n group:
'platform',\r\n visibility: 'shared',\r\n },\r\n
'src/platform/plugins/internal': {\r\n group: 'platform',\r\n
visibility: 'private',\r\n },\r\n 'x-pack/platform/plugins/shared':
{\r\n group: 'platform',\r\n visibility: 'shared',\r\n },\r\n
'x-pack/platform/plugins/internal': {\r\n group: 'platform',\r\n
visibility: 'private',\r\n },\r\n
'x-pack/solutions/observability/plugins': {\r\n group:
'observability',\r\n visibility: 'private',\r\n },\r\n
'x-pack/solutions/security/plugins': {\r\n group: 'security',\r\n
visibility: 'private',\r\n },\r\n 'x-pack/solutions/search/plugins':
{\r\n group: 'search',\r\n visibility: 'private',\r\n },\r\n```\r\n\r\n*
If a plugin is moved to one of the specific locations above, the
group\r\nand visibility in the manifest (if specified) must match those
inferred\r\nfrom the path.\r\n* Plugins that are not relocated are
considered: `group: 'common',\r\nvisibility: 'shared'` by default. As
soon as we specify a custom\r\n`group`, the ESLINT rules will check
violations against dependencies /\r\ndependants.\r\n\r\nThe ESLINT rules
are pretty simple:\r\n* Plugins can only depend on:\r\n * Plugins in the
same group\r\n * OR plugins with `'shared'` visibility\r\n* Plugins in
`'observability', 'security', 'search'` groups are\r\nmandatorily
`'private'`.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2a085e103afe8c7bdfb626d0dc683fc8be0e6c05"}},"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/194810","number":194810,"mergeCommit":{"message":"Add
ESLINT constraints to detect inter-group dependencies (#194810)\n\n##
Summary\r\n\r\nAddresses
https://github.com/elastic/kibana-team/issues/1175\r\n\r\nAs part of the
**Sustainable Kibana Architecture** initiative, this PR\r\nsets the
foundation to start classifying plugins in isolated groups,\r\nmatching
our current solutions / project types:\r\n\r\n* It adds support for the
following fields in the packages' manifests\r\n(kibana.jsonc):\r\n*
`group?: 'search' | 'security' | 'observability' | 'platform'
|\r\n'common'`\r\n * `visibility?: 'private' | 'shared'`\r\n\r\n* It
proposes a folder structure to automatically infer
groups:\r\n```javascript\r\n 'src/platform/plugins/shared': {\r\n group:
'platform',\r\n visibility: 'shared',\r\n },\r\n
'src/platform/plugins/internal': {\r\n group: 'platform',\r\n
visibility: 'private',\r\n },\r\n 'x-pack/platform/plugins/shared':
{\r\n group: 'platform',\r\n visibility: 'shared',\r\n },\r\n
'x-pack/platform/plugins/internal': {\r\n group: 'platform',\r\n
visibility: 'private',\r\n },\r\n
'x-pack/solutions/observability/plugins': {\r\n group:
'observability',\r\n visibility: 'private',\r\n },\r\n
'x-pack/solutions/security/plugins': {\r\n group: 'security',\r\n
visibility: 'private',\r\n },\r\n 'x-pack/solutions/search/plugins':
{\r\n group: 'search',\r\n visibility: 'private',\r\n },\r\n```\r\n\r\n*
If a plugin is moved to one of the specific locations above, the
group\r\nand visibility in the manifest (if specified) must match those
inferred\r\nfrom the path.\r\n* Plugins that are not relocated are
considered: `group: 'common',\r\nvisibility: 'shared'` by default. As
soon as we specify a custom\r\n`group`, the ESLINT rules will check
violations against dependencies /\r\ndependants.\r\n\r\nThe ESLINT rules
are pretty simple:\r\n* Plugins can only depend on:\r\n * Plugins in the
same group\r\n * OR plugins with `'shared'` visibility\r\n* Plugins in
`'observability', 'security', 'search'` groups are\r\nmandatorily
`'private'`.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine
<42973632+kibanamachine@users.noreply.github.com>","sha":"2a085e103afe8c7bdfb626d0dc683fc8be0e6c05"}}]}]
BACKPORT-->
2024-10-24 13:20:30 -07:00
Kibana Machine
631cba307b
[8.x] [React@18] Upgrade @types to React 18 (#194144) (#194536)
# Backport

This will backport the following commits from `main` to `8.x`:
- [[React@18] Upgrade @types to React 18
(#194144)](https://github.com/elastic/kibana/pull/194144)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Anton
Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2024-10-01T09:40:11Z","message":"[React@18]
Upgrade @types to React 18 (#194144)\n\n## Summary\r\n\r\nPart of
https://github.com/elastic/kibana/issues/138222\r\n\r\nThis PR finilizes
the breaking type fixes that are needed for upgrade
to\r\nReact@18.\r\nMost of the remaining issues are muted with
\"@ts-expect-error\" are\r\ntricky or could be runtime bugs that need to
be looked at.\r\n\r\n**Since the types changes are backward compatible
(except the new APIs)\r\nwe can upgrade to @types/react@18 now so that
we \"save\" the progress and\r\nall the code in Kibana from now on is
written in compatbile for react@18\r\nway from types
perspective.**","sha":"bdd57b64fe19683c481f673d6f1571f91379e730","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","Team:Fleet","v9.0.0","Team:SharedUX","backport:prev-minor","ci:project-deploy-observability","Team:obs-ux-infra_services","Team:obs-ux-management","apm:review"],"title":"[React@18]
Upgrade @types to React
18","number":194144,"url":"https://github.com/elastic/kibana/pull/194144","mergeCommit":{"message":"[React@18]
Upgrade @types to React 18 (#194144)\n\n## Summary\r\n\r\nPart of
https://github.com/elastic/kibana/issues/138222\r\n\r\nThis PR finilizes
the breaking type fixes that are needed for upgrade
to\r\nReact@18.\r\nMost of the remaining issues are muted with
\"@ts-expect-error\" are\r\ntricky or could be runtime bugs that need to
be looked at.\r\n\r\n**Since the types changes are backward compatible
(except the new APIs)\r\nwe can upgrade to @types/react@18 now so that
we \"save\" the progress and\r\nall the code in Kibana from now on is
written in compatbile for react@18\r\nway from types
perspective.**","sha":"bdd57b64fe19683c481f673d6f1571f91379e730"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/194144","number":194144,"mergeCommit":{"message":"[React@18]
Upgrade @types to React 18 (#194144)\n\n## Summary\r\n\r\nPart of
https://github.com/elastic/kibana/issues/138222\r\n\r\nThis PR finilizes
the breaking type fixes that are needed for upgrade
to\r\nReact@18.\r\nMost of the remaining issues are muted with
\"@ts-expect-error\" are\r\ntricky or could be runtime bugs that need to
be looked at.\r\n\r\n**Since the types changes are backward compatible
(except the new APIs)\r\nwe can upgrade to @types/react@18 now so that
we \"save\" the progress and\r\nall the code in Kibana from now on is
written in compatbile for react@18\r\nway from types
perspective.**","sha":"bdd57b64fe19683c481f673d6f1571f91379e730"}}]}]
BACKPORT-->

Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
2024-10-01 06:45:16 -05:00
Luke Elmers
b6287708f6
Adds AGPL 3.0 license (#192025)
Updates files outside of x-pack to be triple-licensed under Elastic
License 2.0, AGPL 3.0, or SSPL 1.0.
2024-09-06 19:02:41 -06:00
Kurt
bcc46b60e9
Changing load/dump in source files (#190641)
## Summary

Updates usage of `js-yaml` `load` and `dump` to `safeLoad` and
`safeDump`, in preparation for a major version update of dependency,
where the default behavior will be that of the safe function variants.


## Note to reviewers
`safeDump` will throw if it encounters invalid types (e.g. `undefined`),
whereas the `dump` function will still write the file including the
invalid types. This may have an affect within your use cases - if
throwing is not acceptable or is unhandled. To avoid this the
`skipInvalid` option can be used (see
https://github.com/nodeca/js-yaml#dump-object---options-) - this will
write the file, stripping out any invalid types from the input.

Please consider this when reviewing the changes to your code. If the
`skipInvalid` option is needed, please add it, or let us know to make
the change.

---------

Co-authored-by: Sid <siddharthmantri1@gmail.com>
Co-authored-by: “jeramysoucy” <jeramy.soucy@elastic.co>
Co-authored-by: Elena Shostak <elena.shostak@elastic.co>
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Maxim Palenov <maxim.palenov@elastic.co>
2024-08-21 07:29:36 -04:00
Maryam Saeidi
51736afd24
Import zod from @kbn/zod and add an eslint rule (#190581)
Closes #187638

## Summary

In this [PR](https://github.com/elastic/kibana/pull/186190), we
introduced @kbn/zod package and an OAS convertor to automatically
generate Open API Specifications for the routes that use zod for their
validation. In this PR, we add an eslint rule to enforce importing from
@kbn/zod instead of zod directly.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-08-21 04:14:55 -05:00
Larry Gregory
74d88580a5
Migrate codebase to use Object.hasOwn instead of Object.hasOwnProperty (#186829)
## Summary

This PR has breadth, but not depth. This adds 3 new `eslint` rules. The
first two protect against the use of code generated from strings (`eval`
and friends), which will not work client-side due to our CSP, and is not
something we wish to support server-side. The last rule aims to prevent
a subtle class of bugs, and to defend against a subset of prototype
pollution exploits:

- `no-new-func` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-new-func
- `no-implied-eval` to be compliant with our CSP, and to prevent code
execution from strings server-side:
https://eslint.org/docs/latest/rules/no-implied-eval. Note that this
function implies that it prevents no-new-func, but I don't see [test
cases](https://github.com/eslint/eslint/blob/main/tests/lib/rules/no-implied-eval.js)
covering this behavior, so I think we should play it safe and enable
both rules.
- `no-prototype-builtins` to prevent accessing shadowed properties:
https://eslint.org/docs/latest/rules/no-prototype-builtins


In order to be compliant with `no-prototype-builtins`, I've migrated all
usages and variants of `Object.hasOwnProperty` to use the newer
[`Object.hasOwn`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn).
2024-08-13 10:30:19 -05:00
Alejandro Fernández Haro
5f985213af
Add eslint-plugin-depend (#190233) 2024-08-09 20:07:01 +02:00
Ahmad Bamieh
f1c854b9db
[i18n][system upgrade] Upgrade Intl Packages from v2 to v6 (#179506)
## Summary

Upgrading intl packages from v2 to v6

### Packages upgrade:

- [x] Add @formatJS packages
- [x] `react-intl` Upgraded
- [x] `intl-messageformat` Upgraded
- [x] `intl-format-cache` removed
- [x] `intl-relativeformat` removed
- [x] `intl-messageformat-parser` removed

### Todo list:
- [x] Refactor HTML tags
- [x] Refactor Upgrade tags
- [x] Refactor `kbn-i18n`
- [x] Refactor `kbn-i18n-react`
- [x] Refactor `FormattedRelative` to `FormattedRelativeTime`
- [x] Refactor polyfills
- [x] Refactor IntlShape types
- [x] Rewrite Providers
- [x] Rewrite tests using i18n
- [x] Removed current pseudolocale implementation (tracker:
https://github.com/elastic/kibana/issues/180244)
- [x] Fix jest tests using rendered `Provider`
- [x] Remove no longer valid i18n packages documentation (tracker:
https://github.com/elastic/kibana/issues/180259)

Closes https://github.com/elastic/kibana/issues/178968
Closes https://github.com/elastic/kibana/issues/38642


## Notes to code reviewers
For team other than the core team, please review your plugins code
changes by filtering files by codeowners.


### Test Snapshot updates
Most of the changes are refactors of renamed functions and changed ICU
syntax.

The main updates are snapshot changes where `FormattedMessage` is now
memoized so snapshots capturing the html tree needed to be updated to
use `<Memo(MemoizedFormattedMessage)` instead of `<FormattedMessage`


### ICU now supports HTML tags:
before:
```
<FormattedMessage
  defaultMessage="To buy a shoe, { link } and { cta }"
  values={{
    link: (
      <a class="external_link" target="_blank" href="https://www.shoe.com/">
        visit our website
      </a>
    ),
    cta: <strong class="important">eat a shoe</strong>,
  }}
/>
```
after:
```
<FormattedMessage
  defaultMessage="To buy a shoe, <a>visit our website</a> and <cta>eat a shoe</cta>"
  values={{
    a: msg => (
      <a class="external_link" target="_blank" href="https://www.shoe.com/">
        {msg}
      </a>
    ),
    cta: msg => <strong class="important">{msg}</strong>,
  }}
/>
```

### Escape character to prevent ICU parsing changed from double slashes
to single quotes:
before: `\\{escaped\\}`
after: `'{escaped}'`

### No need for Intl Shape
the new packages under formatJS are written in typescript and come with
types support out of the box so no need to set types when using i18n.

Renamed `InjectedIntlProps` with `WrappedComponentProps`.
Removed `prop-types` and `intlShape` in favor of `IntlShape`.

### FormattedRelative has been renamed to FormattedRelativeTime and its
API has changed significantly. See
[FormattedRelativeTime](https://formatjs.io/docs/react-intl/upgrade-guide-3x#formattedrelativetime)
for more details.

### All tags specified must have corresponding values and will throw
error if it's missing
All tags are now parsed and expected to be formatted properly (all
opened tags must be closed).

To skip this check you can use the `ignoreTag: true` property

```
i18n.translate('xpack.apm.agentConfig.captureJmxMetrics.description', {
      defaultMessage: 'This is not an HTML tag <JMX object name pattern>' +
      ignoreTag: true,
    }),
```

**When do I use ignore tags?**

If your message has HTML tags, it is preferred not to ignore the Tag to
have some string verification that the html tags you are adding are
properly formatted and closed.

If it the text between brackets is not an HTML tag and it is just a
fomat preference then using `ignoreTag` makes sense.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2024-06-02 16:50:33 +03:00
Drew Tate
b694a894ba
[ES|QL] unskip autocomplete tests (#182273)
## Summary

A `.only` snuck into the autocomplete tests a few PRs back and this PR
fixes that... FOR GOOD :D
2024-05-02 09:37:50 -05:00
Jeramy Soucy
2627f48d95
Harden console functions (#171367)
## Summary

This PR overrides console functions only in production, in order to
sanitize input parameters for any potential calls made to the global
console from Kibana's dependencies.

This initial implementation overrides the `debug`, `error`, `info`,
`log`, `trace`, and `warn` functions, and only sanitizes string inputs.
Future updates may expand this to handle other types, or strings nested
in objects.

The unmodified console methods are now exposed internally in Kibana as
`unsafeConsole`. Where needed for formatting (log appenders, core
logger), calls to the global console have been replaced by
`unsafeConsole`. This PR also adds a new es linting rule to disallow
calls to `unsafeConsole` unless `eslint-disable-next-line
@kbn/eslint/no_unsafe_console` is used.

### Testing
Not sure how we could test this. The overrides are only enabled when
running in a true production environment (e.g. docker) by checking
`process.env.NODE_ENV`.

I was able to manually test by adding additional console output denoting
when the console functions were being overriden or not.

Closes https://github.com/elastic/kibana-team/issues/664
Closes #176340

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2024-02-09 09:13:52 -05:00
Coen Warmer
6fcf8c9efe
Add ESLint rule for Translations (#168001)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Jon <jon@budzenski.me>
2023-10-16 18:34:50 +02:00
Thomas Watson
d213ed274c
Upgrade ESLint React plugins (#162464) 2023-07-28 10:43:53 +02:00
Thomas Watson
a79e9c7374
Remove eslint-plugin-prefer-object-spread dependency (#162439)
Remove the `eslint-plugin-prefer-object-spread` dependency as the
`prefer-object-spread` rule has been part of ESLint since v5
2023-07-25 10:04:44 +02:00
Coen Warmer
010ee2e112
ESLint Telemetry Rule (#153108)
Resolves https://github.com/elastic/kibana/issues/144887

## Summary

This PR adds an ESLint Plugin which checks specific `Eui` elements for
the existence of a `data-test-subj` prop. This rule will make having one
for these elements required.

This rule is currently only enabled for Observability apps (APM, Infra,
Observability, Synthetics, Uptime).

The plugin is also able to generate a suggestion based on the context in
which the element is used. In the IDE this suggestion can be applied by
using the autofix capability (see video below).

When opening a PR, the CI will automatically apply the suggestion to
qualifying Eui elements in the branch.



https://user-images.githubusercontent.com/535564/225449622-bbfccb40-fdd2-4f69-9d5a-7d5a97bf62e6.mov



## Why do this?
There is an increased push to move towards data driven feature
development. In order to facilitate this, we need to have an increased
focus on instrumenting user event generating elements in the Kibana
codebase. This linting rule is an attempt to nudge Kibana engineers to
not forget to add this property when writing frontend code. It also
saves a bit of work for engineers by suggesting a value for the
`data-test-subj` based on the location of the file in the codebase and
any potential default values that might be present in the JSX node tree.
Finally, because the suggestion is always of the same form, it can
increase the consistency in the values given to these elements.

## Shape of the suggestion
The suggestion for the value of data-test-subj is of the form:
`[app][componentName][intent][euiElementName]`.

For example, when working in a component in the location:
`x-pack/plugins/observability/public/pages/overview/containers/overview_page/header_actions.tsx`,
and having the code:

```
function HeaderActions() {
  return (
    <EuiButton>{i18n.translate('id', { defaultMessage: 'Submit Form' })}</EuiButton>
  )
}
```

the suggestion becomes:
`data-test-subj=o11yHeaderActionsSubmitFormButton`.

For elements that don't take a `defaultMessage` prop / translation, the
suggestion takes the form: `[app][componentName][euiElementName]`

## Which elements are checked by the ESLint rule?
In its current iteration the rule checks these Eui elements:

*  `EuiButton`
*  `EuiButtonEmpty`
*  `EuiLink`
*  `EuiFieldText`
*  `EuiFieldSearch`
*  `EuiFieldNumber`
*  `EuiSelect`
*  `EuiRadioGroup`
*  'EuiTextArea`

## What types of prop setting does this rule support?
* `<EuiButton data-test-subj="foo">` (direct prop)
* `<EuiButton {...foo}>` (via spreaded object; rule checks for
`data-test-subj` key in object)

## What types of function declarations does this rule support?
* `function Foo(){}` (Named function)
* `const Foo = () => {}` (Arrow function assigned to variable)
* `const Foo = memo(() => {})` (Arrow function assigned to variable
wrapped in function)
* `const Foo = hoc(uponHoc(uponHoc(() => {})))` (Arrow function assigned
to variable wrapped in infinite levels of functions)

## Things to note
* If an element already has a value for `data-test-subj` the rule will
not kick in as any existing instrumentation might depend on the value.
* the auto suggestion is just a suggestion: the engineer can always
adjust the value for a `data-test-subj` before or after committing. Once
a value is present (autofixed or manually set) the rule will not kick
in.

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Dario Gieselaar <d.gieselaar@gmail.com>
Co-authored-by: Katerina Patticha <kate@kpatticha.com>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2023-03-20 13:31:02 +00:00
Spencer
1b85815402
[packages] migrate all plugins to packages (#148130)
Fixes https://github.com/elastic/kibana/issues/149344

This PR migrates all plugins to packages automatically. It does this
using `node scripts/lint_packages` to automatically migrate
`kibana.json` files to `kibana.jsonc` files. By doing this automatically
we can simplify many build and testing procedures to only support
packages, and not both "packages" and "synthetic packages" (basically
pointers to plugins).

The majority of changes are in operations related code, so we'll be
having operations review this before marking it ready for review. The
vast majority of the code owners are simply pinged because we deleted
all `kibana.json` files and replaced them with `kibana.jsonc` files, so
we plan on leaving the PR ready-for-review for about 24 hours before
merging (after feature freeze), assuming we don't have any blockers
(especially from @elastic/kibana-core since there are a few core
specific changes, though the majority were handled in #149370).

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2023-02-08 21:06:50 -06:00
Andrew Macri
1d0b90bd12
[Security Solution] Data Quality dashboard (#150063)
# [Security Solution] Data Quality dashboard

## Check ECS compatibility with just one click

With just one click, the _Data Quality dashboard_ checks all the indices used by the Security Solution, (or anything else), for compatibility with the [Elastic Common Schema (ECS)](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html)

![checking_data_quality](https://user-images.githubusercontent.com/4459398/215989195-2f5e2126-9ece-4df6-9742-284c73442962.gif)

## Create cases from results

Create a single case containing all the results, or create cases for specific indices

![create_case_from_take_action](https://user-images.githubusercontent.com/4459398/215989342-4489cf68-69d1-4ac4-859c-d849c4778d68.gif)

## Interactive tabs put results in context

Expand any index to reveal interactive tabs

- Summary
- Incompatible fields
- Custom fields
- ECS complaint fields
- All fields

![tabs](https://user-images.githubusercontent.com/4459398/215989435-a363a9e5-8635-42d1-a0f7-5e0ddc6f9515.gif)

## Share comprehensive markdown reports

Share markdown reports containing the same content as the dashboard

![markdown_report](https://user-images.githubusercontent.com/4459398/215989555-72c53ed8-99f9-4be7-9181-6b9f365a8f6e.gif)

### On page load

When the Data Quality dashboard page loads, the alerts index, and any indices matching the selected `Data view` are displayed

![page_load](https://user-images.githubusercontent.com/4459398/215989957-3b4d52f1-eaa4-4d42-9e40-d556602b006b.png)

Only `hot`, `warm`, or `unmanaged` indices are displayed by default

Indices are not checked automatically when the dashboard loads

Click either :

- `Check all` to check all the indices on the page
- The expand button to automatically check (just) one index, and instantly view results

### Check all

When the `Check all` button is clicked

- The `Check all` button changes to a `Cancel` button
- The `Last checked: n <time unit> ago` text is replaced with a progress bar indicating how many Indices are left to check
- The `Checking <index name>` text will update as each index is checked. Text will wrap if necessary
- The results tables begin updating with results
- Pattern stats update to summarize each table
- Rolled up results for the entire page update after every index is checked

![running_before_errors](https://user-images.githubusercontent.com/4459398/215990059-43efd573-217f-47e8-8ed2-1b1de4766834.png)

<https://user-images.githubusercontent.com/4459398/216007795-2ebbc0c6-8c7a-49c7-a22c-b97d2a58dddd.mov>

When Check all, is running, the Data Quality dashboard adds a three second delay after every check completes, before beginning the next check.

Check all will keep checking indexes until the user cancels, or all indexes have (attempted to be) checked.

While Check all is running, users may simultaneously click on any index to check it on demand. The results are instantly rolled up when this happens.

When all checks complete, the page looks like this:

![all_results_no_errors](https://user-images.githubusercontent.com/4459398/215990208-b28e1ad4-d8fd-453b-a037-1123c4352469.png)

### Take action

Click the `Take action` popover to share the entire page of results via one of the following actions:

- Add to new case
- Copy to clipboard

![take_action_popover](https://user-images.githubusercontent.com/4459398/215990971-fff06bf3-cac5-418f-83fc-556caa4b9413.png)

![create_case_from_take_action](https://user-images.githubusercontent.com/4459398/216012412-812f7b84-94a7-462a-8574-2e05afa35efd.gif)

![copy_toast](https://user-images.githubusercontent.com/4459398/215992498-c83b9191-8226-4ab1-8170-1bc953083f5c.png)

### Expanding results

The `Incompatible fields` tab is always displayed by default when a result is expanded

The `Incompatible fields` tab shows a success message when a successful result is expanded

![incompatible_fields_zero](https://user-images.githubusercontent.com/4459398/215991201-2ff7158e-1787-4221-b2de-d7e5ee49c412.png)

The `Incompatible fields` tab shows, side by side, expected ECS mapping types vs the actual mapping types when they are different

![mapping_differences](https://user-images.githubusercontent.com/4459398/215990436-82bb969e-fab7-4f2b-97f1-f21fd5bc3641.png)

The `Incompatible fields` tab also compares field values expected by ECS vs the actual values in an index, when they are different

![expect_vs_actual_value](https://user-images.githubusercontent.com/4459398/215990341-2c5ce75b-03cc-4b72-9431-282dfd032844.png)

The `Incompatible fields` tab displays a callout that explains the consequences of having incompatible fields. The content is based on the following illustration, created by @MikePaquette

<img width="1264" alt="ecs_meter" src="https://user-images.githubusercontent.com/4459398/216016124-6fe89ab4-c364-40ec-8a6f-99349e6d583c.png">

The calllout has a call to action to create a case or copy a markdown report for just the expanded result

- Add to new case
- Copy to clipboard

![create_case_from_incompatable_fields_tab](https://user-images.githubusercontent.com/4459398/215990827-57506e26-06e3-4704-afb4-4bd8308b217a.png)

### Tabs

The Summary tab displays a call to action when incompatible fields are found

Click on any part of the Summary tab chart or legend to navigate to the corresponding tab

![summary_tab](https://user-images.githubusercontent.com/4459398/215990517-41e96cab-558a-4461-a34a-e149873841a4.png)

Clicking on the `Copy to clipboard` call to action in the Custom fields tab copies a markdown version of the table to the clipboard

![custom_fields_tab](https://user-images.githubusercontent.com/4459398/215990623-8c787d11-cf93-4321-a803-2133c81fcd1b.png)

The search feature of the ECS complaint fields tab may, for example, be used to verify a specific ECS complaint mapping exists

![ecs_complaint_fields_tab](https://user-images.githubusercontent.com/4459398/215990703-dc0b93b3-a3ed-447b-96c5-714d71f4177d.png)

The All fields tab displays the union of all other tabs

![all_fields_tab](https://user-images.githubusercontent.com/4459398/215990746-88eb8812-7a00-47f4-94fc-5105aad024c1.png)

### Data view selection

The `Data view` dropdown defaults to the `Security Default Data View`

![data_view_selection](https://user-images.githubusercontent.com/4459398/216020987-d710aa85-5ddc-4fa1-9a3f-c131e656da56.png)

The alerts index is always checked and included in the results, even when another Data View is selected

![alerts_index_always_included](https://user-images.githubusercontent.com/4459398/216022004-4a6adb46-5bc1-4619-ad46-7364d7565e3a.png)

### ILM phase options

![ilm_selection](https://user-images.githubusercontent.com/4459398/216023010-c3bb9e3e-9aec-487b-8757-e4736c06de7e.png)

Only `hot`, `warm`, or `unmanaged` indices may be selected for checking.

The `cold` and `frozen` options are disabled.

When all options in the `ILM phase` box are cleared, an informative empty prompt is displayed

![ilm_empty_prompt](https://user-images.githubusercontent.com/4459398/216029584-659fafda-92fb-4607-b61e-87aa3f0b45e8.png)

### Errors

Errors may occur for some (or all) indices. The `View errors` button appears when the first error occurs

![running_with_errors](https://user-images.githubusercontent.com/4459398/216024230-609ec815-e2e4-408f-b9a5-d12aad9f83c5.png)

Users may click the `View errors` button to view them, even while a check is in progress

![error_popover](https://user-images.githubusercontent.com/4459398/216755446-210996d8-605b-4d6b-8c90-cf94dc83a76b.png)

The Copy to clipboard button  in the errors popover copies a markdown version of the errors table to the clipboard

When errors occur, the same content shown in the Errors popover is automatically included in the markdown report created by the `Take action` menu

### Markdown reports

The content of markdown reports (created by the Take action menu) includes most of the content from the Data Quality dashboard that created it

In the screenshot below, the Data Quality dashboard is on the left, and a markdown report (pasted into Github) is on the right

![side_by_side_compare_1](https://user-images.githubusercontent.com/4459398/216026602-7cf7aaaa-b461-44e0-a03e-6690e3d87d3c.png)

Stats rollups and tables are included in markdown reports

![side_by_side_2](https://user-images.githubusercontent.com/4459398/216026872-d5319279-e4b2-4ac0-b291-06dc61ba108c.png)

Markdown reports use the same "expected vs actual" format to display the details of incompatible field mappings

### Navigation

The Data Quality dashboard is grouped with the existing Security Solution dashboards

![dashboards_page](https://user-images.githubusercontent.com/4459398/216057432-0ae99d57-4857-4270-bd7d-07bc96e27cb0.png)

It may also be launched via the side navigation

![side_nav](https://user-images.githubusercontent.com/4459398/216057528-2370b82a-dc92-4ea6-8519-7e8abc61acd0.png)

## Privileges

The privileges in the table below are required to check any pattern of indices, or any specific index:

| Privilege                                         | Required to                                                                                                                       | Required for API |
|-------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------|------------------|
| `monitor` or `manage`  (`manage` builds on `monitor`) | List indices that match a pattern, and get document counts for an index  example: `GET logs-*/_stats`                             | `_stats`         |
| `view_index_metadata` or `manage_ilm`                 | List index ILM configs (e.g. hot) that match a pattern  example: `GET logs-*/_ilm/explain`                                        | `_ilm/explain`   |
| `view_index_metadata` or `manage`                     | Get index mappings for a specific index  example:  `GET .ds-logs-endpoint.events.process-default-2023.01.17-000001/_mapping`      | `_mapping`       |
| `read` or `read_cross_cluster`                        | Run aggregations to test for unallowed values  example:  `GET .ds-logs-endpoint.events.process-default-2023.01.17-000001/_search` | `_search`        |

Users may have some of the privileges required to check an index, but not all of them.

The built-in `viewer` role does not have the `monitor` (or `manage`) role. The following screenshot illustrates what a user will see if they login as a user with the `viewer` role:

![login_with_viewer_role](https://user-images.githubusercontent.com/4459398/216755590-b6c01a7b-73b1-4680-8db1-b9d1c0035f06.png)

# An actual markdown report (all content below)

The rest of the content below is pasted from an actual report, created via the `Take action` menu:

# Data quality

| Incompatible fields | Indices checked | Indices | Docs |
|---------------------|-----------------|---------|------|
| 17 | 15 | 17 | 1,404,514 |

## .alerts-security.alerts-default

`hot(1)`

| Incompatible fields | Indices checked | Indices | Docs |
|---------------------|-----------------|---------|------|
| 1 | 1 | 1 | 1,837 |

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .internal.alerts-security.alerts-default-000001 | 1,837 (100.0%) | 1 | `hot` |

### .internal.alerts-security.alerts-default-000001

The `.internal.alerts-security.alerts-default-000001` index has [mappings](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) or field values that are different than the [Elastic Common Schema](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html) (ECS), version `8.6.0` [definitions](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html).

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .internal.alerts-security.alerts-default-000001 | 1,837 (100.0%) | 1 | `hot` |

### **Incompatible fields** `1` **Custom fields** `188` **ECS compliant fields** `1219` **All fields** `1408`

#### 1 incompatible field

Fields are incompatible with ECS when index mappings, or the values of the fields in the index, don't conform to the Elastic Common Schema (ECS), version 8.6.0.

 Detection engine rules referencing these fields may not match them correctly
 Pages may not display some events or fields due to unexpected field mappings or values
 Mappings or field values that don't comply with ECS are not supported

#### Incompatible field values - .internal.alerts-security.alerts-default-000001

| Field | ECS values (expected) | Document values (actual) |
|-------|-----------------------|--------------------------|
| event.category | `authentication`, `configuration`, `database`, `driver`, `email`, `file`, `host`, `iam`, `intrusion_detection`, `malware`, `network`, `package`, `process`, `registry`, `session`, `threat`, `vulnerability`, `web` | `behavior` (62) |

## auditbeat-*

`hot(11)`  `unmanaged(1)`

| Incompatible fields | Indices checked | Indices | Docs |
|---------------------|-----------------|---------|------|
| 13 | 10 | 12 | 29,182 |

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.6.0-2023.01.17-000001 | 14,409 (49.4%) | 0 | `hot` |
| -- | .ds-auditbeat-8.5.3-2023.01.24-000001 | 2,857 (9.8%) | -- | `hot` |
|  | .ds-auditbeat-8.2.3-2023.01.24-000001 | 2,246 (7.7%) | 0 | `hot` |
|  | .ds-auditbeat-8.4.1-2023.01.24-000001 | 2,179 (7.5%) | 0 | `hot` |
| -- | .ds-auditbeat-8.3.3-2023.01.24-000001 | 1,921 (6.6%) | -- | `hot` |
|  | auditbeat-7.16.0-2023.01.17-000001 | 1,880 (6.4%) | 0 | `hot` |
|  | .ds-auditbeat-8.1.1-2023.01.24-000001 | 1,676 (5.7%) | 0 | `hot` |
|  | .ds-auditbeat-8.2.2-2023.01.24-000001 | 1,578 (5.4%) | 0 | `hot` |
|  | .ds-auditbeat-8.0.0-2023.01.24-000001 | 251 (0.9%) | 0 | `hot` |
|  | auditbeat-7.10.2-2023.01.24-000001 | 111 (0.4%) | 12 | `hot` |
|  | .ds-auditbeat-8.5.0-2023.01.24-000001 | 74 (0.3%) | 0 | `hot` |
|  | auditbeat-custom-empty-index-1 | 0 (0.0%) | 1 | `unmanaged` |

### .ds-auditbeat-8.6.0-2023.01.17-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.6.0-2023.01.17-000001 | 14,409 (49.4%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `549` **ECS compliant fields** `1210` **All fields** `1759`

### .ds-auditbeat-8.2.3-2023.01.24-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.2.3-2023.01.24-000001 | 2,246 (7.7%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `510` **ECS compliant fields** `1210` **All fields** `1720`

### .ds-auditbeat-8.4.1-2023.01.24-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.4.1-2023.01.24-000001 | 2,179 (7.5%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `509` **ECS compliant fields** `1210` **All fields** `1719`

### auditbeat-7.16.0-2023.01.17-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | auditbeat-7.16.0-2023.01.17-000001 | 1,880 (6.4%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `523` **ECS compliant fields** `1111` **All fields** `1634`

### .ds-auditbeat-8.1.1-2023.01.24-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.1.1-2023.01.24-000001 | 1,676 (5.7%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `510` **ECS compliant fields** `1204` **All fields** `1714`

### .ds-auditbeat-8.2.2-2023.01.24-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.2.2-2023.01.24-000001 | 1,578 (5.4%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `510` **ECS compliant fields** `1210` **All fields** `1720`

### .ds-auditbeat-8.0.0-2023.01.24-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.0.0-2023.01.24-000001 | 251 (0.9%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `510` **ECS compliant fields** `1204` **All fields** `1714`

### auditbeat-7.10.2-2023.01.24-000001

The `auditbeat-7.10.2-2023.01.24-000001` index has [mappings](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) or field values that are different than the [Elastic Common Schema](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html) (ECS), version `8.6.0` [definitions](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html).

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | auditbeat-7.10.2-2023.01.24-000001 | 111 (0.4%) | 12 | `hot` |

### **Incompatible fields** `12` **Custom fields** `467` **ECS compliant fields** `602` **All fields** `1081`

#### 12 incompatible fields

Fields are incompatible with ECS when index mappings, or the values of the fields in the index, don't conform to the Elastic Common Schema (ECS), version 8.6.0.

 Detection engine rules referencing these fields may not match them correctly
 Pages may not display some events or fields due to unexpected field mappings or values
 Mappings or field values that don't comply with ECS are not supported

#### Incompatible field mappings - auditbeat-7.10.2-2023.01.24-000001

| Field | ECS mapping type (expected) | Index mapping type (actual) |
|-------|-----------------------------|-----------------------------|
| error.message | `match_only_text` | `text` |
| error.stack_trace | `wildcard` | `keyword` |
| http.request.body.content | `wildcard` | `keyword` |
| http.response.body.content | `wildcard` | `keyword` |
| message | `match_only_text` | `text` |
| process.command_line | `wildcard` | `keyword` |
| process.parent.command_line | `wildcard` | `keyword` |
| registry.data.strings | `wildcard` | `keyword` |
| url.full | `wildcard` | `keyword` |
| url.original | `wildcard` | `keyword` |
| url.path | `wildcard` | `keyword` |

#### Incompatible field values - auditbeat-7.10.2-2023.01.24-000001

| Field | ECS values (expected) | Document values (actual) |
|-------|-----------------------|--------------------------|
| event.kind | `alert`, `enrichment`, `event`, `metric`, `state`, `pipeline_error`, `signal` | `error` (1) |

### .ds-auditbeat-8.5.0-2023.01.24-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-auditbeat-8.5.0-2023.01.24-000001 | 74 (0.3%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `509` **ECS compliant fields** `1210` **All fields** `1719`

### auditbeat-custom-empty-index-1

The `auditbeat-custom-empty-index-1` index has [mappings](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) or field values that are different than the [Elastic Common Schema](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html) (ECS), version `8.6.0` [definitions](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html).

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | auditbeat-custom-empty-index-1 | 0 (0.0%) | 1 | `unmanaged` |

### **Incompatible fields** `1` **Custom fields** `0` **ECS compliant fields** `0` **All fields** `0`

#### 1 incompatible field

Fields are incompatible with ECS when index mappings, or the values of the fields in the index, don't conform to the Elastic Common Schema (ECS), version 8.6.0.

 Detection engine rules referencing these fields may not match them correctly
 Pages may not display some events or fields due to unexpected field mappings or values
 Mappings or field values that don't comply with ECS are not supported

#### Incompatible field mappings - auditbeat-custom-empty-index-1

| Field | ECS mapping type (expected) | Index mapping type (actual) |
|-------|-----------------------------|-----------------------------|
| @timestamp | `date` | `-` |

## logs-*

`hot(2)`

| Incompatible fields | Indices checked | Indices | Docs |
|---------------------|-----------------|---------|------|
| 3 | 2 | 2 | 602 |

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-logs-endpoint.alerts-default-2023.01.17-000001 | 342 (56.8%) | 2 | `hot` |
|  | .ds-logs-endpoint.events.process-default-2023.01.17-000001 | 260 (43.2%) | 1 | `hot` |

### .ds-logs-endpoint.alerts-default-2023.01.17-000001

The `.ds-logs-endpoint.alerts-default-2023.01.17-000001` index has [mappings](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) or field values that are different than the [Elastic Common Schema](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html) (ECS), version `8.6.0` [definitions](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html).

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-logs-endpoint.alerts-default-2023.01.17-000001 | 342 (56.8%) | 2 | `hot` |

### **Incompatible fields** `2` **Custom fields** `857` **ECS compliant fields** `675` **All fields** `1534`

#### 2 incompatible fields

Fields are incompatible with ECS when index mappings, or the values of the fields in the index, don't conform to the Elastic Common Schema (ECS), version 8.6.0.

 Detection engine rules referencing these fields may not match them correctly
 Pages may not display some events or fields due to unexpected field mappings or values
 Mappings or field values that don't comply with ECS are not supported

#### Incompatible field mappings - .ds-logs-endpoint.alerts-default-2023.01.17-000001

| Field | ECS mapping type (expected) | Index mapping type (actual) |
|-------|-----------------------------|-----------------------------|
| process.env_vars | `keyword` | `object` |

#### Incompatible field values - .ds-logs-endpoint.alerts-default-2023.01.17-000001

| Field | ECS values (expected) | Document values (actual) |
|-------|-----------------------|--------------------------|
| event.category | `authentication`, `configuration`, `database`, `driver`, `email`, `file`, `host`, `iam`, `intrusion_detection`, `malware`, `network`, `package`, `process`, `registry`, `session`, `threat`, `vulnerability`, `web` | `behavior` (45) |

### .ds-logs-endpoint.events.process-default-2023.01.17-000001

The `.ds-logs-endpoint.events.process-default-2023.01.17-000001` index has [mappings](https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping.html) or field values that are different than the [Elastic Common Schema](https://www.elastic.co/guide/en/ecs/current/ecs-reference.html) (ECS), version `8.6.0` [definitions](https://www.elastic.co/guide/en/ecs/current/ecs-field-reference.html).

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-logs-endpoint.events.process-default-2023.01.17-000001 | 260 (43.2%) | 1 | `hot` |

### **Incompatible fields** `1` **Custom fields** `130` **ECS compliant fields** `304` **All fields** `435`

#### 1 incompatible field

Fields are incompatible with ECS when index mappings, or the values of the fields in the index, don't conform to the Elastic Common Schema (ECS), version 8.6.0.

 Detection engine rules referencing these fields may not match them correctly
 Pages may not display some events or fields due to unexpected field mappings or values
 Mappings or field values that don't comply with ECS are not supported

#### Incompatible field mappings - .ds-logs-endpoint.events.process-default-2023.01.17-000001

| Field | ECS mapping type (expected) | Index mapping type (actual) |
|-------|-----------------------------|-----------------------------|
| process.env_vars | `keyword` | `object` |

## packetbeat-*

`hot(2)`

| Incompatible fields | Indices checked | Indices | Docs |
|---------------------|-----------------|---------|------|
| 0 | 2 | 2 | 1,372,893 |

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-packetbeat-8.6.0-2023.01.17-000001 | 704,062 (51.3%) | 0 | `hot` |
|  | .ds-packetbeat-8.4.1-2023.01.24-000001 | 668,831 (48.7%) | 0 | `hot` |

### .ds-packetbeat-8.6.0-2023.01.17-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-packetbeat-8.6.0-2023.01.17-000001 | 704,062 (51.3%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `604` **ECS compliant fields** `1209` **All fields** `1813`

### .ds-packetbeat-8.4.1-2023.01.24-000001

| Result | Index | Docs | Incompatible fields | ILM Phase |
|--------|-------|------|---------------------|-----------|
|  | .ds-packetbeat-8.4.1-2023.01.24-000001 | 668,831 (48.7%) | 0 | `hot` |

### **Incompatible fields** `0` **Custom fields** `604` **ECS compliant fields** `1209` **All fields** `1813`

## Errors

Some indices were not checked for Data Quality

Errors may occur when pattern or index metadata is temporarily unavailable, or because you don't have the privileges required for access

The following privileges are required to check an index:
- `monitor` or `manage`
- `view_index_metadata`
- `read` or `read_cross_cluster`


| Pattern | Index | Error | 
|---------|-------|-------|
| .alerts-security.alerts-default | -- | `Error loading stats: Error: Forbidden` |
| auditbeat-* | -- | `Error loading stats: Error: Forbidden` |
| logs-* | -- | `Error loading stats: Error: Forbidden` |
| packetbeat-* | -- | `Error loading stats: Error: Forbidden` |

See also: https://github.com/elastic/security-team/issues/4559
2023-02-06 21:10:43 -07:00
Spencer
ffeb61a75f
[presUtils/fleet] stop importing test helpers in bundles (#148825)
This PR stops importing:
- `functionWrapper` and `fontStyle` test helpers in
`@kbn/presentation-util-plugin/common`
 - `createFleetAuthzMock` test helper in `@kbn/fleet-plugin/common`

These are instead imported from a `*/mocks` or `*/test_helpers` import
target and the related `eslint-disable` comments were removed.

While working through some changes to the package system I fixed a bug
in the source classifier which made these issues clear and made a fix
required. The changes have been broken out of my massive PR to make
review simpler.
2023-01-12 15:11:30 -07:00
Spencer
afb09ccf8a
Transpile packages on demand, validate all TS projects (#146212)
## Dearest Reviewers 👋 

I've been working on this branch with @mistic and @tylersmalley and
we're really confident in these changes. Additionally, this changes code
in nearly every package in the repo so we don't plan to wait for reviews
to get in before merging this. If you'd like to have a concern
addressed, please feel free to leave a review, but assuming that nobody
raises a blocker in the next 24 hours we plan to merge this EOD pacific
tomorrow, 12/22.

We'll be paying close attention to any issues this causes after merging
and work on getting those fixed ASAP. 🚀

---

The operations team is not confident that we'll have the time to achieve
what we originally set out to accomplish by moving to Bazel with the
time and resources we have available. We have also bought ourselves some
headroom with improvements to babel-register, optimizer caching, and
typescript project structure.

In order to make sure we deliver packages as quickly as possible (many
teams really want them), with a usable and familiar developer
experience, this PR removes Bazel for building packages in favor of
using the same JIT transpilation we use for plugins.

Additionally, packages now use `kbn_references` (again, just copying the
dx from plugins to packages).

Because of the complex relationships between packages/plugins and in
order to prepare ourselves for automatic dependency detection tools we
plan to use in the future, this PR also introduces a "TS Project Linter"
which will validate that every tsconfig.json file meets a few
requirements:

1. the chain of base config files extended by each config includes
`tsconfig.base.json` and not `tsconfig.json`
1. the `include` config is used, and not `files`
2. the `exclude` config includes `target/**/*`
3. the `outDir` compiler option is specified as `target/types`
1. none of these compiler options are specified: `declaration`,
`declarationMap`, `emitDeclarationOnly`, `skipLibCheck`, `target`,
`paths`

4. all references to other packages/plugins use their pkg id, ie:
	
	```js
    // valid
    {
      "kbn_references": ["@kbn/core"]
    }
    // not valid
    {
      "kbn_references": [{ "path": "../../../src/core/tsconfig.json" }]
    }
    ```

5. only packages/plugins which are imported somewhere in the ts code are
listed in `kbn_references`

This linter is not only validating all of the tsconfig.json files, but
it also will fix these config files to deal with just about any
violation that can be produced. Just run `node scripts/ts_project_linter
--fix` locally to apply these fixes, or let CI take care of
automatically fixing things and pushing the changes to your PR.

> **Example:** [`64e93e5`
(#146212)](64e93e5806)
When I merged main into my PR it included a change which removed the
`@kbn/core-injected-metadata-browser` package. After resolving the
conflicts I missed a few tsconfig files which included references to the
now removed package. The TS Project Linter identified that these
references were removed from the code and pushed a change to the PR to
remove them from the tsconfig.json files.

## No bazel? Does that mean no packages??
Nope! We're still doing packages but we're pretty sure now that we won't
be using Bazel to accomplish the 'distributed caching' and 'change-based
tasks' portions of the packages project.

This PR actually makes packages much easier to work with and will be
followed up with the bundling benefits described by the original
packages RFC. Then we'll work on documentation and advocacy for using
packages for any and all new code.

We're pretty confident that implementing distributed caching and
change-based tasks will be necessary in the future, but because of
recent improvements in the repo we think we can live without them for
**at least** a year.

## Wait, there are still BUILD.bazel files in the repo
Yes, there are still three webpack bundles which are built by Bazel: the
`@kbn/ui-shared-deps-npm` DLL, `@kbn/ui-shared-deps-src` externals, and
the `@kbn/monaco` workers. These three webpack bundles are still created
during bootstrap and remotely cached using bazel. The next phase of this
project is to figure out how to get the package bundling features
described in the RFC with the current optimizer, and we expect these
bundles to go away then. Until then any package that is used in those
three bundles still needs to have a BUILD.bazel file so that they can be
referenced by the remaining webpack builds.

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-12-22 19:00:29 -06:00
Spencer
2e314db2ce
Wrap rison-node to improve types (#146649)
@maximpn brought up the issues caused by the types required by the
rison-node package, which attempted to communicate that "encoded values
must be primitive values, or recursive arrays/object of primitive
values". This isn't actually expressible in TypeScript, which lead to
many instances of `rison.encode(value as unknown as RisonValue)` which
is useless. Additionally, the rison-node library actually supports any
value and will either produce valid rison or `undefined` for that value.

To address this I'm adding a wrapper function which accepts `any` and
returns a `string`. If rison-node is totally unable to produce any rison
for the value (because the value is `undefined` or some other type like
Symbol or BigInt) the `encode()` function will throw. If you're
accepting arbitrary input you can use the `encodeUnknown()` function,
which will return a string or undefined, if the value you provided has
zero rison representation.

Like JSON.stringify() any non-circular primitive, object, or array can
be encoded with either function. If the values within those objects are
not encodable (functions, RegExps, etc) then they will be skipped. Any
object/array with the `toJSON()` method will be converted to JSON first,
and if the prototype of the object has the `encode_rison()` method it
will be used to convert he value into rison.

The changes in this PR are mostly updating usage of rison-node to use
`@kbn/rison` (which is also enforced by eslint). There are also several
changes which remove unnecessary casting.
2022-12-01 08:33:56 -07:00
Tiago Costa
016e3e03a4
chore(NA): enables isolatedModules on base tsconfig file (#144841)
This PR enables `isolatedModules` on our `tsconfig.base.json`. Enabling
this means that our codebase is safe for tools that use TypeScript APIs
like `transpileModule` or alternative compilers like Babel. The
requirements introduced by enabling `isolatedModules` were already in
place for every piece of code transpiled with babel so we feel like its
time to make it the default across the board inside our repository.

The DX shouldn't be impacted negatively by these change as we introduced
a lint rule verification for the critical part around `isolatedModules`
which is around `const enums`. The PR also has a couple of `TODOs` to be
removed once we upgrade into typescript v4.8 where we would be able to
say everything that is typescript inside our repo should be consider a
module by default.

More information about `isolatedModules` can be found at
https://www.typescriptlang.org/tsconfig#isolatedModules

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-11-18 19:39:11 +00:00
spalger
42879f7656
[bazel] fix some BUILD.bazel file inconsistencies 2022-10-26 11:07:55 -05:00
Spencer
32491462a9
add kibana.jsonc files to existing packages (#138965)
* [packages] add kibana.jsonc files

* auto-migrate to kibana.jsonc

* support interactive pkg id selection too

* remove old codeowners entry

* skip codeowners generation when .github/CODEOWNERS doesn't exist

* fall back to format validation if user is offline

* update question style

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-09-08 13:31:57 -07:00
Spencer
9003353729
rename @elastic/* packages to @kbn/* (#138957)
* rename @elastic/* packages to @kbn/*

* update yarn.lock

* [CI] Auto-commit changed files from 'node scripts/generate packages_build_manifest'

* update lint task

* review feedback

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-08-18 08:54:42 -07:00
Spencer
bebec37f04
[eslint] fix and skip violations for cross-boundary imports (#136911) 2022-07-29 13:57:55 -05:00
Tiago Costa
b1c7efff8a
chore(NA): prevent disabling eslint protected rules (#137066)
* chore(NA): introduce barebones for no_protected_eslint_disable rule

* chore(NA): includes schema for protected eslint

* chore(NA): more progress on the rule

* chore(NA): first working logic for the rule

* fix(NA): correctly match allowed exclusions

* refact(NA): final refactor to complete rule

* chore(NA): remove non needed additional types

* fix(NA): remove wrongly left custom type

* refact(NA): create parseEslintDisableComment function

* refact(NA): remove option to configure disabled protected rules from configuration

* chore(NA): Update packages/kbn-eslint-plugin-disable/src/helpers/regex.ts

Co-authored-by: Spencer <email@spalger.com>

* refact(NA): use a const instead of function to setup protected rules

* chore(NA): run eslint fix

* refact(NA): removed unused functionality

* add failing test

* refact(NA): rebuild entire comment line on fixing

* refact(NA): joining with a space in between

* chore(NA): improved comparision logic

Co-authored-by: Spencer <email@spalger.com>
Co-authored-by: spalger <spencer@elastic.co>
2022-07-26 16:40:01 -07:00
Spencer
0596007f64
[inspector] remove root-level redirect to common (#136999)
* [inspector] remove root-level redirect to common

* autofix all imports
2022-07-25 11:33:51 -05:00
Spencer
36260fb358
[expressions] remove root-level redirect, import from common (#136997)
Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-07-25 08:07:43 -07:00
Spencer
676be86d9d
[kibana_utils] remove root index.ts file (#137003)
* [kibana_utils] remove root-level index.ts file

* autofix all imports
2022-07-25 08:01:49 -05:00
Tiago Costa
302bd423f3
chore(NA): eslint rule for disallowing naked eslint-disable (#136408)
* chore(NA): eslint rule for disallowing naked eslint-disable

* chore(NA): export new rule and update docs

* chore(NA): creation of rule in ts

* chore(NA): new corrected rule in ts

* refact(NA): remove old logic from older plugin

* docs(NA): update documentation

* docs(NA): update documentation

* docs(NA): update documentation

* refact(NA): include edge cases for better locating errors

* chore(NA): changed regex name

* docs(NA): correct name rule on docs

* refact(NA): use dedent in the template literals

* refact(NA): check for undefined

* fix(NA): introduces support for eslint-disable-line

* chore(NA): fix extra space

* test(NA): created more test cases

* chore(NA): rename plugin to eslint-plugin-disable

* docs(NA): update nav and operations landing page ids for eslint rule

* test(NA): use messageIds on test

* chore(NA): complete naked eslint disables with specific rules

* chore(NA): specific rules for a few naked eslint disable

* chore(NA): add focused eslint disable on big reindex_operation_with_large_error_message.ts file

* chore(NA): changes according PR feedback

* chore(NA): include specific eslint rules on latest naked eslint disable

* chore(NA): missing eslint disable specific rule

* fix(NA): remove comment for js annotator

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

* chore(NA): re add eslint focused disable rule to x-pack/plugins/osquery/cypress/support/coverage.ts

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-07-19 17:11:04 +01:00
Spencer
4f817ad8a0
[kbn/pm] rewrite to avoid needing a build process (#136207)
* [kbn/pm] rewrite to avoid needing a build process

* uncomment timing reporting

* throw in a few missing comments

* Update README.md

* remove extra SomeDevLog interface from ci-stats-core

* remove non-stdio logging from bazel_runner, improve output formatting

* use private fields instead of just ts private props

* promote args to a positional arg

* optionally require the ci-stats-reporter after each command

* allow opt-ing out of vscode config management

* reduce to a single import

* add bit of docs regarding weird imports and package deps of kbn/pm

* clean extraDirs from Kibana's package.json file too

* tweak logging of run-in-packages to use --quiet and not just CI=true

* remove unlazy-loader

* add readme for @kbn/yarn-lock-validator

* convert @kbn/some-dev-logs docs to mdx

* remove missing navigation id and fix id in dev-cli-runner docs

* fix title of some-dev-logs docs page

* typo
2022-07-18 08:46:13 -07:00
Jonathan Budzenski
5d85008aa9
Bump prettier to 2.7.1 (#135143)
* Bump prettier to 2.7.1

* bump eslint-config-prettier

* update .eslintrc
2022-07-05 14:39:20 -05:00
Tiago Costa
3a6cc6e747
chore(NA): remove @kbn/utility-types/jest subpackage (#133448)
* chore(NA): remove @kbn/utility-types/jest subpackage

* chore(NA): include migration rule for import path

* chore(NA): remove double import

* chore(NA): creating a new package

* chore(NA): remove jest mentions from @kbn/utility-types

* docs(NA): complete new readme file

* [CI] Auto-commit changed files from 'node scripts/generate packages_build_manifest'

* chore(NA): remove expect error comment

* chore(NA): merge and solve problems with merge on latest upstream

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-06-03 21:15:06 +01:00
Spencer
a10a4f9f03
Initialize ops documentation section (#132262)
Co-authored-by: Jonathan Budzenski <jon@elastic.co>
Co-authored-by: Tiago Costa <tiago.costa@elastic.co>
2022-05-17 15:22:38 -05:00
Spencer
f3d69b8197
[@kbn/dev-utils] break out more pieces (#132292)
* [@kbn/dev-utils] break out more pieces

* [CI] Auto-commit changed files from 'node scripts/eslint --no-cache --fix'

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
2022-05-17 11:19:20 -05:00
Tiago Costa
dea9159c5d
chore(NA): rename @elastic/eslint-config-kibana as @kbn/eslint-config (#132278) 2022-05-16 13:02:02 -07:00