summary refs log tree commit diff
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2026-04-19 21:54:08 +0200
committerRory& <root@rory.gay>2026-04-19 22:45:37 +0200
commita4913dc25ffc14994e25affdd1c2f48502805509 (patch)
tree5d788e9cc5080d76db7e71ba2cb5910d15dae455
parenteslint: array callback return, no restricted imports (diff)
downloadserver-ts-a4913dc25ffc14994e25affdd1c2f48502805509.tar.xz
eslint: more rules, no-duplicate-imports
-rw-r--r--assets/openapi.json8
-rw-r--r--assets/schemas.json8
-rw-r--r--eslint.config.mjs6
-rw-r--r--src/api/routes/channels/#channel_id/attachments.ts3
-rw-r--r--src/api/routes/guilds/#guild_id/bulk-ban.ts3
-rw-r--r--src/cdn/routes/attachments.ts3
-rw-r--r--src/gateway/opcodes/VoiceStateUpdate.ts3
-rw-r--r--src/util/entities/Message.ts2
-rw-r--r--src/util/util/Event.ts6
-rw-r--r--src/util/util/Rights.ts3
-rw-r--r--src/util/util/lambert-server/Server.ts3
11 files changed, 19 insertions, 29 deletions
diff --git a/assets/openapi.json b/assets/openapi.json

