Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@
"@vitest/coverage-v8": "4.1.5",
"concurrently": "8.2.2",
"openapi3-ts": "2.0.2",
"oxlint": "1.74.0",
"oxlint-tsgolint": "0.24.0",
"oxlint": "1.75.0",
"oxlint-tsgolint": "7.0.2001",
"readline-sync": "1.4.10",
"supertest": "7.1.4",
"testcontainers": "11.11.0",
Expand Down
8 changes: 4 additions & 4 deletions backend/scripts/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ function addAuth(
function getRequiredPermissions(
metadata: EndpointMetadata | undefined,
): PermissionId[] | undefined {
if (metadata === undefined || metadata.requirePermission === undefined) {
if (metadata?.requirePermission === undefined) {
return undefined;
}

Expand All @@ -210,7 +210,7 @@ function addTags(
operation: OperationObject,
metadata: EndpointMetadata | undefined,
): void {
if (metadata === undefined || metadata.openApiTags === undefined) return;
if (metadata?.openApiTags === undefined) return;
operation.tags = Array.isArray(metadata.openApiTags)
? metadata.openApiTags
: [metadata.openApiTags];
Expand All @@ -220,7 +220,7 @@ function addRateLimit(
operation: OperationObject,
metadata: EndpointMetadata | undefined,
): void {
if (metadata === undefined || metadata.rateLimit === undefined) return;
if (metadata?.rateLimit === undefined) return;
// oxlint-disable-next-line no-unsafe-assignment
const okResponse = operation.responses["200"];
if (okResponse === undefined) return;
Expand Down Expand Up @@ -280,7 +280,7 @@ function addRequiredConfiguration(
operation: OperationObject,
metadata: EndpointMetadata | undefined,
): void {
if (metadata === undefined || metadata.requireConfiguration === undefined) {
if (metadata?.requireConfiguration === undefined) {
return;
}

Expand Down
2 changes: 1 addition & 1 deletion backend/src/middlewares/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ function getValue(
function getRequireConfigurations(
metadata: EndpointMetadata | undefined,
): RequireConfiguration[] | undefined {
if (metadata === undefined || metadata.requireConfiguration === undefined) {
if (metadata?.requireConfiguration === undefined) {
return undefined;
}

Expand Down
2 changes: 1 addition & 1 deletion backend/src/middlewares/permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export function verifyPermissions<
function getRequiredPermissionIds(
metadata: EndpointMetadata | undefined,
): PermissionId[] | undefined {
if (metadata === undefined || metadata.requirePermission === undefined) {
if (metadata?.requirePermission === undefined) {
return undefined;
}

Expand Down
6 changes: 3 additions & 3 deletions backend/src/middlewares/rate-limit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function initialiseLimiters(): Record<RateLimiterId, RateLimitRequestHandler> {
const convert = (options: RateLimitOptions): RateLimitRequestHandler => {
return rateLimit({
windowMs: convertWindowToMs(options.window),
max: options.max * REQUEST_MULTIPLIER,
limit: options.max * REQUEST_MULTIPLIER,
handler: customHandler,
keyGenerator: getKeyWithUid,
});
Expand Down Expand Up @@ -140,7 +140,7 @@ export function rateLimitRequest<
// Root Rate Limit
export const rootRateLimiter = rateLimit({
windowMs: 60 * 1000 * 60,
max: 1000 * REQUEST_MULTIPLIER,
limit: 1000 * REQUEST_MULTIPLIER,
keyGenerator: getKey,
handler: (_req, _res, _next, _options): void => {
throw new MonkeyError(
Expand Down Expand Up @@ -206,7 +206,7 @@ export async function incrementBadAuth(

export const webhookLimit = rateLimit({
windowMs: 1000,
max: 1 * REQUEST_MULTIPLIER,
limit: 1 * REQUEST_MULTIPLIER,
keyGenerator: getKeyWithUid,
handler: customHandler,
});
4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@
"madge": "8.0.0",
"magic-string": "0.30.17",
"normalize.css": "8.0.1",
"oxlint": "1.74.0",
"oxlint-tsgolint": "0.24.0",
"oxlint": "1.75.0",
"oxlint-tsgolint": "7.0.2001",
"postcss": "8.5.15",
"sass": "1.70.0",
"solid-devtools": "0.34.5",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/html/pages/test.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<mount data-component="testmodesnotice"></mount>

<mount data-component="livestatstexttop"></mount>
<mount data-component="livestatsmini" class="full-width"></mount>
<!-- <mount data-component="livestatsmini" class="full-width"></mount> -->
<div id="wordsWrapper" class="content-grid full-width" translate="no">
<textarea
id="wordsInput"
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/ts/commandline/commandline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,7 @@ async function showCommands(): Promise<void> {
});

if (
lastState &&
usingSingleList === lastState.usingSingleList &&
usingSingleList === lastState?.usingSingleList &&
areSortedArraysEqual(list, lastState.list)
) {
return;
Expand Down Expand Up @@ -961,8 +960,7 @@ const modal = new AnimatedModal({

input.on("input", async (e) => {
if (
inputModeParams === null ||
inputModeParams.command === null ||
inputModeParams?.command === null ||
!("validation" in inputModeParams.command)
) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function StreakHourOffsetModal() {
name="offset"
validators={{
onChange: ({ value }) => {
const val = parseFloat(String(value));
const val = parseFloat(value);
if (isNaN(val)) {
return "Must be a number";
}
Expand Down
5 changes: 1 addition & 4 deletions frontend/src/ts/components/pages/login/Register.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ export function Register(): JSXElement {
});
}

if (
disposableEmailModule &&
disposableEmailModule.isDisposableEmail !== undefined
) {
if (disposableEmailModule?.isDisposableEmail !== undefined) {
try {
if (disposableEmailModule.isDisposableEmail(email)) {
messages.push({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export function AnimationFpsLimit(): JSXElement {
fpsLimit: getfpsLimit() === 1000 ? "" : String(getfpsLimit()),
},
onSubmit: ({ value }) => {
const val = parseFloat(String(value.fpsLimit));
const val = parseFloat(value.fpsLimit);
if (isNaN(val) || val === getfpsLimit()) return;
setfpsLimit(val);
savedIndicator.flash();
Expand Down Expand Up @@ -57,7 +57,7 @@ export function AnimationFpsLimit(): JSXElement {
if (value === "") {
return;
}
const val = parseFloat(String(value));
const val = parseFloat(value);
if (isNaN(val)) {
return "Must be a number";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ export function CustomBackground(): JSXElement {
{ displayString?: string }
>;
const displayString =
optionMeta?.[String(option)]?.displayString ?? String(option);
optionMeta?.[option]?.displayString ?? option;
return (
<Button
active={getConfig.customBackgroundSize === option}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ export function FontFamily(): JSXElement {
<For each={getOptions(ConfigSchema.shape.fontFamily)?.sort()}>
{(option) => {
const optionsMeta = configMetadata.fontFamily.optionsMetadata;
const match = optionsMeta?.[String(option)];
const match = optionsMeta?.[option];
const displayString =
match?.displayString ?? String(option).replace(/_/g, " ");
match?.displayString ?? option.replace(/_/g, " ");

const fontFamily = () => {
if (option === "Comic_Sans_MS") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function PaceCaret(): JSXElement {
{ displayString?: string }
>;
const displayString =
optionMeta?.[String(option)]?.displayString ?? String(option);
optionMeta?.[option]?.displayString ?? option;
return (
<Button
active={getConfig.paceCaret === option}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/components/ui/table/DataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function DataTable<TData extends Object, TValue = any>(

const [rowSelection, setRowSelection] = createSignal({});
createEffect(() => {
if (!props.rowSelection || props.rowSelection.activeRow === undefined) {
if (props.rowSelection?.activeRow === undefined) {
setRowSelection({});
} else {
const activeId = props.rowSelection.activeRow();
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/controllers/sound-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ export async function previewClick(clickId: PlaySoundOnClick): Promise<void> {
await init();

const safeClickSounds = clickSoundConfig[clickId];
if (safeClickSounds === undefined || safeClickSounds[0] === undefined) {
if (safeClickSounds?.[0] === undefined) {
return;
}

Expand Down
3 changes: 1 addition & 2 deletions frontend/src/ts/controllers/theme-controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,7 @@ configEvent.subscribe(async ({ key, newValue, nosave }) => {
if (
key === "themeDark" &&
Config.autoSwitchTheme &&
window.matchMedia !== undefined &&
window.matchMedia("(prefers-color-scheme: dark)").matches &&
window.matchMedia?.("(prefers-color-scheme: dark)")?.matches &&
!nosave
) {
await set(Config.themeDark, true);
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/controllers/url-handler.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export function loadCustomThemeFromUrl(getOverride?: string): void {
colorArray = decoded as unknown as CustomThemeColors;
}

if (colorArray === undefined || colorArray.length !== 10) {
if (colorArray?.length !== 10) {
showNoticeNotification("Failed to load theme from URL: no colors found");
return;
}
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/ts/elements/psa.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ async function getLatest(): Promise<PSA[] | null> {
if (
maintenanceData !== undefined &&
maintenanceData.length > 0 &&
maintenanceData[0] !== undefined &&
maintenanceData[0].status === "INPROGRESS"
maintenanceData[0]?.status === "INPROGRESS"
) {
addBanner({
level: "error",
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/ts/elements/result-word-highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,7 @@ export async function highlightWordsInRange(

// Early exit if highlight range has not changed
if (
highlightRange !== undefined &&
firstWordIndex === highlightRange[0] &&
firstWordIndex === highlightRange?.[0] &&
lastWordIndex === highlightRange[1]
) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/states/account-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ createEffectOn(isAuthenticated, (hasUser) => {
export function readAccountSettingsGetParameters(
params: AccountSettingsUrlParams | undefined,
): void {
if (params === undefined || params.tab === undefined) return;
if (params?.tab === undefined) return;

setCurrentTab(params.tab);
}
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/states/leaderboard-selection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export { setSelection };
export function readLeaderboardGetParameters(
params: LeaderboardUrlParams | undefined,
): void {
if (params === undefined || params.type === undefined) return;
if (params?.type === undefined) return;

let newSelection: Partial<Selection> = {
type: params.type,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/test/events/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export function getInputFromDom(events: TestEventNoMs[]): string {
let lastInputEvent: InputEventNoMs | undefined;
for (let i = events.length - 1; i >= 0; i--) {
const e = events[i];
if (e !== undefined && e.type === "input") {
if (e?.type === "input") {
lastInputEvent = e;
break;
}
Expand Down
3 changes: 1 addition & 2 deletions frontend/src/ts/test/pace-caret.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,8 +233,7 @@ function incrementLetterIndex(): void {
export function handleSpace(correct: boolean, currentWord: string): void {
if (correct) {
if (
settings !== null &&
settings.wordsStatus[getActiveWordIndex()] === true &&
settings?.wordsStatus[getActiveWordIndex()] === true &&
!Config.blindMode
) {
settings.wordsStatus[getActiveWordIndex()] = undefined;
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/test/test-logic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,7 @@ export async function finish(difficultyFailed = false): Promise<void> {

savingResultPromise = saveResult(completedEvent, false);
void savingResultPromise.then((response) => {
if (response && response.status === 200) {
if (response?.status === 200) {
void AnalyticsController.log("testCompleted");
}
});
Expand Down
7 changes: 2 additions & 5 deletions frontend/src/ts/test/test-ui.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,10 +353,7 @@ async function updateHintsPosition(): Promise<void> {

for (const currentLetterIndex of letterIndices) {
const lastBlock = hintIndices[hintIndices.length - 1];
if (
lastBlock &&
lastBlock[lastBlock.length - 1] === currentLetterIndex - 1
) {
if (lastBlock?.[lastBlock.length - 1] === currentLetterIndex - 1) {
lastBlock.push(currentLetterIndex);
} else {
hintIndices.push([currentLetterIndex]);
Expand Down Expand Up @@ -835,7 +832,7 @@ export async function updateWordLetters({
Config.indicateTypos === "both"
) {
const lastBlock = hintIndices[hintIndices.length - 1];
if (lastBlock && lastBlock[lastBlock.length - 1] === i - 1) {
if (lastBlock?.[lastBlock.length - 1] === i - 1) {
lastBlock.push(i);
} else {
hintIndices.push([i]);
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/ts/utils/dom.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function handleReady(): void {

//call deferred callbacks and empty the list
//flush the list in a loop in case callbacks were added during the execution
while (readyList && readyList.length) {
while (readyList !== undefined && readyList.length > 0) {
const callbacks = readyList;
readyList = [];
callbacks.forEach((it) => {
Expand Down Expand Up @@ -395,7 +395,7 @@ export class ElementWithUtils<T extends HTMLElement = HTMLElement> {
while (
childTarget !== null &&
childTarget !== this.native && //stop on parent
this.native.contains(childTarget) //stop above parent
this.native?.contains(childTarget) //stop above parent
) {
if (typeof handler === "function") {
handler.call(
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/utils/json-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export async function getLatestReleaseFromGitHub(): Promise<string> {
const releases = await cachedFetchJson<releaseType[]>(
"https://api.github.com/repos/monkeytypegame/monkeytype/releases?per_page=1",
);
if (releases[0] === undefined || releases[0].name === undefined) {
if (releases[0]?.name === undefined) {
throw new Error("No release found");
}
return releases[0].name;
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,9 @@
"knip": "2.19.2",
"lint-staged": "13.2.3",
"only-allow": "1.2.1",
"oxfmt": "0.59.0",
"oxlint": "1.74.0",
"oxlint-tsgolint": "0.24.0",
"oxfmt": "0.60.0",
"oxlint": "1.75.0",
"oxlint-tsgolint": "7.0.2001",
"prettier": "3.7.1",
"stylelint": "17.6.0",
"stylelint-config-standard": "40.0.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/challenges/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@monkeytype/typescript-config": "workspace:*",
"@types/node": "24.9.1",
"madge": "8.0.0",
"oxlint": "1.74.0",
"oxlint-tsgolint": "0.24.0",
"oxlint": "1.75.0",
"oxlint-tsgolint": "7.0.2001",
"tsup": "8.4.0",
"typescript": "7.0.2",
"vitest": "4.1.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@
"@monkeytype/typescript-config": "workspace:*",
"@types/node": "24.9.1",
"madge": "8.0.0",
"oxlint": "1.74.0",
"oxlint-tsgolint": "0.24.0",
"oxlint": "1.75.0",
"oxlint-tsgolint": "7.0.2001",
"tsup": "8.4.0",
"typescript": "7.0.2",
"vitest": "4.1.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/funbox/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
"@monkeytype/typescript-config": "workspace:*",
"@types/node": "24.9.1",
"madge": "8.0.0",
"oxlint": "1.74.0",
"oxlint-tsgolint": "0.24.0",
"oxlint": "1.75.0",
"oxlint-tsgolint": "7.0.2001",
"tsup": "8.4.0",
"typescript": "7.0.2",
"vitest": "4.1.0"
Expand Down
Loading
Loading