chore: Migrate ESLint and prettier to Biome (#3634)

* Migrate eslint and prettier to biomejs

This does NOT include examples/bigbot as it has its own formatter

* Update to biome 1.8.0

* Readd dotenv dev dependency to rest

During a merge it got lost
This commit is contained in:
Fleny
2024-07-13 13:05:02 -05:00
committed by GitHub
parent 7b3bd76c82
commit 919474069d
132 changed files with 722 additions and 4993 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
import { createBot, Intents, LogDepth, type logger as discordenoLogger } from '@discordeno/bot'
import { Intents, LogDepth, createBot, type logger as discordenoLogger } from '@discordeno/bot'
import { createProxyCache } from 'dd-cache-proxy'
import { configs } from './config.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, type ApplicationCommandOption, type ApplicationCommandTypes, type Interaction } from '@discordeno/bot'
import { type ApplicationCommandOption, type ApplicationCommandTypes, Collection, type Interaction } from '@discordeno/bot'
export const commands = new Collection<string, Command>()
+1 -1
View File
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionTypes, ApplicationCommandTypes, createEmbeds, Permissions, type Member, type User } from '@discordeno/bot'
import { ApplicationCommandOptionTypes, ApplicationCommandTypes, type Member, Permissions, type User, createEmbeds } from '@discordeno/bot'
import { bot } from '../bot.js'
import { createCommand } from '../commands.js'
import { calculateMemberPermissions } from '../utils/permissions.js'
+1 -1
View File
@@ -1,5 +1,5 @@
import { logger } from '@discordeno/bot'
import { readdir } from 'node:fs/promises'
import { logger } from '@discordeno/bot'
export default async function importDirectory(folder: string): Promise<void> {
const files = await readdir(folder, { recursive: true })
+1 -1
View File
@@ -1,5 +1,5 @@
import { BitwisePermissionFlags, type Guild, type Member } from '@discordeno/bot'
import assert from 'node:assert'
import { BitwisePermissionFlags, type Guild, type Member } from '@discordeno/bot'
export async function calculateMemberPermissions(guild: Guild, member: Member): Promise<bigint> {
if (member.id === guild.ownerId) return 8n
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, type ApplicationCommandOption, type ApplicationCommandTypes, type Interaction } from '@discordeno/bot'
import { type ApplicationCommandOption, type ApplicationCommandTypes, Collection, type Interaction } from '@discordeno/bot'
export const commands = new Collection<string, Command>()
@@ -1,4 +1,4 @@
import { ApplicationCommandOptionTypes, hasProperty, type Guild } from '@discordeno/bot'
import { ApplicationCommandOptionTypes, type Guild, hasProperty } from '@discordeno/bot'
import chalk from 'chalk'
import { bot } from '../bot.js'
import { commands } from '../commands.js'
+5 -5
View File
@@ -1,14 +1,14 @@
import { hasProperty, type Bot, type CreateApplicationCommand, type Guild } from '@discordeno/bot'
import { type Bot, type CreateApplicationCommand, type Guild, hasProperty } from '@discordeno/bot'
import { bot } from '../bot.js'
import { commands, type SubCommand, type SubCommandGroup } from '../commands.js'
import { type SubCommand, type SubCommandGroup, commands } from '../commands.js'
import { createLogger } from './logger.js'
const logger = createLogger({ name: 'Helpers' })
/** This function will update all commands, or the defined scope */
export async function updateCommands(scope?: 'Guild' | 'Global'): Promise<void> {
const globalCommands: Array<MakeRequired<CreateApplicationCommand, 'name'>> = []
const perGuildCommands: Array<MakeRequired<CreateApplicationCommand, 'name'>> = []
const globalCommands: MakeRequired<CreateApplicationCommand, 'name'>[] = []
const perGuildCommands: MakeRequired<CreateApplicationCommand, 'name'>[] = []
for (const command of commands.values()) {
if (command.scope === 'Guild') {
@@ -44,7 +44,7 @@ export async function updateCommands(scope?: 'Guild' | 'Global'): Promise<void>
/** Update commands for a guild */
export async function updateGuildCommands(bot: Bot, guild: Guild): Promise<void> {
const perGuildCommands: Array<MakeRequired<CreateApplicationCommand, 'name'>> = []
const perGuildCommands: MakeRequired<CreateApplicationCommand, 'name'>[] = []
for (const command of commands.values()) {
if (command.scope === 'Guild') {
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, LogDepth, createBot, type Bot, type logger } from '@discordeno/bot'
import { type Bot, Collection, LogDepth, createBot, type logger } from '@discordeno/bot'
import { DISCORD_TOKEN, GATEWAY_AUTHORIZATION, GATEWAY_INTENTS, GATEWAY_URL, REST_AUTHORIZATION, REST_URL } from '../config.js'
import type { ManagerGetShardInfoFromGuildId, ShardInfo, WorkerPresencesUpdate, WorkerShardPayload } from '../gateway/worker/types.js'
import type { Command } from './commands.js'
@@ -1,4 +1,4 @@
import { InteractionTypes, LogLevels, commandOptionsParser, type Interaction, type logger } from '@discordeno/bot'
import { type Interaction, InteractionTypes, LogLevels, commandOptionsParser, type logger } from '@discordeno/bot'
import chalk from 'chalk'
import { bot } from '../../bot.js'
@@ -48,6 +48,5 @@ function logCommand(
const command = `Command${autocomplete}: ${chalk.bgYellow.black(commandName || 'Unknown')} - ${chalk.bgBlack(typeColor)}`
const user = chalk.bgGreen.black(`@${interaction.user.username} (${interaction.user.id})`)
const guild = chalk.bgMagenta.black(interaction.guildId ? `guildId: ${interaction.guildId}` : 'DM')
;(bot.logger as typeof logger).log(logLevel, `${command} - By ${user} in ${guild}`, ...restArgs)
}
+1 -1
View File
@@ -1,5 +1,5 @@
import { createEmbeds } from '@discordeno/bot'
import { inspect } from 'node:util'
import { createEmbeds } from '@discordeno/bot'
import { BUGS_ERRORS_REPORT_WEBHOOK } from '../../config.js'
import { bot } from '../bot.js'
import { webhookURLToIDAndToken } from '../utils/webhook.js'
+1 -1
View File
@@ -1,6 +1,6 @@
import { join as joinPath } from 'node:path'
import type { DiscordGatewayPayload, GatewayDispatchEventNames } from '@discordeno/bot'
import { connect as connectAmqp } from 'amqplib'
import { join as joinPath } from 'node:path'
import {
EVENT_HANDLER_HOST,
EVENT_HANDLER_PORT,
@@ -1,5 +1,5 @@
import { createGatewayManager, createLogger, createRestManager, LogDepth } from '@discordeno/bot'
import type { Worker } from 'node:worker_threads'
import { LogDepth, createGatewayManager, createLogger, createRestManager } from '@discordeno/bot'
import { DISCORD_TOKEN, GATEWAY_INTENTS, REST_AUTHORIZATION, REST_URL, SHARDS_PER_WORKER, TOTAL_SHARDS, TOTAL_WORKERS } from '../config.js'
import { createWorker } from './worker/createWorker.js'
import type { WorkerMessage } from './worker/types.js'
+2 -2
View File
@@ -1,8 +1,8 @@
import { createLogger, DiscordenoShard, GatewayOpcodes, LogDepth } from '@discordeno/bot'
import { connect as connectAmqp, type Channel as amqpChannel } from 'amqplib'
import assert from 'node:assert'
import { createHash } from 'node:crypto'
import { workerData as _workerData, parentPort } from 'node:worker_threads'
import { DiscordenoShard, GatewayOpcodes, LogDepth, createLogger } from '@discordeno/bot'
import { type Channel as amqpChannel, connect as connectAmqp } from 'amqplib'
import { promiseWithResolvers } from '../../util.js'
import type { ManagerMessage, WorkerCreateData, WorkerMessage } from './types.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { createLogger, createRestManager, LogDepth } from '@discordeno/bot'
import { LogDepth, createLogger, createRestManager } from '@discordeno/bot'
import { DISCORD_TOKEN } from '../config.js'
import { setupRestAnalyticsHooks } from './influx.js'
+1 -1
View File
@@ -1,4 +1,4 @@
import { Collection, Intents, createBot, type Bot } from '@discordeno/bot'
import { type Bot, Collection, Intents, createBot } from '@discordeno/bot'
import { configs } from './config.js'
import type { Command } from './types/commands.js'
@@ -1,12 +1,12 @@
import {
DiscordInteractionContextType,
MessageComponentTypes,
TextStyles,
type ActionRow,
type ButtonComponent,
DiscordInteractionContextType,
type Interaction,
MessageComponentTypes,
type Role,
type SelectMenuComponent,
TextStyles,
} from '@discordeno/bot'
import { ApplicationCommandOptionTypes, ButtonStyles } from '@discordeno/types'
import ItemCollector from '../collector.js'
@@ -1,4 +1,4 @@
import { InteractionTypes, MessageComponentTypes, commandOptionsParser, type EventHandlers, type Interaction } from '@discordeno/bot'
import { type EventHandlers, type Interaction, InteractionTypes, MessageComponentTypes, commandOptionsParser } from '@discordeno/bot'
import type ItemCollector from '../collector.js'
import commands from '../commands/index.js'