Fix lint errors (except @typescript-eslint/prefer-nullish-coalescing) (#9311)

* `yarn workspace client run lint --fix`

* `eslint-disable-next-line no-var` for service worker self

* A few more manual sw fixes

* word change
This commit is contained in:
Kagami Sascha Rosylight 2022-12-12 19:27:47 +09:00 committed by GitHub
parent bae7939d79
commit 8211893210
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 25 additions and 21 deletions

View file

@ -1,6 +1,9 @@
/*
* Notification manager for SW
*/
// TODO: remove this declaration when https://github.com/microsoft/TypeScript/issues/11781 closes
// eslint-disable-next-line no-var
declare var self: ServiceWorkerGlobalScope;
import { swLang } from '@/scripts/lang';
@ -40,7 +43,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
*/
case 'notification':
switch (data.body.type) {
case 'follow':
case 'follow': {
// users/showの型定義をswos.apiへ当てはめるのが困難なのでapiFetch.requestを直接使用
const account = await getAccountFromId(data.userId);
if (!account) return null;
@ -57,6 +60,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
}
],
}];
}
case 'mention':
return [t('_notification.youGotMention', { name: getUserName(data.body.user) }), {
@ -120,7 +124,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
],
}];
case 'reaction':
case 'reaction': {
let reaction = data.body.reaction;
let badge: string | undefined;
@ -150,7 +154,6 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
badge = `/twemoji-badge/${char2fileName(reaction)}.png`;
}
if (badge ? await fetch(badge).then(res => res.status !== 200).catch(() => true) : true) {
badge = iconUrl('plus');
}
@ -167,6 +170,7 @@ async function composeNotification<K extends keyof pushNotificationDataMap>(data
}
],
}];
}
case 'pollVote':
return [t('_notification.youGotPoll', { name: getUserName(data.body.user) }), {