diff --git a/cli/rt/06_util.js b/cli/rt/06_util.js index b0ed5696fa..011fa6de5c 100644 --- a/cli/rt/06_util.js +++ b/cli/rt/06_util.js @@ -53,7 +53,6 @@ function immutableDefine( o, p, - // eslint-disable-next-line @typescript-eslint/no-explicit-any value, ) { Object.defineProperty(o, p, { diff --git a/cli/rt/99_main.js b/cli/rt/99_main.js index 846216ec4d..c6d6d13955 100644 --- a/cli/rt/99_main.js +++ b/cli/rt/99_main.js @@ -1,7 +1,6 @@ // Removes the `__proto__` for security reasons. This intentionally makes // Deno non compliant with ECMA-262 Annex B.2.2.1 // -// eslint-disable-next-line @typescript-eslint/no-explicit-any delete Object.prototype.__proto__; ((window) => { @@ -292,9 +291,9 @@ delete Object.prototype.__proto__; if (hasBootstrapped) { throw new Error("Worker runtime already bootstrapped"); } - // Remove bootstrapping methods from global scope - globalThis.__bootstrap = undefined; - globalThis.bootstrap = undefined; + // Remove bootstrapping data from the global scope + delete globalThis.__bootstrap; + delete globalThis.bootstrap; util.log("bootstrapMainRuntime"); hasBootstrapped = true; Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods); @@ -360,9 +359,9 @@ delete Object.prototype.__proto__; if (hasBootstrapped) { throw new Error("Worker runtime already bootstrapped"); } - // Remove bootstrapping methods from global scope - globalThis.__bootstrap = undefined; - globalThis.bootstrap = undefined; + // Remove bootstrapping data from the global scope + delete globalThis.__bootstrap; + delete globalThis.bootstrap; util.log("bootstrapWorkerRuntime"); hasBootstrapped = true; Object.defineProperties(globalThis, windowOrWorkerGlobalScopeMethods); @@ -412,7 +411,6 @@ delete Object.prototype.__proto__; workerRuntime: bootstrapWorkerRuntime, }, configurable: true, - writable: true, }, }); })(this); diff --git a/cli/tests/unit/globals_test.ts b/cli/tests/unit/globals_test.ts index dabe3c08e1..5fc125296e 100644 --- a/cli/tests/unit/globals_test.ts +++ b/cli/tests/unit/globals_test.ts @@ -5,6 +5,13 @@ unitTest(function globalThisExists(): void { assert(globalThis != null); }); +unitTest(function noInternalGlobals(): void { + // globalThis.__bootstrap should not be there. + for (const key of Object.keys(globalThis)) { + assert(!key.startsWith("_")); + } +}); + unitTest(function windowExists(): void { assert(window != null); }); diff --git a/cli/tsc/99_main_compiler.js b/cli/tsc/99_main_compiler.js index aa334907a4..dede279c15 100644 --- a/cli/tsc/99_main_compiler.js +++ b/cli/tsc/99_main_compiler.js @@ -14,7 +14,6 @@ // Removes the `__proto__` for security reasons. This intentionally makes // Deno non compliant with ECMA-262 Annex B.2.2.1 // -// eslint-disable-next-line @typescript-eslint/no-explicit-any delete Object.prototype.__proto__; ((window) => { @@ -1528,7 +1527,7 @@ delete Object.prototype.__proto__; core.registerErrorClass("TypeError", TypeError); core.registerErrorClass("Other", Error); core.registerErrorClass("Busy", errors.Busy); - globalThis.__bootstrap = undefined; + delete globalThis.__bootstrap; runtimeStart("TS"); } diff --git a/op_crates/web/08_text_encoding.js b/op_crates/web/08_text_encoding.js index e938eecd1e..f759fb66ce 100644 --- a/op_crates/web/08_text_encoding.js +++ b/op_crates/web/08_text_encoding.js @@ -393,7 +393,6 @@ } } - // eslint-disable-next-line @typescript-eslint/no-explicit-any function isEitherArrayBuffer(x) { return x instanceof SharedArrayBuffer || x instanceof ArrayBuffer || typeof x === "undefined"; diff --git a/op_crates/web/event_test.js b/op_crates/web/event_test.js index 4f9f94fa96..f533d78fb4 100644 --- a/op_crates/web/event_test.js +++ b/op_crates/web/event_test.js @@ -72,7 +72,6 @@ function eventPreventDefaultSuccess() { } function eventInitializedWithNonStringType() { - // eslint-disable-next-line @typescript-eslint/no-explicit-any const type = undefined; const event = new Event(type);