Skip to content

Commit 43b342a

Browse files
Merge pull request #1236 from dank074/patch/prettier
2 parents 9321975 + f5d6394 commit 43b342a

File tree

14 files changed

+157
-128
lines changed

14 files changed

+157
-128
lines changed

eslint.config.mjs

+38-31
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,46 @@ import { FlatCompat } from "@eslint/eslintrc";
99
const __filename = fileURLToPath(import.meta.url);
1010
const __dirname = path.dirname(__filename);
1111
const compat = new FlatCompat({
12-
baseDirectory: __dirname,
13-
recommendedConfig: js.configs.recommended,
14-
allConfig: js.configs.all
12+
baseDirectory: __dirname,
13+
recommendedConfig: js.configs.recommended,
14+
allConfig: js.configs.all,
1515
});
1616

17-
export default [{
18-
ignores: [
19-
"**/node_modules",
20-
"**/dist",
21-
"**/README.md",
22-
"**/COPYING",
23-
"src/webrtc",
24-
"**/scripts/",
25-
"**/assets",
26-
],
27-
}, ...compat.extends("eslint:recommended", "plugin:@typescript-eslint/recommended"), {
28-
plugins: {
29-
"@typescript-eslint": typescriptEslint,
30-
},
17+
export default [
18+
{
19+
ignores: [
20+
"**/node_modules",
21+
"**/dist",
22+
"**/README.md",
23+
"**/COPYING",
24+
"src/webrtc",
25+
"**/scripts/",
26+
"**/assets",
27+
],
28+
},
29+
...compat.extends(
30+
"eslint:recommended",
31+
"plugin:@typescript-eslint/recommended",
32+
),
33+
{
34+
plugins: {
35+
"@typescript-eslint": typescriptEslint,
36+
},
3137

32-
languageOptions: {
33-
globals: {
34-
...globals.node,
35-
},
38+
languageOptions: {
39+
globals: {
40+
...globals.node,
41+
},
3642

37-
parser: tsParser,
38-
},
43+
parser: tsParser,
44+
},
3945

40-
rules: {
41-
"no-mixed-spaces-and-tabs": "off",
42-
"@typescript-eslint/no-inferrable-types": "off", // Required by typeorm
43-
"@typescript-eslint/no-var-requires": "off", // Sometimes requred by typeorm to resolve circular deps
44-
"@typescript-eslint/no-require-imports": "off",
45-
"@typescript-eslint/no-unused-vars": "off",
46-
},
47-
}];
46+
rules: {
47+
"no-mixed-spaces-and-tabs": "off",
48+
"@typescript-eslint/no-inferrable-types": "off", // Required by typeorm
49+
"@typescript-eslint/no-var-requires": "off", // Sometimes requred by typeorm to resolve circular deps
50+
"@typescript-eslint/no-require-imports": "off",
51+
"@typescript-eslint/no-unused-vars": "off",
52+
},
53+
},
54+
];

flake.lock

+59-59
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server.code-workspace

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
{
22
"folders": [
33
{
4-
"path": "src"
4+
"path": "src",
55
},
66
{
7-
"path": "assets"
7+
"path": "assets",
88
},
99
{
10-
"path": "scripts"
10+
"path": "scripts",
1111
},
1212
{
13-
"path": "."
14-
}
13+
"path": ".",
14+
},
1515
],
1616
"settings": {
17-
"typescript.tsdk": "util\\node_modules\\typescript\\lib"
17+
"typescript.tsdk": "util\\node_modules\\typescript\\lib",
1818
},
1919
"launch": {
2020
"version": "0.2.0",
21-
"configurations": []
22-
}
21+
"configurations": [],
22+
},
2323
}

src/api/Server.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,7 @@ export class SpacebarServer extends Server {
100100
this.app.set("json replacer", JSONReplacer);
101101

102102
const trustedProxies = Config.get().security.trustedProxies;
103-
if(trustedProxies)
104-
this.app.set("trust proxy", trustedProxies);
103+
if (trustedProxies) this.app.set("trust proxy", trustedProxies);
105104

106105
this.app.use(CORS);
107106
this.app.use(BodyParser({ inflate: true, limit: "10mb" }));

src/api/routes/auth/generate-registration-tokens.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ router.get(
7272
`${Config.get().general.frontPage}/register?token=${
7373
x.token
7474
}`,
75-
)
75+
)
7676
: tokens.map((x) => x.token);
7777

7878
if (req.query.plain) return res.send(ret.join("\n"));

src/api/routes/channels/#channel_id/messages/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -417,7 +417,7 @@ router.post(
417417
? Member.update(
418418
{ id: req.user_id, guild_id: message.guild_id },
419419
{ last_message_id: message.id },
420-
)
420+
)
421421
: null,
422422
channel.save(),
423423
]);

