From 1f956dfab99a959bd16c8764618f152804d57560 Mon Sep 17 00:00:00 2001 From: Francesco Novy Date: Tue, 2 Apr 2024 13:32:30 +0200 Subject: [PATCH] ref(v8): Remove `getGlobalObject` utility method --- packages/eslint-config-sdk/src/base.js | 8 ++++---- packages/utils/src/browser.ts | 5 ++--- packages/utils/src/supports.ts | 5 ++--- packages/utils/src/vendor/supportsHistory.ts | 5 ++--- packages/utils/src/worldwide.ts | 7 ------- 5 files changed, 10 insertions(+), 20 deletions(-) diff --git a/packages/eslint-config-sdk/src/base.js b/packages/eslint-config-sdk/src/base.js index aa179260dc2c..9a6fa807e09f 100644 --- a/packages/eslint-config-sdk/src/base.js +++ b/packages/eslint-config-sdk/src/base.js @@ -111,22 +111,22 @@ module.exports = { { name: 'window', message: - 'Some global variables are not available in environments like WebWorker or Node.js. Use getGlobalObject() instead.', + 'Some global variables are not available in environments like WebWorker or Node.js. Use GLOBAL_OBJ instead.', }, { name: 'document', message: - 'Some global variables are not available in environments like WebWorker or Node.js. Use getGlobalObject() instead.', + 'Some global variables are not available in environments like WebWorker or Node.js. Use GLOBAL_OBJ instead.', }, { name: 'location', message: - 'Some global variables are not available in environments like WebWorker or Node.js. Use getGlobalObject() instead.', + 'Some global variables are not available in environments like WebWorker or Node.js. Use GLOBAL_OBJ instead.', }, { name: 'navigator', message: - 'Some global variables are not available in environments like WebWorker or Node.js. Use getGlobalObject() instead.', + 'Some global variables are not available in environments like WebWorker or Node.js. Use GLOBAL_OBJ instead.', }, ], diff --git a/packages/utils/src/browser.ts b/packages/utils/src/browser.ts index 91a62eaafced..5024038822b9 100644 --- a/packages/utils/src/browser.ts +++ b/packages/utils/src/browser.ts @@ -1,8 +1,7 @@ import { isString } from './is'; -import { getGlobalObject } from './worldwide'; +import { GLOBAL_OBJ } from './worldwide'; -// eslint-disable-next-line deprecation/deprecation -const WINDOW = getGlobalObject(); +const WINDOW = GLOBAL_OBJ as unknown as Window; const DEFAULT_MAX_STRING_LENGTH = 80; diff --git a/packages/utils/src/supports.ts b/packages/utils/src/supports.ts index 01d4627d2892..2931e9b72c4c 100644 --- a/packages/utils/src/supports.ts +++ b/packages/utils/src/supports.ts @@ -1,9 +1,8 @@ import { DEBUG_BUILD } from './debug-build'; import { logger } from './logger'; -import { getGlobalObject } from './worldwide'; +import { GLOBAL_OBJ } from './worldwide'; -// eslint-disable-next-line deprecation/deprecation -const WINDOW = getGlobalObject(); +const WINDOW = GLOBAL_OBJ as unknown as Window; declare const EdgeRuntime: string | undefined; diff --git a/packages/utils/src/vendor/supportsHistory.ts b/packages/utils/src/vendor/supportsHistory.ts index 35af156eb96f..c0e2f61f0d4f 100644 --- a/packages/utils/src/vendor/supportsHistory.ts +++ b/packages/utils/src/vendor/supportsHistory.ts @@ -21,10 +21,9 @@ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. -import { getGlobalObject } from '../worldwide'; +import { GLOBAL_OBJ } from '../worldwide'; -// eslint-disable-next-line deprecation/deprecation -const WINDOW = getGlobalObject(); +const WINDOW = GLOBAL_OBJ as unknown as Window; /** * Tells whether current environment supports History API diff --git a/packages/utils/src/worldwide.ts b/packages/utils/src/worldwide.ts index 6ac98ac0f6ae..6d7145a7a140 100644 --- a/packages/utils/src/worldwide.ts +++ b/packages/utils/src/worldwide.ts @@ -111,13 +111,6 @@ export const GLOBAL_OBJ: InternalGlobal = })() || {}; -/** - * @deprecated Use GLOBAL_OBJ instead or WINDOW from @sentry/browser. This will be removed in v8 - */ -export function getGlobalObject(): T & InternalGlobal { - return GLOBAL_OBJ as T & InternalGlobal; -} - /** * Returns a global singleton contained in the global `__SENTRY__` object. *