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: { constructor(opts: {
origin: APIClient['origin']; origin: APIClient['origin'];
credential?: APIClient['credential']; credential?: APIClient['credential'];
fetch?: APIClient['fetch'] | null | undefined; fetch?: FetchLike;
}) { }) {
this.origin = opts.origin; this.origin = opts.origin;
this.credential = opts.credential; this.credential = opts.credential;
// ネイティブ関数をそのまま変数に代入して使おうとするとChromiumではIllegal invocationエラーが発生するため、 // Wrap a native function with an anonymous function when using
// 環境で実装されているfetchを使う場合は無名関数でラップして使用する // environment-implemented fetch, because Chromium generates an
this.fetch = opts.fetch || ((...args) => fetch(...args)); // 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']>( public request<E extends keyof Endpoints, P extends Endpoints[E]['req']>(

View file

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

View file

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