mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-02 14:38:07 +00:00
Enable the sort-imports eslint rule (#1849)
## Description: Enable the `sort-imports` eslint rule. Fixes #1784 ## Please complete the following: - [x] I have added screenshots for all UI updates - [x] I process any text displayed to the user through translateText() and I've added it to the en.json file - [x] I have added relevant tests to the test directory - [x] I confirm I have thoroughly tested these changes and take full responsibility for any bugs introduced
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { AnalyticsRecord, GameID, GameRecord } from "../core/Schemas";
|
||||
import { S3 } from "@aws-sdk/client-s3";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { AnalyticsRecord, GameID, GameRecord } from "../core/Schemas";
|
||||
import { replacer } from "../core/Util";
|
||||
import { logger } from "./Logger";
|
||||
import { replacer } from "../core/Util";
|
||||
|
||||
const config = getServerConfigFromServer();
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import WebSocket from "ws";
|
||||
import { TokenPayload } from "../core/ApiSchemas";
|
||||
import { Tick } from "../core/game/Game";
|
||||
import { ClientID, Winner } from "../core/Schemas";
|
||||
import { Tick } from "../core/game/Game";
|
||||
import { TokenPayload } from "../core/ApiSchemas";
|
||||
import WebSocket from "ws";
|
||||
|
||||
export class Client {
|
||||
public lastPing: number = Date.now();
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { spawn } from "child_process";
|
||||
import { promises as fs } from "fs";
|
||||
import { logger } from "./Logger";
|
||||
import { spawn } from "child_process";
|
||||
import yaml from "js-yaml";
|
||||
import { z } from "zod";
|
||||
import { logger } from "./Logger";
|
||||
|
||||
const log = logger.child({
|
||||
module: "cloudflare",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { Logger } from "winston";
|
||||
import { ServerConfig } from "../core/configuration/Config";
|
||||
import { Difficulty, GameMapType, GameMode, GameType } from "../core/game/Game";
|
||||
import { GameConfig, GameID } from "../core/Schemas";
|
||||
import { Client } from "./Client";
|
||||
import { GamePhase, GameServer } from "./GameServer";
|
||||
import { Client } from "./Client";
|
||||
import { Logger } from "winston";
|
||||
import { ServerConfig } from "../core/configuration/Config";
|
||||
|
||||
export class GameManager {
|
||||
private games: Map<GameID, GameServer> = new Map();
|
||||
|
||||
@@ -1,7 +1,3 @@
|
||||
import ipAnonymize from "ip-anonymize";
|
||||
import { Logger } from "winston";
|
||||
import WebSocket from "ws";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
ClientID,
|
||||
ClientSendWinnerMessage,
|
||||
@@ -18,13 +14,18 @@ import {
|
||||
ServerTurnMessage,
|
||||
Turn,
|
||||
} from "../core/Schemas";
|
||||
import { createGameRecord } from "../core/Util";
|
||||
import { GameEnv, ServerConfig } from "../core/configuration/Config";
|
||||
import { GameType } from "../core/game/Game";
|
||||
import { archive } from "./Archive";
|
||||
import { Client } from "./Client";
|
||||
import { GameType } from "../core/game/Game";
|
||||
import { Logger } from "winston";
|
||||
import WebSocket from "ws";
|
||||
import { archive } from "./Archive";
|
||||
import { createGameRecord } from "../core/Util";
|
||||
import { gatekeeper } from "./Gatekeeper";
|
||||
import ipAnonymize from "ip-anonymize";
|
||||
import { postJoinMessageHandler } from "./worker/websocket/handler/message/PostJoinHandler";
|
||||
import { z } from "zod";
|
||||
|
||||
export enum GamePhase {
|
||||
Lobby = "LOBBY",
|
||||
Active = "ACTIVE",
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
// src/server/Security.ts
|
||||
import { NextFunction, Request, Response } from "express";
|
||||
import { fileURLToPath } from "url";
|
||||
import fs from "fs";
|
||||
import http from "http";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
|
||||
export enum LimiterType {
|
||||
Get = "get",
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import * as dotenv from "dotenv";
|
||||
import * as logsAPI from "@opentelemetry/api-logs";
|
||||
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
||||
import {
|
||||
LoggerProvider,
|
||||
SimpleLogRecordProcessor,
|
||||
} from "@opentelemetry/sdk-logs";
|
||||
import { OTLPLogExporter } from "@opentelemetry/exporter-logs-otlp-http";
|
||||
import { OpenTelemetryTransportV3 } from "@opentelemetry/winston-transport";
|
||||
import * as dotenv from "dotenv";
|
||||
import winston from "winston";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { getOtelResource } from "./OtelResource";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import winston from "winston";
|
||||
dotenv.config();
|
||||
|
||||
const config = getServerConfigFromServer();
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import {
|
||||
Difficulty,
|
||||
Duos,
|
||||
@@ -9,8 +8,9 @@ import {
|
||||
Quads,
|
||||
Trios,
|
||||
} from "../core/game/Game";
|
||||
import { PseudoRandom } from "../core/PseudoRandom";
|
||||
import { GameConfig, TeamCountConfig } from "../core/Schemas";
|
||||
import { PseudoRandom } from "../core/PseudoRandom";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { logger } from "./Logger";
|
||||
|
||||
const log = logger.child({});
|
||||
|
||||
+8
-11
@@ -1,20 +1,17 @@
|
||||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
||||
import { ApiEnvResponse, ApiPublicLobbiesResponse } from "../core/ExpressSchemas";
|
||||
import { GameInfo, ID } from "../core/Schemas";
|
||||
import { LimiterType, gatekeeper } from "./Gatekeeper";
|
||||
import { MapPlaylist } from "./MapPlaylist";
|
||||
import cluster from "cluster";
|
||||
import express from "express";
|
||||
import rateLimit from "express-rate-limit";
|
||||
import http from "http";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import {
|
||||
ApiEnvResponse,
|
||||
ApiPublicLobbiesResponse,
|
||||
} from "../core/ExpressSchemas";
|
||||
import { GameInfo, ID } from "../core/Schemas";
|
||||
import { generateID } from "../core/Util";
|
||||
import { gatekeeper, LimiterType } from "./Gatekeeper";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import http from "http";
|
||||
import { logger } from "./Logger";
|
||||
import { MapPlaylist } from "./MapPlaylist";
|
||||
import path from "path";
|
||||
import rateLimit from "express-rate-limit";
|
||||
|
||||
const config = getServerConfigFromServer();
|
||||
const playlist = new MapPlaylist();
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { resourceFromAttributes } from "@opentelemetry/resources";
|
||||
import {
|
||||
ATTR_SERVICE_NAME,
|
||||
ATTR_SERVICE_VERSION,
|
||||
} from "@opentelemetry/semantic-conventions";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { resourceFromAttributes } from "@opentelemetry/resources";
|
||||
|
||||
const config = getServerConfigFromServer();
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { base64url } from "jose";
|
||||
import { Logger } from "winston";
|
||||
import { CosmeticsSchema } from "../core/CosmeticSchemas";
|
||||
import {
|
||||
FailOpenPrivilegeChecker,
|
||||
PrivilegeChecker,
|
||||
PrivilegeCheckerImpl,
|
||||
} from "./Privilege";
|
||||
import { CosmeticsSchema } from "../core/CosmeticSchemas";
|
||||
import { Logger } from "winston";
|
||||
import { base64url } from "jose";
|
||||
|
||||
// Refreshes the privilege checker every 5 minutes.
|
||||
// WARNING: This fails open if cosmetics.json is not available.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import cluster from "cluster";
|
||||
import * as dotenv from "dotenv";
|
||||
import { GameEnv } from "../core/configuration/Config";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { Cloudflare, TunnelConfig } from "./Cloudflare";
|
||||
import { GameEnv } from "../core/configuration/Config";
|
||||
import cluster from "cluster";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { startMaster } from "./Master";
|
||||
import { startWorker } from "./Worker";
|
||||
|
||||
|
||||
+15
-15
@@ -1,27 +1,27 @@
|
||||
import express, { NextFunction, Request, Response } from "express";
|
||||
import rateLimit from "express-rate-limit";
|
||||
import http from "http";
|
||||
import ipAnonymize from "ip-anonymize";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import { WebSocket, WebSocketServer } from "ws";
|
||||
import { z } from "zod";
|
||||
import { GameEnv } from "../core/configuration/Config";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { GameType } from "../core/game/Game";
|
||||
import { GameRecord, GameRecordSchema, ID } from "../core/Schemas";
|
||||
import {
|
||||
CreateGameInputSchema,
|
||||
GameInputSchema,
|
||||
WorkerApiGameIdExists,
|
||||
} from "../core/WorkerSchemas";
|
||||
import { GameRecord, GameRecordSchema, ID } from "../core/Schemas";
|
||||
import { LimiterType, gatekeeper } from "./Gatekeeper";
|
||||
import { WebSocket, WebSocketServer } from "ws";
|
||||
import { archive, readGameRecord } from "./Archive";
|
||||
import express, { NextFunction, Request, Response } from "express";
|
||||
import { GameEnv } from "../core/configuration/Config";
|
||||
import { GameManager } from "./GameManager";
|
||||
import { gatekeeper, LimiterType } from "./Gatekeeper";
|
||||
import { logger } from "./Logger";
|
||||
import { GameType } from "../core/game/Game";
|
||||
import { PrivilegeRefresher } from "./PrivilegeRefresher";
|
||||
import { preJoinMessageHandler } from "./worker/websocket/handler/message/PreJoinHandler";
|
||||
import { fileURLToPath } from "url";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import http from "http";
|
||||
import { initWorkerMetrics } from "./WorkerMetrics";
|
||||
import ipAnonymize from "ip-anonymize";
|
||||
import { logger } from "./Logger";
|
||||
import path from "path";
|
||||
import { preJoinMessageHandler } from "./worker/websocket/handler/message/PreJoinHandler";
|
||||
import rateLimit from "express-rate-limit";
|
||||
import { z } from "zod";
|
||||
|
||||
const config = getServerConfigFromServer();
|
||||
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
||||
import {
|
||||
MeterProvider,
|
||||
PeriodicExportingMetricReader,
|
||||
} from "@opentelemetry/sdk-metrics";
|
||||
import * as dotenv from "dotenv";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
import { GameManager } from "./GameManager";
|
||||
import { MeterProvider, PeriodicExportingMetricReader } from "@opentelemetry/sdk-metrics";
|
||||
import { getOtelResource, getPromLabels } from "./OtelResource";
|
||||
import { GameManager } from "./GameManager";
|
||||
import { OTLPMetricExporter } from "@opentelemetry/exporter-metrics-otlp-http";
|
||||
import { getServerConfigFromServer } from "../core/configuration/ConfigLoader";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
|
||||
+3
-3
@@ -1,13 +1,13 @@
|
||||
import { jwtVerify } from "jose";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
TokenPayload,
|
||||
TokenPayloadSchema,
|
||||
UserMeResponse,
|
||||
UserMeResponseSchema,
|
||||
} from "../core/ApiSchemas";
|
||||
import { ServerConfig } from "../core/configuration/Config";
|
||||
import { PersistentIdSchema } from "../core/Schemas";
|
||||
import { ServerConfig } from "../core/configuration/Config";
|
||||
import { jwtVerify } from "jose";
|
||||
import { z } from "zod";
|
||||
|
||||
type TokenVerificationResult =
|
||||
| {
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
import { Logger } from "winston";
|
||||
import { z } from "zod";
|
||||
import {
|
||||
ClientMessageSchema,
|
||||
ClientSendWinnerMessage,
|
||||
@@ -7,6 +5,8 @@ import {
|
||||
} from "../../../../../core/Schemas";
|
||||
import { Client } from "../../../../Client";
|
||||
import { GameServer } from "../../../../GameServer";
|
||||
import { Logger } from "winston";
|
||||
import { z } from "zod";
|
||||
|
||||
export async function postJoinMessageHandler(
|
||||
gs: GameServer,
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
import http from "http";
|
||||
import ipAnonymize from "ip-anonymize";
|
||||
import { WebSocket } from "ws";
|
||||
import { z } from "zod";
|
||||
import { getServerConfigFromServer } from "../../../../../core/configuration/ConfigLoader";
|
||||
import {
|
||||
ClientMessageSchema,
|
||||
ServerErrorMessage,
|
||||
} from "../../../../../core/Schemas";
|
||||
import { getUserMe, verifyClientToken } from "../../../../jwt";
|
||||
import { Client } from "../../../../Client";
|
||||
import { GameManager } from "../../../../GameManager";
|
||||
import { getUserMe, verifyClientToken } from "../../../../jwt";
|
||||
import { logger } from "../../../../Logger";
|
||||
import { PrivilegeRefresher } from "../../../../PrivilegeRefresher";
|
||||
import { WebSocket } from "ws";
|
||||
import { getServerConfigFromServer } from "../../../../../core/configuration/ConfigLoader";
|
||||
import http from "http";
|
||||
import ipAnonymize from "ip-anonymize";
|
||||
import { logger } from "../../../../Logger";
|
||||
import { z } from "zod";
|
||||
|
||||
const config = getServerConfigFromServer();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user