Commit graph

146 commits

Author SHA1 Message Date
Pierre Gayvallet
3af5893f3b
[i18n] remove Object.freeze in initTranslations (#188813)
## Summary

Fix https://github.com/elastic/kibana/issues/180810

Title.
2024-07-23 09:57:32 +02:00
Ahmad Bamieh
7c6aa3fc8a
[i18n][system upgrade] Upgrade i18n tooling (#186519)
Update i18n tools after the main packages upgrade. This upgrade makes
use of formatJS tooling instead of fully implementing the parsers
ourselves. It also changes our custom AST parsing from babel to the
typescript compiler.
- [x] i18n exrtract
- [x] i18n check
- [x] i18n integrate
- [x] add test cases for formatjs runner
- [x] Make sure all CLI flags are handled properly
- [x] Update tooling readme

Closes https://github.com/elastic/kibana/issues/180616
Closes https://github.com/elastic/kibana/issues/187703

### Note to reviewers

Teams outside operations and core are probably requested to review
because the `i18n_check` fixed malformed i18n messages in your plugins.
Please check and approve :elasticheart:
2024-07-16 21:47:54 +01:00
Matthew Kime
8a5ed874af
[data views] Fix single quotes on field save confirm toast (#184789)
## Summary

Address two cases where single quotes needed to be doubled up to prevent
escaping of string interpolation. Also addressed some doc examples.

Verify confirm toasts after saving field in discover and creating a
scripted field in data view management.

Follow up to https://github.com/elastic/kibana/pull/179506

---------

Co-authored-by: Julia Rechkunova <julia.rechkunova@gmail.com>
2024-06-05 05:09:51 -07: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
Marco Liberati
99fc9099c5
[Lens] Move formula docs into separate package (#173770)
## Summary

Fixes #103248 and #164952

---------

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>
2024-01-02 16:02:46 +02:00
Pierre Gayvallet
2b60d3a6ec
Minor reduce perf optimizations (#170922)
## Summary

Cherry picked from https://github.com/elastic/kibana/pull/168812 the
changes from `core` packages and the `security` and `spaces` plugins

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2023-11-10 07:45:51 -07:00
Chris Cowan
a518276428
Change i18n.translate() to return string type instead of leaving it up to Typescript parser (#164464)
## Summary

While researching why we had so many `ANY`s in our "Any counts by team"
quality report, I noticed that all of the `i18n.translate` in our
`uiSettings` we being reported as `any` even though Typescript says that
function returns a `string`. When I explicitly define the return value,
our `any` count drops from `46` to `2`.

This is the command I ran for the report: `node scripts/build_api_docs
--plugin observability --stats any`

### Before
```
┌─────────┬─────────────────────────────────────────────────────────────────────────────────────────────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ (index) │                                             id                                              │                                                                      link                                                                       │
├─────────┼─────────────────────────────────────────────────────────────────────────────────────────────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│    0    │                        'def-server.getInspectResponse.$1.esResponse'                        │       'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/common/utils/get_inspect_response.ts#:~:text=esResponse'        │
│    1    │                     'def-server.uiSettings.enableInspectEsQueries.name'                     │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│    2    │                 'def-server.uiSettings.enableInspectEsQueries.description'                  │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│    3    │                         'def-server.uiSettings.maxSuggestions.name'                         │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│    4    │                     'def-server.uiSettings.maxSuggestions.description'                      │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│    5    │                   'def-server.uiSettings.enableComparisonByDefault.name'                    │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│    6    │                'def-server.uiSettings.enableComparisonByDefault.description'                │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│    7    │                  'def-server.uiSettings.defaultApmServiceEnvironment.name'                  │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│    8    │              'def-server.uiSettings.defaultApmServiceEnvironment.description'               │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│    9    │                     'def-server.uiSettings.apmProgressiveLoading.name'                      │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   10    │                  'def-server.uiSettings.apmProgressiveLoading.description'                  │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   11    │  'def-server.uiSettings.apmProgressiveLoading.optionLabels.ProgressiveLoadingQuality.off'   │  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=%5BProgressiveLoadingQuality.off%5D'   │
│   12    │  'def-server.uiSettings.apmProgressiveLoading.optionLabels.ProgressiveLoadingQuality.low'   │  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=%5BProgressiveLoadingQuality.low%5D'   │
│   13    │ 'def-server.uiSettings.apmProgressiveLoading.optionLabels.ProgressiveLoadingQuality.medium' │ 'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=%5BProgressiveLoadingQuality.medium%5D' │
│   14    │  'def-server.uiSettings.apmProgressiveLoading.optionLabels.ProgressiveLoadingQuality.high'  │  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=%5BProgressiveLoadingQuality.high%5D'  │
│   15    │              'def-server.uiSettings.apmServiceInventoryOptimizedSorting.name'               │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   16    │           'def-server.uiSettings.apmServiceInventoryOptimizedSorting.description'           │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   17    │               'def-server.uiSettings.apmServiceGroupMaxNumberOfServices.name'               │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   18    │           'def-server.uiSettings.apmServiceGroupMaxNumberOfServices.description'            │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   19    │                      'def-server.uiSettings.apmTraceExplorerTab.name'                       │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   20    │                   'def-server.uiSettings.apmTraceExplorerTab.description'                   │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   21    │                         'def-server.uiSettings.apmLabsButton.name'                          │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   22    │                      'def-server.uiSettings.apmLabsButton.description'                      │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   23    │                 'def-server.uiSettings.enableInfrastructureHostsView.name'                  │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   24    │              'def-server.uiSettings.enableInfrastructureHostsView.description'              │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   25    │                     'def-server.uiSettings.enableAwsLambdaMetrics.name'                     │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   26    │                 'def-server.uiSettings.enableAwsLambdaMetrics.description'                  │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   27    │                    'def-server.uiSettings.enableAgentExplorerView.name'                     │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   28    │                 'def-server.uiSettings.enableAgentExplorerView.description'                 │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   29    │                    'def-server.uiSettings.apmAWSLambdaPriceFactor.name'                     │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   30    │                 'def-server.uiSettings.apmAWSLambdaPriceFactor.description'                 │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   31    │               'def-server.uiSettings.apmAWSLambdaRequestCostPerMillion.name'                │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   32    │                    'def-server.uiSettings.apmEnableServiceMetrics.name'                     │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   33    │                 'def-server.uiSettings.apmEnableServiceMetrics.description'                 │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   34    │                   'def-server.uiSettings.apmEnableContinuousRollups.name'                   │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   35    │               'def-server.uiSettings.apmEnableContinuousRollups.description'                │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   36    │                       'def-server.uiSettings.enableCriticalPath.name'                       │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   37    │                   'def-server.uiSettings.enableCriticalPath.description'                    │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   38    │                  'def-server.uiSettings.syntheticsThrottlingEnabled.name'                   │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   39    │               'def-server.uiSettings.syntheticsThrottlingEnabled.description'               │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   40    │                     'def-server.uiSettings.enableLegacyUptimeApp.name'                      │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   41    │                  'def-server.uiSettings.enableLegacyUptimeApp.description'                  │              'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=description'               │
│   42    │                 'def-server.uiSettings.apmEnableProfilingIntegration.name'                  │                  'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/server/ui_settings.ts#:~:text=name'                  │
│   43    │                                  'def-common.AsPercent.$3'                                  │     'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/common/utils/formatters/formatters.ts#:~:text=fallbackResult'     │
│   44    │                                  'def-common.asPercent.$3'                                  │     'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/common/utils/formatters/formatters.ts#:~:text=fallbackResult'     │
│   45    │                        'def-common.getInspectResponse.$1.esResponse'                        │       'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/common/utils/get_inspect_response.ts#:~:text=esResponse'        │
└─────────┴─────────────────────────────────────────────────────────────────────────────────────────────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘

```

### After
```
┌─────────┬───────────────────────────────────────────────┬────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│ (index) │                      id                       │                                                                link                                                                │
├─────────┼───────────────────────────────────────────────┼────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┤
│    0    │ 'def-server.getInspectResponse.$1.esResponse' │ 'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/common/utils/get_inspect_response.ts#:~:text=esResponse' │
│    1    │ 'def-common.getInspectResponse.$1.esResponse' │ 'https://github.com/elastic/kibana/tree/main/x-pack/plugins/observability/common/utils/get_inspect_response.ts#:~:text=esResponse' │
└─────────┴───────────────────────────────────────────────┴────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
```
2023-08-22 10:42:20 -06:00
ws900
1dbd736b15
Include support to pt and pt-BR in locales.js (#162715) 2023-07-28 22:28:30 +03:00
Thomas Watson
6a0f7b9562
Downgrade Node.js to version 16 (#149531)
Closes #149438

We'll upgrade again once a suitable solution to the issue has been
found.
2023-01-26 11:53:52 +00:00
Thomas Watson
b345f75634
Upgrade Node.js from v16.18.1 to v18.13.0 (#144012)
Closes #134930

Breaking changes in Node.js majors:

- `17.0.0`:
https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V17.md#17.0.0
- `18.0.0`:
https://github.com/nodejs/node/blob/main/doc/changelogs/CHANGELOG_V18.md#18.0.0
2023-01-17 21:04:23 +01: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
Jonathan Budzenski
2ac7ebe3bf
Upgrade to Jest 29 (#143319)
https://jestjs.io/blog/2022/04/25/jest-28
https://jestjs.io/blog/2022/08/25/jest-29

- jest.useFakeTimers('legacy') -> jest.useFakeTimers({ legacyFakeTimers:
true });
- jest.useFakeTimers('modern'); -> jest.useFakeTimers();
- tests can either use promises or callbacks, but not both
- test runner jasmine is no longer included, switch all suites to
jest-circus

Co-authored-by: Andrew Tate <andrew.tate@elastic.co>
2022-11-18 09:40:16 -06:00
Tiago Costa
e41569b4a6
fix(NA): wrongly spread stripInternal and rootDir configs across packages (#144463)
* chore(NA): remove overrides for rootDir on packages

* chore(NA): replace './target_types' with 'target_types' on packages

* chore(NA): removes stripInternal false configs

* chore(NA): remove unused strip internals
2022-11-03 01:04:55 +00:00
spalger
52f2b33a07
[auto] migrate existing plugin/package configs 2022-10-28 14:06:46 -05: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
Tiago Costa
1cbf83f73c
chore(NA): remove src folder requirement from packages (part 2) (#138476)
* refact(NA): apply root_input_dir=src to each already created pkg

* refact(NA): update package generator

* fix(NA): correctly use rootDir

* fix(NA): use root input dir on latest introduced pkgs for jsts_transpiler macro

* chore(NA): merge with main

* chore(NA): first attempt to complete removal of src folder on a small group of pkgs

* Revert "chore(NA): first attempt to complete removal of src folder on a small group of pkgs"

This reverts commit b6f34b7530.

* chore(NA): remove src folder requirement from xpack pkgs

* chore(NA): remove src folder from analytics pkgs

* chore(NA): remove src folder from home pkgs

* chore(NA): remove src folder from shared_ux pkgs

* fix(NA): remove missing src folder inputs on sharedux pkg

* chore(NA): remove src folder from kbn-a* pkgs

* chore(NA): remove src folder from kbn-b* pkgs

* chore(NA): remove src folder from kbn-c* pkgs

* chore(NA): correct exclude pattern for each changed pkg

* chore(NA): remove src folder from kbn-y* pkgs

* chore(NA): remove src folder from kbn-e* pkgs

* chore(NA): remove src folder from kbn-f* and kbn-g* pkgs

* chore(NA): remove src folder from kbn-f* and kbn-g* pkgs

* chore(NA): remove src folder from kbn-h** pkgs

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

* Revert "chore(NA): remove src folder from kbn-h** pkgs"

This reverts commit dcdf72bcc1.

* fix(NA): grammar location

* test(NA): fix tests for kbn/config-schema

* test(NA): fix tests for kbn/config-schema

* chore(NA): multiple errors fixed

* chore(NA): remove kuery grammar fix

* fix(NA): @kbn/ace imports

* fix(NA): grammar location

* fix(NA): add missing files to tsconfigs

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

* chore(NA): complete tsconfigs

* Revert "chore(NA): complete tsconfigs"

This reverts commit f48c616864.

* chore(NA): remove src folder from kbn-core* pkgs

* chore(NA): remove src folder from kbn-u* pkgs

* chore(NA): remove src folder from kbn-ui-shared-deps* pkgs

* chore(NA): fix problems on core pkgs

* chore(NA): fix problems on core pkgs

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

* fix(NA): shared_built_assets correct location'

* test(NA): update @kbn/optimizer integration snapshots

* chore(NA): remove src folder from kbn-t* p1 pkgs

* chore(NA): remove src folder from kbn-t* p2 pkgs

* chore(NA): update rootDir on utility types pkg

* chore(NA): include missing files on @kbn/test

* chore(NA): include missing files on @kbn/test

* fix(NA): new jest preset paths on @kbn/test

* chore(NA): fix eslint

* fix(NA): new jest preset paths on @kbn/test

* chore(NA): remove exclusion for mocks folde on @kbn/test

* fix(NA): several imports from target_node

* fix(NA): @kbn/test mocha and jest types clash

* chore(NA): remove src folder from kbn-storybook pkg

* chore(NA): remove src folder from kbn-stdio-dev-helpers pkg

* chore(NA): remove src folder from kbn-std pkg

* chore(NA): remove src folder from kbn-sort-pkg-json pkg

* chore(NA): remove src folder from kbn-some-dev-log and kbn-shared-ux-utility pkgs

* chore(NA): remove src folder from kbn-ux-storybook pkg

* chore(NA): remove src folder from kbn-shared-ux-services pkg

* chore(NA): remove src folder from kbn-shared-ux-components pkg

* chore(NA): remove src folder from kbn-shared-svg pkg

* chore(NA): remove src folder from kbn-server-http-tools pkg

* chore(NA): remove src folder from kbn-securitysolution-* pkgs

* chore(NA): remove src folder from kbn-r-* pkgs

* chore(NA): remove src folder from kbn-p* pkgs

* chore(NA): remove src folder from kbn-o* pkgs

* chore(NA): remove src folder from kbn-m* pkgs

* chore(NA): remove src folder from kbn-j,k,l* pkgs

* chore(NA): remove src folder from kbn-j,k,l* pkgs

* chore(NA): remove src folder from kbn-io-ts-utils* pkgs

* chore(NA): remove src folder from kbn-* pkgs except a few

* chore(NA): update @kbn/generate

* fix(NA): wrong exclusion on kbn-storybook

* chore(NA): remove src folder from kbn-monaco pkg

* chore(NA): remove src folder from kbn-interpreter pkg

* fix(NA): wrong exclusion on kbn-storybook

* chore(NA): update every require for target_*/src

* chore(NA): remover src folder from @kbn/handlebars

* fix(NA): license for @kbn/handlebars

* chore(NA): copy templates as part of the jsts_transpiler macro for @kbn/storybook

* chore(NA): update handlebars

* fix(NA): @kbn/plugin-generator import paths

* fix(NA): bundle sizes

* fix(NA): web bundle for @kbn/i18n-react

* Revert "fix(NA): bundle sizes"

This reverts commit 8aefe84fbc.

* Revert "Revert "fix(NA): bundle sizes""

This reverts commit e9d87d72a4.

* fix(NA): @kbn/docs-utils index.ts path expectation

* chore(NA): merge and solve conflicts with main

* fix(NA): relative import to index

* chore(NA): merge and solve conflicts with main

* [CI] Auto-commit changed files from 'node scripts/precommit_hook.js --ref HEAD~1..HEAD --fix'

* chore(NA): apply eslint fix

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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-08-30 15:57:35 +01:00
Tiago Costa
df8b62aa98
chore(NA): allow packages to not have an obligation for a src folder on packages (#138038)
* refact(NA): apply root_input_dir=src to each already created pkg

* refact(NA): update package generator

* fix(NA): correctly use rootDir

* fix(NA): use root input dir on latest introduced pkgs for jsts_transpiler macro

* chore(NA): merge with main

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-08-08 15:54:05 +01:00
Alejandro Fernández Haro
c3500c21e9
[IDM] Assign author: Kibana Core to packages owned by core (#137887) 2022-08-02 10:25:53 -07: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
a3b2757e4e
[type-summarizer] reimplement for broader support (#135163)
* [type-summarizer] reimplement for broader support

* Enable sourceMaps in all packages

* include naming collision in summarizePackage test

* fix readmes

* remove unnecessary transient dependency

* remove code that was commented out

* remove outdated todo comment

* ensure errors triggered by untyped-exports are ligible

* remove unused import

* break out snippet generation from AstIndexer

* refactor several massive files into smaller pieces and add more inline docs

* fix typos

* update jest snapshots

* add sections to readme that points people to the useful parts of the source code along with a high-level overview of how the type-summarizer works

* remove --dump flag, it doesn't work

* use decName instead of calling names.get a second time

* include `export` as invalid name
2022-07-06 13:48:45 -05:00
spalger
3730dd0779 fix all violations 2022-04-16 01:37:30 -05:00
Spencer
614139b8e5
[bazel] avoid a little boilerplate in packages (#126309)
* [bazel] avoid a little boilerplate for @types packages

* [bazel/ts] stop building sourcemaps since they're ignored
2022-02-24 12:43:12 -06:00
Tiago Costa
a5b4b822ce
chore(NA): splits types from code on @kbn/test (#124469)
* chore(NA): splits types from code on @kbn/test

* chore(NA): create new @kbn/test-jest-helpers

* chore(NA): move wrong files into @kbn/test

* chore(NA): remove @kbn/test/jest references

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2022-02-04 03:27:39 +00:00
Tiago Costa
9d662b77be
chore(NA): splits types from code on @kbn/i18n (#119256)
* chore(NA): auto creation of the package.json for the new types pkg rule

* chore(NA): first alpha api extractor working version

* chore(NA): support kbn-analytics

* chore(NA): correctly read tsconfig files and deps from ts_config rule

* chore(NA): layed out pkg_npm_types tree artifact custom rule

* chore(NA): missing todos

* chore(NA): node modules link mapping

* chore(NA): fully working pkg_npm_types rule

* chore(NA): fix changes on new packages using elastic datemath pkgs

* docs(NA): remove todo

* docs(NA): last todo text correction

* chore(NA): removed commented lines

* fix(NA): include missing package version

* chore(NA): include license keys

* chore(NA): change mock types package into private

* chore(NA): disable validator on ts_project rule

* chore(NA): use the wrapper for ts_project

* commit using @elastic.co

* chore(NA): commit using @elastic.co

* chore(NA): split types from code on @kbn/i18n

* chore(NA): update yarn.lock file

* chore(NA): split @kbn/i18n and @kbn/i18n-react

* chore(NA): missing import fix

* chore(NA): fix jest project configs

* chore(NA): change imports on kbn i18n

* chore(NA): change imports on kbn i18n

* chore(NA): correct loader imports

* chore(NA): missnig i18nLoader export key

* chore(NA): fix type exports

* chore(NA): export type only

* chore(NA): export type only

* fix(NA): type exports

* chore(NA): missing @Kbn/i18n/react imports

* chore(NA): missing skip path for kbn-i18n-react

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-11-24 17:18:03 +00:00
Jonathan Budzenski
7d66002da2
Bump node to 16.11.1 (#110684)
* Bump node to ^16

* fix comment

* use jest timers

* bump mock-fs

* Fix core type errors

* Unskipping tests that work on my machine

* skip new unhandled promise rejection

* Fix Nodejs v16 regression due to https://github.com/nodejs/node/issues/38924

* Fix failing concurrent connections collector test

* Fix types after merge from master

* update servicenow test

* Skip unhandledRejection tests

* Skip tests with unhandled promise rejection

* Fix discover jest failures

* bump node to 16.11.1

* revert timeout increase

* skip unhandled promise rejection

* rm jest import

* skip unhandled promise rejection

Co-authored-by: Rudolf Meijering <skaapgif@gmail.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Tim Roes <tim.roes@elastic.co>
2021-10-16 16:21:58 -05:00
Ahmad Bamieh
d19510535a
[i18n] remove angular i18n and move the remains to monitoring plugin (#115003) 2021-10-15 12:09:19 +03:00
Tyler Smalley
4681a80317
[DX] Upgrade prettier to v2.4.0 (#112359)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2021-09-19 22:34:30 -07:00
Tiago Costa
7c4e4f507b
chore(NA): replace babel config files by inline presets by default in the jsts_transpiler rule (#110620)
* chore(NA): replace babel config files by inline presets by default in the js_ts_transpiler rule

* chore(NA): update @kbn/ace build to exclude worker file

* chore(NA): remove config file support

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-09-03 21:17:46 +01:00
Spencer
c0395c9ef6
[build_ts_refs] improve caches, allow building a subset of projects (#107981)
* [build_ts_refs] improve caches, allow building a subset of projects

* cleanup project def script and update refs in type check script

* rename browser_bazel config to avoid kebab-case

* remove execInProjects() helper

* list references for tsconfig.types.json for api-extractor workload

* disable composite features of tsconfig.types.json for api-extractor

* set declaration: true to avoid weird debug error

* fix jest tests

Co-authored-by: spalger <spalger@users.noreply.github.com>
2021-08-10 22:12:45 -07:00
Tiago Costa
11c32c3de1
chore(NA): moving @kbn/i18n to babel transpiler (#107447) 2021-08-03 12:55:04 +01:00
Christiane (Tina) Heiligers
9e60da5b46
[Localization] Adds guidelines about markdown and long paragraphs (#104171) 2021-07-01 15:28:48 -04:00
Spencer
407b96e021
[eslint/module-migration] add support for re-export defs and test rule (#102840)
Co-authored-by: spalger <spalger@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-06-28 14:28:10 -07:00
Anton Dosov
be1c5bbd72
Don't import react-intl directly to reduce bundle sizes (#102497) 2021-06-24 16:52:55 +02:00
Tiago Costa
50616aa0f9
chore(NA): correctly setup dep order on js_library to fix windows build (#100420) 2021-05-21 00:03:54 +01:00
Tiago Costa
4f754550e8
refact(NA): remove extra pkg_npm target and add specific target folders for @kbn/i18n on Bazel (#100271)
* refact(NA): remove extra pkg_npm target and add specific target folders on @kbn/i18n

* chore(NA): override the browser types
2021-05-18 17:49:23 -04:00
Tiago Costa
7124719d5b
chore(NA): moving @kbn/i18n into bazel (#99390)
* chore(NA): moving @kbn/i18n into bazel

* chore(NA): include javascript locales.js files

* chore(NA): remove build scripts

* chore(NA): remove node types on browser

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2021-05-14 21:12:20 +01:00
Tiago Costa
f690c60517
chore(NA): moving @kbn/dev-utils into bazel (#98496)
* chore(NA): moving @kbn/dev-utils into bazel

* docs(NA): updated generated plugin list
2021-04-28 23:46:33 +01:00
Tiago Costa
b6fd28884b
chore(NA): moving @kbn/babel-preset into bazel (#97271)
* chore(NA): moving @kbn/babel-preset into bazel

* chore(NA): remove unused deps from xpack package.json
2021-04-19 12:37:56 +02:00
Tiago Costa
50313f75f6
chore(NA): enable preserve symlinks for ts without breaking packages development (#95433)
* chore(NA): move elastic-datemath into a ts package

* chore(NA): finish elastic-datemath

* chore(NA): finish elastic-datemath

* chore(NA): source folder for elastic-datemath

* chore(NA): add source-maps ace, analytics, apm-config-loader and apm-utils packages

* chore(NA): add sourcemaps to packages on typescript

* chore(NA): move test fixtures within source

* chore(NA): correct exclusions on packages

* chore(NA): correct package.json on all packages

* chore(NA): correct package.json on all packages

* chore(NA): complete kbn pm

* chore(NA): default export on elastic-datemath

* chore(NA): include logs on kbn-logging

* chore(NA): update bundle ref module to last code used in the webpack upstream

* chore(NA): update bundle ref module to last code used in the webpack upstream - refactored

* chore(NA): remove override method for exportsArgument

* fix(NA): typechecking problems by use @internal at javascript import sources on kbn-test package

* fix(NA): typescript projects check

* fix(NA): run optimizer integration tests from source

* chore(NA): fix usage from target for kbn optimizer

* chore(NA): path on tsconfig

* chore(NA): move tsignore into ts-expect-error

* chore(NA): include souce maps on kbn cli dev

* chore(NA): include souce maps on kbn-crypto, kbn-server-http-tools and kbn-telemetry-tools

* chore(NA): add issue links into the ts-expect-error comments
2021-03-31 00:02:22 +01:00
Brandon Kobel
4584a8b570
Elastic License 2.0 (#90099)
* Updating everything except the license headers themselves

* Applying ESLint rules

* Manually replacing the stragglers
2021-02-03 18:12:39 -08:00
Brandon Kobel
170a2956c8
Updating the License (#88343)
* Updating the Licenses, except for applying eslint, building

* Applying ESLint rules,building @kbn/pm, regenerating api docs
2021-01-19 17:52:56 -08:00
Kukhyeon Heo
77947b64d2
Add i18n test helper documentation. (#46298) 2021-01-04 09:22:42 -07:00
Tyler Smalley
b593781009
Jest multi-project configuration (#77894)
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-12-02 11:42:23 -08:00
Mikhail Shustov
ec983ef610
do not export types from 3rd party modules as 'type' (#83803)
to avoid inlining. see 9 https://www.techatbloomberg.com/blog/10-insights-adopting-typescript-at-scale/
2020-11-20 15:27:37 +01:00
Tyler Smalley
aba2068291
Consolidates Jest configuration files and scripts (#82671)
Jest tests are currently organized into main configuration files (src/dev/jest/config.js and x-pack/dev-tools/jest/create_jest_config.js). Both of these are similar, but very slightly due to  previously being in separate repositories. This change consolidates the scripts referenced in those configs and moves them to the `@kbn/test` project.

OSS contained an alias for `test_utils`. Those aliases have been removed in favor of importing these utilities from `@kbn/test/jest`

Blocker to #72569

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
2020-11-12 16:19:56 -08:00
Thomas Watson
4c49d5d1be
Upgrade Node.js to version 12 (#61587) 2020-11-12 22:00:57 +01:00
Tiago Costa
0eeaafa722
chore(NA): move into single pkg json (#80015)
* chore(NA): update gitignore to include first changes from moving into a single package.json

* chore(NA): update gitignore

* chore(NA): move all the dependencies into the single package.json and apply changes to bootstrap

* chore(NA): fix types problems after the single package json

* chore(NA): include code to find the dependencies used across the code

* chore(NA): introduce pure lockfile for install dependencies on build

* chore(NA): update clean task to not delete anything from xpack node_modules

* chore(NA): update gitignore to remove development temporary rules

* chore(NA): update notice file

* chore(NA): update jest snapshots

* chore(NA): fix whitelisted licenses to include a new specify form of an already included one

* chore(NA): remove check lockfile symlinks from child projects

* chore(NA): fix eslint and add missing declared deps on single pkg json

* chore(NA): correctly update notice

* chore(NA): fix failing jest test for storyshots.test.tsx

* chore(NA): fix cypress multi reporter path

* chore(NA): fix Project tests check

* chore(NA): fix problem with logic to detect used dependes on oss build

* chore(NA): include correct x-pack plugins dep discovery

* chore(NA): discover entries under dynamic requires on vis_type_timelion

* chore(NA): remove canvas

* test(NA): fix jest unit tests

* chore(NA): remove double react declaration from storyshot test file

* chore(NA): try removing isOSS check

* chore(NA): support for plugin development

* chore(NA): update logic to fix unit tests and typechecking

* chore(NA): support to run npm scripts in child kbn projects across all envs

* chore(NA): support github checks reporter on x-pack and remove cpy types as the package correctly provides them

* chore(NA): update cpy version

* chore(NA): include last kbn pm changes

* chore(NA): update style on build_production_projects.ts

* chore(NA): remove any cast fom telemetry opt in stats

* chore(NA): remove del and re-use rm -rf again

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-11-02 21:18:52 +00:00
Ahmad Bamieh
025af1ad3f
remove react-intl from kibana and keep it inside only i18n package (#78956)
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
2020-10-06 01:41:49 +03:00
Spencer
ddf2d82e44
[kbn/optimizer] implement more efficient auto transpilation for node (#79052)
Co-authored-by: spalger <spalger@users.noreply.github.com>
2020-10-02 18:36:25 -07:00