src/api/routes/channels/#channel_id/typing.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ router.post(
5454
...member,
5555
roles: member?.roles?.map((x) => x.id),
5656
},
57-
}
57+
}
5858
: null),
5959
channel_id,
6060
timestamp,

src/api/routes/discoverable-guilds.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,24 @@ router.get(
4242
guilds = showAllGuilds
4343
? await Guild.find({
4444
take: Math.abs(Number(limit || configLimit)),
45-
})
45+
})
4646
: await Guild.find({
4747
where: { features: Like(`%DISCOVERABLE%`) },
4848
take: Math.abs(Number(limit || configLimit)),
49-
});
49+
});
5050
} else {
5151
guilds = showAllGuilds
5252
? await Guild.find({
5353
where: { primary_category_id: categories.toString() },
5454
take: Math.abs(Number(limit || configLimit)),
55-
})
55+
})
5656
: await Guild.find({
5757
where: {
5858
primary_category_id: categories.toString(),
5959
features: Like("%DISCOVERABLE%"),
6060
},
6161
take: Math.abs(Number(limit || configLimit)),
62-
});
62+
});
6363
}
6464

6565
const total = guilds ? guilds.length : undefined;

src/api/routes/guild-recommendations.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ router.get(
4848
: await Guild.find({
4949
where: { features: Like("%DISCOVERABLE%") },
5050
take: Math.abs(Number(limit || 24)),
51-
});
51+
});
5252
res.send({
5353
recommended_guilds: guilds,
5454
load_id: `server_recs/${genLoadId(32)}`,

src/api/routes/oauth2/authorize.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ router.get(
118118
guild: {
119119
roles: x?.roles || [],
120120
},
121-
});
121+
});
122122

123123
return {
124124
id: x.guild.id,

src/gateway/events/Message.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,13 @@ export async function Message(this: WebSocket, buffer: WS.Data) {
8989
}
9090

9191
try {
92-
return await Sentry.startSpan( // Emma [it/its]@Rory&: is this the right function to migrate to in v8?
92+
return await Sentry.startSpan(
93+
// Emma [it/its]@Rory&: is this the right function to migrate to in v8?
9394
{
9495
op: "websocket.server",
9596
name: `GATEWAY ${OPCODES[data.op]}`,
96-
attributes: { // this needs to be reworked :)
97+
attributes: {
98+
// this needs to be reworked :)
9799
...data.d,
98100
token: data?.d?.token ? "[Redacted]" : undefined,
99101
},

src/gateway/listener/listener.ts

+21-4
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ export async function setupListener(this: WebSocket) {
8282

8383
const opts: {
8484
acknowledge: boolean;
85-
channel?: AMQChannel & { queues?: unknown, ch?: number };
85+
channel?: AMQChannel & { queues?: unknown; ch?: number };
8686
} = {
8787
acknowledge: true,
8888
};
@@ -91,10 +91,20 @@ export async function setupListener(this: WebSocket) {
9191

9292
console.log("[RabbitMQ] setupListener: open for ", this.user_id);
9393
if (RabbitMQ.connection) {
94-
console.log("[RabbitMQ] setupListener: opts.channel = ", typeof opts.channel, "with channel id", opts.channel?.ch);
94+
console.log(
95+
"[RabbitMQ] setupListener: opts.channel = ",
96+
typeof opts.channel,
97+
"with channel id",
98+
opts.channel?.ch,
99+
);
95100
opts.channel = await RabbitMQ.connection.createChannel();
96101
opts.channel.queues = {};
97-
console.log("[RabbitMQ] channel created: ", typeof opts.channel, "with channel id", opts.channel?.ch);
102+
console.log(
103+
"[RabbitMQ] channel created: ",
104+
typeof opts.channel,
105+
"with channel id",
106+
opts.channel?.ch,
107+
);
98108
}
99109

100110
this.events[this.user_id] = await listenEvent(this.user_id, consumer, opts);
@@ -132,7 +142,14 @@ export async function setupListener(this: WebSocket) {
132142
});
133143

134144
this.once("close", () => {
135-
console.log("[RabbitMQ] setupListener: close for", this.user_id, "=", typeof opts.channel, "with channel id", opts.channel?.ch);
145+
console.log(
146+
"[RabbitMQ] setupListener: close for",
147+
this.user_id,
148+
"=",
149+
typeof opts.channel,
150+
"with channel id",
151+
opts.channel?.ch,
152+
);
136153
if (opts.channel) opts.channel.close();
137154
else {
138155
Object.values(this.events).forEach((x) => x?.());

src/util/entities/Channel.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ export class Channel extends BaseClass {
323323
event: "CHANNEL_CREATE",
324324
data: channel,
325325
guild_id: channel.guild_id,
326-
} as ChannelCreateEvent)
326+
} as ChannelCreateEvent)
327327
: Promise.resolve(),
328328
Guild.insertChannelInOrder(guild.id, ret.id, position, guild),
329329
]);

0 commit comments

Comments
 (0)