From 85fb7cfa7a98215d8f52e152778adbd07448c9ad Mon Sep 17 00:00:00 2001 From: aronmal Date: Tue, 11 Apr 2023 18:47:44 +0200 Subject: [PATCH] Using @trivago/prettier-plugin-sort-imports --- leaky-ships/.prettierrc.json | 5 +- .../components/Gamefield/BorderTiles.tsx | 4 +- leaky-ships/components/Gamefield/EventBar.tsx | 2 +- .../components/Gamefield/Gamefield.tsx | 4 +- .../components/Gamefield/GamefieldPointer.tsx | 10 +- leaky-ships/components/Gamefield/HitElems.tsx | 2 +- leaky-ships/components/Gamefield/Labeling.tsx | 4 +- leaky-ships/components/Gamefield/Targets.tsx | 2 +- leaky-ships/components/Lobby/LobbyFrame.tsx | 2 +- .../Lobby/SettingsFrame/Settings.tsx | 4 +- leaky-ships/components/OptionButton.tsx | 2 +- leaky-ships/components/SocketIO.tsx | 2 +- leaky-ships/interfaces/NextApiSocket.ts | 2 +- .../components/checkPasswordIsValid.ts | 4 +- .../backend/components/checkTokenIsValid.ts | 4 +- .../lib/backend/components/createPlayerDB.ts | 2 +- .../lib/backend/components/createTokenDB.ts | 2 +- .../lib/backend/components/getPlayerByIdDB.ts | 4 +- .../backend/components/getPlayerByNameDB.ts | 4 +- .../lib/backend/components/getTokenDB.ts | 4 +- .../backend/components/getTokenFromBody.ts | 2 +- .../lib/backend/components/getUserFromBody.ts | 2 +- .../lib/backend/components/sendError.ts | 4 +- .../lib/backend/components/updatePlayerDB.ts | 4 +- leaky-ships/lib/backend/errors.ts | 2 +- leaky-ships/lib/backend/jwtVerifyCatch.ts | 2 +- leaky-ships/lib/backend/logging.ts | 3 +- leaky-ships/lib/hooks/useGameEvent.ts | 18 +- leaky-ships/package.json | 1 + leaky-ships/pages/_app.tsx | 4 +- leaky-ships/pages/api/user/auth.ts | 10 +- leaky-ships/pages/api/user/data.ts | 10 +- leaky-ships/pages/api/user/login.ts | 16 +- leaky-ships/pages/api/user/loginCheck.ts | 8 +- leaky-ships/pages/api/user/logout.ts | 8 +- leaky-ships/pages/api/user/register.ts | 14 +- leaky-ships/pages/api/user/remove.ts | 8 +- leaky-ships/pages/api/ws.ts | 6 +- leaky-ships/pages/dev/gamefield.tsx | 2 +- leaky-ships/pages/dev/grid.tsx | 2 +- leaky-ships/pages/dev/grid2.tsx | 2 +- leaky-ships/pages/dev/index.tsx | 10 +- leaky-ships/pages/dev/lobby.tsx | 8 +- leaky-ships/pages/dev/login.tsx | 4 +- leaky-ships/pages/dev/socket.tsx | 5 +- leaky-ships/pnpm-lock.yaml | 212 +++++++++++++++++- 46 files changed, 323 insertions(+), 113 deletions(-) diff --git a/leaky-ships/.prettierrc.json b/leaky-ships/.prettierrc.json index 7e66ab7..1380ed3 100644 --- a/leaky-ships/.prettierrc.json +++ b/leaky-ships/.prettierrc.json @@ -1,5 +1,8 @@ { "semi": false, - "plugins": ["prettier-plugin-tailwindcss"], + "plugins": [ + "prettier-plugin-tailwindcss", + "@trivago/prettier-plugin-sort-imports" + ], "pluginSearchDirs": false } diff --git a/leaky-ships/components/Gamefield/BorderTiles.tsx b/leaky-ships/components/Gamefield/BorderTiles.tsx index 4a7e514..9038175 100644 --- a/leaky-ships/components/Gamefield/BorderTiles.tsx +++ b/leaky-ships/components/Gamefield/BorderTiles.tsx @@ -1,6 +1,6 @@ -import { CSSProperties, Dispatch, SetStateAction } from "react" -import { borderCN, cornerCN, fieldIndex } from "@lib/utils/helpers" import { Position, MouseCursor } from "../../interfaces/frontend" +import { borderCN, cornerCN, fieldIndex } from "@lib/utils/helpers" +import { CSSProperties, Dispatch, SetStateAction } from "react" type TilesType = { key: number diff --git a/leaky-ships/components/Gamefield/EventBar.tsx b/leaky-ships/components/Gamefield/EventBar.tsx index 897f2f6..cc5f092 100644 --- a/leaky-ships/components/Gamefield/EventBar.tsx +++ b/leaky-ships/components/Gamefield/EventBar.tsx @@ -1,6 +1,6 @@ -import React, { Dispatch, SetStateAction } from "react" import { Items, Target } from "../../interfaces/frontend" import Item from "./Item" +import React, { Dispatch, SetStateAction } from "react" function EventBar({ props: { setMode, setTarget }, diff --git a/leaky-ships/components/Gamefield/Gamefield.tsx b/leaky-ships/components/Gamefield/Gamefield.tsx index a65b0be..0a34c0c 100644 --- a/leaky-ships/components/Gamefield/Gamefield.tsx +++ b/leaky-ships/components/Gamefield/Gamefield.tsx @@ -1,4 +1,3 @@ -import { CSSProperties } from "react" // import Bluetooth from './Bluetooth' import BorderTiles from "./BorderTiles" import EventBar from "./EventBar" @@ -6,8 +5,9 @@ import EventBar from "./EventBar" import HitElems from "./HitElems" import Labeling from "./Labeling" import Ships from "./Ships" -import useGameEvent from "@lib/hooks/useGameEvent" import Targets from "./Targets" +import useGameEvent from "@lib/hooks/useGameEvent" +import { CSSProperties } from "react" function Gamefield() { const count = 12 diff --git a/leaky-ships/components/Gamefield/GamefieldPointer.tsx b/leaky-ships/components/Gamefield/GamefieldPointer.tsx index 89473b0..6957a17 100644 --- a/leaky-ships/components/Gamefield/GamefieldPointer.tsx +++ b/leaky-ships/components/Gamefield/GamefieldPointer.tsx @@ -1,9 +1,9 @@ -import { faCrosshairs } from "@fortawesome/pro-solid-svg-icons" -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" -import { CSSProperties } from "react" -import classNames from "classnames" -import { faRadar } from "@fortawesome/pro-thin-svg-icons" import { Target, TargetList } from "../../interfaces/frontend" +import { faCrosshairs } from "@fortawesome/pro-solid-svg-icons" +import { faRadar } from "@fortawesome/pro-thin-svg-icons" +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" +import classNames from "classnames" +import { CSSProperties } from "react" export interface PointerProps extends Target, TargetList { imply: boolean diff --git a/leaky-ships/components/Gamefield/HitElems.tsx b/leaky-ships/components/Gamefield/HitElems.tsx index c94d832..12b81f6 100644 --- a/leaky-ships/components/Gamefield/HitElems.tsx +++ b/leaky-ships/components/Gamefield/HitElems.tsx @@ -1,7 +1,7 @@ +import { Hit } from "../../interfaces/frontend" import { faBurst, faXmark } from "@fortawesome/pro-solid-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { CSSProperties } from "react" -import { Hit } from "../../interfaces/frontend" function HitElems({ hits }: { hits: Hit[] }) { return ( diff --git a/leaky-ships/components/Gamefield/Labeling.tsx b/leaky-ships/components/Gamefield/Labeling.tsx index fdd8b5e..5b33d21 100644 --- a/leaky-ships/components/Gamefield/Labeling.tsx +++ b/leaky-ships/components/Gamefield/Labeling.tsx @@ -1,7 +1,7 @@ +import { Field } from "../../interfaces/frontend" +import { fieldIndex } from "@lib/utils/helpers" import classNames from "classnames" import { CSSProperties } from "react" -import { fieldIndex } from "@lib/utils/helpers" -import { Field } from "../../interfaces/frontend" function Labeling({ count }: { count: number }) { let elems: (Field & { diff --git a/leaky-ships/components/Gamefield/Targets.tsx b/leaky-ships/components/Gamefield/Targets.tsx index 38c2f29..9bc34a4 100644 --- a/leaky-ships/components/Gamefield/Targets.tsx +++ b/leaky-ships/components/Gamefield/Targets.tsx @@ -1,6 +1,6 @@ -import React from "react" import { Target } from "../../interfaces/frontend" import GamefieldPointer, { PointerProps } from "./GamefieldPointer" +import React from "react" function Targets({ props: { composeTargetTiles, target, targetPreview }, diff --git a/leaky-ships/components/Lobby/LobbyFrame.tsx b/leaky-ships/components/Lobby/LobbyFrame.tsx index de412ae..2026426 100644 --- a/leaky-ships/components/Lobby/LobbyFrame.tsx +++ b/leaky-ships/components/Lobby/LobbyFrame.tsx @@ -1,6 +1,6 @@ -import { Fragment, useEffect, useState } from "react" import Icon from "./Icon" import Player from "./Player" +import { Fragment, useEffect, useState } from "react" function LobbyFrame({ openSettings }: { openSettings: () => void }) { const [enemy, setEnemy] = useState(false) diff --git a/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx b/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx index ae1c9fe..28e93ce 100644 --- a/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx +++ b/leaky-ships/components/Lobby/SettingsFrame/Settings.tsx @@ -1,8 +1,8 @@ -import { faXmark } from "@fortawesome/pro-solid-svg-icons" +import Setting from "./Setting" import { faRotateLeft } from "@fortawesome/pro-regular-svg-icons" +import { faXmark } from "@fortawesome/pro-solid-svg-icons" import { FontAwesomeIcon } from "@fortawesome/react-fontawesome" import { useState } from "react" -import Setting from "./Setting" const settingOptionsInit: { [key: string]: boolean } = { allowSpectators: false, diff --git a/leaky-ships/components/OptionButton.tsx b/leaky-ships/components/OptionButton.tsx index d1ea5dd..77bb853 100644 --- a/leaky-ships/components/OptionButton.tsx +++ b/leaky-ships/components/OptionButton.tsx @@ -15,7 +15,7 @@ function OptionButton({ }) { return (