diff --git a/extension/eslint.config.js b/extension/eslint.config.js index bd774e6..cb7fcc6 100644 --- a/extension/eslint.config.js +++ b/extension/eslint.config.js @@ -242,10 +242,6 @@ export default tseslint.config( // no-global-object-property-assignment stays at its recommended `error` // for production code; it's disabled only for tests (which legitimately // assign globals to set up mocks) in the test-files block below. - // Partially autofixable — fixable instances are corrected in-tree; the - // remainder warn until handled in #279. - "unicorn/no-unnecessary-global-this": "warn", - // Allow underscore-prefixed unused parameters (e.g. `_root` for the // Rule#apply signature when a rule ignores the argument). "@typescript-eslint/no-unused-vars": [ @@ -280,6 +276,10 @@ export default tseslint.config( // Tests assign onto global objects to install mocks / stubs; the rule // stays an error everywhere else. "unicorn/no-global-object-property-assignment": "off", + // Tests reach for `globalThis.*` deliberately — overriding globals for + // mocks (`globalThis.MutationObserver = …`) and dispatching events / + // reading computed style against the jsdom global. Enforced in prod. + "unicorn/no-unnecessary-global-this": "off", // Jest matchers and mock patterns routinely pass methods by reference. "@typescript-eslint/unbound-method": "off", diff --git a/extension/src/lib/placeholder.ts b/extension/src/lib/placeholder.ts index 1d374aa..6e76874 100644 --- a/extension/src/lib/placeholder.ts +++ b/extension/src/lib/placeholder.ts @@ -71,7 +71,7 @@ export function pickPaletteFromAncestor( ): PlaceholderPalette { let node: Element | null = start; while (node) { - const bg = globalThis.getComputedStyle(node).backgroundColor; + const bg = getComputedStyle(node).backgroundColor; const brightness = parseBackgroundBrightness(bg); if (brightness !== null) { return brightness < 0.5 ? "dark" : "light"; @@ -208,7 +208,7 @@ export function replaceWithBlockPlaceholder( label: string, ): HTMLDivElement { const rect = element.getBoundingClientRect(); - const computed = globalThis.getComputedStyle(element); + const computed = getComputedStyle(element); // Outer container is a non-interactive
so the inner reveal button can // use position: sticky (which doesn't work as a child of