Skip to content

Commit a27e2ee

Browse files
committed
Merge branch 'master' into dom-util
2 parents ad5147b + 5d3bcb7 commit a27e2ee

File tree

94 files changed

+1890
-1438
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+1890
-1438
lines changed

.github/labeler.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ packages:
1818
- any: ["packages/**/*"]
1919

2020
local dev:
21-
- any: ["**/turbo.json", "**/tsconfig.json", "**/knip.json", "**/.prettierrc", "**/.oxlintrc.json", "**/.eslintrc.cjs", "**/vite.config.dev.js"]
21+
- any: ["**/turbo.json", "**/tsconfig.json", "**/knip.json", "**/.prettierrc", "**/.oxlintrc.json", "**/.eslintrc.cjs"]

.husky/pre-push

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export NVM_DIR="$HOME/.nvm"
99
if [ $(git branch --no-color | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/') = "master" ] && [ $(git remote get-url origin) = "https://github.com/monkeytypegame/monkeytype" ]; then
1010
nvm install
1111
echo "Running a full check before pushing to master..."
12-
npm run full-check
12+
pnpm run full-check
1313
if [ $? -ne 0 ]; then
1414
echo "Full check failed, aborting push."
1515
exit 1

backend/__tests__/__testData__/auth.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@ export async function mockAuthenticateWithApeKey(
1212
uid: string,
1313
config: Configuration,
1414
): Promise<string> {
15-
if (!config.apeKeys.acceptKeys)
15+
if (!config.apeKeys.acceptKeys) {
1616
throw Error("config.apeKeys.acceptedKeys needs to be set to true");
17+
}
1718
const { apeKeyBytes, apeKeySaltRounds } = config.apeKeys;
1819

1920
const apiKey = randomBytes(apeKeyBytes).toString("base64url");

backend/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"gen-docs": "tsx scripts/openapi.ts dist/static/api/openapi.json && redocly build-docs -o dist/static/api/internal.html internal@v2 && redocly bundle -o dist/static/api/public.json public-filter && redocly build-docs -o dist/static/api/public.html public@v2"
2222
},
2323
"engines": {
24-
"node": "24.11.0"
24+
"node": "24.11.0 || 22.21.0"
2525
},
2626
"dependencies": {
2727
"@date-fns/utc": "1.2.0",
@@ -40,7 +40,7 @@
4040
"date-fns": "3.6.0",
4141
"dotenv": "16.4.5",
4242
"etag": "1.8.1",
43-
"express": "5.1.0",
43+
"express": "5.2.0",
4444
"express-rate-limit": "7.5.1",
4545
"firebase-admin": "12.0.0",
4646
"helmet": "4.6.0",
@@ -49,7 +49,7 @@
4949
"mjml": "4.15.0",
5050
"mongodb": "6.3.0",
5151
"mustache": "4.2.0",
52-
"nodemailer": "7.0.7",
52+
"nodemailer": "7.0.11",
5353
"object-hash": "3.0.0",
5454
"prom-client": "15.1.3",
5555
"rate-limiter-flexible": "5.0.3",

backend/src/api/controllers/dev.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ async function createTestResults(
9696
const results = createArray(day.amount, () =>
9797
createResult(user, day.timestamp),
9898
);
99-
if (results.length > 0)
99+
if (results.length > 0) {
100100
await ResultDal.getResultCollection().insertMany(results);
101+
}
101102
}
102103
}
103104

@@ -221,9 +222,10 @@ async function updateUser(uid: string): Promise<void> {
221222
{ sort: { wpm: -1, timestamp: 1 } },
222223
)) as DBResult;
223224

224-
if (personalBests[mode.mode] === undefined) personalBests[mode.mode] = {};
225-
if (personalBests[mode.mode][mode.mode2] === undefined)
225+
personalBests[mode.mode] ??= {};
226+
if (personalBests[mode.mode][mode.mode2] === undefined) {
226227
personalBests[mode.mode][mode.mode2] = [];
228+
}
227229

228230
const entry = {
229231
acc: best.acc,
@@ -241,8 +243,9 @@ async function updateUser(uid: string): Promise<void> {
241243
(personalBests[mode.mode][mode.mode2] as PersonalBest[]).push(entry);
242244

243245
if (mode.mode === "time") {
244-
if (lbPersonalBests[mode.mode][mode.mode2] === undefined)
246+
if (lbPersonalBests[mode.mode][mode.mode2] === undefined) {
245247
lbPersonalBests[mode.mode][mode.mode2] = {};
248+
}
246249

247250
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
248251
lbPersonalBests[mode.mode][mode.mode2][mode.language] = entry;

backend/src/api/controllers/quote.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ export async function submitRating(
125125
shouldUpdateRating,
126126
);
127127

128-
if (!userQuoteRatings[language]) {
129-
userQuoteRatings[language] = {};
130-
}
128+
userQuoteRatings[language] ??= {};
131129
userQuoteRatings[language][quoteId] = rating;
132130

133131
await updateQuoteRatings(uid, userQuoteRatings);

backend/src/api/controllers/result.ts

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -170,24 +170,12 @@ export async function updateTags(
170170
await ResultDAL.updateTags(uid, resultId, tagIds);
171171
const result = await ResultDAL.getResult(uid, resultId);
172172

173-
if (!result.difficulty) {
174-
result.difficulty = "normal";
175-
}
176-
if (!(result.language ?? "")) {
177-
result.language = "english";
178-
}
179-
if (result.funbox === undefined) {
180-
result.funbox = [];
181-
}
182-
if (!result.lazyMode) {
183-
result.lazyMode = false;
184-
}
185-
if (!result.punctuation) {
186-
result.punctuation = false;
187-
}
188-
if (!result.numbers) {
189-
result.numbers = false;
190-
}
173+
result.difficulty ??= "normal";
174+
result.language ??= "english";
175+
result.funbox ??= [];
176+
result.lazyMode ??= false;
177+
result.punctuation ??= false;
178+
result.numbers ??= false;
191179

192180
const user = await UserDAL.getPartialUser(uid, "update tags", ["tags"]);
193181
const tagPbs = await UserDAL.checkIfTagPb(uid, user, result);

backend/src/api/controllers/user.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1207,8 +1207,9 @@ export function generateCurrentTestActivity(
12071207
let thisYearData = testActivity?.[thisYear.getFullYear().toString()];
12081208
let lastYearData = testActivity?.[lastYear.getFullYear().toString()];
12091209

1210-
if (lastYearData === undefined && thisYearData === undefined)
1210+
if (lastYearData === undefined && thisYearData === undefined) {
12111211
return undefined;
1212+
}
12121213

12131214
lastYearData = lastYearData ?? [];
12141215
thisYearData = thisYearData ?? [];

backend/src/api/controllers/webhooks.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ export async function githubRelease(
1111

1212
if (action === "published") {
1313
const releaseId = req.body.release?.id;
14-
if (releaseId === undefined)
14+
if (releaseId === undefined) {
1515
throw new MonkeyError(422, 'Missing property "release.id".');
16+
}
1617

1718
await GeorgeQueue.sendReleaseAnnouncement(releaseId);
1819
return new MonkeyResponse("Added release announcement task to queue", null);

backend/src/dal/connections.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ export async function getConnections(options: {
2020
}): Promise<DBConnection[]> {
2121
const { initiatorUid, receiverUid, status } = options;
2222

23-
if (initiatorUid === undefined && receiverUid === undefined)
23+
if (initiatorUid === undefined && receiverUid === undefined) {
2424
throw new Error("Missing filter");
25+
}
2526

2627
let filter: Filter<DBConnection> = { $or: [] };
2728

0 commit comments

Comments
 (0)