Skip to content

Commit d962147

Browse files
committed
Dependencies: Update dependencies and lint tooling
Update runtime and development dependencies to current compatible versions, keeping TypeScript on 5.9 instead of taking the TS 6 migration in this change. Move ESLint to flat config for ESLint 10 and add narrow overrides for transitive ws/flatted fixes that stay within upstream semver ranges.
1 parent 385b928 commit d962147

10 files changed

Lines changed: 52 additions & 56 deletions

File tree

‎.eslintignore‎

Lines changed: 0 additions & 2 deletions
This file was deleted.

‎.eslintrc‎

Lines changed: 0 additions & 19 deletions
This file was deleted.

‎bun.lockb‎

18.1 KB
Binary file not shown.

‎eslint.config.mjs‎

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import js from "@eslint/js";
2+
import typescriptEslint from "@typescript-eslint/eslint-plugin";
3+
import eslintConfigPrettier from "eslint-config-prettier";
4+
import prettier from "eslint-plugin-prettier";
5+
import unusedImports from "eslint-plugin-unused-imports";
6+
7+
export default [
8+
{
9+
ignores: ["node_modules/**", "build/**"],
10+
},
11+
js.configs.recommended,
12+
...typescriptEslint.configs["flat/recommended"],
13+
eslintConfigPrettier,
14+
{
15+
files: ["**/*.ts"],
16+
plugins: {
17+
prettier,
18+
"unused-imports": unusedImports,
19+
},
20+
rules: {
21+
"prettier/prettier": "error",
22+
camelcase: "error",
23+
},
24+
},
25+
];

‎package.json‎

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,23 +27,26 @@
2727
},
2828
"homepage": "https://github.com/LadybirdBrowser/discord-bot#readme",
2929
"devDependencies": {
30-
"@types/bun": "latest",
31-
"@typescript-eslint/eslint-plugin": "^7.15.0",
32-
"@typescript-eslint/parser": "^7.15.0",
33-
"eslint": "^8.56.0",
34-
"eslint-config-prettier": "^8.8.0",
35-
"eslint-plugin-prettier": "^5.1.3",
36-
"eslint-plugin-unused-imports": "^4.0.0",
37-
"prettier": "^3.3.2"
30+
"@eslint/js": "^10.0.1",
31+
"@types/bun": "^1.3.14",
32+
"@typescript-eslint/eslint-plugin": "^8.60.1",
33+
"@typescript-eslint/parser": "^8.60.1",
34+
"eslint": "^10.4.1",
35+
"eslint-config-prettier": "^10.1.8",
36+
"eslint-plugin-prettier": "^5.5.6",
37+
"eslint-plugin-unused-imports": "^4.4.1",
38+
"prettier": "^3.8.3",
39+
"typescript": "^5.9.3"
3840
},
3941
"dependencies": {
40-
"@octokit/plugin-throttling": "^9.3.0",
41-
"@octokit/rest": "^21.0.0",
42-
"axios": "^1.4.0",
43-
"discord.js": "^14.16.3",
44-
"zod": "^3.23.8"
42+
"@octokit/plugin-throttling": "^11.0.3",
43+
"@octokit/rest": "^22.0.1",
44+
"axios": "^1.17.0",
45+
"discord.js": "^14.26.4",
46+
"zod": "^4.4.3"
4547
},
46-
"peerDependencies": {
47-
"typescript": "^5.5.3"
48+
"overrides": {
49+
"flatted": "^3.4.0",
50+
"ws": "^8.20.1"
4851
}
4952
}

