Skip to content

Commit

Permalink
Merge branch 'master' into fix/user-profile-colors
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberL1 authored Nov 14, 2024
2 parents a11f3c0 + 841b361 commit 9384138
Show file tree
Hide file tree
Showing 16 changed files with 23 additions and 36 deletions.
7 changes: 0 additions & 7 deletions .eslintignore

This file was deleted.

6 changes: 4 additions & 2 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,9 @@ export default [{

rules: {
"no-mixed-spaces-and-tabs": "off",
"@typescript-eslint/no-inferrable-types": "off",
"@typescript-eslint/no-var-requires": "off",
"@typescript-eslint/no-inferrable-types": "off", // Required by typeorm
"@typescript-eslint/no-var-requires": "off", // Sometimes requred by typeorm to resolve circular deps
"@typescript-eslint/no-require-imports": "off",
"@typescript-eslint/no-unused-vars": "off",
},
}];
7 changes: 1 addition & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion src/api/middlewares/Authentication.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ export async function Authentication(
req.rights = new Rights(Number(user.rights));
return next();
} catch (error) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return next(new HTTPError(error!.toString(), 400));
}
}
1 change: 0 additions & 1 deletion src/api/routes/auth/reset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ router.post(
await User.update({ id: user.id }, data);

// come on, the user has to have an email to reset their password in the first place
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
await Email.sendPasswordChanged(user, user.email!);

res.json({ token: await generateToken(user.id) });
Expand Down
1 change: 0 additions & 1 deletion src/gateway/opcodes/Identify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ export async function onIdentify(this: WebSocket, data: Payload) {
// but we do want almost everything from guild.
// How do you do that without just enumerating the guild props?
guild: Object.fromEntries(
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
getDatabase()!
.getMetadata(Guild)
.columns.map((x) => [x.propertyName, true]),
Expand Down
1 change: 0 additions & 1 deletion src/gateway/opcodes/LazyRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,6 @@ async function subscribeToMemberEvents(this: WebSocket, user_id: string) {
export async function onLazyRequest(this: WebSocket, { d }: Payload) {
// TODO: check data
check.call(this, LazyRequestSchema, d);
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { guild_id, typing, channels, activities, members } =
d as LazyRequestSchema;

Expand Down
22 changes: 12 additions & 10 deletions src/gateway/opcodes/RequestGuildMembers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from "@spacebar/util";
import { WebSocket, Payload, OPCODES, Send } from "@spacebar/gateway";
import { check } from "./instanceOf";
import { FindManyOptions, In, Like } from "typeorm";
import { FindManyOptions, ILike, In } from "typeorm";

export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
// Schema validation can only accept either string or array, so transforming it here to support both
Expand Down Expand Up @@ -114,7 +114,7 @@ export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
if (query) {
// @ts-expect-error memberFind.where is very much defined
memberFind.where.user = {
username: Like(query + "%"),
username: ILike(query + "%"),
};
} else if (user_ids && user_ids.length > 0) {
// @ts-expect-error memberFind.where is still very much defined
Expand Down Expand Up @@ -166,15 +166,17 @@ export async function onRequestGuildMembers(this: WebSocket, { d }: Payload) {
});
}

if (chunks.length == 0) {
chunks.push({
...baseData,
members: [],
presences: presences ? [] : undefined,
chunk_index: 0,
chunk_count: 1,
});
}

if (notFound.length > 0) {
if (chunks.length == 0)
chunks.push({
...baseData,
members: [],
presences: presences ? [] : undefined,
chunk_index: 0,
chunk_count: 1,
});
chunks[0].not_found = notFound;
}

Expand Down
1 change: 0 additions & 1 deletion src/gateway/opcodes/VoiceStateUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ export async function onVoiceStateUpdate(this: WebSocket, data: Payload) {
voiceState.token = genVoiceToken();
voiceState.session_id = this.session_id;

// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { id, ...newObj } = voiceState;

await Promise.all([
Expand Down
2 changes: 1 addition & 1 deletion src/util/entities/BaseClass.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export class BaseClassWithoutId extends BaseEntity {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
toJSON(): any {
return Object.fromEntries(
// eslint-disable-next-line @typescript-eslint/ban-ts-comment, @typescript-eslint/no-non-null-assertion
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
this.metadata!.columns // @ts-ignore
.map((x) => [x.propertyName, this[x.propertyName]])
.concat(
Expand Down
4 changes: 2 additions & 2 deletions src/util/entities/Member.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,8 +466,8 @@ export class Member extends BaseClassWithoutId {
member[x] = this[x];
});

if (member.roles) member.roles = member.roles.map((x: Role) => x.id);
if (member.user) member.user = member.user.toPublicUser();
if (this.roles) member.roles = this.roles.map((x: Role) => x.id);
if (this.user) member.user = this.user.toPublicUser();

return member as PublicMember;
}
Expand Down
1 change: 0 additions & 1 deletion src/util/schemas/MessageCreateSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export interface MessageCreateSchema {
}

// TypeScript complains once this is used above
// eslint-disable-next-line @typescript-eslint/no-unused-vars
interface PollCreationSchema {
question: PollMedia;
answers: PollAnswer[];
Expand Down
1 change: 1 addition & 0 deletions src/util/schemas/responses/TeamListResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@

import { Team } from "@spacebar/util";

// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface TeamListResponse extends Array<Team> {}
1 change: 0 additions & 1 deletion src/util/util/AutoUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ export function enableAutoUpdate(opts: {
});
}

// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function download(url: string, dir: string) {
try {
// TODO: use file stream instead of buffer (to prevent crash because of high memory usage for big files)
Expand Down
1 change: 1 addition & 0 deletions src/util/util/Event.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ export async function listenEvent(
};

const listener = (msg: ProcessEvent) => {
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
msg.type === "event" &&
msg.id === event &&
callback({ ...msg.event, cancel });
Expand Down
2 changes: 1 addition & 1 deletion src/util/util/Sentry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export const Sentry = {
Integrations.setupExpressErrorHandler(app);

// The typings for this are broken?
// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unused-vars
// eslint-disable-next-line @typescript-eslint/no-explicit-any
app.use(function onError(err: any, req: any, res: any, next: any) {
res.statusCode = 500;
res.end(res.sentry + "\n");
Expand Down

0 comments on commit 9384138

Please sign in to comment.