mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
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>
This commit is contained in:
parent
9a0622bb2e
commit
016e3e03a4
68 changed files with 174 additions and 120 deletions
|
@ -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"],
|
||||
)
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
)
|
||||
|
|
|
@ -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,
|
||||
}: {
|
||||
|
|
|
@ -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.
|
||||
*/
|
|
@ -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',
|
||||
|
|
|
@ -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.
|
||||
*/
|
|
@ -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: () => {},
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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 };
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export const enum ApmMlDetectorType {
|
||||
export enum ApmMlDetectorType {
|
||||
txLatency = 'txLatency',
|
||||
txThroughput = 'txThroughput',
|
||||
txFailureRate = 'txFailureRate',
|
||||
|
|
|
@ -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',
|
||||
}
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
|
||||
import { euiPaletteColorBlind } from '@elastic/eui';
|
||||
|
||||
export const enum ChartType {
|
||||
export enum ChartType {
|
||||
LATENCY_AVG,
|
||||
LATENCY_P95,
|
||||
LATENCY_P99,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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() } },
|
||||
}));
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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'),
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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.
|
||||
*/
|
|
@ -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.
|
||||
*/
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
*/
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export const enum ProgressiveLoadingQuality {
|
||||
export enum ProgressiveLoadingQuality {
|
||||
low = 'low',
|
||||
medium = 'medium',
|
||||
high = 'high',
|
||||
|
|
|
@ -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.
|
||||
*/
|
|
@ -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
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
// / <reference types="cypress" />
|
||||
// @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');
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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.
|
||||
*/
|
|
@ -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.
|
||||
|
|
|
@ -72,7 +72,7 @@ export interface RuleRisk {
|
|||
|
||||
export type RiskScoreSortField = SortField<RiskScoreFields>;
|
||||
|
||||
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<number>;
|
||||
}
|
||||
|
||||
export const enum RiskSeverity {
|
||||
export enum RiskSeverity {
|
||||
unknown = 'Unknown',
|
||||
low = 'Low',
|
||||
moderate = 'Moderate',
|
||||
|
|
|
@ -43,7 +43,7 @@ export enum RiskQueries {
|
|||
kpiRiskScore = 'kpiRiskScore',
|
||||
}
|
||||
|
||||
export const enum RiskScoreEntity {
|
||||
export enum RiskScoreEntity {
|
||||
host = 'host',
|
||||
user = 'user',
|
||||
}
|
||||
|
|
|
@ -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',
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
export const enum InputsModelId {
|
||||
export enum InputsModelId {
|
||||
global = 'global',
|
||||
timeline = 'timeline',
|
||||
socTrends = 'socTrends',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -16,7 +16,7 @@ import {
|
|||
} from './schema';
|
||||
|
||||
// config definition
|
||||
export const enum CasesWebhookMethods {
|
||||
export enum CasesWebhookMethods {
|
||||
PATCH = 'patch',
|
||||
POST = 'post',
|
||||
PUT = 'put',
|
||||
|
|
|
@ -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',
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -23,7 +23,7 @@ interface SubActionsState<R> {
|
|||
error: Error | null;
|
||||
}
|
||||
|
||||
const enum SubActionsActionsList {
|
||||
enum SubActionsActionsList {
|
||||
START,
|
||||
STOP,
|
||||
SUCCESS,
|
||||
|
|
|
@ -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';
|
|
@ -5,7 +5,7 @@
|
|||
* 2.0.
|
||||
*/
|
||||
|
||||
class UnreachableError extends Error {
|
||||
export class UnreachableError extends Error {
|
||||
constructor(val: never) {
|
||||
super(`Unreachable: ${val}`);
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue