Skip to content

Commit 33cf325

Browse files
author
HunteRoi
committed
linting
1 parent 6aa637d commit 33cf325

14 files changed

Lines changed: 100 additions & 81 deletions

File tree

biome.json

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,22 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.6.4/schema.json",
3-
"organizeImports": {
4-
"enabled": true
5-
},
6-
"vcs": {
7-
"enabled": true,
8-
"clientKind": "git",
9-
"useIgnoreFile": true,
10-
"defaultBranch": "master"
11-
},
12-
"linter": {
13-
"enabled": true,
14-
"rules": {
15-
"recommended": true
16-
}
17-
},
18-
"formatter": {
19-
"enabled": true,
20-
"indentStyle": "space",
21-
"indentWidth": 4,
22-
"lineEnding": "lf"
23-
}
2+
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
3+
"assist": { "actions": { "source": { "organizeImports": "on" } } },
4+
"vcs": {
5+
"enabled": true,
6+
"clientKind": "git",
7+
"useIgnoreFile": true,
8+
"defaultBranch": "master"
9+
},
10+
"linter": {
11+
"enabled": true,
12+
"rules": {
13+
"recommended": true
14+
}
15+
},
16+
"formatter": {
17+
"enabled": true,
18+
"indentStyle": "space",
19+
"indentWidth": 4,
20+
"lineEnding": "lf"
21+
}
2422
}

index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import { GatewayIntentBits } from "discord.js";
21
import * as dotenvx from "@dotenvx/dotenvx";
2+
import { GatewayIntentBits } from "discord.js";
33

44
import { readConfig } from "./src/config.js";
55
import { DatadropClient } from "./src/datadrop.js";

src/commands/admins/announce.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default {
6464
"Ceci est une preview de l'annonce. Voulez-vous l'envoyer?",
6565
components: [row],
6666
embeds: [embed],
67-
flags: MessageFlags.Ephemeral
67+
flags: MessageFlags.Ephemeral,
6868
});
6969

