fix(13-02): eliminate all ESLint violations — pnpm lint exits 0
- eslint.config.js: disable React Compiler rules (v7 flat.recommended enables
them; codebase does not use the Compiler); add e2e/ to disableTypeChecked
block; promote exhaustive-deps to error
- API broker: remove redundant as-casts (outboxWorker, poller, reminderScheduler,
expand, sync, vevent, spike); add targeted ical.js no-unsafe-assignment/argument
disables with justifying comments inside try blocks
- API routes/sse.ts: fix no-misused-promises on async writeSSE callback with
void+IIFE+catch pattern
- API routes/lists.ts: let → const for updateValues
- API tests: remove unused imports (beforeEach, eq, vi); rename unused vars
with _ prefix; remove unused lastActiveId assignment
- PWA components: void navigate() and void queryClient.invalidateQueries() on
all fire-and-forget call sites; fix CalendarShell explicit-type-casts;
Couldn't → HTML entity
- PWA test files: as unknown as Response for partial mock objects; string | null
type annotation on mockLastSyncedUid; remove async from test callbacks without
await; act(() => {}) not await act(async () => {}) for sync ops
- sw.ts: restructure Notification.data?.url access as let+if so disable
comments land on the exact violation lines; void self.skipWaiting()
This commit is contained in:
+12
-7
@@ -35,7 +35,8 @@ declare const self: ServiceWorkerGlobalScope
|
||||
// AutoUpdate behavior: replace old SW immediately on install/activate.
|
||||
// Equivalent to the former generateSW autoUpdate: 'prompt' → 'autoUpdate' path.
|
||||
// ---------------------------------------------------------------------------
|
||||
self.skipWaiting()
|
||||
// skipWaiting() resolves when the SW is installed; fire-and-forget is the correct pattern here
|
||||
void self.skipWaiting()
|
||||
clientsClaim()
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
@@ -156,10 +157,14 @@ self.addEventListener('push', (event: PushEvent) => {
|
||||
self.addEventListener('notificationclick', (event: NotificationEvent) => {
|
||||
event.notification.close()
|
||||
|
||||
const url: string =
|
||||
typeof event.notification.data?.url === 'string'
|
||||
? event.notification.data.url
|
||||
: '/'
|
||||
// Notification.data is typed as 'any' in the ServiceWorker lib; we validate with typeof
|
||||
// before using the value so the access is safe despite the lack of static types.
|
||||
let url = '/'
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Notification.data is 'any' per webworker lib; typeof guard on the right-hand side validates this access
|
||||
if (typeof event.notification.data?.url === 'string') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access -- Notification.data is 'any'; typeof check above validates this access
|
||||
url = event.notification.data.url as string
|
||||
}
|
||||
|
||||
event.waitUntil(
|
||||
self.clients
|
||||
@@ -170,8 +175,8 @@ self.addEventListener('notificationclick', (event: NotificationEvent) => {
|
||||
// from the current window location (query string with event uid / date).
|
||||
for (const client of clientList) {
|
||||
if ('focus' in client) {
|
||||
return (client as WindowClient).focus().then(() =>
|
||||
(client as WindowClient).navigate(url)
|
||||
return client.focus().then(() =>
|
||||
client.navigate(url)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user