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:
parent
bae7939d79
commit
8211893210
15 changed files with 25 additions and 21 deletions
|
@ -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) }), {
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
/*
|
||||
* Language manager for SW
|
||||
*/
|
||||
declare var self: ServiceWorkerGlobalScope;
|
||||
|
||||
import { get, set } from 'idb-keyval';
|
||||
import { I18n } from '@/scripts/i18n';
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
declare var self: ServiceWorkerGlobalScope;
|
||||
|
||||
import { get } from 'idb-keyval';
|
||||
import { pushNotificationDataMap } from '@/types';
|
||||
import { api } from '@/scripts/operations';
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
* Operations
|
||||
* 各種操作
|
||||
*/
|
||||
|
||||
// TODO: remove this declaration when https://github.com/microsoft/TypeScript/issues/11781 closes
|
||||
// eslint-disable-next-line no-var
|
||||
declare var self: ServiceWorkerGlobalScope;
|
||||
|
||||
import * as Misskey from 'misskey-js';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export function query(obj: {}): string {
|
||||
export function query(obj: object): string {
|
||||
const params = Object.entries(obj)
|
||||
.filter(([, v]) => Array.isArray(v) ? v.length : v !== undefined)
|
||||
.reduce((a, [k, v]) => (a[k] = v, a), {} as Record<string, any>);
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
// TODO: remove this declaration when https://github.com/microsoft/TypeScript/issues/11781 closes
|
||||
// eslint-disable-next-line no-var
|
||||
declare var self: ServiceWorkerGlobalScope;
|
||||
|
||||
import { createEmptyNotification, createNotification } from '@/scripts/create-notification';
|
||||
|
@ -176,7 +178,6 @@ self.addEventListener('notificationclick', <K extends keyof pushNotificationData
|
|||
}
|
||||
|
||||
notification.close();
|
||||
|
||||
})());
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue