Skip to content

Commit 5c1b87d

Browse files
chore: replace 'global' with 'globalThis' (#701)
1 parent 77f11bb commit 5c1b87d

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

Diff for: .eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const { getBaseConfig } = require('@openedx/frontend-build');
33

44
const config = getBaseConfig('eslint');
55

6+
config.globals = { globalThis: 'readonly' };
67
config.rules = {
78
'import/no-extraneous-dependencies': ['error', {
89
devDependencies: [

Diff for: src/i18n/lib.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export function getLocale(locale) {
167167
// Note that some browers prefer upper case for the region part of the locale, while others don't.
168168
// Thus the toLowerCase, for consistency.
169169
// https://developer.mozilla.org/en-US/docs/Web/API/NavigatorLanguage/language
170-
return findSupportedLocale(global.navigator.language.toLowerCase());
170+
return findSupportedLocale(globalThis.navigator.language.toLowerCase());
171171
}
172172

173173
/**
@@ -199,9 +199,9 @@ export function isRtl(locale) {
199199
*/
200200
export function handleRtl() {
201201
if (isRtl(getLocale())) {
202-
global.document.getElementsByTagName('html')[0].setAttribute('dir', 'rtl');
202+
globalThis.document.getElementsByTagName('html')[0].setAttribute('dir', 'rtl');
203203
} else {
204-
global.document.getElementsByTagName('html')[0].setAttribute('dir', 'ltr');
204+
globalThis.document.getElementsByTagName('html')[0].setAttribute('dir', 'ltr');
205205
}
206206
}
207207

Diff for: src/initialize.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export async function initError(error) {
140140
*/
141141
export async function auth(requireUser, hydrateUser) {
142142
if (requireUser) {
143-
await ensureAuthenticatedUser(global.location.href);
143+
await ensureAuthenticatedUser(globalThis.location.href);
144144
} else {
145145
await fetchAuthenticatedUser();
146146
}

0 commit comments

Comments
 (0)