Skip to content

Commit

Permalink
Switch to import instead of import type
Browse files Browse the repository at this point in the history
`import type` adds clarity over what's being imported, but Biome doesn't
enforce this, so we run the risk of having some types imported with
`import` and others with `import type`. Inconsistencies can lead to weak
assumptions, so it's better to stick with whatever Biome enforces for
small details like these
  • Loading branch information
yndajas committed Mar 7, 2024
1 parent 844db95 commit 7e9b74d
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion server/@types/models/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Socket } from "socket.io";
import { Socket } from "socket.io";

type Answer = {
colours: Colour[];
Expand Down
4 changes: 2 additions & 2 deletions server/events/clientbound.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Player, Question } from "../@types/models";
import type { Lobby } from "../lobby";
import { Player, Question } from "../@types/models";
import { Lobby } from "../lobby";

const clientboundEvents = {
getPlayers: (lobby: Lobby): ClientboundSocketServerEvent<"players:get"> => {
Expand Down
6 changes: 3 additions & 3 deletions server/events/serverbound.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Server, Socket } from "socket.io";
import { Server, Socket } from "socket.io";
import { Colour, Player } from "../@types/models";
import type { Lobby } from "../lobby";
import { Lobby } from "../lobby";
import { Round } from "../round";
import type { SocketServer } from "../socketServer";
import { SocketServer } from "../socketServer";
import { clientboundEvents } from "./clientbound";

const serverboundEvents = {
Expand Down
6 changes: 3 additions & 3 deletions server/lobby.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Socket } from "socket.io";
import { Socket } from "socket.io";
import { Actor, createActor } from "xstate";
import type { Player } from "./@types/models";
import { Player } from "./@types/models";
import { context, lobbyMachine } from "./machines/lobby";
import type { SocketServer } from "./socketServer";
import { SocketServer } from "./socketServer";

class Lobby {
machine: Actor<typeof lobbyMachine>;
Expand Down
2 changes: 1 addition & 1 deletion server/machines/lobby.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { beforeEach, describe, expect, it } from "bun:test";
import type { Actor } from "xstate";
import { Actor } from "xstate";
import { createActor, getNextSnapshot } from "xstate";
import { context, isNewPlayer, lobbyMachine } from "./lobby";

Expand Down
2 changes: 1 addition & 1 deletion server/machines/lobby.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { EventObject, assign, createMachine } from "xstate";
import { GuardArgs } from "xstate/guards";
import type { Player } from "../@types/models";
import { Player } from "../@types/models";

const context = {
players: [] as Player[],
Expand Down
4 changes: 2 additions & 2 deletions server/round.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type { Actor } from "xstate";
import { Actor } from "xstate";
import { createActor } from "xstate";
import { Answer, Question } from "./@types/models";
import { context, roundMachine } from "./machines/round";
import type { SocketServer } from "./socketServer";
import { SocketServer } from "./socketServer";

class Round {
machine: Actor<typeof roundMachine>;
Expand Down
4 changes: 2 additions & 2 deletions server/socketServer.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Server as HttpServer } from "http";
import { Server as HttpServer } from "http";
import { Server } from "socket.io";
import type { Question } from "./@types/models";
import { Question } from "./@types/models";
import { clientboundEvents } from "./events/clientbound";
import { serverboundEvents } from "./events/serverbound";
import { Lobby } from "./lobby";
Expand Down

0 comments on commit 7e9b74d

Please sign in to comment.