fix lints in foundkey-js

Fixes all lints except '@typescript-eslint/no-explicit-any'.
This commit is contained in:
Johann150 2023-05-07 18:07:18 +02:00
parent 7e1ea09458
commit 0df36490c7
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1
3 changed files with 13 additions and 15 deletions

View file

@ -42,13 +42,15 @@ export class APIClient {
constructor(opts: {
origin: APIClient['origin'];
credential?: APIClient['credential'];
fetch?: APIClient['fetch'] | null | undefined;
fetch?: FetchLike;
}) {
this.origin = opts.origin;
this.credential = opts.credential;
// ネイティブ関数をそのまま変数に代入して使おうとするとChromiumではIllegal invocationエラーが発生するため、
// 環境で実装されているfetchを使う場合は無名関数でラップして使用する
this.fetch = opts.fetch || ((...args) => fetch(...args));
// Wrap a native function with an anonymous function when using
// environment-implemented fetch, because Chromium generates an
// Illegal invocation error if you try to use a native function by
// assigning it to a variable as it is.
this.fetch = opts.fetch || (((...args) => fetch(...args)) as FetchLike);
}
public request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(
@ -79,7 +81,7 @@ export class APIClient {
cache: 'no-cache',
}).then(async (res) => {
const body = res.status === 204 ? null : await res.json();
if (res.status === 200) {
resolve(body);
} else if (res.status === 204) {

View file

@ -135,9 +135,9 @@ export type Note = {
user: User;
userId: User['id'];
reply?: Note;
replyId: Note['id'];
replyId: Note['id'] | null;
renote?: Note;
renoteId: Note['id'];
renoteId: Note['id'] | null;
files: DriveFile[];
fileIds: DriveFile['id'][];
visibility: NoteVisibility;
@ -475,9 +475,6 @@ export function isPureRenote(note: Note): boolean {
return note.renoteId != null
&& note.text == null
&& note.cw == null
&& (
note.fileIds == null
|| note.fileIds.length === 0
)
&& note.fileIds.length === 0
&& note.poll == null;
}

View file

@ -34,14 +34,13 @@ export default class Stream extends EventEmitter<StreamEvents> {
constructor(origin: string, user: { token: string; } | null, options?: {
WebSocket?: any;
}) {
} = {}) {
super();
options = options || { };
const query = urlQuery({
i: user?.token,
// To prevent cache of an HTML such as error screen
// cache busting parameter
_t: Date.now(),
});