From 78e9b7652a22ca57bde33d98af81f76d91f5a5fc Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:24:14 +1000 Subject: [PATCH] [8.x] chore(tsconfig): uncomment option `moduleDetection` (#191834) (#193481) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit # Backport This will backport the following commits from `main` to `8.x`: - [chore(tsconfig): uncomment option `moduleDetection` (#191834)](https://github.com/elastic/kibana/pull/191834) ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) Co-authored-by: Alejandro Fernández Haro --- packages/kbn-optimizer/src/worker/entry_point_creator.ts | 3 --- .../event_annotation/server/fetch_event_annotations/index.ts | 4 ---- tsconfig.base.json | 5 +---- x-pack/plugins/cases/server/common/index.ts | 4 ---- .../__jest__/client_integration/mocks/breadcrumbs.mock.ts | 4 ---- .../client_integration/mocks/track_ui_metric.mock.ts | 4 ---- .../dashboard_drilldown_config.test.tsx | 4 ---- .../components/tables/__mocks__/engines_logic.mock.ts | 4 ---- .../agent_enrollment_flyout.test.mocks.tsx | 3 --- .../__jest__/client_integration/helpers/mocks.ts | 4 ---- x-pack/plugins/lists/common/index.ts | 4 ---- x-pack/plugins/osquery/cypress/plugins/index.ts | 4 ---- .../public/test/client_integration/helpers/jest.mocks.tsx | 4 ---- x-pack/plugins/security_solution/common/index.ts | 3 --- .../public/common/mock/formatted_relative.ts | 4 ---- 15 files changed, 1 insertion(+), 57 deletions(-) diff --git a/packages/kbn-optimizer/src/worker/entry_point_creator.ts b/packages/kbn-optimizer/src/worker/entry_point_creator.ts index 2d4f8ffce6f3..46fb14d1f659 100644 --- a/packages/kbn-optimizer/src/worker/entry_point_creator.ts +++ b/packages/kbn-optimizer/src/worker/entry_point_creator.ts @@ -7,9 +7,6 @@ * License v3.0 only", or the "Server 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/src/plugins/event_annotation/server/fetch_event_annotations/index.ts b/src/plugins/event_annotation/server/fetch_event_annotations/index.ts index 8e91f5cee36c..fd63bd130703 100644 --- a/src/plugins/event_annotation/server/fetch_event_annotations/index.ts +++ b/src/plugins/event_annotation/server/fetch_event_annotations/index.ts @@ -9,10 +9,6 @@ // 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/tsconfig.base.json b/tsconfig.base.json index e6549c170cb9..4b290135f106 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1996,11 +1996,8 @@ "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", - // + "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/cases/server/common/index.ts b/x-pack/plugins/cases/server/common/index.ts index 25a567a32d90..18bedd3ebeca 100644 --- a/x-pack/plugins/cases/server/common/index.ts +++ b/x-pack/plugins/cases/server/common/index.ts @@ -5,10 +5,6 @@ * 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 09eb2dedfd6d..00ae0680bf48 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,10 +5,6 @@ * 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 040b5b807881..76354e035e0f 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,10 +5,6 @@ * 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 ecad5f5c5ab3..8556bab76046 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,10 +5,6 @@ * 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/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 c502b37bf8ec..bc954790debb 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,10 +5,6 @@ * 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/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.tsx b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.tsx index 6658eb5a8e0b..d4244a6bbf5a 100644 --- a/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.tsx +++ b/x-pack/plugins/fleet/public/components/agent_enrollment_flyout/agent_enrollment_flyout.test.mocks.tsx @@ -6,9 +6,6 @@ */ import React from 'react'; -// 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 { 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 7b67e364b634..c0c2c179607b 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,10 +5,6 @@ * 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/lists/common/index.ts b/x-pack/plugins/lists/common/index.ts index 148d6a6a5c00..a9aa96c2d9c6 100644 --- a/x-pack/plugins/lists/common/index.ts +++ b/x-pack/plugins/lists/common/index.ts @@ -5,10 +5,6 @@ * 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/osquery/cypress/plugins/index.ts b/x-pack/plugins/osquery/cypress/plugins/index.ts index ee375ff757c9..2653d7f55419 100644 --- a/x-pack/plugins/osquery/cypress/plugins/index.ts +++ b/x-pack/plugins/osquery/cypress/plugins/index.ts @@ -21,10 +21,6 @@ /** * @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 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 94f1f5dc7839..6b763fec07a6 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,10 +5,6 @@ * 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/index.ts b/x-pack/plugins/security_solution/common/index.ts index fb5caa2268f3..7c240b39554a 100644 --- a/x-pack/plugins/security_solution/common/index.ts +++ b/x-pack/plugins/security_solution/common/index.ts @@ -5,9 +5,6 @@ * 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 {}; export { APP_UI_ID, APP_ID, 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 8e33021aede0..0aebd25a1c17 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,10 +5,6 @@ * 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 { i18n } = jest.requireActual('@kbn/i18n'); i18n.init({ locale: 'en' });