From 016e3e03a46b8702a686f5bb60190d41b69f51e5 Mon Sep 17 00:00:00 2001 From: Tiago Costa Date: Fri, 18 Nov 2022 19:39:11 +0000 Subject: [PATCH] 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> --- .../content-management/inspector/BUILD.bazel | 22 +++++++--------- .../content-management/inspector/package.json | 3 ++- .../inspector/tsconfig.json | 4 +-- packages/kbn-eslint-config/typescript.js | 9 ++++++- .../src/worker/entry_point_creator.ts | 3 +++ .../src/use_api/types.ts | 7 ----- .../src/path_validations/index.ts | 6 ++--- src/plugins/bfetch/public/types.ts | 7 ----- .../console_editor/editor.test.mock.tsx | 4 +++ src/plugins/controls/public/index.ts | 6 ++--- .../field_format_editor/editors/index.ts | 26 +++++++++---------- .../server/fetch_event_annotations/index.ts | 4 +++ src/plugins/expressions/server/index.ts | 12 ++++----- .../kbn_tp_run_pipeline/public/types.ts | 3 +-- tsconfig.base.json | 7 +++++ .../anomaly_detection/apm_ml_detectors.ts | 2 +- x-pack/plugins/apm/common/privilege_type.ts | 2 +- .../charts/helper/get_timeseries_color.ts | 2 +- .../cases/public/common/mock/match_media.ts | 4 +++ .../actions/tags/edit_tags_selectable.tsx | 6 ++--- x-pack/plugins/cases/server/common/index.ts | 4 +++ .../mocks/breadcrumbs.mock.ts | 4 +++ .../mocks/track_ui_metric.mock.ts | 4 +++ .../dashboard_drilldown_config.test.tsx | 4 +++ .../enterprise_search/common/types/api.ts | 2 +- .../tables/__mocks__/engines_logic.mock.ts | 4 +++ .../components/new_index/new_index.tsx | 2 +- .../enterprise_search_content/types.ts | 4 +-- .../agent_enrollment_flyout.test.mocks.ts | 4 +++ .../client_integration/helpers/mocks.ts | 4 +++ .../lib/adapters/log_entries/adapter_types.ts | 6 ----- .../server/lib/adapters/log_entries/index.ts | 6 ----- x-pack/plugins/lists/common/index.ts | 4 +++ .../set_view_control/number_form_row.tsx | 6 ----- .../routes/apidoc_scripts/schema_parser.ts | 4 +++ .../common/progressive_loading.ts | 2 +- .../alerts/components/alerts_search_bar.tsx | 6 ----- .../plugins/osquery/cypress/plugins/index.ts | 4 +++ .../osquery/cypress/support/coverage.ts | 4 +++ .../client_integration/helpers/jest.mocks.tsx | 4 +++ .../rule_management/api/urls.ts | 6 ----- .../plugins/security_solution/common/index.ts | 4 +++ .../security_solution/risk_score/all/index.ts | 4 +-- .../risk_score/common/index.ts | 2 +- .../cypress/tasks/risk_scores/common.ts | 2 +- .../guided_onboarding_tour/tour_config.ts | 4 +-- .../ml/anomaly/use_anomalies_search.ts | 2 +- .../public/common/mock/formatted_relative.ts | 4 +++ .../public/common/mock/match_media.ts | 4 +++ .../public/common/store/inputs/constants.ts | 2 +- .../pages/policy/view/tabs/policy_tabs.tsx | 2 +- .../public/risk_score/containers/index.ts | 4 +-- .../server/__mocks__/action.mock.ts | 2 +- .../content/prepackaged_rules/notice.ts | 4 +++ .../common/types/process_tree/index.ts | 6 ++--- .../security/tines/constants.ts | 2 +- .../cases/cases_webhook/types.ts | 2 +- .../threat_intelligence/common/constants.ts | 2 +- .../indicators/components/flyout/flyout.tsx | 2 +- .../application/hooks/use_sub_action.tsx | 2 +- .../ui_capabilities/common/lib}/index.ts | 3 +++ .../common/lib/unreachable_error.ts | 2 +- .../security_and_spaces/tests/catalogue.ts | 1 + .../security_and_spaces/tests/foo.ts | 1 + .../security_and_spaces/tests/nav_links.ts | 1 + .../spaces_only/tests/catalogue.ts | 1 + .../ui_capabilities/spaces_only/tests/foo.ts | 1 + .../spaces_only/tests/nav_links.ts | 1 + 68 files changed, 174 insertions(+), 120 deletions(-) delete mode 100644 packages/kbn-securitysolution-list-hooks/src/use_api/types.ts delete mode 100644 src/plugins/bfetch/public/types.ts delete mode 100644 x-pack/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts delete mode 100644 x-pack/plugins/infra/server/lib/adapters/log_entries/index.ts delete mode 100644 x-pack/plugins/maps/public/connected_components/toolbar_overlay/set_view_control/number_form_row.tsx delete mode 100644 x-pack/plugins/observability/public/pages/alerts/components/alerts_search_bar.tsx delete mode 100644 x-pack/plugins/security_solution/common/detection_engine/rule_management/api/urls.ts rename x-pack/{plugins/transform/public/app/sections/transform_management/components/managed_transforms_callout => test/ui_capabilities/common/lib}/index.ts (76%) diff --git a/packages/content-management/inspector/BUILD.bazel b/packages/content-management/inspector/BUILD.bazel index db6d9e4889425..c4f70c67f68e6 100644 --- a/packages/content-management/inspector/BUILD.bazel +++ b/packages/content-management/inspector/BUILD.bazel @@ -110,7 +110,6 @@ ts_project( srcs = SRCS, deps = TYPES_DEPS, declaration = True, - declaration_map = True, emit_declaration_only = True, out_dir = "target_types", tsconfig = ":tsconfig", @@ -124,6 +123,14 @@ js_library( visibility = ["//visibility:public"], ) +js_library( + name = "npm_module_types", + srcs = NPM_MODULE_EXTRA_FILES, + deps = RUNTIME_DEPS + [":target_node", ":target_web", ":tsc_types"], + package_name = PKG_REQUIRE_NAME, + visibility = ["//visibility:public"], +) + pkg_npm( name = "npm_module", deps = [":" + PKG_DIRNAME], @@ -135,17 +142,8 @@ filegroup( visibility = ["//visibility:public"], ) -pkg_npm_types( - name = "npm_module_types", - srcs = SRCS, - deps = [":tsc_types"], - package_name = PKG_REQUIRE_NAME, - tsconfig = ":tsconfig", - visibility = ["//visibility:public"], -) - -filegroup( +pkg_npm( name = "build_types", - srcs = [":npm_module_types"], + deps = [":npm_module_types"], visibility = ["//visibility:public"], ) diff --git a/packages/content-management/inspector/package.json b/packages/content-management/inspector/package.json index f7bd8c072bcec..60a04483baee8 100644 --- a/packages/content-management/inspector/package.json +++ b/packages/content-management/inspector/package.json @@ -4,5 +4,6 @@ "version": "1.0.0", "main": "./target_node/index.js", "browser": "./target_web/index.js", - "license": "SSPL-1.0 OR Elastic License 2.0" + "license": "SSPL-1.0 OR Elastic License 2.0", + "types": "./target_types/index.d.ts" } diff --git a/packages/content-management/inspector/tsconfig.json b/packages/content-management/inspector/tsconfig.json index 9f42450328c9e..695a24957687b 100644 --- a/packages/content-management/inspector/tsconfig.json +++ b/packages/content-management/inspector/tsconfig.json @@ -2,10 +2,8 @@ "extends": "../../../tsconfig.bazel.json", "compilerOptions": { "declaration": true, - "declarationMap": true, "emitDeclarationOnly": true, "outDir": "target_types", - "stripInternal": false, "types": [ "jest", "node", @@ -17,6 +15,6 @@ }, "include": [ "**/*.ts", - "**/*.tsx", + "**/*.tsx", ] } diff --git a/packages/kbn-eslint-config/typescript.js b/packages/kbn-eslint-config/typescript.js index 777b02a4cf618..76506b640746d 100644 --- a/packages/kbn-eslint-config/typescript.js +++ b/packages/kbn-eslint-config/typescript.js @@ -257,7 +257,14 @@ module.exports = { 'import/no-default-export': 'error', 'eslint-comments/no-unused-disable': 'error', - 'eslint-comments/no-unused-enable': 'error' + 'eslint-comments/no-unused-enable': 'error', + 'no-restricted-syntax': [ + 'error', + { + "selector": "TSEnumDeclaration[const=true]", + "message": "Do not use `const` with enum declarations" + } + ] }, eslintConfigPrettierRules ) diff --git a/packages/kbn-optimizer/src/worker/entry_point_creator.ts b/packages/kbn-optimizer/src/worker/entry_point_creator.ts index e2ec8c9afb50f..27a16a2daec8d 100644 --- a/packages/kbn-optimizer/src/worker/entry_point_creator.ts +++ b/packages/kbn-optimizer/src/worker/entry_point_creator.ts @@ -6,6 +6,9 @@ * Side Public License, v 1. */ +// TODO: we should be able to remove this ts-ignore while using isolatedModules +// this is a skip for the errors created when typechecking with isolatedModules +// @ts-ignore module.exports = function ({ entries, }: { diff --git a/packages/kbn-securitysolution-list-hooks/src/use_api/types.ts b/packages/kbn-securitysolution-list-hooks/src/use_api/types.ts deleted file mode 100644 index 5c2d5b68ae2e0..0000000000000 --- a/packages/kbn-securitysolution-list-hooks/src/use_api/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ diff --git a/packages/kbn-securitysolution-utils/src/path_validations/index.ts b/packages/kbn-securitysolution-utils/src/path_validations/index.ts index 4e296cb90584c..ba17757589613 100644 --- a/packages/kbn-securitysolution-utils/src/path_validations/index.ts +++ b/packages/kbn-securitysolution-utils/src/path_validations/index.ts @@ -16,13 +16,13 @@ export const FILEPATH_WARNING = i18n.translate('utils.filename.pathWarning', { defaultMessage: `Path may be formed incorrectly; verify value`, }); -export const enum ConditionEntryField { +export enum ConditionEntryField { HASH = 'process.hash.*', PATH = 'process.executable.caseless', SIGNER = 'process.Ext.code_signature', } -export const enum EntryFieldType { +export enum EntryFieldType { HASH = '.hash.', EXECUTABLE = '.executable.caseless', PATH = '.path', @@ -39,7 +39,7 @@ export type AllConditionEntryFields = | BlocklistConditionEntryField | 'file.path.text'; -export const enum OperatingSystem { +export enum OperatingSystem { LINUX = 'linux', MAC = 'macos', WINDOWS = 'windows', diff --git a/src/plugins/bfetch/public/types.ts b/src/plugins/bfetch/public/types.ts deleted file mode 100644 index 5c2d5b68ae2e0..0000000000000 --- a/src/plugins/bfetch/public/types.ts +++ /dev/null @@ -1,7 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0 and the Server Side Public License, v 1; you may not use this file except - * in compliance with, at your election, the Elastic License 2.0 or the Server - * Side Public License, v 1. - */ diff --git a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.mock.tsx b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.mock.tsx index fa138fea22e9c..059a0912d3ec8 100644 --- a/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.mock.tsx +++ b/src/plugins/console/public/application/containers/editor/legacy/console_editor/editor.test.mock.tsx @@ -6,6 +6,10 @@ * Side Public License, v 1. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + jest.mock('../../../../contexts/editor_context/editor_registry', () => ({ instance: { setInputEditor: () => {}, diff --git a/src/plugins/controls/public/index.ts b/src/plugins/controls/public/index.ts index ac7a2ab23df84..41eebbfd22ccf 100644 --- a/src/plugins/controls/public/index.ts +++ b/src/plugins/controls/public/index.ts @@ -32,7 +32,7 @@ export { } from '../common'; export { - ControlGroupContainer, + type ControlGroupContainer, ControlGroupContainerFactory, type ControlGroupInput, type ControlGroupOutput, @@ -40,13 +40,13 @@ export { export { OptionsListEmbeddableFactory, - OptionsListEmbeddable, + type OptionsListEmbeddable, type OptionsListEmbeddableInput, } from './options_list'; export { RangeSliderEmbeddableFactory, - RangeSliderEmbeddable, + type RangeSliderEmbeddable, type RangeSliderEmbeddableInput, } from './range_slider'; diff --git a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/index.ts b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/index.ts index 18ac46228d912..e5aa5c5495a2f 100644 --- a/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/index.ts +++ b/src/plugins/data_view_field_editor/public/components/field_format_editor/editors/index.ts @@ -10,17 +10,17 @@ export type { DefaultFormatEditor } from './default'; export type { FieldFormatEditor, FieldFormatEditorFactory, FormatEditorProps } from './types'; export type { UrlFormatEditorFormatParams } from './url'; -export { BytesFormatEditor, bytesFormatEditorFactory } from './bytes'; -export { ColorFormatEditor, colorFormatEditorFactory } from './color'; -export { DateFormatEditor, dateFormatEditorFactory } from './date'; -export { DateNanosFormatEditor, dateNanosFormatEditorFactory } from './date_nanos'; +export { type BytesFormatEditor, bytesFormatEditorFactory } from './bytes'; +export { type ColorFormatEditor, colorFormatEditorFactory } from './color'; +export { type DateFormatEditor, dateFormatEditorFactory } from './date'; +export { type DateNanosFormatEditor, dateNanosFormatEditorFactory } from './date_nanos'; export { defaultFormatEditorFactory } from './default'; -export { DurationFormatEditor, durationFormatEditorFactory } from './duration'; -export { GeoPointFormatEditor, geoPointFormatEditorFactory } from './geo_point'; -export { HistogramFormatEditor, histogramFormatEditorFactory } from './histogram'; -export { NumberFormatEditor, numberFormatEditorFactory } from './number'; -export { PercentFormatEditor, percentFormatEditorFactory } from './percent'; -export { StaticLookupFormatEditor, staticLookupFormatEditorFactory } from './static_lookup'; -export { StringFormatEditor, stringFormatEditorFactory } from './string'; -export { TruncateFormatEditor, truncateFormatEditorFactory } from './truncate'; -export { UrlFormatEditor, urlFormatEditorFactory } from './url'; +export { type DurationFormatEditor, durationFormatEditorFactory } from './duration'; +export { type GeoPointFormatEditor, geoPointFormatEditorFactory } from './geo_point'; +export { type HistogramFormatEditor, histogramFormatEditorFactory } from './histogram'; +export { type NumberFormatEditor, numberFormatEditorFactory } from './number'; +export { type PercentFormatEditor, percentFormatEditorFactory } from './percent'; +export { type StaticLookupFormatEditor, staticLookupFormatEditorFactory } from './static_lookup'; +export { type StringFormatEditor, stringFormatEditorFactory } from './string'; +export { type TruncateFormatEditor, truncateFormatEditorFactory } from './truncate'; +export { type UrlFormatEditor, urlFormatEditorFactory } from './url'; diff --git a/src/plugins/event_annotation/server/fetch_event_annotations/index.ts b/src/plugins/event_annotation/server/fetch_event_annotations/index.ts index 474b5286c49ef..b6c0792f4d6de 100644 --- a/src/plugins/event_annotation/server/fetch_event_annotations/index.ts +++ b/src/plugins/event_annotation/server/fetch_event_annotations/index.ts @@ -8,6 +8,10 @@ // TODO: implement this on the server +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + // import { StartServicesAccessor } from '@kbn/core/server'; // import { EventAnnotationStartDependencies } from '../plugin'; diff --git a/src/plugins/expressions/server/index.ts b/src/plugins/expressions/server/index.ts index facb1b80fb759..2e087d33c7aa5 100644 --- a/src/plugins/expressions/server/index.ts +++ b/src/plugins/expressions/server/index.ts @@ -75,23 +75,23 @@ export type { export { buildExpression, buildExpressionFunction, - Execution, - Executor, + type Execution, + type Executor, ExpressionFunction, - ExpressionFunctionParameter, + type ExpressionFunctionParameter, ExpressionRenderer, - ExpressionRendererRegistry, + type ExpressionRendererRegistry, ExpressionType, FontStyle, FontWeight, format, formatExpression, - FunctionsRegistry, + type FunctionsRegistry, isExpressionAstBuilder, Overflow, parse, parseExpression, TextAlignment, TextDecoration, - TypesRegistry, + type TypesRegistry, } from '../common'; diff --git a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts index 56d04da36f62a..d74b78b3535cc 100644 --- a/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts +++ b/test/interpreter_functional/plugins/kbn_tp_run_pipeline/public/types.ts @@ -9,5 +9,4 @@ import { ExpressionsStart, ExpressionRenderHandler } from '@kbn/expressions-plugin/public'; import { Adapters } from '@kbn/inspector-plugin/public'; -export type { ExpressionsStart, Adapters }; -export { ExpressionRenderHandler }; +export type { ExpressionsStart, ExpressionRenderHandler, Adapters }; diff --git a/tsconfig.base.json b/tsconfig.base.json index b0b8fc1d79090..d3591343954d8 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1211,6 +1211,13 @@ "strict": true, // for now, don't use unknown in catch "useUnknownInCatchVariables": false, + // enabled to point out not supported features when emitting in an isolated module environment + "isolatedModules": true, + // TODO(jbudz): should be uncommented when upgrading to TS@4.8 + // + // ensures every non-declaration file is treated as a module + // "moduleDetection": "force", + // // disabled for better IDE support, enabled when running the type_check script "composite": false, // enabled for improved performance diff --git a/x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts b/x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts index e8c894cfdd01b..72f4d361ff95f 100644 --- a/x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts +++ b/x-pack/plugins/apm/common/anomaly_detection/apm_ml_detectors.ts @@ -5,7 +5,7 @@ * 2.0. */ -export const enum ApmMlDetectorType { +export enum ApmMlDetectorType { txLatency = 'txLatency', txThroughput = 'txThroughput', txFailureRate = 'txFailureRate', diff --git a/x-pack/plugins/apm/common/privilege_type.ts b/x-pack/plugins/apm/common/privilege_type.ts index 161225da68480..3c2a0da3f3f05 100644 --- a/x-pack/plugins/apm/common/privilege_type.ts +++ b/x-pack/plugins/apm/common/privilege_type.ts @@ -7,7 +7,7 @@ import * as t from 'io-ts'; -export const enum PrivilegeType { +export enum PrivilegeType { EVENT = 'event:write', AGENT_CONFIG = 'config_agent:read', } diff --git a/x-pack/plugins/apm/public/components/shared/charts/helper/get_timeseries_color.ts b/x-pack/plugins/apm/public/components/shared/charts/helper/get_timeseries_color.ts index 5098839330c95..1fb0f89bb0860 100644 --- a/x-pack/plugins/apm/public/components/shared/charts/helper/get_timeseries_color.ts +++ b/x-pack/plugins/apm/public/components/shared/charts/helper/get_timeseries_color.ts @@ -7,7 +7,7 @@ import { euiPaletteColorBlind } from '@elastic/eui'; -export const enum ChartType { +export enum ChartType { LATENCY_AVG, LATENCY_P95, LATENCY_P99, diff --git a/x-pack/plugins/cases/public/common/mock/match_media.ts b/x-pack/plugins/cases/public/common/mock/match_media.ts index 88d5cfad812ec..a36e91bf59ec0 100644 --- a/x-pack/plugins/cases/public/common/mock/match_media.ts +++ b/x-pack/plugins/cases/public/common/mock/match_media.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + window.matchMedia = jest.fn().mockImplementation((query) => ({ matches: false, media: query, diff --git a/x-pack/plugins/cases/public/components/actions/tags/edit_tags_selectable.tsx b/x-pack/plugins/cases/public/components/actions/tags/edit_tags_selectable.tsx index 61ebe43e3b24a..bb7b167814c6b 100644 --- a/x-pack/plugins/cases/public/components/actions/tags/edit_tags_selectable.tsx +++ b/x-pack/plugins/cases/public/components/actions/tags/edit_tags_selectable.tsx @@ -37,18 +37,18 @@ interface Props { type TagSelectableOption = EuiSelectableOption<{ tagIcon: IconType; newItem?: boolean }>; -const enum TagState { +enum TagState { CHECKED = 'checked', PARTIAL = 'partial', UNCHECKED = 'unchecked', } -const enum Actions { +enum Actions { CHECK_TAG, UNCHECK_TAG, } -const enum ICONS { +enum ICONS { CHECKED = 'check', PARTIAL = 'asterisk', UNCHECKED = 'empty', diff --git a/x-pack/plugins/cases/server/common/index.ts b/x-pack/plugins/cases/server/common/index.ts index 18bedd3ebeca8..25a567a32d908 100644 --- a/x-pack/plugins/cases/server/common/index.ts +++ b/x-pack/plugins/cases/server/common/index.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + // Careful of exporting anything from this file as any file(s) you export here will cause your functions to be exposed as public. // If you're using functions/types/etc... internally or within integration tests it's best to import directly from their paths // than expose the functions/types/etc... here. You should _only_ expose functions/types/etc... that need to be shared with other plugins here. diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/breadcrumbs.mock.ts b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/breadcrumbs.mock.ts index 00ae0680bf480..09eb2dedfd6d8 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/breadcrumbs.mock.ts +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/breadcrumbs.mock.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + jest.mock('../../../app/services/breadcrumbs', () => { const original = jest.requireActual('../../../app/services/breadcrumbs'); diff --git a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/track_ui_metric.mock.ts b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/track_ui_metric.mock.ts index 76354e035e0f7..040b5b8078817 100644 --- a/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/track_ui_metric.mock.ts +++ b/x-pack/plugins/cross_cluster_replication/public/__jest__/client_integration/mocks/track_ui_metric.mock.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + jest.mock('../../../app/services/track_ui_metric', () => { const original = jest.requireActual('../../../app/services/track_ui_metric'); diff --git a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/dashboard_drilldown_config/dashboard_drilldown_config.test.tsx b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/dashboard_drilldown_config/dashboard_drilldown_config.test.tsx index 8556bab76046a..ecad5f5c5ab36 100644 --- a/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/dashboard_drilldown_config/dashboard_drilldown_config.test.tsx +++ b/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/abstract_dashboard_drilldown/components/dashboard_drilldown_config/dashboard_drilldown_config.test.tsx @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + // Need to wait for https://github.com/elastic/eui/pull/3173/ // to unit test this component // basic interaction is covered in end-to-end tests diff --git a/x-pack/plugins/enterprise_search/common/types/api.ts b/x-pack/plugins/enterprise_search/common/types/api.ts index 71ea380711d3f..80585e6c005b9 100644 --- a/x-pack/plugins/enterprise_search/common/types/api.ts +++ b/x-pack/plugins/enterprise_search/common/types/api.ts @@ -14,7 +14,7 @@ import { ErrorCode } from './error_codes'; * Each Status string corresponds to a possible status in a request's lifecycle */ -export const enum Status { +export enum Status { IDLE, LOADING, SUCCESS, diff --git a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/__mocks__/engines_logic.mock.ts b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/__mocks__/engines_logic.mock.ts index bc954790debba..c502b37bf8ecb 100644 --- a/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/__mocks__/engines_logic.mock.ts +++ b/x-pack/plugins/enterprise_search/public/applications/app_search/components/engines/components/tables/__mocks__/engines_logic.mock.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + jest.mock('../../..', () => ({ EnginesLogic: { actions: { deleteEngine: jest.fn() } }, })); diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx index 4be7638f50cd4..ac8ee6bde87ac 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/components/new_index/new_index.tsx @@ -33,7 +33,7 @@ import { MethodApi } from './method_api/method_api'; import { MethodConnector } from './method_connector/method_connector'; import { MethodCrawler } from './method_crawler/method_crawler'; -export const enum IngestionMethodId { +export enum IngestionMethodId { api = 'api', connector = 'connector', crawler = 'crawler', diff --git a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/types.ts b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/types.ts index 036a9d41e6edf..e77cd1bf1401e 100644 --- a/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/types.ts +++ b/x-pack/plugins/enterprise_search/public/applications/enterprise_search_content/types.ts @@ -11,13 +11,13 @@ export interface Crawler { domains: []; } -export const enum IngestionMethod { +export enum IngestionMethod { CONNECTOR = 'connector', CRAWLER = 'crawler', API = 'api', } -export const enum IngestionStatus { +export enum IngestionStatus { CONFIGURED, CONNECTED, ERROR, diff --git a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.ts b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.ts index 05fd78c7ecf60..8c3a567a8f896 100644 --- a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.ts +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + jest.mock('../../hooks', () => { return { ...jest.requireActual('../../hooks'), diff --git a/x-pack/plugins/index_management/__jest__/client_integration/helpers/mocks.ts b/x-pack/plugins/index_management/__jest__/client_integration/helpers/mocks.ts index c0c2c179607bf..7b67e364b634d 100644 --- a/x-pack/plugins/index_management/__jest__/client_integration/helpers/mocks.ts +++ b/x-pack/plugins/index_management/__jest__/client_integration/helpers/mocks.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + (window as any).Worker = class Worker { onmessage() {} postMessage() {} diff --git a/x-pack/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts b/x-pack/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/infra/server/lib/adapters/log_entries/adapter_types.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ diff --git a/x-pack/plugins/infra/server/lib/adapters/log_entries/index.ts b/x-pack/plugins/infra/server/lib/adapters/log_entries/index.ts deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/infra/server/lib/adapters/log_entries/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ diff --git a/x-pack/plugins/lists/common/index.ts b/x-pack/plugins/lists/common/index.ts index a9aa96c2d9c60..148d6a6a5c007 100644 --- a/x-pack/plugins/lists/common/index.ts +++ b/x-pack/plugins/lists/common/index.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + // Careful of exporting anything from this file as any file(s) you export here will cause your page bundle size to increase. // If you're using functions/types/etc... internally it's best to import directly from their paths than expose the functions/types/etc... here. // You should _only_ expose functions/types/etc... that need to be shared with other plugins here. diff --git a/x-pack/plugins/maps/public/connected_components/toolbar_overlay/set_view_control/number_form_row.tsx b/x-pack/plugins/maps/public/connected_components/toolbar_overlay/set_view_control/number_form_row.tsx deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/maps/public/connected_components/toolbar_overlay/set_view_control/number_form_row.tsx +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ diff --git a/x-pack/plugins/ml/server/routes/apidoc_scripts/schema_parser.ts b/x-pack/plugins/ml/server/routes/apidoc_scripts/schema_parser.ts index 11fe3af1a40b7..90515d7e96a3b 100644 --- a/x-pack/plugins/ml/server/routes/apidoc_scripts/schema_parser.ts +++ b/x-pack/plugins/ml/server/routes/apidoc_scripts/schema_parser.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + function parse(content?: string) { const schema = typeof content === 'string' && content.trim(); diff --git a/x-pack/plugins/observability/common/progressive_loading.ts b/x-pack/plugins/observability/common/progressive_loading.ts index 04063c8a9cf79..f4a97d3c6b5a3 100644 --- a/x-pack/plugins/observability/common/progressive_loading.ts +++ b/x-pack/plugins/observability/common/progressive_loading.ts @@ -5,7 +5,7 @@ * 2.0. */ -export const enum ProgressiveLoadingQuality { +export enum ProgressiveLoadingQuality { low = 'low', medium = 'medium', high = 'high', diff --git a/x-pack/plugins/observability/public/pages/alerts/components/alerts_search_bar.tsx b/x-pack/plugins/observability/public/pages/alerts/components/alerts_search_bar.tsx deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/observability/public/pages/alerts/components/alerts_search_bar.tsx +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ diff --git a/x-pack/plugins/osquery/cypress/plugins/index.ts b/x-pack/plugins/osquery/cypress/plugins/index.ts index 7e135eb15c56e..f5d97d5cfd007 100644 --- a/x-pack/plugins/osquery/cypress/plugins/index.ts +++ b/x-pack/plugins/osquery/cypress/plugins/index.ts @@ -21,6 +21,10 @@ /** * @type {Cypress.PluginConfig} */ +// TODO: we should be able to remove this ts-ignore while using isolatedModules +// this is a skip for the errors created when typechecking with isolatedModules +// eslint-disable-next-line @typescript-eslint/ban-ts-comment +// @ts-ignore // eslint-disable-next-line @typescript-eslint/no-explicit-any module.exports = (on: any, config: any) => { // eslint-disable-next-line @typescript-eslint/no-var-requires, import/no-extraneous-dependencies diff --git a/x-pack/plugins/osquery/cypress/support/coverage.ts b/x-pack/plugins/osquery/cypress/support/coverage.ts index 9278edfcc6ddd..ddcb99477e916 100644 --- a/x-pack/plugins/osquery/cypress/support/coverage.ts +++ b/x-pack/plugins/osquery/cypress/support/coverage.ts @@ -10,6 +10,10 @@ // / // @ts-check +// TODO: we should be able to remove this ts-ignore while using isolatedModules +// this is a skip for the errors created when typechecking with isolatedModules +// @ts-ignore + const dayjs = require('dayjs'); const duration = require('dayjs/plugin/duration'); // const { filterSpecsFromCoverage } = require('./support-utils'); diff --git a/x-pack/plugins/rollup/public/test/client_integration/helpers/jest.mocks.tsx b/x-pack/plugins/rollup/public/test/client_integration/helpers/jest.mocks.tsx index 6b763fec07a66..94f1f5dc78391 100644 --- a/x-pack/plugins/rollup/public/test/client_integration/helpers/jest.mocks.tsx +++ b/x-pack/plugins/rollup/public/test/client_integration/helpers/jest.mocks.tsx @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + jest.mock('lodash', () => ({ ...jest.requireActual('lodash'), debounce: (fn: () => unknown) => fn, diff --git a/x-pack/plugins/security_solution/common/detection_engine/rule_management/api/urls.ts b/x-pack/plugins/security_solution/common/detection_engine/rule_management/api/urls.ts deleted file mode 100644 index 1fec1c76430eb..0000000000000 --- a/x-pack/plugins/security_solution/common/detection_engine/rule_management/api/urls.ts +++ /dev/null @@ -1,6 +0,0 @@ -/* - * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one - * or more contributor license agreements. Licensed under the Elastic License - * 2.0; you may not use this file except in compliance with the Elastic License - * 2.0. - */ diff --git a/x-pack/plugins/security_solution/common/index.ts b/x-pack/plugins/security_solution/common/index.ts index a9aa96c2d9c60..148d6a6a5c007 100644 --- a/x-pack/plugins/security_solution/common/index.ts +++ b/x-pack/plugins/security_solution/common/index.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + // Careful of exporting anything from this file as any file(s) you export here will cause your page bundle size to increase. // If you're using functions/types/etc... internally it's best to import directly from their paths than expose the functions/types/etc... here. // You should _only_ expose functions/types/etc... that need to be shared with other plugins here. diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts index b35a6aa154999..531dcfefe2f62 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/all/index.ts @@ -72,7 +72,7 @@ export interface RuleRisk { export type RiskScoreSortField = SortField; -export const enum RiskScoreFields { +export enum RiskScoreFields { timestamp = '@timestamp', hostName = 'host.name', hostRiskScore = 'host.risk.calculated_score_norm', @@ -97,7 +97,7 @@ export interface RiskScoreItem { [RiskScoreFields.alertsCount]: Maybe; } -export const enum RiskSeverity { +export enum RiskSeverity { unknown = 'Unknown', low = 'Low', moderate = 'Moderate', diff --git a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts index f373b4dc8874d..a95ef1f41d823 100644 --- a/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts +++ b/x-pack/plugins/security_solution/common/search_strategy/security_solution/risk_score/common/index.ts @@ -43,7 +43,7 @@ export enum RiskQueries { kpiRiskScore = 'kpiRiskScore', } -export const enum RiskScoreEntity { +export enum RiskScoreEntity { host = 'host', user = 'user', } diff --git a/x-pack/plugins/security_solution/cypress/tasks/risk_scores/common.ts b/x-pack/plugins/security_solution/cypress/tasks/risk_scores/common.ts index 03a064a4c7635..87769e264bf53 100644 --- a/x-pack/plugins/security_solution/cypress/tasks/risk_scores/common.ts +++ b/x-pack/plugins/security_solution/cypress/tasks/risk_scores/common.ts @@ -4,7 +4,7 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ -export const enum RiskScoreEntity { +export enum RiskScoreEntity { host = 'host', user = 'user', } diff --git a/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_config.ts b/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_config.ts index 2fc2c2dfe74ad..6b0300ed80110 100644 --- a/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_config.ts +++ b/x-pack/plugins/security_solution/public/common/components/guided_onboarding_tour/tour_config.ts @@ -9,12 +9,12 @@ import type { EuiTourStepProps } from '@elastic/eui'; import { i18n } from '@kbn/i18n'; import type { ElementTarget } from '@elastic/eui/src/services/findElement'; -export const enum SecurityStepId { +export enum SecurityStepId { rules = 'rules', alertsCases = 'alertsCases', } -export const enum AlertsCasesTourSteps { +export enum AlertsCasesTourSteps { none = 0, pointToAlertName = 1, expandEvent = 2, diff --git a/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts b/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts index 90025eb8d65fe..5f2ba01532fb5 100644 --- a/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts +++ b/x-pack/plugins/security_solution/public/common/components/ml/anomaly/use_anomalies_search.ts @@ -20,7 +20,7 @@ import type { inputsModel } from '../../../store'; import { useSecurityJobs } from '../../ml_popover/hooks/use_security_jobs'; import type { SecurityJob } from '../../ml_popover/types'; -export const enum AnomalyEntity { +export enum AnomalyEntity { User, Host, } diff --git a/x-pack/plugins/security_solution/public/common/mock/formatted_relative.ts b/x-pack/plugins/security_solution/public/common/mock/formatted_relative.ts index eb4c4ca443c94..e90f0b8fdee2d 100644 --- a/x-pack/plugins/security_solution/public/common/mock/formatted_relative.ts +++ b/x-pack/plugins/security_solution/public/common/mock/formatted_relative.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + jest.mock('@kbn/i18n-react', () => { const originalModule = jest.requireActual('@kbn/i18n-react'); const FormattedRelative = jest.fn().mockImplementation(() => '20 hours ago'); diff --git a/x-pack/plugins/security_solution/public/common/mock/match_media.ts b/x-pack/plugins/security_solution/public/common/mock/match_media.ts index 722f4c3917ea0..f3c9774c709d9 100644 --- a/x-pack/plugins/security_solution/public/common/mock/match_media.ts +++ b/x-pack/plugins/security_solution/public/common/mock/match_media.ts @@ -5,6 +5,10 @@ * 2.0. */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + window.matchMedia = jest.fn().mockImplementation((query) => { return { matches: false, diff --git a/x-pack/plugins/security_solution/public/common/store/inputs/constants.ts b/x-pack/plugins/security_solution/public/common/store/inputs/constants.ts index 8bd663d88f812..8f094e8dc6a43 100644 --- a/x-pack/plugins/security_solution/public/common/store/inputs/constants.ts +++ b/x-pack/plugins/security_solution/public/common/store/inputs/constants.ts @@ -5,7 +5,7 @@ * 2.0. */ -export const enum InputsModelId { +export enum InputsModelId { global = 'global', timeline = 'timeline', socTrends = 'socTrends', diff --git a/x-pack/plugins/security_solution/public/management/pages/policy/view/tabs/policy_tabs.tsx b/x-pack/plugins/security_solution/public/management/pages/policy/view/tabs/policy_tabs.tsx index b9a7e1cda040e..9728e89e539e8 100644 --- a/x-pack/plugins/security_solution/public/management/pages/policy/view/tabs/policy_tabs.tsx +++ b/x-pack/plugins/security_solution/public/management/pages/policy/view/tabs/policy_tabs.tsx @@ -53,7 +53,7 @@ import { SEARCHABLE_FIELDS as BLOCKLISTS_SEARCHABLE_FIELDS } from '../../../bloc import type { PolicyDetailsRouteState } from '../../../../../../common/endpoint/types'; import { useListArtifact } from '../../../../hooks/artifacts'; -const enum PolicyTabKeys { +enum PolicyTabKeys { SETTINGS = 'settings', TRUSTED_APPS = 'trustedApps', EVENT_FILTERS = 'eventFilters', diff --git a/x-pack/plugins/security_solution/public/risk_score/containers/index.ts b/x-pack/plugins/security_solution/public/risk_score/containers/index.ts index 605bbd7d0d6b1..21995266f0902 100644 --- a/x-pack/plugins/security_solution/public/risk_score/containers/index.ts +++ b/x-pack/plugins/security_solution/public/risk_score/containers/index.ts @@ -13,12 +13,12 @@ import type { export * from './all'; export * from './kpi'; -export const enum UserRiskScoreQueryId { +export enum UserRiskScoreQueryId { USERS_BY_RISK = 'UsersByRisk', USER_DETAILS_RISK_SCORE = 'UserDetailsRiskScore', } -export const enum HostRiskScoreQueryId { +export enum HostRiskScoreQueryId { DEFAULT = 'HostRiskScore', HOST_DETAILS_RISK_SCORE = 'HostDetailsRiskScore', OVERVIEW_RISKY_HOSTS = 'OverviewRiskyHosts', diff --git a/x-pack/plugins/security_solution/server/__mocks__/action.mock.ts b/x-pack/plugins/security_solution/server/__mocks__/action.mock.ts index 2a430c47cc127..e54aeb9745f9d 100644 --- a/x-pack/plugins/security_solution/server/__mocks__/action.mock.ts +++ b/x-pack/plugins/security_solution/server/__mocks__/action.mock.ts @@ -6,4 +6,4 @@ */ // See: https://github.com/elastic/kibana/issues/117255, this creates mocks to avoid memory leaks from kibana core. -module.exports = {}; +export {}; diff --git a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/content/prepackaged_rules/notice.ts b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/content/prepackaged_rules/notice.ts index 86d95c1e021b4..0cccc1fc6a215 100644 --- a/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/content/prepackaged_rules/notice.ts +++ b/x-pack/plugins/security_solution/server/lib/detection_engine/prebuilt_rules/content/prepackaged_rules/notice.ts @@ -1,5 +1,9 @@ /* eslint-disable @kbn/eslint/require-license-header */ +// TODO(jbudz): should be removed when upgrading to TS@4.8 +// this is a skip for the errors created when typechecking with isolatedModules +export {}; + /* @notice * Detection Rules * Copyright 2021 Elasticsearch B.V. diff --git a/x-pack/plugins/session_view/common/types/process_tree/index.ts b/x-pack/plugins/session_view/common/types/process_tree/index.ts index 07a17fe43d01f..dadc656cc49ab 100644 --- a/x-pack/plugins/session_view/common/types/process_tree/index.ts +++ b/x-pack/plugins/session_view/common/types/process_tree/index.ts @@ -12,7 +12,7 @@ export interface AlertStatusEventEntityIdMap { }; } -export const enum ProcessEventAlertCategory { +export enum ProcessEventAlertCategory { all = 'all', file = 'file', network = 'network', @@ -25,12 +25,12 @@ export interface AlertTypeCount { } export type DefaultAlertFilterType = 'all'; -export const enum EventKind { +export enum EventKind { event = 'event', signal = 'signal', } -export const enum EventAction { +export enum EventAction { fork = 'fork', exec = 'exec', end = 'end', diff --git a/x-pack/plugins/stack_connectors/common/connector_types/security/tines/constants.ts b/x-pack/plugins/stack_connectors/common/connector_types/security/tines/constants.ts index 513c45bc07b98..f0bfaf602a3d8 100644 --- a/x-pack/plugins/stack_connectors/common/connector_types/security/tines/constants.ts +++ b/x-pack/plugins/stack_connectors/common/connector_types/security/tines/constants.ts @@ -8,7 +8,7 @@ export const TINES_TITLE = 'Tines'; export const TINES_CONNECTOR_ID = '.tines'; export const API_MAX_RESULTS = 500; -export const enum SUB_ACTION { +export enum SUB_ACTION { STORIES = 'stories', WEBHOOKS = 'webhooks', RUN = 'run', diff --git a/x-pack/plugins/stack_connectors/server/connector_types/cases/cases_webhook/types.ts b/x-pack/plugins/stack_connectors/server/connector_types/cases/cases_webhook/types.ts index f9fde29f252e0..c4404748fc33b 100644 --- a/x-pack/plugins/stack_connectors/server/connector_types/cases/cases_webhook/types.ts +++ b/x-pack/plugins/stack_connectors/server/connector_types/cases/cases_webhook/types.ts @@ -16,7 +16,7 @@ import { } from './schema'; // config definition -export const enum CasesWebhookMethods { +export enum CasesWebhookMethods { PATCH = 'patch', POST = 'post', PUT = 'put', diff --git a/x-pack/plugins/threat_intelligence/common/constants.ts b/x-pack/plugins/threat_intelligence/common/constants.ts index e5aa41d8ad2f4..63d98c4a60494 100644 --- a/x-pack/plugins/threat_intelligence/common/constants.ts +++ b/x-pack/plugins/threat_intelligence/common/constants.ts @@ -12,7 +12,7 @@ export const BARCHART_AGGREGATION_NAME = 'barchartAggregation'; /** * Used inside custom search strategy */ -export const enum FactoryQueryType { +export enum FactoryQueryType { IndicatorGrid = 'indicatorGrid', Barchart = 'barchart', } diff --git a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx index 30fdaa8c9c4da..e177089e0517d 100644 --- a/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx +++ b/x-pack/plugins/threat_intelligence/public/modules/indicators/components/flyout/flyout.tsx @@ -34,7 +34,7 @@ export const SUBTITLE_TEST_ID = 'tiIndicatorFlyoutSubtitle'; export const TABS_TEST_ID = 'tiIndicatorFlyoutTabs'; export const MORE_ACTIONS_ID = 'tiIndicatorFlyoutMoreActions'; -const enum TAB_IDS { +enum TAB_IDS { overview, table, json, diff --git a/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_sub_action.tsx b/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_sub_action.tsx index 4deab3689fb38..519fd6ba9baa9 100644 --- a/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_sub_action.tsx +++ b/x-pack/plugins/triggers_actions_ui/public/application/hooks/use_sub_action.tsx @@ -23,7 +23,7 @@ interface SubActionsState { error: Error | null; } -const enum SubActionsActionsList { +enum SubActionsActionsList { START, STOP, SUCCESS, diff --git a/x-pack/plugins/transform/public/app/sections/transform_management/components/managed_transforms_callout/index.ts b/x-pack/test/ui_capabilities/common/lib/index.ts similarity index 76% rename from x-pack/plugins/transform/public/app/sections/transform_management/components/managed_transforms_callout/index.ts rename to x-pack/test/ui_capabilities/common/lib/index.ts index 1fec1c76430eb..fbf5d6b6ee0b4 100644 --- a/x-pack/plugins/transform/public/app/sections/transform_management/components/managed_transforms_callout/index.ts +++ b/x-pack/test/ui_capabilities/common/lib/index.ts @@ -4,3 +4,6 @@ * 2.0; you may not use this file except in compliance with the Elastic License * 2.0. */ + +export * from './assert_deeply_false'; +export * from './unreachable_error'; diff --git a/x-pack/test/ui_capabilities/common/lib/unreachable_error.ts b/x-pack/test/ui_capabilities/common/lib/unreachable_error.ts index 04e1ae1f6c1b0..c3941bd725c02 100644 --- a/x-pack/test/ui_capabilities/common/lib/unreachable_error.ts +++ b/x-pack/test/ui_capabilities/common/lib/unreachable_error.ts @@ -5,7 +5,7 @@ * 2.0. */ -class UnreachableError extends Error { +export class UnreachableError extends Error { constructor(val: never) { super(`Unreachable: ${val}`); } diff --git a/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts b/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts index 2844483018e10..1934a22da6ddb 100644 --- a/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts +++ b/x-pack/test/ui_capabilities/security_and_spaces/tests/catalogue.ts @@ -9,6 +9,7 @@ import expect from '@kbn/expect'; import { mapValues } from 'lodash'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { UICapabilitiesService } from '../../common/services/ui_capabilities'; +import { UnreachableError } from '../../common/lib'; import { UserAtSpaceScenarios } from '../scenarios'; export default function catalogueTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/ui_capabilities/security_and_spaces/tests/foo.ts b/x-pack/test/ui_capabilities/security_and_spaces/tests/foo.ts index 7e00864b54761..34dca7f6ccbbf 100644 --- a/x-pack/test/ui_capabilities/security_and_spaces/tests/foo.ts +++ b/x-pack/test/ui_capabilities/security_and_spaces/tests/foo.ts @@ -8,6 +8,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { UICapabilitiesService } from '../../common/services/ui_capabilities'; +import { UnreachableError } from '../../common/lib'; import { UserAtSpaceScenarios } from '../scenarios'; export default function fooTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts b/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts index 7ee9b9a28aa29..5167b611de2b4 100644 --- a/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts +++ b/x-pack/test/ui_capabilities/security_and_spaces/tests/nav_links.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context'; import { NavLinksBuilder } from '../../common/nav_links_builder'; import { FeaturesService } from '../../common/services'; import { UICapabilitiesService } from '../../common/services/ui_capabilities'; +import { UnreachableError } from '../../common/lib'; import { UserAtSpaceScenarios } from '../scenarios'; export default function navLinksTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/ui_capabilities/spaces_only/tests/catalogue.ts b/x-pack/test/ui_capabilities/spaces_only/tests/catalogue.ts index 4b585e4b95c81..60f13694a6326 100644 --- a/x-pack/test/ui_capabilities/spaces_only/tests/catalogue.ts +++ b/x-pack/test/ui_capabilities/spaces_only/tests/catalogue.ts @@ -9,6 +9,7 @@ import expect from '@kbn/expect'; import { mapValues } from 'lodash'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { UICapabilitiesService } from '../../common/services/ui_capabilities'; +import { UnreachableError } from '../../common/lib'; import { SpaceScenarios } from '../scenarios'; export default function catalogueTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/ui_capabilities/spaces_only/tests/foo.ts b/x-pack/test/ui_capabilities/spaces_only/tests/foo.ts index 68e2ef36302d9..3e8c881b17686 100644 --- a/x-pack/test/ui_capabilities/spaces_only/tests/foo.ts +++ b/x-pack/test/ui_capabilities/spaces_only/tests/foo.ts @@ -8,6 +8,7 @@ import expect from '@kbn/expect'; import { FtrProviderContext } from '../../common/ftr_provider_context'; import { UICapabilitiesService } from '../../common/services/ui_capabilities'; +import { UnreachableError } from '../../common/lib'; import { SpaceScenarios } from '../scenarios'; export default function fooTests({ getService }: FtrProviderContext) { diff --git a/x-pack/test/ui_capabilities/spaces_only/tests/nav_links.ts b/x-pack/test/ui_capabilities/spaces_only/tests/nav_links.ts index 4b0ee87c00abb..7301bcef177d0 100644 --- a/x-pack/test/ui_capabilities/spaces_only/tests/nav_links.ts +++ b/x-pack/test/ui_capabilities/spaces_only/tests/nav_links.ts @@ -10,6 +10,7 @@ import { FtrProviderContext } from '../../common/ftr_provider_context'; import { NavLinksBuilder } from '../../common/nav_links_builder'; import { FeaturesService } from '../../common/services'; import { UICapabilitiesService } from '../../common/services/ui_capabilities'; +import { UnreachableError } from '../../common/lib'; import { SpaceScenarios } from '../scenarios'; export default function navLinksTests({ getService }: FtrProviderContext) {