‎src/apis/githubAPI.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ class GithubAPI {
5959
private readonly octokit: Octokit;
6060

6161
constructor() {
62-
// @ts-expect-error -- TODO: types need fixes
6362
this.octokit = new (Octokit.plugin(OctokitThrottling))({
6463
userAgent: "Ladybird-Bot",
6564
auth: env.GITHUB_TOKEN,

‎src/commandHandler.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,8 @@ export default class CommandHandler {
7777
)} from '${interaction.user.tag}'`;
7878
console.log(msg);
7979

80-
if (!interaction.isCommand()) throw new Error("Invalid command interaction");
80+
if (!interaction.isChatInputCommand() && !interaction.isContextMenuCommand())
81+
throw new Error("Invalid command interaction");
8182

8283
if (interaction.commandName === "help") {
8384
await interaction.reply({
@@ -120,7 +121,7 @@ export default class CommandHandler {
120121
throw new Error(`${matchedCommand.constructor.name}: Missing handleContextMenu handler`);
121122
}
122123

123-
// NOTE: At this point we can we be sure that it's a command
124+
// NOTE: At this point we can be sure that it's a chat input command.
124125
return this.callInteractionHandler(matchedCommand, matchedCommand.handleCommand, interaction);
125126
}
126127

‎src/commands/testCommand.ts‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { getLadybird, getMakemore, getSadCaret } from "@/util/emoji";
1111
import Command from "./command";
1212
import githubAPI from "@/apis/githubAPI";
1313

14-
/* eslint-disable camelcase */
1514
interface Result {
1615
commit_timestamp: number;
1716
run_timestamp: number;
@@ -25,7 +24,6 @@ interface Result {
2524
};
2625
};
2726
}
28-
/* eslint-enable camelcase */
2927

3028
interface TestVariant {
3129
description: string;

‎src/commands/userCommand.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,14 @@ export class UserCommand extends Command {
4949

5050
if (username === null) {
5151
const message = await noMatchingFoundMessage(interaction);
52-
await interaction.editReply(message);
52+
await interaction.editReply({ content: message.content });
5353
throw new Error(message.content);
5454
}
5555

5656
const response = await githubAPI.fetchUserIssuesAndPulls(username).catch(() => null);
5757
if (!response || (response.issues.length === 0 && response.pulls.length === 0)) {
5858
const message = await noMatchingFoundMessage(interaction);
59-
await interaction.editReply(message);
59+
await interaction.editReply({ content: message.content });
6060
throw new Error(message.content);
6161
}
6262

‎src/config/env.ts‎

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,16 @@ import z from "zod";
1010
const envSchema = z.object({
1111
NODE_ENV: z.enum(["development", "production", "test"]).default("development"),
1212
DISCORD_TOKEN: z
13-
.string({
14-
// eslint-disable-next-line camelcase -- Param isn't camelcase
15-
required_error: "DISCORD_TOKEN was not found, either it or the .env file are missing",
16-
})
13+
.string("DISCORD_TOKEN was not found, either it or the .env file are missing")
1714
.trim()
1815
.min(1, "DISCORD_TOKEN was not of the minimum length it is either malformed or incomplete"),
1916
GITHUB_TOKEN: z
20-
.string({
21-
// eslint-disable-next-line camelcase -- Param isn't camelcase
22-
required_error: "GITHUB_TOKEN was not found, either it or the .env file are missing",
23-
})
17+
.string("GITHUB_TOKEN was not found, either it or the .env file are missing")
2418
.trim()
2519
.min(1, "GITHUB_TOKEN was not of the minimum length it is either malformed or incomplete")
2620
.optional(),
2721
GUILD_ID: z
28-
.string({
29-
// eslint-disable-next-line camelcase -- Param isn't camelcase
30-
required_error: "GUILD_ID was not found, either it or the .env file are missing",
31-
})
22+
.string("GUILD_ID was not found, either it or the .env file are missing")
3223
.trim()
3324
.min(1, "GUILD_ID was not of the minimum length it is either malformed or incomplete"),
3425
});
@@ -52,7 +43,7 @@ type EnvSchemaType = z.infer<typeof envSchema>;
5243
declare global {
5344
// eslint-disable-next-line @typescript-eslint/no-namespace -- intentional global override of process.env.
5445
namespace NodeJS {
55-
// eslint-disable-next-line @typescript-eslint/no-empty-interface -- Just an overwrite of types
46+
// eslint-disable-next-line @typescript-eslint/no-empty-object-type -- Just an overwrite of types
5647
interface ProcessEnv extends EnvSchemaType {}
5748
}
5849
}

0 commit comments

Comments
 (0)