Skip to content
Draft
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
8 changes: 3 additions & 5 deletions backend/src/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,16 @@ type FirebaseErrorParent = {
errorInfo: FirebaseError;
};

// oxlint-disable-next-line no-explicit-any
export function isFirebaseError(err: any): err is FirebaseErrorParent {
export function isFirebaseError(err: unknown): err is FirebaseErrorParent {
return (
err !== null &&
typeof err === "object" &&
"code" in err &&
"errorInfo" in err &&
"codePrefix" in err &&
// oxlint-disable-next-line no-unsafe-member-access
typeof err.errorInfo === "object" &&
// oxlint-disable-next-line no-unsafe-member-access
err.errorInfo !== null &&
"code" in err.errorInfo &&
// oxlint-disable-next-line no-unsafe-member-access
"message" in err.errorInfo
);
}
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/ts/commandline/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from "./commandline-metadata";
import { Command } from "./types";
import * as ConfigSchemas from "@monkeytype/schemas/configs";
import { z, ZodSchema } from "zod";
import { z, ZodSchema, ZodFirstPartySchemaTypes } from "zod";

function getOptions<T extends ZodSchema>(schema: T): undefined | z.infer<T>[] {
if (schema instanceof z.ZodLiteral) {
Expand All @@ -28,7 +28,6 @@ function getOptions<T extends ZodSchema>(schema: T): undefined | z.infer<T>[] {
}

export function buildCommandForConfigKey<
// oxlint-disable-next-line no-unnecessary-type-parameters
K extends keyof CommandlineConfigMetadataObject,
>(key: K): Command {
const configMeta = configMetadata[key];
Expand Down Expand Up @@ -120,8 +119,7 @@ function buildCommandWithSubgroup<K extends keyof ConfigSchemas.Config>(

if (values === undefined) {
throw new Error(
//@ts-expect-error todo
`Unsupported schema type for key "${key}": ${schema._def.typeName}`,
`Unsupported schema type for key "${key}": ${(schema as ZodFirstPartySchemaTypes)._def.typeName}`,
);
}
const list = values.map((value) =>
Expand Down
5 changes: 3 additions & 2 deletions frontend/src/ts/components/common/ChartJs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ export function ChartJs<T extends ChartType, TData = DefaultDataPoint<T>>(
let chart: ChartWithUpdateColors<T, TData> | undefined;

onMount(() => {
//oxlint-disable-next-line no-non-null-assertion
chart = new ChartWithUpdateColors(canvasEl()!.native, {
const canvas = canvasEl();
if (canvas === undefined) return;
chart = new ChartWithUpdateColors(canvas.native, {
type: props.type,
data: props.data,
options: props.options,
Expand Down
9 changes: 3 additions & 6 deletions frontend/src/ts/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,11 @@ let dbSnapshot: Snapshot | undefined;
const firstDayOfTheWeek = getFirstDayOfTheWeek();

export class SnapshotInitError extends Error {
constructor(
message: string,
public responseCode: number,
) {
public responseCode: number;

constructor(message: string, responseCode: number) {
super(message);
this.name = "SnapshotInitError";
// TODO INVESTIGATE
// oxlint-disable-next-line
this.responseCode = responseCode;
}
}
Expand Down
5 changes: 2 additions & 3 deletions frontend/src/ts/popups/video-ad-popup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/* oxlint-disable no-unsafe-call */
/* oxlint-disable no-unsafe-member-access */
import * as Notifications from "../elements/notifications";
import * as AdController from "../controllers/ad-controller";
import * as Skeleton from "../utils/skeleton";
Expand Down Expand Up @@ -44,7 +42,8 @@ export async function show(): Promise<void> {
el.show();
},
onComplete: () => {
//@ts-expect-error 3rd party ad code
// @ts-expect-error 3rd party ad code
// oxlint-disable-next-line no-unsafe-call no-unsafe-member-access
window.dataLayer.push({ event: "EG_Video" });
},
});
Expand Down
1 change: 0 additions & 1 deletion frontend/src/ts/utils/async-modules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ export async function getDevOptionsModal(): Promise<
> {
try {
showLoaderBar();
// oxlint-disable-next-line import/no-unresolved
const module = await import("../modals/dev-options.js");
hideLoaderBar();
return module;
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/ts/utils/misc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,6 @@ type LastIndex = {
lastIndexOfRegex(regex: RegExp): number;
} & string;

// TODO INVESTIGATE IF THIS IS NEEDED
// oxlint-disable-next-line no-extend-native
(String.prototype as LastIndex).lastIndexOfRegex = function (
regex: RegExp,
): number {
Expand Down Expand Up @@ -596,13 +594,11 @@ export function promiseWithResolvers<T = void>(): {
): Promise<TResult1 | TResult2> {
return currentPromise.then(onfulfilled, onrejected);
},
// oxlint-disable-next-line promise-function-async
async catch<TResult = never>(
onrejected?: ((reason: unknown) => TResult | PromiseLike<TResult>) | null,
): Promise<T | TResult> {
return currentPromise.catch(onrejected);
},
// oxlint-disable-next-line promise-function-async
async finally(onfinally?: (() => void) | null): Promise<T> {
return currentPromise.finally(onfinally);
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/ts/utils/results.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export async function syncNotSignedInLastResult(uid: string): Promise<void> {

//TODO - this type cast was not needed before because we were using JSON cloning
// but now with the stronger types it shows that we are forcing completed event
// into a snapshot result - might not cuase issues but worth investigating
// into a snapshot result - might not cause issues but worth investigating
const result = structuredClone(
notSignedInLastResult,
) as unknown as SnapshotResult<Mode>;
Expand Down
8 changes: 2 additions & 6 deletions packages/release/src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// idk why its failing to resolve
// oxlint-disable-next-line import/no-unresolved
import { Octokit } from "@octokit/rest";
import { execSync } from "child_process";
import dotenv from "dotenv";
Expand Down Expand Up @@ -263,14 +261,12 @@ const main = async () => {
const name = readlineSync.question(
"Enter preview channel name (default: preview): ",
);
// oxlint-disable-next-line prefer-nullish-coalescing
const channelName = name.trim() || "preview";
const channelName = name.trim() ?? "preview";

const expirationTime = readlineSync.question(
"Enter expiration time (e.g., 2h, default: 1d): ",
);
// oxlint-disable-next-line prefer-nullish-coalescing
const expires = expirationTime.trim() || "1d";
const expires = expirationTime.trim() ?? "1d";

console.log(
`Deploying frontend preview to channel "${channelName}" with expiration "${expires}"...`,
Expand Down
2 changes: 1 addition & 1 deletion packages/schemas/src/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ export const UserSchema = z.object({
uid: z.string(), //defined by firebase, no validation should be applied
addedAt: z.number().int().nonnegative(),
personalBests: PersonalBestsSchema,
lastReultHashes: z.array(z.string()).optional(), //todo: fix typo (its in the db too)
lastReultHashes: z.array(z.string()).optional(), //TODO: fix typo (it's in the db too)
completedTests: z.number().int().nonnegative().optional(),
startedTests: z.number().int().nonnegative().optional(),
timeTyping: z
Expand Down
4 changes: 1 addition & 3 deletions packages/tsup-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { defineConfig, Options } from "tsup";

export function extendConfig(
customizer?: (options: Options) => Options,
// tsup uses MaybePromise which is not exported
// oxlint-disable-next-line no-explicit-any
): (options: Options) => any {
): (options: Options) => unknown {
return (options) => {
const overrideOptions = customizer?.(options);
const config: Options = {
Expand Down
8 changes: 2 additions & 6 deletions packages/util/src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ export function parseWithSchema<T extends z.ZodTypeAny>(
if (fallback === undefined) {
throw new Error(`Invalid JSON: ` + error.message);
}
// todo fix me
// oxlint-disable-next-line no-unsafe-return
return fallback as z.infer<T>;
return fallback as unknown;
}

const safeParse = schema.safeParse(jsonParsed);
Expand All @@ -60,9 +58,7 @@ export function parseWithSchema<T extends z.ZodTypeAny>(
.join(", ")}`,
);
}
// todo fix me
// oxlint-disable-next-line no-unsafe-return
return fallback as z.infer<T>;
return fallback as unknown;
}

return safeParseMigrated.data as T;
Expand Down
3 changes: 1 addition & 2 deletions vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ function convertTests(
function copySolidPlugin(config: UserWorkspaceConfig): void {
if (!config.plugins) return;
config.plugins
//@ts-expect-error this is fine
.filter((it) => it["name"] === "solid")
.filter((it) => it?.["name"] === "solid")
.forEach((it) => globalPlugins.push(it));
}