chore: drop stale oxlint suppressions

This commit is contained in:
hazre committed 2026-04-19 16:47:28 +02:00
1 parent 70ccc6ff55
commit fecf22ad5a
33 files changed
-94

No files matched your search

-1
View File
@@ -1,5 +1,4 @@
#!/usr/bin/env node
/* oxlint-disable no-console */
import fs from 'node:fs/promises';
import path from 'node:path';
-1
View File
@@ -1,4 +1,3 @@
/* oxlint-disable no-console */
import process from 'node:process';
export const ANSI = {
@@ -1,5 +1,3 @@
/* oxlint-disable no-param-reassign */
import type { FormEventHandler, MouseEventHandler } from 'react';
import { useEffect, useRef, useState } from 'react';
import classNames from 'classnames';
@@ -74,7 +74,6 @@ export function CodeHighlightRenderer({
}
return (
// oxlint-disable-next-line react/no-danger
<code className={codeClassName} dangerouslySetInnerHTML={{ __html: currentResult.html }} />
);
}
-1
View File
@@ -1,4 +1,3 @@
/* oxlint-disable no-param-reassign */
import type { ClipboardEventHandler, KeyboardEventHandler, ReactNode } from 'react';
import { forwardRef, useCallback, useEffect, useLayoutEffect, useRef, useState } from 'react';
import { Box, Scroll, Text } from 'folds';
-1
View File
@@ -162,7 +162,6 @@ export const resetEditor = (editor: Editor) => {
};
export const resetEditorHistory = (editor: Editor) => {
// oxlint-disable-next-line no-param-reassign
editor.history = {
undos: [],
redos: [],
@@ -34,7 +34,6 @@ const getClientCache = (mx: MatrixClient): Map<string, Promise<IPreviewUrlRespon
const openMediaInNewTab = async (url: string | undefined) => {
if (!url) {
// eslint-disable-next-line no-console -- Warning for debugging
console.warn('Attempted to open an empty url');
return;
}
@@ -96,7 +95,6 @@ export const UrlPreviewCard = as<
);
const handleAuxClick = (ev: React.MouseEvent) => {
if (!prev['og:image']) {
// eslint-disable-next-line no-console -- Debug logging for missing image
console.warn('No image');
return;
}
@@ -104,7 +102,6 @@ export const UrlPreviewCard = as<
ev.preventDefault();
const mxcUrl = mxcUrlToHttp(mx, prev['og:image'], /* useAuthentication */ true);
if (!mxcUrl) {
// eslint-disable-next-line no-console -- Error logging for URL conversion failure
console.error('Error converting mxc:// url.');
return;
}
-2
View File
@@ -519,7 +519,6 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
// We intentionally mutate the objects here to avoid unnecessary copying
// mutating should be unproblematic here, since contents isn't a react component,
// or used for rendering
// oxlint-disable-next-line no-param-reassign
c['com.beeper.per_message_profile'] = convertPerMessageProfileToBeeperFormat(
perMessageProfile,
false
@@ -1399,7 +1398,6 @@ export const RoomInput = forwardRef<HTMLDivElement, RoomInputProps>(
setShowAudioRecorder(true);
function onUp() {
// oxlint-disable-next-line eslint(no-use-before-define)
cleanup();
const held = Date.now() - micHoldStartRef.current;
if (held >= HOLD_THRESHOLD_MS) {
-1
View File
@@ -324,7 +324,6 @@ export function ThreadBrowser({ room, onOpenThread, onClose, overlay }: ThreadBr
// Now fetch page 1 from the /threads endpoint. threadsTimelineSets is
// populated so fetchRoomThreadList will not early-return.
await room.fetchRoomThreads().catch((err: unknown) => {
// oxlint-disable-next-line no-console
console.warn('ThreadBrowser: fetchRoomThreads failed', err);
});
-1
View File
@@ -406,7 +406,6 @@ export function ThreadDrawer({ room, threadRootId, onClose, overlay }: ThreadDra
try {
await mx.sendReadReceipt(lastEvent, ReceiptType.Read);
} catch (err) {
// oxlint-disable-next-line no-console
console.warn('Failed to send thread read receipt:', err);
}
}
@@ -1117,7 +1117,6 @@ function MessageInternal(
>
<Text size="L400">Nickname</Text>
<input
// oxlint-disable-next-line jsx-a11y/no-autofocus
autoFocus
value={nickDraft}
onChange={(e) => setNickDraft(e.target.value)}
@@ -1,4 +1,3 @@
/* eslint-disable react/no-unused-prop-types */
import type { MouseEventHandler, ReactNode } from 'react';
import { forwardRef, useCallback, useMemo, useRef } from 'react';
import type { MatrixEvent, Room, RoomPinnedEventsEventContent } from '$types/matrix-sdk';
@@ -45,7 +45,6 @@ export function PerMessageProfileEditor({
const [currentId, setCurrentId] = useState(profileId);
const [newId, setNewId] = useState(profileId);
// eslint-disable-next-line no-console -- Debug logging for pronouns
console.warn(pronouns);
// Pronouns
@@ -207,7 +207,6 @@ export function DebugLogViewer() {
category: filterCategory !== 'all' ? filterCategory : 'none',
},
logsCount: logsToExport.length,
// oxlint-disable-next-line oxc/no-map-spread
logs: logsToExport.map((log) => ({
...log,
timestamp: new Date(log.timestamp).toISOString(),
@@ -256,7 +255,6 @@ export function DebugLogViewer() {
category: filterCategory !== 'all' ? filterCategory : 'none',
},
logsCount: logsToExport.length,
// oxlint-disable-next-line oxc/no-map-spread
logs: logsToExport.map((log) => ({
...log,
timestamp: new Date(log.timestamp).toISOString(),
@@ -1,4 +1,3 @@
/* oxlint-disable no-nested-ternary */
import { useCallback, useEffect, useState } from 'react';
import { Box, Text, Switch, Button, color, Spinner, config } from 'folds';
import type { IPusherRequest } from '$types/matrix-sdk';
@@ -340,7 +340,6 @@ export class GenericWidgetDriver extends WidgetDriver {
return this.mxClient.getVisibleRooms().map((r: Room) => r.roomId);
}
// oxlint-disable-next-line class-methods-use-this -- WidgetDriver requires an instance override
public processError(error: unknown): IWidgetApiErrorResponseDataDetails | undefined {
return error instanceof MatrixError
? { matrix_api_error: error.asWidgetApiErrorData() }
-10
View File
@@ -46,13 +46,11 @@ const fillMissingPowers = (powerLevels: IPowerLevels): IPowerLevels =>
const keys = Object.keys(DEFAULT_POWER_LEVELS) as unknown as (keyof IPowerLevels)[];
keys.forEach((key) => {
if (draftPl[key] === undefined) {
// oxlint-disable-next-line no-param-reassign
(draftPl as Record<string, unknown>)[key] =
(DEFAULT_POWER_LEVELS as Record<string, unknown>)[key] ?? 0;
}
});
if (draftPl.notifications && typeof draftPl.notifications.room !== 'number') {
// oxlint-disable-next-line no-param-reassign
draftPl.notifications.room = DEFAULT_POWER_LEVELS.notifications.room as number;
}
return draftPl;
@@ -237,23 +235,19 @@ export const applyPermissionPower = (
if (typeof location.key === 'string') {
const users = powerLevels.users ?? {};
users[location.key] = power;
// oxlint-disable-next-line no-param-reassign
powerLevels.users = users;
return powerLevels;
}
// oxlint-disable-next-line no-param-reassign
powerLevels.users_default = power;
return powerLevels;
}
if ('action' in location) {
// oxlint-disable-next-line no-param-reassign
powerLevels[location.key] = power;
return powerLevels;
}
if ('notification' in location) {
const notifications = powerLevels.notifications ?? {};
notifications[location.key] = power;
// oxlint-disable-next-line no-param-reassign
powerLevels.notifications = notifications;
return powerLevels;
}
@@ -261,11 +255,9 @@ export const applyPermissionPower = (
if (typeof location.key === 'string') {
const events = powerLevels.events ?? {};
events[location.key] = power;
// oxlint-disable-next-line no-param-reassign
powerLevels.events = events;
return powerLevels;
}
// oxlint-disable-next-line no-param-reassign
powerLevels.state_default = power;
return powerLevels;
}
@@ -273,11 +265,9 @@ export const applyPermissionPower = (
if (typeof location.key === 'string') {
const events = powerLevels.events ?? {};
events[location.key] = power;
// oxlint-disable-next-line no-param-reassign
powerLevels.events = events;
return powerLevels;
}
// oxlint-disable-next-line no-param-reassign
powerLevels.events_default = power;
return powerLevels;
};
@@ -1,4 +1,3 @@
/* oxlint-disable no-continue */
import type { MatrixEvent, Room, RoomEventHandlerMap } from '$types/matrix-sdk';
import { RoomEvent } from '$types/matrix-sdk';
import { useEffect, useState } from 'react';
@@ -819,7 +819,6 @@ function HandleDecryptPushEvent() {
visibilityState: document.visibilityState,
});
} catch (err) {
// eslint-disable-next-line no-console -- Warning logging for push decryption failure
console.warn('[app] HandleDecryptPushEvent: failed to decrypt push event', err);
pushRelayLog.error(
'notification',
-1
View File
@@ -134,7 +134,6 @@ export class CallControl extends EventEmitter implements CallControlState {
const callDocument = this.iframe.contentDocument ?? this.iframe.contentWindow?.document;
if (callDocument) {
callDocument.querySelectorAll('audio').forEach((el) => {
// oxlint-disable-next-line no-param-reassign
el.muted = !sound;
});
}
-2
View File
@@ -303,7 +303,6 @@ export class CallEmbed {
if (this.call === null) return;
const raw = ev.getEffectiveEvent();
this.call.feedStateUpdate(raw as IRoomEvent).catch((e) => {
// eslint-disable-next-line no-console -- Error logging for widget communication debugging
console.error('Error sending state update to widget: ', e);
});
}
@@ -410,7 +409,6 @@ export class CallEmbed {
} else {
const raw = ev.getEffectiveEvent();
this.call.feedEvent(raw as IRoomEvent).catch((e) => {
// eslint-disable-next-line no-console -- Error logging for widget communication debugging
console.error('Error sending event to widget: ', e);
});
}
-1
View File
@@ -365,7 +365,6 @@ export class CallWidgetDriver extends WidgetDriver {
return this.mx.getVisibleRooms().map((r) => r.roomId);
}
// oxlint-disable-next-line class-methods-use-this
public processError(error: unknown): IWidgetApiErrorResponseDataDetails | undefined {
return error instanceof MatrixError
? { matrix_api_error: error.asWidgetApiErrorData() }
-2
View File
@@ -1,5 +1,3 @@
/* oxlint-disable no-bitwise */
/* oxlint-disable no-plusplus */
// https://github.com/element-hq/element-web/blob/a5b63d582fde59ea4dd3c7fdcad7266ab70dd695/apps/web/src/utils/MegolmExportEncryption.ts
import { createLogger } from './debug';
-1
View File
@@ -7,7 +7,6 @@ function hashCode(str?: string): number {
}
for (let i = 0; i < str.length; i += 1) {
const chr = str.codePointAt(i) ?? 0;
// oxlint-disable-next-line no-bitwise
hash = (hash << 5) - hash + chr;
hash = Math.trunc(hash);
-1
View File
@@ -16,7 +16,6 @@ type LogLevel = 'log' | 'warn' | 'error';
const fmt = (namespace: string, level: LogLevel, ...args: unknown[]): void => {
if (!isDebug() && level === 'log') return;
const prefix = `[sable:${namespace}]`;
// oxlint-disable-next-line no-console
console[level](prefix, ...args);
};
-2
View File
@@ -84,7 +84,6 @@ class DebugLoggerService {
listener(entry);
} catch (error) {
// Silently catch listener errors to prevent debug logging from breaking the app
// eslint-disable-next-line no-console -- Error logging for debugging
console.error('[DebugLogger] Listener error:', error);
}
});
@@ -123,7 +122,6 @@ class DebugLoggerService {
// Also log to console for developer convenience
const prefix = `[sable:${category}:${namespace}]`;
const consoleLevel = level === 'debug' ? 'log' : level;
// oxlint-disable-next-line no-console
console[consoleLevel](prefix, message, data !== undefined ? data : '');
}
-1
View File
@@ -180,7 +180,6 @@ export const getOrphanParents = (roomToParents: RoomToParents, roomId: string):
return Array.from(parents).filter((parentRoomId) => !roomToParents.has(parentRoomId));
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
export const isMutedRule = (rule: IPushRule) =>
// Check for empty actions (new spec) or dont_notify (deprecated)
(rule.actions.length === 0 || (rule.actions[0] as unknown as string) === 'dont_notify') &&
-6
View File
@@ -288,33 +288,27 @@ export const sanitizeCustomHtml = (customHtml: string): string => {
if (tagName === 'img' && attrName === INTERNAL_IMG_SRC_ATTR) {
if (!protectedSources.has(hookEvent.attrValue)) {
// oxlint-disable-next-line no-param-reassign
hookEvent.keepAttr = false;
return;
}
// oxlint-disable-next-line no-param-reassign
hookEvent.forceKeepAttr = true;
return;
}
if (!tagAllowsAttribute(tagName, attrName)) {
// DOMPurify exposes attribute decisions by mutating the hook event.
// oxlint-disable-next-line no-param-reassign
hookEvent.keepAttr = false;
return;
}
const validatedAttrValue = getValidatedAttributeValue(tagName, attrName, hookEvent.attrValue);
if (validatedAttrValue === undefined) {
// oxlint-disable-next-line no-param-reassign
hookEvent.keepAttr = false;
return;
}
// oxlint-disable-next-line no-param-reassign
hookEvent.attrValue = validatedAttrValue;
// oxlint-disable-next-line no-param-reassign
hookEvent.forceKeepAttr = true;
});
-3
View File
@@ -1,4 +1,3 @@
/* oxlint-disable max-classes-per-file */
import type {
Extension,
MatrixClient,
@@ -212,12 +211,10 @@ class ExtensionPresence implements Extension<{ enabled: boolean }, { events?: ob
this.enabled = value;
}
// oxlint-disable-next-line class-methods-use-this
public name(): string {
return 'presence';
}
// oxlint-disable-next-line class-methods-use-this
public when(): ExtensionState {
// Run after the main response body has been processed so room/member state is ready.
return ExtensionState.PostProcess;
-2
View File
@@ -36,7 +36,6 @@ const showUpdateAvailablePrompt = (registration: ServiceWorkerRegistration) => {
return;
}
// oxlint-disable-next-line eslint(no-alert) -- PWA update prompt requires browser confirm dialog
if (window.confirm('A new version of the app is available. Refresh to update?')) {
if (registration.waiting) {
// oxlint-disable-next-line unicorn/require-post-message-target-origin
@@ -102,7 +101,6 @@ if ('serviceWorker' in navigator) {
if (data.type === 'token' && data.id) {
const token = localStorage.getItem('cinny_access_token') ?? undefined;
// oxlint-disable-next-line unicorn/require-post-message-target-origin
ev.source?.postMessage({
replyTo: data.id,
payload: token,
-15
View File
@@ -94,13 +94,11 @@ if (dsn && sentryEnabled) {
if (log.level === 'debug' && environment === 'production') return null;
// Redact Matrix IDs and tokens from the log message string
if (typeof log.message === 'string') {
// oxlint-disable-next-line no-param-reassign
log.message = scrubMatrixIds(log.message);
}
// Redact Matrix IDs from any string-valued log attributes (e.g. roomId, userId)
// These are flattened from the structured data object and sent as searchable attributes.
if (log.attributes && typeof log.attributes === 'object') {
// oxlint-disable-next-line no-param-reassign
log.attributes = scrubDataObject(log.attributes) as typeof log.attributes;
}
return log;
@@ -113,7 +111,6 @@ if (dsn && sentryEnabled) {
// React Router normally parameterises routes (e.g. /home/:roomIdOrAlias/) but falls
// back to the raw URL when matching fails, so we scrub defensively here.
if (event.transaction) {
// oxlint-disable-next-line no-param-reassign
event.transaction = scrubMatrixUrl(event.transaction);
}
@@ -126,7 +123,6 @@ if (dsn && sentryEnabled) {
// For each string value: apply URL scrubbing when the value starts with "http",
// then apply ID scrubbing to catch any remaining bare Matrix IDs.
if (event.spans) {
// oxlint-disable-next-line no-param-reassign
event.spans = event.spans.map((span) => {
const newDesc = span.description ? scrubMatrixUrl(span.description) : span.description;
const spanData = span.data as Record<string, unknown> | undefined;
@@ -217,13 +213,11 @@ if (dsn && sentryEnabled) {
) {
const errcode = (originalException as Record<string, unknown>).errcode as string;
// Preserve default grouping AND split by errcode
// oxlint-disable-next-line no-param-reassign
event.fingerprint = ['{{ default }}', errcode];
}
// Scrub sensitive data from error messages and exception values using shared helpers
if (event.message) {
// oxlint-disable-next-line no-param-reassign
event.message = scrubMatrixIds(event.message);
}
@@ -231,7 +225,6 @@ if (dsn && sentryEnabled) {
if (event.exception?.values) {
event.exception.values.forEach((exception) => {
if (exception.value) {
// oxlint-disable-next-line no-param-reassign
exception.value = scrubMatrixUrl(scrubMatrixIds(exception.value));
}
});
@@ -240,13 +233,11 @@ if (dsn && sentryEnabled) {
// Scrub contexts (e.g. debugLog context from captureMessage in debugLogger.ts,
// which can carry structured data fields like roomId, targetEventId, etc.)
if (event.contexts) {
// oxlint-disable-next-line no-param-reassign
event.contexts = scrubDataObject(event.contexts) as typeof event.contexts;
}
// Scrub request data
if (event.request?.url) {
// oxlint-disable-next-line no-param-reassign
event.request.url = scrubMatrixUrl(
event.request.url.replace(
/(access_token|password|token)([=:]\s*)([^\s&]+)/gi,
@@ -258,7 +249,6 @@ if (dsn && sentryEnabled) {
// Scrub the transaction name on error events (set when the error occurred during a
// page-load or navigation transaction — raw URL leaks here when route matching fails)
if (event.transaction) {
// oxlint-disable-next-line no-param-reassign
event.transaction = scrubMatrixUrl(event.transaction);
}
@@ -289,19 +279,14 @@ if (dsn && sentryEnabled) {
// @ts-expect-error - Adding to window for debugging
window.Sentry = Sentry;
// oxlint-disable-next-line no-console
console.info(
`[Sentry] Initialized for ${environment} environment${replayEnabled ? ' with Session Replay' : ''}`
);
// oxlint-disable-next-line no-console
console.info(`[Sentry] DSN configured: ${dsn?.substring(0, 30)}...`);
// oxlint-disable-next-line no-console
console.info(`[Sentry] Release: ${release || 'not set'}`);
} else if (!sentryEnabled) {
// oxlint-disable-next-line no-console
console.info('[Sentry] Disabled by user preference');
} else {
// oxlint-disable-next-line no-console
console.info('[Sentry] Disabled - no DSN provided');
}
-22
View File
@@ -154,7 +154,6 @@ function setSession(clientId: string, accessToken: unknown, baseUrl: unknown, us
sessions.set(clientId, info);
// A real session has arrived — discard the preloaded fallback.
preloadedSession = undefined;
// eslint-disable-next-line no-console -- Service worker debug logging for session management
console.debug('[SW] setSession: stored', clientId, baseUrl);
// Persist so push-event fetches work after iOS restarts the SW.
persistSession(info).catch(() => undefined);
@@ -162,7 +161,6 @@ function setSession(clientId: string, accessToken: unknown, baseUrl: unknown, us
// Logout or invalid session
sessions.delete(clientId);
preloadedSession = undefined;
// eslint-disable-next-line no-console -- Service worker debug logging
console.debug('[SW] setSession: removed', clientId);
clearPersistedSession().catch(() => undefined);
}
@@ -196,7 +194,6 @@ async function requestSessionWithTimeout(
): Promise<SessionInfo | undefined> {
const client = await self.clients.get(clientId);
if (!client) {
// eslint-disable-next-line no-console -- Service worker warning for debugging
console.warn('[SW] requestSessionWithTimeout: client not found', clientId);
return undefined;
}
@@ -205,7 +202,6 @@ async function requestSessionWithTimeout(
const timeout = new Promise<undefined>((resolve) => {
setTimeout(() => {
// eslint-disable-next-line no-console -- Service worker warning for debugging
console.warn('[SW] requestSessionWithTimeout: timed out after', timeoutMs, 'ms', clientId);
resolve(undefined);
}, timeoutMs);
@@ -252,13 +248,11 @@ async function fetchRawEvent(
headers: { Authorization: `Bearer ${accessToken}` },
});
if (!res.ok) {
// eslint-disable-next-line no-console -- Service worker debug logging for HTTP errors
console.warn('[SW fetchRawEvent] HTTP', res.status, 'for', eventId);
return undefined;
}
return (await res.json()) as Record<string, unknown>;
} catch (err) {
// eslint-disable-next-line no-console -- Service worker debug logging for errors
console.warn('[SW fetchRawEvent] error', err);
return undefined;
}
@@ -396,7 +390,6 @@ async function requestDecryptionFromClient(
const timeout = new Promise<undefined>((resolve) => {
setTimeout(() => {
decryptionPendingMap.delete(eventId);
// eslint-disable-next-line no-console -- Service worker debug logging for timeout
console.warn('[SW decryptRelay] timed out waiting for client', client.id);
resolve(undefined);
}, 5000);
@@ -409,7 +402,6 @@ async function requestDecryptionFromClient(
});
} catch (err) {
decryptionPendingMap.delete(eventId);
// eslint-disable-next-line no-console -- Service worker error logging for postMessage failure
console.warn('[SW decryptRelay] postMessage error', err);
return undefined;
}
@@ -438,7 +430,6 @@ async function handleMinimalPushPayload(
if (!session) {
// No session anywhere — app was never opened since install, or the user logged out.
// Show a minimal actionable notification so the user can tap through to the room.
// eslint-disable-next-line no-console -- Service worker debug logging for push notifications
console.debug('[SW push] minimal payload: no session, showing generic notification');
await self.registration.showNotification('New Message', {
body: undefined,
@@ -740,7 +731,6 @@ self.addEventListener('fetch', (event: FetchEvent) => {
if (persisted && validMediaRequest(url, persisted.baseUrl)) {
return fetch(url, { ...fetchConfig(persisted.accessToken), redirect });
}
// eslint-disable-next-line no-console -- Service worker warning for media fetch fallback
console.warn(
'[SW fetch] No valid session for media request',
{ url, clientId, hasSession: !!s },
@@ -777,23 +767,19 @@ const onPushNotification = async (event: PushEvent) => {
// because iOS Safari PWA often returns empty or stale results from matchAll().
const hasVisibleClient =
appIsVisible || clients.some((client) => client.visibilityState === 'visible');
// eslint-disable-next-line no-console -- Service worker debug logging for visibility check
console.debug(
'[SW push] appIsVisible:',
appIsVisible,
'| clients:',
clients.map((c) => ({ url: c.url, visibility: c.visibilityState }))
);
// eslint-disable-next-line no-console -- Service worker debug logging for visibility check
console.debug('[SW push] hasVisibleClient:', hasVisibleClient);
if (hasVisibleClient) {
// eslint-disable-next-line no-console -- Service worker debug logging for visibility check
console.debug('[SW push] suppressing OS notification — app is visible');
return;
}
const pushData = event.data.json();
// eslint-disable-next-line no-console -- Service worker debug logging for push data
console.debug('[SW push] raw payload:', JSON.stringify(pushData, null, 2));
try {
@@ -827,7 +813,6 @@ const onPushNotification = async (event: PushEvent) => {
// event_id_only format: fetch the event ourselves and (for E2EE rooms) try
// to relay decryption to an open app tab.
if (isMinimalPushPayload(pushData)) {
// eslint-disable-next-line no-console -- Service worker debug logging for minimal payload
console.debug('[SW push] minimal payload detected — fetching event', pushData.event_id);
await handleMinimalPushPayload(pushData.room_id, pushData.event_id, clients);
return;
@@ -853,9 +838,7 @@ self.addEventListener('notificationclick', (event: NotificationEvent) => {
const pushEventId: string | undefined = data?.event_id ?? undefined;
const isInvite = data?.content?.membership === 'invite';
// eslint-disable-next-line no-console -- Service worker debug logging for notification click
console.debug('[SW notificationclick] notification data:', JSON.stringify(data, null, 2));
// eslint-disable-next-line no-console -- Service worker debug logging for notification click
console.debug('[SW notificationclick] resolved fields:', {
pushUserId,
pushRoomId,
@@ -891,7 +874,6 @@ self.addEventListener('notificationclick', (event: NotificationEvent) => {
targetUrl = new URL('inbox/notifications/', scope).href;
}
// eslint-disable-next-line no-console -- Service worker debug logging for notification click
console.debug('[SW notificationclick] targetUrl:', targetUrl);
event.waitUntil(
@@ -901,7 +883,6 @@ self.addEventListener('notificationclick', (event: NotificationEvent) => {
includeUncontrolled: true,
})) as WindowClient[];
// eslint-disable-next-line no-console -- Service worker debug logging for notification click
console.debug(
'[SW notificationclick] window clients:',
clientList.map((c) => ({
@@ -912,7 +893,6 @@ self.addEventListener('notificationclick', (event: NotificationEvent) => {
);
for (const wc of clientList) {
// eslint-disable-next-line no-console -- Service worker debug logging for notification click
console.debug('[SW notificationclick] postMessage to existing client:', wc.url);
try {
// Post notification data directly to the running app so its
@@ -931,14 +911,12 @@ self.addEventListener('notificationclick', (event: NotificationEvent) => {
await wc.focus();
return;
} catch (err) {
// eslint-disable-next-line no-console -- Service worker debug logging for notification click
console.debug('[SW notificationclick] postMessage/focus failed:', err);
}
}
// No existing window clients — open a new window.
// ToRoomEvent handles the /to/ URL on cold launch (account switch + pending atom).
// eslint-disable-next-line no-console -- Service worker debug logging for notification click
console.debug('[SW notificationclick] falling back to openWindow()', targetUrl);
if (self.clients.openWindow) {
await self.clients.openWindow(targetUrl);
-2
View File
@@ -55,7 +55,6 @@ export const createPushNotifications = (
silent,
data,
};
// eslint-disable-next-line no-console -- Service worker debug logging for notifications
console.debug('[SW showNotification] title:', title, '| data:', JSON.stringify(data, null, 2));
await self.registration.showNotification(title, notifOptions as NotificationOptions);
};
@@ -177,7 +176,6 @@ export const createPushNotifications = (
const handlePushNotificationPushData = async (pushData: MatrixPushData) => {
const eventType = pushData?.type as EventType | undefined;
if (!eventType) {
// eslint-disable-next-line no-console -- Service worker debug logging
console.warn('no event type');
}