From 5a02c8356b8aa065a8a6ef4498b1628c1e122b51 Mon Sep 17 00:00:00 2001 From: Kuitos Date: Thu, 19 Oct 2023 17:27:12 +0800 Subject: [PATCH] fix: fix eslint error --- packages/sandbox/src/patchers/dynamicAppend/common.ts | 5 +---- .../src/patchers/dynamicAppend/forStandardSandbox.ts | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/packages/sandbox/src/patchers/dynamicAppend/common.ts b/packages/sandbox/src/patchers/dynamicAppend/common.ts index 4aa6af549..3bf8d5f8e 100644 --- a/packages/sandbox/src/patchers/dynamicAppend/common.ts +++ b/packages/sandbox/src/patchers/dynamicAppend/common.ts @@ -52,10 +52,7 @@ export function isHijackingTag(tagName?: string) { * @param element */ export function isStyledComponentsLike(element: HTMLStyleElement) { - return ( - !element.textContent && - ((element.sheet as CSSStyleSheet)?.cssRules.length || getStyledElementCSSRules(element)?.length) - ); + return !element.textContent && (element.sheet?.cssRules.length || getStyledElementCSSRules(element)?.length); } const appsCounterMap = new Map(); diff --git a/packages/sandbox/src/patchers/dynamicAppend/forStandardSandbox.ts b/packages/sandbox/src/patchers/dynamicAppend/forStandardSandbox.ts index 46e8c0fbf..4832941f8 100644 --- a/packages/sandbox/src/patchers/dynamicAppend/forStandardSandbox.ts +++ b/packages/sandbox/src/patchers/dynamicAppend/forStandardSandbox.ts @@ -27,8 +27,8 @@ declare global { } interface Window { - __sandboxConfigWeakMap__: WeakMap; - __currentLockingSandbox__: Sandbox; + __sandboxConfigWeakMap__?: WeakMap; + __currentLockingSandbox__?: Sandbox; } interface Document { @@ -260,7 +260,7 @@ export function patchStandardSandbox( if (typeof refNo === 'number' && refNo !== -1) { // the reference node may be dynamic script comment which is not rebuilt while remounting thus reference node no longer exists // in this case, we should append the style element to the end of mountDom - const refNode = mountDom.childNodes[refNo] || null; + const refNode = mountDom.childNodes[refNo]; rawHeadInsertBefore.call(mountDom, stylesheetElement, refNode); return true; }