7070
try {
@@ -110,7 +110,8 @@ export default {
110110
components: [],
111111
});
112112
}
113-
} catch (e) {
113+
} catch (error) {
114+
console.error(error);
114115
await interaction.editReply({
115116
content:
116117
"❌ **Oups!** - Aucune confirmation reçue, annulation...",

src/commands/owner/eval.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import {
22
type ChatInputCommandInteraction,
3+
codeBlock,
34
MessageFlags,
45
PermissionFlagsBits,
56
SlashCommandBuilder,
6-
codeBlock,
77
} from "discord.js";
88

99
import type { DatadropClient } from "../../datadrop.js";

src/commands/utility/email.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ export default {
2525
"Affiche un message concernant l'envoi d'email à un.e professeur.e ou aux organisations étudiantes.",
2626
),
2727

28-
async execute(
29-
client: DatadropClient,
30-
interaction: ChatInputCommandInteraction,
31-
) {
28+
async execute(_: DatadropClient, interaction: ChatInputCommandInteraction) {
3229
const embed = new EmbedBuilder()
3330
.setTitle("Emails")
3431
.setColor("Random")

src/commands/utility/mdn.ts

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ import {
44
type AutocompleteInteraction,
55
ButtonBuilder,
66
ButtonStyle,
7+
bold,
78
type ChatInputCommandInteraction,
89
Colors,
910
EmbedBuilder,
10-
SlashCommandBuilder,
11-
bold,
1211
hideLinkEmbed,
1312
hyperlink,
1413
inlineCode,
14+
SlashCommandBuilder,
1515
} from "discord.js";
1616

1717
import type { DatadropClient } from "../../datadrop.js";
@@ -142,7 +142,9 @@ export default {
142142
try {
143143
let hit = searchCache.get(searchUrl);
144144
if (!hit) {
145-
client.logger.debug(`Fetching MDN search results for ${cleanQuery} hitting on ${searchUrl}...`);
145+
client.logger.debug(
146+
`Fetching MDN search results for ${cleanQuery} hitting on ${searchUrl}...`,
147+
);
146148
const response = await fetch(searchUrl);
147149
if (!response.ok)
148150
throw new Error(
@@ -159,17 +161,22 @@ export default {
159161
.setURL(url)
160162
.setTitle(sanitize(hit.title))
161163
.setDescription(sanitize(hit.summary))
162-
.setFooter({ text: 'MDN Web Docs', iconURL: 'https://developer.mozilla.org/favicon-48x48.png' })
164+
.setFooter({
165+
text: "MDN Web Docs",
166+
iconURL: "https://developer.mozilla.org/favicon-48x48.png",
167+
})
163168
.setTimestamp();
164169
const button = new ButtonBuilder()
165170
.setStyle(ButtonStyle.Link)
166171
.setLabel("Voir plus")
167172
.setURL(url);
168-
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(button);
173+
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(
174+
button,
175+
);
169176
await interaction.editReply({
170177
content: "✅ Voici le résultat de votre recherche!",
171178
embeds: [embed],
172-
components: [row]
179+
components: [row],
173180
});
174181
} catch (err) {
175182
client.logger.error(

src/config.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,7 @@ export async function readConfig(): Promise<Configuration> {
5151
...json,
5252
version: `${environment}-v${packageInfo.version}`,
5353
};
54-
config.communicationServiceOptions.apiKey =
55-
process.env.SMTP2GO_API_KEY;
54+
config.communicationServiceOptions.apiKey = process.env.SMTP2GO_API_KEY;
5655

5756
return config;
5857
} catch (err: unknown) {

src/datadrop.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,4 @@
11
import * as path from "node:path";
2-
import {
3-
type ButtonInteraction,
4-
Client,
5-
type ClientEvents,
6-
type ClientOptions,
7-
Collection,
8-
type GuildMember,
9-
type GuildTextBasedChannel,
10-
type Message,
11-
type Role,
12-
type Snowflake,
13-
type StringSelectMenuInteraction,
14-
type VoiceChannel,
15-
} from "discord.js";
16-
172
import {
183
ConsoleLogger,
194
type DefaultLogger,
@@ -35,6 +20,20 @@ import {
3520
VerificationManagerEvents,
3621
} from "@hunteroi/discord-verification";
3722
import { SMTP2GoService } from "@hunteroi/discord-verification/lib/services/SMTP2GoService.js";
23+
import {
24+
type ButtonInteraction,
25+
Client,
26+
type ClientEvents,
27+
type ClientOptions,
28+
Collection,
29+
type GuildMember,
30+
type GuildTextBasedChannel,
31+
type Message,
32+
type Role,
33+
type Snowflake,
34+
type StringSelectMenuInteraction,
35+
type VoiceChannel,
36+
} from "discord.js";
3837

3938
import { readConfig } from "./config.js";
4039
import { getErrorMessage, readFilesFrom } from "./helpers.js";
@@ -216,7 +215,7 @@ export class DatadropClient extends Client {
216215
this.selfRoleManager.on(
217216
SelfRoleManagerEvents.interaction,
218217
async (
219-
rte: RoleToEmojiData,
218+
_: RoleToEmojiData,
220219
interaction: StringSelectMenuInteraction | ButtonInteraction,
221220
) => {
222221
await interaction.editReply(

src/events/clientReady.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { ButtonStyle, Events, Role, bold, roleMention } from "discord.js";
2-
31
import type { RoleToEmojiData } from "@hunteroi/discord-selfrole";
2+
import { ButtonStyle, bold, Events, Role, roleMention } from "discord.js";
43

54
import type { DatadropClient } from "../datadrop.js";
65
import type { Configuration } from "../models/Configuration.js";

src/events/interactionCreate.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,16 @@ import {
77
type ChatInputCommandInteraction,
88
Events,
99
type Interaction,
10-
InteractionEditReplyOptions,
11-
InteractionReplyOptions,
10+
type InteractionEditReplyOptions,
11+
type InteractionReplyOptions,
12+
italic,
1213
type MessageContextMenuCommandInteraction,
1314
MessageFlags,
1415
ModalBuilder,
1516
type ModalSubmitInteraction,
1617
type RepliableInteraction,
1718
TextInputBuilder,
1819
TextInputStyle,
19-
italic,
2020
} from "discord.js";
2121

2222
import type { DatadropClient } from "../datadrop.js";
@@ -121,7 +121,9 @@ async function isAlreadyVerified(
121121
flags: MessageFlags.Ephemeral,
122122
};
123123
if (interaction.deferred) {
124-
await interaction.editReply(replyOptions as InteractionEditReplyOptions);
124+
await interaction.editReply(
125+
replyOptions as InteractionEditReplyOptions,
126+
);
125127
} else if (interaction.replied) {
126128
await interaction.followUp(replyOptions);
127129
} else {
@@ -226,7 +228,7 @@ async function showVerificationButton(
226228
.setCustomId(`lacb${interaction.user.id}`)
227229
.setDisabled(
228230
content.includes(client.errorMessage) ||
229-
content.includes(client.activeAccountMessage),
231+
content.includes(client.activeAccountMessage),
230232
);
231233
const buttonComponent = new ActionRowBuilder<ButtonBuilder>().addComponents(
232234
linkAccountButton,

0 commit comments

Comments
 (0)