Skip to content

ref(v8): Remove getGlobalObject utility method #11372

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/eslint-config-sdk/src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.',
},
],

Expand Down
5 changes: 2 additions & 3 deletions packages/utils/src/browser.ts
Original file line number Diff line number Diff line change
@@ -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<Window>();
const WINDOW = GLOBAL_OBJ as unknown as Window;

const DEFAULT_MAX_STRING_LENGTH = 80;

Expand Down
5 changes: 2 additions & 3 deletions packages/utils/src/supports.ts
Original file line number Diff line number Diff line change
@@ -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<Window>();
const WINDOW = GLOBAL_OBJ as unknown as Window;

declare const EdgeRuntime: string | undefined;

Expand Down
5 changes: 2 additions & 3 deletions packages/utils/src/vendor/supportsHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Window>();
const WINDOW = GLOBAL_OBJ as unknown as Window;

/**
* Tells whether current environment supports History API
Expand Down
7 changes: 0 additions & 7 deletions packages/utils/src/worldwide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>(): T & InternalGlobal {
return GLOBAL_OBJ as T & InternalGlobal;
}

/**
* Returns a global singleton contained in the global `__SENTRY__` object.
*
Expand Down