forked from FoundKeyGang/FoundKey
fix lints in foundkey-js
Fixes all lints except '@typescript-eslint/no-explicit-any'.
This commit is contained in:
parent
7e1ea09458
commit
0df36490c7
3 changed files with 13 additions and 15 deletions
|
@ -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']>(
|
||||||
|
@ -79,7 +81,7 @@ export class APIClient {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
}).then(async (res) => {
|
}).then(async (res) => {
|
||||||
const body = res.status === 204 ? null : await res.json();
|
const body = res.status === 204 ? null : await res.json();
|
||||||
|
|
||||||
if (res.status === 200) {
|
if (res.status === 200) {
|
||||||
resolve(body);
|
resolve(body);
|
||||||
} else if (res.status === 204) {
|
} else if (res.status === 204) {
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue