Originally posted in #2410 (comment)
you should still prefer nothing at all over
globalThis
in some cases (unless you're using?.
), like you wouldn't usenew globalThis.Image()
orglobalThis.Array.from()
orglobalThis.globalThis
I'd lean towards never using globalThis
(and window
, self
, global
, etc) for known globals. globalThis.jQuery = jQuery
should still be allowed though.
globalThis.alert();
globalThis.fetch();
globalThis.console.log();
globalThis.addEventListener('navigate', fn);
globalThis.JSON.stringify();
globalThis.window.self.close()
new globalThis.Image();
globalThis.RegExp.$1;
alert();
fetch();
console.log();
addEventListener('navigate', fn);
JSON.stringify();
self.close(); // Partial exception
new Image();
RegExp.$1;
The exception is the same as the one described in #2410 (comment)
global-properties
or just avoid-global-propertoes
No response
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too