index 89e190bb..178e208a 100644 --- a/assets/openapi.json +++ b/assets/openapi.json
@@ -3714,9 +3714,7 @@ "additionalProperties": false }, "intents": { - "type": "number", - "properties": {}, - "additionalProperties": false + "type": "number" }, "presence": { "$ref": "#/components/schemas/ActivitySchema" @@ -3735,9 +3733,7 @@ "maxItems": 2, "type": "array", "items": { - "type": "number", - "properties": {}, - "additionalProperties": false + "type": "number" } }, "guild_subscriptions": { diff --git a/assets/schemas.json b/assets/schemas.json
index 56f78490..65b6edba 100644 --- a/assets/schemas.json +++ b/assets/schemas.json
@@ -3936,9 +3936,7 @@ "additionalProperties": false }, "intents": { - "type": "number", - "properties": {}, - "additionalProperties": false + "type": "bigint" }, "presence": { "$ref": "#/definitions/ActivitySchema" @@ -3957,9 +3955,7 @@ "maxItems": 2, "type": "array", "items": { - "type": "number", - "properties": {}, - "additionalProperties": false + "type": "bigint" } }, "guild_subscriptions": { diff --git a/eslint.config.mjs b/eslint.config.mjs
index b52ab1f7..cc1cb831 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs
@@ -48,6 +48,12 @@ export default defineConfig([ "@typescript-eslint/no-unused-vars": "off", "@typescript-eslint/no-deprecated": "warn", "array-callback-return": "error", + "no-constructor-return": "error", + "no-duplicate-imports": "error", + // unsure what the defaults are here, but we want them to error + "for-direction": "error", + "constructor-super": "error", + "getter-return": "error", "no-restricted-imports": [ "error", { name: "@spacebar/api*", message: "Did you mean @spacebar/api?" }, diff --git a/src/api/routes/channels/#channel_id/attachments.ts b/src/api/routes/channels/#channel_id/attachments.ts
index 0e595ccc..7e59c0a6 100644 --- a/src/api/routes/channels/#channel_id/attachments.ts +++ b/src/api/routes/channels/#channel_id/attachments.ts
@@ -17,9 +17,8 @@ */ import { randomString, route } from "@spacebar/api"; -import { Channel, Config, Permissions } from "@spacebar/util"; +import { CloudAttachment, Channel, Config, Permissions } from "@spacebar/util"; import { Request, Response, Router } from "express"; -import { CloudAttachment } from "@spacebar/util"; import { UploadAttachmentRequestSchema, UploadAttachmentResponseSchema } from "@spacebar/schemas"; const router: Router = Router({ mergeParams: true }); diff --git a/src/api/routes/guilds/#guild_id/bulk-ban.ts b/src/api/routes/guilds/#guild_id/bulk-ban.ts
index 6b25aceb..1831deb5 100644 --- a/src/api/routes/guilds/#guild_id/bulk-ban.ts +++ b/src/api/routes/guilds/#guild_id/bulk-ban.ts
@@ -17,10 +17,9 @@ */ import { route } from "@spacebar/api"; -import { Ban, DiscordApiErrors, GuildBanAddEvent, Member, User, emitEvent } from "@spacebar/util"; +import { Ban, Config, DiscordApiErrors, GuildBanAddEvent, Member, User, emitEvent } from "@spacebar/util"; import { Request, Response, Router } from "express"; import { HTTPError } from "lambert-server"; -import { Config } from "@spacebar/util"; const router: Router = Router({ mergeParams: true }); diff --git a/src/cdn/routes/attachments.ts b/src/cdn/routes/attachments.ts
index 054089c5..39980db3 100644 --- a/src/cdn/routes/attachments.ts +++ b/src/cdn/routes/attachments.ts
@@ -16,13 +16,12 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Config, hasValidSignature, NewUrlUserSignatureData, Snowflake, UrlSignResult } from "@spacebar/util"; +import { Config, CloudAttachment, hasValidSignature, NewUrlUserSignatureData, Snowflake, UrlSignResult } from "@spacebar/util"; import { Request, Response, Router } from "express"; import imageSize from "image-size"; import { HTTPError } from "lambert-server"; import { multer } from "../util/multer"; import { storage } from "@spacebar/cdn"; -import { CloudAttachment } from "@spacebar/util"; import { fileTypeFromBuffer } from "file-type"; import { cache } from "../util/cache"; diff --git a/src/gateway/opcodes/VoiceStateUpdate.ts b/src/gateway/opcodes/VoiceStateUpdate.ts
index 4c34cccc..0bc09852 100644 --- a/src/gateway/opcodes/VoiceStateUpdate.ts +++ b/src/gateway/opcodes/VoiceStateUpdate.ts
@@ -16,9 +16,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { Payload, WebSocket } from "@spacebar/gateway"; +import { Payload, WebSocket, genVoiceToken } from "@spacebar/gateway"; import { Config, emitEvent, Guild, Member, VoiceServerUpdateEvent, VoiceState, VoiceStateUpdateEvent } from "@spacebar/util"; -import { genVoiceToken } from "@spacebar/gateway"; import { check } from "./instanceOf"; import { Region, VoiceStateUpdateSchema } from "@spacebar/schemas"; // TODO: check if a voice server is setup diff --git a/src/util/entities/Message.ts b/src/util/entities/Message.ts
index c2628e2c..c35b3f60 100644 --- a/src/util/entities/Message.ts +++ b/src/util/entities/Message.ts
@@ -41,8 +41,8 @@ import { PublicMessage, Reaction, UnfurledMediaItem, + PartialUser, } from "@spacebar/schemas"; -import { PartialUser } from "@spacebar/schemas"; import { MessageFlags } from "@spacebar/util"; import { JsonRemoveEmpty } from "../util/Decorators"; diff --git a/src/util/util/Event.ts b/src/util/util/Event.ts
index 9dda083c..0e662886 100644 --- a/src/util/util/Event.ts +++ b/src/util/util/Event.ts
@@ -22,12 +22,10 @@ import EventEmitter from "node:events"; import { EVENT, Event } from "../interfaces"; import { randomUUID } from "node:crypto"; import path from "node:path"; -import { Socket } from "node:net"; -import { FSWatcher } from "node:fs"; +import net, { Socket } from "node:net"; +import fs, { FSWatcher } from "node:fs"; import { Stopwatch } from "./Stopwatch"; import { Config } from "./Config"; -import net from "node:net"; -import fs from "node:fs"; import { red } from "picocolors"; export const events = new EventEmitter(); diff --git a/src/util/util/Rights.ts b/src/util/util/Rights.ts
index 6b90f748..41b6d93b 100644 --- a/src/util/util/Rights.ts +++ b/src/util/util/Rights.ts
@@ -16,8 +16,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>. */ -import { BitField } from "./BitField"; -import { BitFieldResolvable, BitFlag } from "./BitField"; +import { BitField, BitFieldResolvable, BitFlag } from "./BitField"; import { User } from "../entities"; import { HTTPError } from "lambert-server"; diff --git a/src/util/util/lambert-server/Server.ts b/src/util/util/lambert-server/Server.ts
index c291fbfe..0d345815 100644 --- a/src/util/util/lambert-server/Server.ts +++ b/src/util/util/lambert-server/Server.ts
@@ -1,6 +1,5 @@ import express, { Application, Router } from "express"; -import { Server as HTTPServer } from "node:http"; -import http from "node:http"; +import http, { Server as HTTPServer } from "node:http"; export type ServerOptions = { port: number;