fix: lint issues (#133)

Signed-off-by: Chris Hultin <chris.hultin@gmail.com>
This commit is contained in:
Christopher Hultin
2026-02-28 12:18:54 -07:00
committed by GitHub
parent e1a9c8a856
commit 0f2cd21df8
14 changed files with 56 additions and 40 deletions
+1 -1
View File
@@ -279,7 +279,7 @@ export class Client extends AsyncEventEmitter<Events> {
this.#reconnectTimeout = setTimeout(
() => this.connect(),
this.options.retryDelayFunction(this.connectionFailureCount()) *
1e3,
1e3,
) as never;
this.#setConnectionFailureCount((count) => count + 1);
+2 -2
View File
@@ -177,8 +177,8 @@ export class Channel {
get recipient(): User | undefined {
return this.type === "DirectMessage"
? this.recipients?.find(
(user) => user?.id !== this.#collection.client.user!.id,
)
(user) => user?.id !== this.#collection.client.user!.id,
)
: undefined;
}
+1 -1
View File
@@ -61,7 +61,7 @@ export class MFA {
return new MFATicket(
this.#client,
await this.#client.api.put("/auth/mfa/ticket", params),
this.#store[1]
this.#store[1],
);
}
+6 -2
View File
@@ -110,7 +110,9 @@ export class ServerMember {
/**
* Ordered list of roles for this member, from lowest to highest priority.
*/
get orderedRoles(): (Partial<Omit<Role, 'permissions'> & { permissions: { a: bigint, d: bigint } }> & { id: string })[] {
get orderedRoles(): (Partial<
Omit<Role, "permissions"> & { permissions: { a: bigint; d: bigint } }
> & { id: string })[] {
const server = this.server!;
return (
this.roles
@@ -125,7 +127,9 @@ export class ServerMember {
/**
* Member's currently hoisted role.
*/
get hoistedRole(): Partial<Omit<Role, 'permissions'> & { permissions: { a: bigint, d: bigint } }> | null {
get hoistedRole(): Partial<
Omit<Role, "permissions"> & { permissions: { a: bigint; d: bigint } }
> | null {
const roles = this.orderedRoles.filter((x) => x.hoist);
if (roles.length > 0) {
return roles[roles.length - 1];
+3 -3
View File
@@ -12,8 +12,8 @@ export class ServerRole {
readonly id: string;
readonly name: string;
readonly permissions: {
a: bigint,
d: bigint
a: bigint;
d: bigint;
};
readonly colour?: string;
readonly hoist: boolean;
@@ -34,7 +34,7 @@ export class ServerRole {
this.name = data.name;
this.permissions = {
a: BigInt(data.permissions.a),
d: BigInt(data.permissions.d)
d: BigInt(data.permissions.d),
};
this.colour = data.colour ?? undefined;
this.hoist = data.hoist || false;
+14 -4
View File
@@ -1,10 +1,13 @@
import type { SystemMessage as APISystemMessage, Message as APIMessage } from "stoat-api";
import type {
Message as APIMessage,
SystemMessage as APISystemMessage,
} from "stoat-api";
import { decodeTime } from "ulid";
import type { Client } from "../Client.js";
import type { User } from "./User.js";
import { Message } from "./index.js";
import { decodeTime } from "ulid";
/**
* System Message
@@ -29,7 +32,11 @@ export abstract class SystemMessage {
* @param embed Data
* @returns System Message
*/
static from(client: Client, parent: APIMessage, message: APISystemMessage): SystemMessage {
static from(
client: Client,
parent: APIMessage,
message: APISystemMessage,
): SystemMessage {
switch (message.type) {
case "text":
return new TextSystemMessage(client, message);
@@ -299,7 +306,10 @@ export class CallStartedSystemMessage extends SystemMessage {
super(client, systemMessage.type);
this.byId = systemMessage.by;
this.startedAt = new Date(decodeTime(parent._id));
this.finishedAt = systemMessage.finished_at != null ? new Date(systemMessage.finished_at) : null;
this.finishedAt =
systemMessage.finished_at != null
? new Date(systemMessage.finished_at)
: null;
}
/**
+8 -6
View File
@@ -1,5 +1,5 @@
import { Accessor, Setter, createSignal } from "solid-js";
import { Accessor, createSignal, Setter } from "solid-js";
import type { Client } from "../Client.js";
import { UserVoiceState } from "../events/v1.js";
@@ -39,7 +39,9 @@ export class VoiceParticipant {
this.isPublishing = isPublishing;
this.#setPublishing = setPublishing;
const [isScreensharing, setScreensharing] = createSignal(data.screensharing);
const [isScreensharing, setScreensharing] = createSignal(
data.screensharing,
);
this.isScreensharing = isScreensharing;
this.#setScreensharing = setScreensharing;
@@ -53,19 +55,19 @@ export class VoiceParticipant {
* @param data Data
*/
update(data: Partial<UserVoiceState>) {
if (typeof data.is_receiving === 'boolean') {
if (typeof data.is_receiving === "boolean") {
this.#setReceiving(data.is_receiving);
}
if (typeof data.is_publishing === 'boolean') {
if (typeof data.is_publishing === "boolean") {
this.#setPublishing(data.is_publishing);
}
if (typeof data.screensharing === 'boolean') {
if (typeof data.screensharing === "boolean") {
this.#setScreensharing(data.screensharing);
}
if (typeof data.camera === 'boolean') {
if (typeof data.camera === "boolean") {
this.#setCamera(data.camera);
}
}
+1 -5
View File
@@ -1,10 +1,6 @@
import { batch } from "solid-js";
import type {
Server as APIServer,
Channel,
DataCreateServer,
} from "stoat-api";
import type { Server as APIServer, Channel, DataCreateServer } from "stoat-api";
import { Server } from "../classes/Server.js";
import type { HydratedServer } from "../hydration/server.js";
+7 -7
View File
@@ -291,14 +291,14 @@ export class EventClient<
*/
get lastError():
| {
type: "socket";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any;
}
type: "socket";
// eslint-disable-next-line @typescript-eslint/no-explicit-any
data: any;
}
| {
type: "revolt";
data: Error;
}
type: "revolt";
data: Error;
}
| undefined {
return this.#lastError;
}
+1 -1
View File
@@ -41,4 +41,4 @@ export const botHydration: Hydrate<APIBot, HydratedBot> = {
/**
* Flags attributed to users
*/
export enum BotFlags { }
export enum BotFlags {}
+9 -5
View File
@@ -1,13 +1,13 @@
import { ReactiveMap } from "@solid-primitives/map";
import { ReactiveSet } from "@solid-primitives/set";
import type { Channel as APIChannel } from "stoat-api";
import type { Client } from "../Client.js";
import { File } from "../classes/File.js";
import { VoiceParticipant } from "../classes/VoiceParticipant.js";
import type { Merge } from "../lib/merge.js";
import type { Hydrate } from "./index.js";
import { VoiceParticipant } from "../classes/VoiceParticipant.js";
import { ReactiveMap } from "@solid-primitives/map";
export type HydratedChannel = {
id: string;
@@ -77,9 +77,13 @@ export const channelHydration: Hydrate<Merge<APIChannel>, HydratedChannel> = {
nsfw: (channel) => channel.nsfw || false,
lastMessageId: (channel) => channel.last_message_id!,
voice: (channel) =>
!!channel.voice || channel.channel_type === 'DirectMessage' || channel.channel_type === 'Group' ? ({
maxUsers: channel.voice?.max_users || undefined,
}) : undefined,
!!channel.voice ||
channel.channel_type === "DirectMessage" ||
channel.channel_type === "Group"
? {
maxUsers: channel.voice?.max_users || undefined,
}
: undefined,
},
initialHydration: () => ({
typingIds: new ReactiveSet(),
+1 -1
View File
@@ -98,4 +98,4 @@ export enum MessageFlags {
* This cannot be true if MentionsEveryone is true
*/
MentionsOnline = 3,
}
}
+1 -1
View File
@@ -8,4 +8,4 @@ export { BotFlags } from "./hydration/bot.js";
export { ServerFlags } from "./hydration/server.js";
export { UserBadges, UserFlags } from "./hydration/user.js";
export * from "./lib/regex.js";
export * from './permissions/definitions.js';
export * from "./permissions/definitions.js";
+1 -1
View File
@@ -40,7 +40,7 @@ export class ObjectStorage<T> {
id: string,
type: keyof Hydrators,
context: unknown,
data?: unknown
data?: unknown,
): void {
if (data) {
data = { partial: false, ...data };