From feef4b51bc3a168e1422c2828bd97b3db31679ae Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 08:56:11 +0000 Subject: [PATCH 1/4] Update dependency @biomejs/biome to v1.9.3 --- package.json | 2 +- yarn.lock | 104 +++++++++++++++++++++++++-------------------------- 2 files changed, 53 insertions(+), 53 deletions(-) diff --git a/package.json b/package.json index f526c7b..7ab82cf 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ "xstate": "5.18.2" }, "devDependencies": { - "@biomejs/biome": "1.8.3", + "@biomejs/biome": "1.9.3", "@playwright/test": "^1.39.0", "@types/serve-handler": "^6.1.1", "@types/web": "^0.0.171", diff --git a/yarn.lock b/yarn.lock index 739bff0..d40773a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -25,59 +25,59 @@ js-tokens "^4.0.0" picocolors "^1.0.0" -"@biomejs/biome@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.8.3.tgz#3b5eecea90d973f71618aae3e6e8be4d2ca23e42" - integrity sha512-/uUV3MV+vyAczO+vKrPdOW0Iaet7UnJMU4bNMinggGJTAnBPjCoLEYcyYtYHNnUNYlv4xZMH6hVIQCAozq8d5w== +"@biomejs/biome@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/biome/-/biome-1.9.3.tgz#5362fc390ac00c82e3698824490e3801d012c1b0" + integrity sha512-POjAPz0APAmX33WOQFGQrwLvlu7WLV4CFJMlB12b6ZSg+2q6fYu9kZwLCOA+x83zXfcPd1RpuWOKJW0GbBwLIQ== optionalDependencies: - "@biomejs/cli-darwin-arm64" "1.8.3" - "@biomejs/cli-darwin-x64" "1.8.3" - "@biomejs/cli-linux-arm64" "1.8.3" - "@biomejs/cli-linux-arm64-musl" "1.8.3" - "@biomejs/cli-linux-x64" "1.8.3" - "@biomejs/cli-linux-x64-musl" "1.8.3" - "@biomejs/cli-win32-arm64" "1.8.3" - "@biomejs/cli-win32-x64" "1.8.3" - -"@biomejs/cli-darwin-arm64@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.8.3.tgz#be2bfdd445cd2d3cb0ff41a96a72ec761753997c" - integrity sha512-9DYOjclFpKrH/m1Oz75SSExR8VKvNSSsLnVIqdnKexj6NwmiMlKk94Wa1kZEdv6MCOHGHgyyoV57Cw8WzL5n3A== - -"@biomejs/cli-darwin-x64@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.8.3.tgz#47d408edd9f5c04069fbcf8610bacf1db8c6c0d9" - integrity sha512-UeW44L/AtbmOF7KXLCoM+9PSgPo0IDcyEUfIoOXYeANaNXXf9mLUwV1GeF2OWjyic5zj6CnAJ9uzk2LT3v/wAw== - -"@biomejs/cli-linux-arm64-musl@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.8.3.tgz#44df284383d57cf4f28daeedd080dad7be05df78" - integrity sha512-9yjUfOFN7wrYsXt/T/gEWfvVxKlnh3yBpnScw98IF+oOeCYb5/b/+K7YNqKROV2i1DlMjg9g/EcN9wvj+NkMuQ== - -"@biomejs/cli-linux-arm64@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.8.3.tgz#6a6b1da1dfce0294a028cbb5d6c40d73691dd713" - integrity sha512-fed2ji8s+I/m8upWpTJGanqiJ0rnlHOK3DdxsyVLZQ8ClY6qLuPc9uehCREBifRJLl/iJyQpHIRufLDeotsPtw== - -"@biomejs/cli-linux-x64-musl@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.8.3.tgz#ceef30a8ee1a00d4ad31e32dd31ba2a661f2719d" - integrity sha512-UHrGJX7PrKMKzPGoEsooKC9jXJMa28TUSMjcIlbDnIO4EAavCoVmNQaIuUSH0Ls2mpGMwUIf+aZJv657zfWWjA== - -"@biomejs/cli-linux-x64@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.8.3.tgz#665df74d19fb8f83001a9d80824d3a1723e2123f" - integrity sha512-I8G2QmuE1teISyT8ie1HXsjFRz9L1m5n83U1O6m30Kw+kPMPSKjag6QGUn+sXT8V+XWIZxFFBoTDEDZW2KPDDw== - -"@biomejs/cli-win32-arm64@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.8.3.tgz#0fb6f58990f4de0331a6ed22c47c66f5a89133cc" - integrity sha512-J+Hu9WvrBevfy06eU1Na0lpc7uR9tibm9maHynLIoAjLZpQU3IW+OKHUtyL8p6/3pT2Ju5t5emReeIS2SAxhkQ== - -"@biomejs/cli-win32-x64@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.8.3.tgz#6a9dc5a4e13357277da43c015cd5cdc374035448" - integrity sha512-/PJ59vA1pnQeKahemaQf4Nyj7IKUvGQSc3Ze1uIGi+Wvr1xF7rGobSrAAG01T/gUDG21vkDsZYM03NAmPiVkqg== + "@biomejs/cli-darwin-arm64" "1.9.3" + "@biomejs/cli-darwin-x64" "1.9.3" + "@biomejs/cli-linux-arm64" "1.9.3" + "@biomejs/cli-linux-arm64-musl" "1.9.3" + "@biomejs/cli-linux-x64" "1.9.3" + "@biomejs/cli-linux-x64-musl" "1.9.3" + "@biomejs/cli-win32-arm64" "1.9.3" + "@biomejs/cli-win32-x64" "1.9.3" + +"@biomejs/cli-darwin-arm64@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-arm64/-/cli-darwin-arm64-1.9.3.tgz#3a981835a7a891589b356bbdb4e50157e494aa7d" + integrity sha512-QZzD2XrjJDUyIZK+aR2i5DDxCJfdwiYbUKu9GzkCUJpL78uSelAHAPy7m0GuPMVtF/Uo+OKv97W3P9nuWZangQ== + +"@biomejs/cli-darwin-x64@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-darwin-x64/-/cli-darwin-x64-1.9.3.tgz#0e33284e5def9cbc17705b6a9acbc22b161accb1" + integrity sha512-vSCoIBJE0BN3SWDFuAY/tRavpUtNoqiceJ5PrU3xDfsLcm/U6N93JSM0M9OAiC/X7mPPfejtr6Yc9vSgWlEgVw== + +"@biomejs/cli-linux-arm64-musl@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64-musl/-/cli-linux-arm64-musl-1.9.3.tgz#b68e2fe56381cbf71770b6c785215448c47595fd" + integrity sha512-VBzyhaqqqwP3bAkkBrhVq50i3Uj9+RWuj+pYmXrMDgjS5+SKYGE56BwNw4l8hR3SmYbLSbEo15GcV043CDSk+Q== + +"@biomejs/cli-linux-arm64@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-arm64/-/cli-linux-arm64-1.9.3.tgz#bb8186f000bd7366c3a1822a4a505e374905c462" + integrity sha512-vJkAimD2+sVviNTbaWOGqEBy31cW0ZB52KtpVIbkuma7PlfII3tsLhFa+cwbRAcRBkobBBhqZ06hXoZAN8NODQ== + +"@biomejs/cli-linux-x64-musl@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64-musl/-/cli-linux-x64-musl-1.9.3.tgz#01ccee0db2ca2ec9fb51fa69b2fc9e96434b5b32" + integrity sha512-TJmnOG2+NOGM72mlczEsNki9UT+XAsMFAOo8J0me/N47EJ/vkLXxf481evfHLlxMejTY6IN8SdRSiPVLv6AHlA== + +"@biomejs/cli-linux-x64@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-linux-x64/-/cli-linux-x64-1.9.3.tgz#82d6fb824dd2c76142ab8625e202eb63a34e14f1" + integrity sha512-x220V4c+romd26Mu1ptU+EudMXVS4xmzKxPVb9mgnfYlN4Yx9vD5NZraSx/onJnd3Gh/y8iPUdU5CDZJKg9COA== + +"@biomejs/cli-win32-arm64@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-arm64/-/cli-win32-arm64-1.9.3.tgz#7fac607ade8e204eecae09e127713f000da0ccf2" + integrity sha512-lg/yZis2HdQGsycUvHWSzo9kOvnGgvtrYRgoCEwPBwwAL8/6crOp3+f47tPwI/LI1dZrhSji7PNsGKGHbwyAhw== + +"@biomejs/cli-win32-x64@1.9.3": + version "1.9.3" + resolved "https://registry.yarnpkg.com/@biomejs/cli-win32-x64/-/cli-win32-x64-1.9.3.tgz#1cbc269dcd5f29b034cb7f5982353c1cc3629318" + integrity sha512-cQMy2zanBkVLpmmxXdK6YePzmZx0s5Z7KEnwmrW54rcXK3myCNbQa09SwGZ8i/8sLw0H9F3X7K4rxVNGU8/D4Q== "@csstools/css-parser-algorithms@^3.0.1": version "3.0.2" From 93b399ede883b695fd7b92082011d6b79f287c9f Mon Sep 17 00:00:00 2001 From: Ynda Jas Date: Fri, 18 Oct 2024 11:41:56 +0100 Subject: [PATCH 2/4] Fix CSS formatting errors from Biome Biome now lints/formats CSS. This means we have both Biome and Stylelint linting CSS. At the moment, this doesn't seem to be producing any conflicts, but we could turn off CSS linting/formatting in Biome later if it does, or remove Stylelint (but we have some useful plugins that are probably not replicated in Biome) --- client/assets/styles/colour-cards.css | 97 +++++++++++++-------------- client/assets/styles/main.css | 57 ++++++++-------- client/assets/styles/reset.css | 30 ++++----- 3 files changed, 91 insertions(+), 93 deletions(-) diff --git a/client/assets/styles/colour-cards.css b/client/assets/styles/colour-cards.css index f53c713..5baf56e 100644 --- a/client/assets/styles/colour-cards.css +++ b/client/assets/styles/colour-cards.css @@ -1,105 +1,104 @@ .colour-cards { - --black: #22181c; - --grey: #707070; - --white: #fafafa; - --red: #e60008; - --orange: #ff924c; - --yellow: #ffca3a; - --green: #8ac926; - --blue: #1778b5; - --purple: #6a4c93; - --pink: #ff8cc6; - --brown: #a33b20; - --selected: #52a675; - - display: flex; - flex-wrap: wrap; - gap: 1rem; - - font-family: Poppins, sans-serif; - font-weight: 400; + --black: #22181c; + --grey: #707070; + --white: #fafafa; + --red: #e60008; + --orange: #ff924c; + --yellow: #ffca3a; + --green: #8ac926; + --blue: #1778b5; + --purple: #6a4c93; + --pink: #ff8cc6; + --brown: #a33b20; + --selected: #52a675; + + display: flex; + flex-wrap: wrap; + gap: 1rem; + + font-family: Poppins, sans-serif; + font-weight: 400; } .colour-cards input { - display: none; + display: none; } .colour-cards__card { - height: 6rem; - padding: 1rem; - border: var(--dxw-black) solid 0.2rem; - border-radius: 0.5rem; + height: 6rem; + padding: 1rem; + border: var(--dxw-black) solid 0.2rem; + border-radius: 0.5rem; } .colour-cards input:checked + .colour-cards__card { - outline: var(--selected) solid 0.2rem; + outline: var(--selected) solid 0.2rem; } .colour-cards__card--black { - color: var(--dxw-white); - background-color: var(--black); + color: var(--dxw-white); + background-color: var(--black); } .colour-cards__card--blue { - color: var(--dxw-white); - background-color: var(--blue); + color: var(--dxw-white); + background-color: var(--blue); } .colour-cards__card--brown { - color: var(--dxw-white); - background-color: var(--brown); + color: var(--dxw-white); + background-color: var(--brown); } .colour-cards__card--green { - background-color: var(--green); + background-color: var(--green); } .colour-cards__card--grey { - color: var(--dxw-white); - background-color: var(--grey); + color: var(--dxw-white); + background-color: var(--grey); } .colour-cards__card--orange { - background-color: var(--orange); + background-color: var(--orange); } .colour-cards__card--pink { - background-color: var(--pink); + background-color: var(--pink); } .colour-cards__card--purple { - color: var(--dxw-white); - background-color: var(--purple); + color: var(--dxw-white); + background-color: var(--purple); } .colour-cards__card--red { - color: var(--dxw-white); - background-color: var(--red); + color: var(--dxw-white); + background-color: var(--red); } .colour-cards__card--white { - background-color: var(--white); + background-color: var(--white); } .colour-cards__card--yellow { - background-color: var(--yellow); + background-color: var(--yellow); } - .colour-cards__card p { - width: 4rem; - text-align: center; + width: 4rem; + text-align: center; } .colour-cards__name { - margin: 0; + margin: 0; } .colour-cards__check-mark { - display: none; - margin-top: 2rem; + display: none; + margin-top: 2rem; } .colour-cards input:checked + label .colour-cards__check-mark { - display: block; + display: block; } diff --git a/client/assets/styles/main.css b/client/assets/styles/main.css index eeef47d..d733628 100644 --- a/client/assets/styles/main.css +++ b/client/assets/styles/main.css @@ -2,18 +2,17 @@ @import url("https://fonts.googleapis.com/css?family=Merriweather:300&display=swap"); @import url("colour-cards.css"); - body { - --dxw-white: #f9f8f5; - --dxw-black: #243746; + --dxw-white: #f9f8f5; + --dxw-black: #243746; - padding: 1rem; + padding: 1rem; - font-family: Merriweather, serif; - font-weight: 300; - color: var(--dxw-black); + font-family: Merriweather, serif; + font-weight: 300; + color: var(--dxw-black); - background-color: var(--dxw-white); + background-color: var(--dxw-white); } h1, @@ -22,55 +21,55 @@ h3, h4, h5, h6 { - font-family: Poppins, sans-serif; - font-weight: 600; + font-family: Poppins, sans-serif; + font-weight: 600; } h1 { - margin-bottom: 1rem; - text-align: center; + margin-bottom: 1rem; + text-align: center; } h1::before { - content: url("/assets/images/favicon/favicon-32x32.png"); - height: 2rem; - margin-right: 0.5rem; - vertical-align: middle; + content: url("/assets/images/favicon/favicon-32x32.png"); + height: 2rem; + margin-right: 0.5rem; + vertical-align: middle; } #connection-status { - position: absolute; - top: 1.5rem; - right: 1rem; + position: absolute; + top: 1.5rem; + right: 1rem; } #player-name { - position: absolute; - top: 1.5rem; - left: 1rem; + position: absolute; + top: 1.5rem; + left: 1rem; } #player-list { - padding-inline-start: 0; - list-style: none; + padding-inline-start: 0; + list-style: none; } #bonus-points { - display: none; + display: none; } #question { - display: none; + display: none; } .answer-form fieldset { - display: inline-block; + display: inline-block; } .answer-form button { - display: block; + display: block; } #countdown-section { - display: none; + display: none; } diff --git a/client/assets/styles/reset.css b/client/assets/styles/reset.css index bd36606..b5b5239 100644 --- a/client/assets/styles/reset.css +++ b/client/assets/styles/reset.css @@ -2,12 +2,12 @@ *, *::before, *::after { - box-sizing: border-box; + box-sizing: border-box; } /* Prevent font size inflation */ html { - text-size-adjust: none; + text-size-adjust: none; } /* Remove default margin in favour of better control in authored CSS */ @@ -21,19 +21,19 @@ figure, blockquote, dl, dd { - margin: 0; + margin: 0; } /* Remove list styles on ul, ol elements with a list role, which suggests default styling will be removed */ ul[role="list"], ol[role="list"] { - list-style: none; + list-style: none; } /* Set core body defaults */ body { - min-height: 100vh; - line-height: 1.5; + min-height: 100vh; + line-height: 1.5; } /* Set shorter line heights on headings and interactive elements */ @@ -44,7 +44,7 @@ h4, button, input, label { - line-height: 1.1; + line-height: 1.1; } /* Balance text wrapping on headings */ @@ -52,20 +52,20 @@ h1, h2, h3, h4 { - text-wrap: balance; + text-wrap: balance; } /* A elements that don't have a class get default styles */ a:not([class]) { - color: currentcolor; - text-decoration-skip-ink: auto; + color: currentcolor; + text-decoration-skip-ink: auto; } /* Make images easier to work with */ img, picture { - display: block; - max-width: 100%; + display: block; + max-width: 100%; } /* Inherit fonts for inputs and buttons */ @@ -73,15 +73,15 @@ input, button, textarea, select { - font: inherit; + font: inherit; } /* Make sure textareas without a rows attribute are not tiny */ textarea:not([rows]) { - min-height: 10em; + min-height: 10em; } /* Anything that has been anchored to should have extra scroll margin */ :target { - scroll-margin-block: 5ex; + scroll-margin-block: 5ex; } From 76ea4360a236fb1a60eedca603fa4382a6ca79d7 Mon Sep 17 00:00:00 2001 From: Ynda Jas Date: Fri, 18 Oct 2024 11:44:05 +0100 Subject: [PATCH 3/4] Update linting scripts Now that Biome does CSS linting/formatting, the TypeScript/CSS distinction is no longer accurate. Changing to the name of the package for now, and logging coverage information in `script/test` --- package.json | 8 ++++---- script/test | 14 +++++++++++--- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 7ab82cf..2529050 100644 --- a/package.json +++ b/package.json @@ -7,10 +7,10 @@ "scripts": { "compile": "bun build ./client/index.ts --outdir ./client/assets/scripts", "compile:watch": "bun build ./client/index.ts --outdir ./client/assets/scripts --watch", - "lint:ts": "bunx @biomejs/biome check .", - "lint:ts:fix": "bunx @biomejs/biome check --write .", - "lint:css": "bunx stylelint \"client/assets/styles/*.css\"", - "lint:css:fix": "bunx stylelint \"client/assets/styles/*.css\" --fix", + "lint:biome": "bunx @biomejs/biome check .", + "lint:biome:fix": "bunx @biomejs/biome check --write .", + "lint:stylelint": "bunx stylelint \"client/assets/styles/*.css\"", + "lint:stylelint:fix": "bunx stylelint \"client/assets/styles/*.css\" --fix", "start": "bun run compile && bun server/index.ts", "start:watch": "bun run compile:watch & bun --watch server/index.ts", "typecheck": "bun run tsc", diff --git a/script/test b/script/test index 5b5e3cd..71b37e4 100755 --- a/script/test +++ b/script/test @@ -5,8 +5,17 @@ set -e echo "==> Linting the code" -bun run lint:ts -bun run lint:css +echo "\x1b[1mLinter:\x1b[0m Biome +\x1b[1mCoverage:\x1b[0m JavaScript, TypeScript, JSX, TSX, JSON, CSS, GraphQL +\x1b[1mCoverage restricted by package.json script:\x1b[0m no +\x1b[1mCoverage last checked:\x1b[0m 18 October 2024" +bun run lint:biome + +echo "\x1b[1mLinter:\x1b[0m Stylelint +\x1b[1mCoverage:\x1b[0m CSS +\x1b[1mCoverage restricted by package.json script:\x1b[0m yes +\x1b[1mCoverage last checked:\x1b[0m 18 October 2024" +bun run lint:stylelint echo "==> Typechecking the code" @@ -27,4 +36,3 @@ bunx playwright install chromium echo "==> Running the integration tests" bun run test:integration:cli - From d37178d34c64df5cf5f8807a170580e3c5697133 Mon Sep 17 00:00:00 2001 From: Ynda Jas Date: Fri, 18 Oct 2024 11:54:42 +0100 Subject: [PATCH 4/4] Fix Biome errors - Add file extensions - Ignore a `noConsole` rule in logging method --- client/index.ts | 32 +++++++++---------- client/utils/adminUtils.ts | 2 +- client/utils/domManipulationUtils/answer.ts | 8 ++--- .../utils/domManipulationUtils/bonusPoints.ts | 4 +-- .../domManipulationUtils/colourCheckboxes.ts | 8 ++--- .../domManipulationUtils/connectionStatus.ts | 4 +-- .../utils/domManipulationUtils/countdown.ts | 4 +-- .../utils/domManipulationUtils/playerList.ts | 6 ++-- .../utils/domManipulationUtils/playerName.ts | 6 ++-- client/utils/domManipulationUtils/question.ts | 6 ++-- .../utils/domManipulationUtils/roundReset.ts | 8 ++--- .../utils/domManipulationUtils/startButton.ts | 4 +-- .../domManipulationUtils/unjoinableMessage.ts | 4 +-- client/utils/socketUtils.ts | 4 +-- e2e/app.test.ts | 4 +-- server/@types/events.d.ts | 4 +-- server/index.ts | 4 +-- server/machines/lobby.test.ts | 2 +- server/machines/lobby.ts | 2 +- server/machines/round.ts | 4 +-- server/machines/turn.ts | 4 +-- server/models/lobby.ts | 8 ++--- server/models/round.ts | 14 ++++---- server/socketServer.ts | 17 ++++++---- server/utils/loggingUtils.ts | 1 + server/utils/scoringUtils.test.ts | 4 +-- server/utils/scoringUtils.ts | 7 +++- 27 files changed, 93 insertions(+), 82 deletions(-) diff --git a/client/index.ts b/client/index.ts index 82c3172..26ade6e 100644 --- a/client/index.ts +++ b/client/index.ts @@ -1,40 +1,40 @@ import { type Socket, io } from "socket.io-client"; -import type { Answer, Player } from "../server/@types/entities"; +import type { Answer, Player } from "../server/@types/entities.d.ts"; import type { ClientboundSocketServerEvents, ServerboundSocketServerEvents, -} from "../server/@types/events"; -import { addAdminModeListener } from "./utils/adminUtils"; -import type { NameFormElement } from "./utils/domManipulationUtils"; -import { renderBonusPoints } from "./utils/domManipulationUtils/bonusPoints"; -import { renderColourCheckboxes } from "./utils/domManipulationUtils/colourCheckboxes"; +} from "../server/@types/events.d.ts"; +import { addAdminModeListener } from "./utils/adminUtils.ts"; +import { renderBonusPoints } from "./utils/domManipulationUtils/bonusPoints.ts"; +import { renderColourCheckboxes } from "./utils/domManipulationUtils/colourCheckboxes.ts"; import { renderConnectedIndicator, renderDisconnectedIndicator, -} from "./utils/domManipulationUtils/connectionStatus"; +} from "./utils/domManipulationUtils/connectionStatus.ts"; import { type CountdownOptions, derenderCountdown, renderCountdown, -} from "./utils/domManipulationUtils/countdown"; +} from "./utils/domManipulationUtils/countdown.ts"; +import type { NameFormElement } from "./utils/domManipulationUtils/index.ts"; import { renderPlayerList, renderPlayerListWithScores, -} from "./utils/domManipulationUtils/playerList"; +} from "./utils/domManipulationUtils/playerList.ts"; import { derenderPlayerNameForm, renderPlayerName, resetPlayerNameFormValue, -} from "./utils/domManipulationUtils/playerName"; -import { renderQuestion } from "./utils/domManipulationUtils/question"; -import { resetRound } from "./utils/domManipulationUtils/roundReset"; +} from "./utils/domManipulationUtils/playerName.ts"; +import { renderQuestion } from "./utils/domManipulationUtils/question.ts"; +import { resetRound } from "./utils/domManipulationUtils/roundReset.ts"; import { derenderStartButton, renderStartButton, -} from "./utils/domManipulationUtils/startButton"; -import { renderUnjoinableMessage } from "./utils/domManipulationUtils/unjoinableMessage"; -import { getElementById } from "./utils/getElementById"; -import { addPlayer, emitAnswersPost } from "./utils/socketUtils"; +} from "./utils/domManipulationUtils/startButton.ts"; +import { renderUnjoinableMessage } from "./utils/domManipulationUtils/unjoinableMessage.ts"; +import { getElementById } from "./utils/getElementById.ts"; +import { addPlayer, emitAnswersPost } from "./utils/socketUtils.ts"; const generateSocketUrl = (): string => { const location = window.location; diff --git a/client/utils/adminUtils.ts b/client/utils/adminUtils.ts index a91a963..f64cc09 100644 --- a/client/utils/adminUtils.ts +++ b/client/utils/adminUtils.ts @@ -1,4 +1,4 @@ -import { renderRoundResetButton } from "./domManipulationUtils/roundReset"; +import { renderRoundResetButton } from "./domManipulationUtils/roundReset.ts"; const konamiCode: KeyboardEvent["key"][] = [ "ArrowUp", diff --git a/client/utils/domManipulationUtils/answer.ts b/client/utils/domManipulationUtils/answer.ts index 61bec4b..d06d7b6 100644 --- a/client/utils/domManipulationUtils/answer.ts +++ b/client/utils/domManipulationUtils/answer.ts @@ -1,7 +1,7 @@ -import { htmlElements } from "."; -import type { Answer, Colour } from "../../../server/@types/entities"; -import { getElementById } from "../getElementById"; -import { derenderColourCheckboxes } from "./colourCheckboxes"; +import type { Answer, Colour } from "../../../server/@types/entities.d.ts"; +import { getElementById } from "../getElementById.ts"; +import { derenderColourCheckboxes } from "./colourCheckboxes.ts"; +import { htmlElements } from "./index.ts"; const submitAnswer = async ( emitAnswersPostWrapper: (colours: Answer["colours"]) => void, diff --git a/client/utils/domManipulationUtils/bonusPoints.ts b/client/utils/domManipulationUtils/bonusPoints.ts index e68cb32..ed918c5 100644 --- a/client/utils/domManipulationUtils/bonusPoints.ts +++ b/client/utils/domManipulationUtils/bonusPoints.ts @@ -1,5 +1,5 @@ -import { htmlElements } from "."; -import { getElementById } from "../getElementById"; +import { getElementById } from "../getElementById.ts"; +import { htmlElements } from "./index.ts"; const renderBonusPoints = (bonusPoints: number): void => { htmlElements.bonusPoints ||= diff --git a/client/utils/domManipulationUtils/colourCheckboxes.ts b/client/utils/domManipulationUtils/colourCheckboxes.ts index 43e1221..f2adaf7 100644 --- a/client/utils/domManipulationUtils/colourCheckboxes.ts +++ b/client/utils/domManipulationUtils/colourCheckboxes.ts @@ -1,7 +1,7 @@ -import { htmlElements } from "."; -import type { Answer } from "../../../server/@types/entities"; -import { getElementById } from "../getElementById"; -import { submitAnswer } from "./answer"; +import type { Answer } from "../../../server/@types/entities.d.ts"; +import { getElementById } from "../getElementById.ts"; +import { submitAnswer } from "./answer.ts"; +import { htmlElements } from "./index.ts"; const renderColourCheckboxes = ( emitAnswersPostWrapper: (colours: Answer["colours"]) => void, diff --git a/client/utils/domManipulationUtils/connectionStatus.ts b/client/utils/domManipulationUtils/connectionStatus.ts index 0fdea26..99af999 100644 --- a/client/utils/domManipulationUtils/connectionStatus.ts +++ b/client/utils/domManipulationUtils/connectionStatus.ts @@ -1,5 +1,5 @@ -import { htmlElements } from "."; -import { getElementById } from "../getElementById"; +import { getElementById } from "../getElementById.ts"; +import { htmlElements } from "./index.ts"; const renderConnectedIndicator = (): void => { htmlElements.connectionStatus ||= diff --git a/client/utils/domManipulationUtils/countdown.ts b/client/utils/domManipulationUtils/countdown.ts index 6c260eb..2db8154 100644 --- a/client/utils/domManipulationUtils/countdown.ts +++ b/client/utils/domManipulationUtils/countdown.ts @@ -1,5 +1,5 @@ -import { htmlElements } from "."; -import { getElementById } from "../getElementById"; +import { getElementById } from "../getElementById.ts"; +import { htmlElements } from "./index.ts"; type CountdownOptions = { durationMs: number; diff --git a/client/utils/domManipulationUtils/playerList.ts b/client/utils/domManipulationUtils/playerList.ts index 6df8616..be5ea3b 100644 --- a/client/utils/domManipulationUtils/playerList.ts +++ b/client/utils/domManipulationUtils/playerList.ts @@ -1,6 +1,6 @@ -import { htmlElements } from "."; -import type { Player, PlayerScore } from "../../../server/@types/entities"; -import { getElementById } from "../getElementById"; +import type { Player, PlayerScore } from "../../../server/@types/entities.d.ts"; +import { getElementById } from "../getElementById.ts"; +import { htmlElements } from "./index.ts"; const renderPlayerList = (playerNames: Player["name"][]): void => { htmlElements.playerList ||= getElementById("player-list"); diff --git a/client/utils/domManipulationUtils/playerName.ts b/client/utils/domManipulationUtils/playerName.ts index 6754640..fe285eb 100644 --- a/client/utils/domManipulationUtils/playerName.ts +++ b/client/utils/domManipulationUtils/playerName.ts @@ -1,6 +1,6 @@ -import { type NameFormElement, htmlElements } from "."; -import type { Player } from "../../../server/@types/entities"; -import { getElementById } from "../getElementById"; +import type { Player } from "../../../server/@types/entities.d.ts"; +import { getElementById } from "../getElementById.ts"; +import { type NameFormElement, htmlElements } from "./index.ts"; const renderPlayerName = (currentPlayer: Player): void => { htmlElements.playerName ||= getElementById("player-name"); diff --git a/client/utils/domManipulationUtils/question.ts b/client/utils/domManipulationUtils/question.ts index 86454c4..1831b43 100644 --- a/client/utils/domManipulationUtils/question.ts +++ b/client/utils/domManipulationUtils/question.ts @@ -1,6 +1,6 @@ -import { htmlElements } from "."; -import type { Question } from "../../../server/@types/entities"; -import { getElementById } from "../getElementById"; +import type { Question } from "../../../server/@types/entities.d.ts"; +import { getElementById } from "../getElementById.ts"; +import { htmlElements } from "./index.ts"; const renderQuestion = (question: Question): void => { htmlElements.question ||= getElementById("question"); diff --git a/client/utils/domManipulationUtils/roundReset.ts b/client/utils/domManipulationUtils/roundReset.ts index 687f5db..f34d24a 100644 --- a/client/utils/domManipulationUtils/roundReset.ts +++ b/client/utils/domManipulationUtils/roundReset.ts @@ -1,7 +1,7 @@ -import { htmlElements } from "."; -import type { Player } from "../../../server/@types/entities"; -import { getElementById } from "../getElementById"; -import { renderStartButton } from "./startButton"; +import type { Player } from "../../../server/@types/entities.d.ts"; +import { getElementById } from "../getElementById.ts"; +import { htmlElements } from "./index.ts"; +import { renderStartButton } from "./startButton.ts"; const renderRoundResetButton = (): void => { htmlElements.roundResetButton ||= diff --git a/client/utils/domManipulationUtils/startButton.ts b/client/utils/domManipulationUtils/startButton.ts index fc35a67..2e54a09 100644 --- a/client/utils/domManipulationUtils/startButton.ts +++ b/client/utils/domManipulationUtils/startButton.ts @@ -1,5 +1,5 @@ -import { htmlElements } from "."; -import { getElementById } from "../getElementById"; +import { getElementById } from "../getElementById.ts"; +import { htmlElements } from "./index.ts"; const renderStartButton = (): void => { htmlElements.startButton ||= diff --git a/client/utils/domManipulationUtils/unjoinableMessage.ts b/client/utils/domManipulationUtils/unjoinableMessage.ts index c64dc39..a3f1aeb 100644 --- a/client/utils/domManipulationUtils/unjoinableMessage.ts +++ b/client/utils/domManipulationUtils/unjoinableMessage.ts @@ -1,5 +1,5 @@ -import { type NameFormElement, htmlElements } from "."; -import { getElementById } from "../getElementById"; +import { getElementById } from "../getElementById.ts"; +import { type NameFormElement, htmlElements } from "./index.ts"; const renderUnjoinableMessage = (): void => { htmlElements.playerNameForm ||= getElementById("name-form"); diff --git a/client/utils/socketUtils.ts b/client/utils/socketUtils.ts index 2b53481..a25a889 100644 --- a/client/utils/socketUtils.ts +++ b/client/utils/socketUtils.ts @@ -1,9 +1,9 @@ import type { Socket } from "socket.io-client"; -import type { Answer } from "../../server/@types/entities"; +import type { Answer } from "../../server/@types/entities.d.ts"; import type { ClientboundSocketServerEvents, ServerboundSocketServerEvents, -} from "../../server/@types/events"; +} from "../../server/@types/events.d.ts"; const addPlayer = ( socket: Socket, diff --git a/e2e/app.test.ts b/e2e/app.test.ts index 51be63c..099ebdd 100644 --- a/e2e/app.test.ts +++ b/e2e/app.test.ts @@ -1,6 +1,6 @@ import { type BrowserContext, type Page, expect, test } from "@playwright/test"; -import { konamiCode } from "../client/utils/adminUtils"; -import type { Colour, Player } from "../server/@types/entities"; +import { konamiCode } from "../client/utils/adminUtils.ts"; +import type { Colour, Player } from "../server/@types/entities.d.ts"; const joinedPlayerNames: Player["name"][] = []; let playersPages: Page[] = []; diff --git a/server/@types/events.d.ts b/server/@types/events.d.ts index a429c5d..473e976 100644 --- a/server/@types/events.d.ts +++ b/server/@types/events.d.ts @@ -1,5 +1,5 @@ -import type { CountdownOptions } from "../../client/utils/domManipulationUtils/countdown"; -import type { Colour, Player, PlayerScore, Question } from "./entities"; +import type { CountdownOptions } from "../../client/utils/domManipulationUtils/countdown.ts"; +import type { Colour, Player, PlayerScore, Question } from "./entities.d.ts"; export interface ClientboundSocketServerEvents { "answers:post": (playerId: string, colours: string[]) => void; diff --git a/server/index.ts b/server/index.ts index 225c517..26fd398 100644 --- a/server/index.ts +++ b/server/index.ts @@ -1,7 +1,7 @@ import http from "node:http"; import handler from "serve-handler"; -import { SocketServer } from "./socketServer"; -import { logWithTime } from "./utils/loggingUtils"; +import { SocketServer } from "./socketServer.ts"; +import { logWithTime } from "./utils/loggingUtils.ts"; const httpServer = http.createServer((request, response) => { return handler(request, response, { diff --git a/server/machines/lobby.test.ts b/server/machines/lobby.test.ts index 10604be..959ea26 100644 --- a/server/machines/lobby.test.ts +++ b/server/machines/lobby.test.ts @@ -1,7 +1,7 @@ import { beforeEach, describe, expect, it } from "bun:test"; import type { Actor } from "xstate"; import { createActor, getNextSnapshot } from "xstate"; -import { lobbyMachine } from "./lobby"; +import { lobbyMachine } from "./lobby.ts"; describe("lobbyMachine states", () => { const player1 = { name: "a name", socketId: "id" }; diff --git a/server/machines/lobby.ts b/server/machines/lobby.ts index e2c9ec1..5600261 100644 --- a/server/machines/lobby.ts +++ b/server/machines/lobby.ts @@ -1,5 +1,5 @@ import { assign, setup } from "xstate"; -import type { Player } from "../@types/entities"; +import type { Player } from "../@types/entities.d.ts"; const context = { players: [] as Player[], diff --git a/server/machines/round.ts b/server/machines/round.ts index d55b80f..9fee390 100644 --- a/server/machines/round.ts +++ b/server/machines/round.ts @@ -1,7 +1,7 @@ import { assign, setup } from "xstate"; -import type { Player, PlayerScore, Question } from "../@types/entities"; +import type { Player, PlayerScore, Question } from "../@types/entities.d.ts"; import questions from "../data/questions.json"; -import type { getUpdatedPlayerScoresAndBonusPoints } from "../utils/scoringUtils"; +import type { getUpdatedPlayerScoresAndBonusPoints } from "../utils/scoringUtils.ts"; const context = { questions: questions as Question[], diff --git a/server/machines/turn.ts b/server/machines/turn.ts index cebe5c5..e7732f5 100644 --- a/server/machines/turn.ts +++ b/server/machines/turn.ts @@ -1,6 +1,6 @@ import { assign, setup } from "xstate"; -import type { Answer, Player, Question } from "../@types/entities"; -import { getCorrectSocketIdsFromAnswers } from "../utils/scoringUtils"; +import type { Answer, Player, Question } from "../@types/entities.d.ts"; +import { getCorrectSocketIdsFromAnswers } from "../utils/scoringUtils.ts"; const context = { answers: [] as Answer[], diff --git a/server/models/lobby.ts b/server/models/lobby.ts index 8800c5b..bc1e2a3 100644 --- a/server/models/lobby.ts +++ b/server/models/lobby.ts @@ -1,9 +1,9 @@ import type { Socket } from "socket.io"; import { type Actor, createActor } from "xstate"; -import type { Player } from "../@types/entities"; -import { lobbyMachine } from "../machines/lobby"; -import type { SocketServer } from "../socketServer"; -import { machineLogger } from "../utils/loggingUtils"; +import type { Player } from "../@types/entities.d.ts"; +import { lobbyMachine } from "../machines/lobby.ts"; +import type { SocketServer } from "../socketServer.ts"; +import { machineLogger } from "../utils/loggingUtils.ts"; class Lobby { machine: Actor; diff --git a/server/models/round.ts b/server/models/round.ts index 342d09e..7b2b0ce 100644 --- a/server/models/round.ts +++ b/server/models/round.ts @@ -1,11 +1,11 @@ import { type Actor, type InspectionEvent, createActor } from "xstate"; -import type { Answer, Player, Question } from "../@types/entities"; -import { betweenTurnsCountdownMs, roundMachine } from "../machines/round"; -import { turnMachine } from "../machines/turn"; -import { turnEndCountdownMs } from "../machines/turn"; -import type { SocketServer } from "../socketServer"; -import { machineLogger } from "../utils/loggingUtils"; -import { getUpdatedPlayerScoresAndBonusPoints } from "../utils/scoringUtils"; +import type { Answer, Player, Question } from "../@types/entities.d.ts"; +import { betweenTurnsCountdownMs, roundMachine } from "../machines/round.ts"; +import { turnMachine } from "../machines/turn.ts"; +import { turnEndCountdownMs } from "../machines/turn.ts"; +import type { SocketServer } from "../socketServer.ts"; +import { machineLogger } from "../utils/loggingUtils.ts"; +import { getUpdatedPlayerScoresAndBonusPoints } from "../utils/scoringUtils.ts"; class Round { machine: Actor; diff --git a/server/socketServer.ts b/server/socketServer.ts index 03c7011..075a27b 100644 --- a/server/socketServer.ts +++ b/server/socketServer.ts @@ -1,14 +1,19 @@ import type { Server as HttpServer } from "node:http"; import { Server } from "socket.io"; -import type { CountdownOptions } from "../client/utils/domManipulationUtils/countdown"; -import type { Colour, Player, PlayerScore, Question } from "./@types/entities"; +import type { CountdownOptions } from "../client/utils/domManipulationUtils/countdown.ts"; +import type { + Colour, + Player, + PlayerScore, + Question, +} from "./@types/entities.d.ts"; import type { ClientboundSocketServerEvents, ServerboundSocketServerEvents, -} from "./@types/events"; -import { Lobby } from "./models/lobby"; -import { Round } from "./models/round"; -import { logWithTime } from "./utils/loggingUtils"; +} from "./@types/events.d.ts"; +import { Lobby } from "./models/lobby.ts"; +import { Round } from "./models/round.ts"; +import { logWithTime } from "./utils/loggingUtils.ts"; export class SocketServer { lobby: Lobby; diff --git a/server/utils/loggingUtils.ts b/server/utils/loggingUtils.ts index 590c398..18645e7 100644 --- a/server/utils/loggingUtils.ts +++ b/server/utils/loggingUtils.ts @@ -35,6 +35,7 @@ const logWithTime = ( fractionalSecondDigits: 3, }); + // biome-ignore lint/suspicious/noConsole: this is a logging method console.info( [`\n${currentTime} ${inlineString}`, subsequentLinesString] .filter((string) => string) diff --git a/server/utils/scoringUtils.test.ts b/server/utils/scoringUtils.test.ts index bf29f1f..8c03897 100644 --- a/server/utils/scoringUtils.test.ts +++ b/server/utils/scoringUtils.test.ts @@ -1,9 +1,9 @@ import { describe, expect, it } from "bun:test"; -import type { Colour, Player, PlayerScore } from "../@types/entities"; +import type { Colour, Player, PlayerScore } from "../@types/entities.d.ts"; import { getCorrectSocketIdsFromAnswers, getUpdatedPlayerScoresAndBonusPoints, -} from "./scoringUtils"; +} from "./scoringUtils.ts"; describe("scoringUtils", () => { describe("getCorrectSocketIdsFromAnswers", () => { diff --git a/server/utils/scoringUtils.ts b/server/utils/scoringUtils.ts index f48e2db..a834cc3 100644 --- a/server/utils/scoringUtils.ts +++ b/server/utils/scoringUtils.ts @@ -1,4 +1,9 @@ -import type { Answer, Player, PlayerScore, Question } from "../@types/entities"; +import type { + Answer, + Player, + PlayerScore, + Question, +} from "../@types/entities.d.ts"; const allCorrect = ( totalPlayerCount: number,