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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 8 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ export default [
pluginReact.configs.flat.recommended,
pluginReact.configs.flat["jsx-runtime"],
...tseslint.configs.recommendedTypeChecked,
{
files: ["**/*.js", "**/*.mjs", "**/*.cjs"],
...tseslint.configs.disableTypeChecked,
languageOptions: {
globals: { ...globals.node },
parserOptions: { project: false, projectService: false },
},
},
{
files: ["**/*.{ts,tsx}"],
languageOptions: {
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/__tests__/drivers/email.driver.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { faker } from "@faker-js/faker";
import { Subscriber } from "@core/types/email/email.types";
import { type Subscriber } from "@core/types/email/email.types";
import dayjs from "@core/util/date/dayjs";
import EmailService from "@backend/email/email.service";
import {
Response_TagSubscriber,
Response_UpsertSubscriber,
type Response_TagSubscriber,
type Response_UpsertSubscriber,
} from "@backend/email/email.types";

export class EmailDriver {
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/__tests__/drivers/event.driver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ObjectId } from "mongodb";
import { z } from "zod/v4";
import { type z } from "zod/v4";
import Migration from "@scripts/migrations/2025.10.18T20.01.14.migrate-events-to-new-events-collection";
import { Origin, Priorities } from "@core/constants/core.constants";
import { UserDriver } from "@backend/__tests__/drivers/user.driver";
Expand Down Expand Up @@ -41,8 +41,8 @@ export class EventDriver {
});

const recurringEventIds = new Map<string, ObjectId>([
[gcalAllDayEvents.gcalEvents.recurring.id!, new ObjectId()],
[gcalTimedEvents.gcalEvents.recurring.id!, new ObjectId()],
[gcalAllDayEvents.gcalEvents.recurring.id, new ObjectId()],
[gcalTimedEvents.gcalEvents.recurring.id, new ObjectId()],
]);

const gcalEvents = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
IMPORT_GCAL_START,
} from "@core/constants/websocket.constants";
import { Status } from "@core/errors/status.codes";
import { Payload_Sync_Notif } from "@core/types/sync.types";
import { BaseDriver } from "@backend/__tests__/drivers/base.driver";
import { type Payload_Sync_Notif } from "@core/types/sync.types";
import { type BaseDriver } from "@backend/__tests__/drivers/base.driver";
import { encodeChannelToken } from "@backend/sync/util/watch.util";

export class SyncControllerDriver {
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/__tests__/drivers/sync.driver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ObjectId, WithId } from "mongodb";
import { ObjectId, type WithId } from "mongodb";
import { faker } from "@faker-js/faker";
import { Resource_Sync, Schema_Sync } from "@core/types/sync.types";
import { Schema_User } from "@core/types/user.types";
import { Resource_Sync, type Schema_Sync } from "@core/types/sync.types";
import { type Schema_User } from "@core/types/user.types";
import dayjs from "@core/util/date/dayjs";
import { UserDriver } from "@backend/__tests__/drivers/user.driver";
import { getGcalClient } from "@backend/auth/services/google.auth.service";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import request from "supertest";
import type request from "supertest";
import { Status } from "@core/errors/status.codes";
import { UserProfile } from "@core/types/user.types";
import { BaseDriver } from "@backend/__tests__/drivers/base.driver";
import { type UserProfile } from "@core/types/user.types";
import { type BaseDriver } from "@backend/__tests__/drivers/base.driver";

export class UserControllerDriver {
constructor(private readonly baseDriver: BaseDriver) {}
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/__tests__/drivers/user.driver.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { TokenPayload } from "google-auth-library";
import { ObjectId, WithId } from "mongodb";
import { type TokenPayload } from "google-auth-library";
import { ObjectId, type WithId } from "mongodb";
import { faker } from "@faker-js/faker";
import { Schema_User } from "@core/types/user.types";
import { type Schema_User } from "@core/types/user.types";
import userService from "../../user/services/user.service";

export class UserDriver {
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/__tests__/drivers/util.driver.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { WithId } from "mongodb";
import { Schema_User } from "@core/types/user.types";
import { type WithId } from "mongodb";
import { type Schema_User } from "@core/types/user.types";
import { SyncDriver } from "@backend/__tests__/drivers/sync.driver";
import { UserDriver } from "@backend/__tests__/drivers/user.driver";

Expand Down
12 changes: 6 additions & 6 deletions packages/backend/src/__tests__/helpers/mock.events.init.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ObjectId, WithoutId } from "mongodb";
import { Options } from "rrule";
import { ObjectId, type WithoutId } from "mongodb";
import { type Options } from "rrule";
import { calendar } from "@googleapis/calendar";
import { Origin } from "@core/constants/core.constants";
import { MapEvent } from "@core/mappers/map.event";
import { Schema_Event, WithCompassId } from "@core/types/event.types";
import { type Schema_Event, type WithCompassId } from "@core/types/event.types";
import {
gSchema$Event,
gSchema$EventBase,
gSchema$EventInstance,
type gSchema$Event,
type gSchema$EventBase,
type gSchema$EventInstance,
} from "@core/types/gcal";
import { isBase } from "@core/util/event/event.util";
import { mockGcalEvents } from "@backend/__tests__/mocks.gcal/factories/gcal.event.factory";
Expand Down
22 changes: 11 additions & 11 deletions packages/backend/src/__tests__/helpers/mock.setup.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
import { Handler, NextFunction, Response } from "express";
import { type Handler, type NextFunction, type Response } from "express";
import mergeWith from "lodash.mergewith";
import { randomUUID } from "node:crypto";
import { SessionRequest } from "supertokens-node/framework/express";
import { type SessionRequest } from "supertokens-node/framework/express";
import {
ExpressRequest,
ExpressResponse,
type ExpressRequest,
type ExpressResponse,
} from "supertokens-node/lib/build/framework/express/framework";
import {
APIOptions,
SessionContainerInterface,
VerifySessionOptions,
type APIOptions,
type SessionContainerInterface,
type VerifySessionOptions,
} from "supertokens-node/lib/build/recipe/session/types";
import { UserContext } from "supertokens-node/lib/build/types";
import { type UserContext } from "supertokens-node/lib/build/types";
import { createMockCalendarListEntry as mockCalendarListCreate } from "@core/__tests__/helpers/gcal.factory";
import { mockModule } from "@core/__tests__/mock.setup";
import { gSchema$CalendarListEntry } from "@core/types/gcal";
import { type gSchema$CalendarListEntry } from "@core/types/gcal";
import { StringV4Schema, zObjectId } from "@core/types/type.utils";
import { UserMetadata } from "@core/types/user.types";
import { type UserMetadata } from "@core/types/user.types";
import { mockAndCategorizeGcalEvents } from "@backend/__tests__/mocks.gcal/factories/gcal.event.batch";
import { mockGcal } from "@backend/__tests__/mocks.gcal/factories/gcal.factory";
import { ENV } from "@backend/common/constants/env.constants";
import { SupertokensAccessTokenPayload } from "@backend/common/types/supertokens.types";
import { type SupertokensAccessTokenPayload } from "@backend/common/types/supertokens.types";

export interface CompassTestState {
events: ReturnType<typeof mockAndCategorizeGcalEvents>;
Expand Down
6 changes: 3 additions & 3 deletions packages/backend/src/__tests__/mocks.db/ccal.mock.db.util.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ObjectId } from "mongodb";
import {
Schema_Event,
Schema_Event_Recur_Base,
Schema_Event_Recur_Instance,
type Schema_Event,
type Schema_Event_Recur_Base,
type Schema_Event_Recur_Instance,
} from "@core/types/event.types";
import {
createMockBaseEvent,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$EventBase } from "@core/types/gcal";
import { type gSchema$EventBase } from "@core/types/gcal";
import {
mockRecurringGcalBaseEvent,
mockRecurringGcalInstances,
Expand All @@ -13,7 +13,7 @@ export const mockAndCategorizeGcalEvents = () => {
{ summary: "Recurrence" },
false,
{ count: 3 },
) as gSchema$EventBase;
);

// Create instances of the recurring event
const instances = mockRecurringGcalInstances(baseRecurringEvent);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$EventInstance } from "@core/types/gcal";
import { type gSchema$EventInstance } from "@core/types/gcal";
import {
mockRecurringGcalBaseEvent,
mockRecurringGcalInstances,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Options, RRule } from "rrule";
import { type Options, RRule } from "rrule";
import { faker } from "@faker-js/faker";
import { Origin, Priorities } from "@core/constants/core.constants";
import {
WithGcalId,
gSchema$Event,
gSchema$EventBase,
gSchema$EventInstance,
type WithGcalId,
type gSchema$Event,
type gSchema$EventBase,
type gSchema$EventInstance,
} from "@core/types/gcal";
import { formatAs } from "@core/util/date/date.util";
import dayjs from "@core/util/date/dayjs";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ export const mockGcal = ({
options,
200,
"OK",
updatedEvent.id!,
updatedEvent.id,
),
);
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const createNewRecurringEventPayload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const deleteAllPayload1: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const deleteAllPayload2: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const deleteSinglePayload2: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const deleteSinglePayload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const deleteThisAndFollowingPayload2: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const deleteThisAndFollowingPayload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const allPayload1: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const allPayload2: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const singleInstance1Payload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const singleInstance2Payload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

/**
* Payload with instances that were each edited individually
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const thisAndFollowing1Payload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const thisAndFollowing2Payload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const thisAndFollowing3Payload: gSchema$Events = {
kind: "calendar#events",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { gSchema$Events } from "@core/types/gcal";
import { type gSchema$Events } from "@core/types/gcal";

export const thisAndFollowing4Payload: gSchema$Events = {
kind: "calendar#events",
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/auth/auth.routes.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import express from "express";
import type express from "express";
import { verifySession } from "supertokens-node/recipe/session/framework/express";
import { CommonRoutesConfig } from "@backend/common/common.routes.config";
import authController from "./controllers/auth.controller";
Expand Down
7 changes: 5 additions & 2 deletions packages/backend/src/auth/controllers/auth.controller.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { ObjectId } from "mongodb";
import { SessionRequest } from "supertokens-node/framework/express";
import { type SessionRequest } from "supertokens-node/framework/express";
import { zObjectId } from "@core/types/type.utils";
import compassAuthService from "@backend/auth/services/compass.auth.service";
import { ReqBody, Res_Promise } from "@backend/common/types/express.types";
import {
type ReqBody,
type Res_Promise,
} from "@backend/common/types/express.types";

class AuthController {
createSession = async (
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/auth/middleware/auth.middleware.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { NextFunction, Request, Response } from "express";
import { type NextFunction, type Request, type Response } from "express";
import { COMPASS_RESOURCE_HEADER } from "@core/constants/core.constants";
import { Status } from "@core/errors/status.codes";
import { ENV, IS_DEV } from "@backend/common/constants/env.constants";
import { AuthError } from "@backend/common/errors/auth/auth.errors";
import { error } from "@backend/common/errors/handlers/error.handler";
import { GcalError } from "@backend/common/errors/integration/gcal/gcal.errors";
import { SReqBody } from "@backend/common/types/express.types";
import { type SReqBody } from "@backend/common/types/express.types";
import { hasGoogleHeaders } from "@backend/sync/util/sync.util";
import { decodeChannelToken } from "@backend/sync/util/watch.util";

Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/auth/services/auth.utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Credentials } from "google-auth-library";
import GoogleAuthService from "@backend/auth/services/google.auth.service";
import { type Credentials } from "google-auth-library";
import type GoogleAuthService from "@backend/auth/services/google.auth.service";
import { AuthError } from "@backend/common/errors/auth/auth.errors";
import { error } from "@backend/common/errors/handlers/error.handler";

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/auth/services/compass.auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Credentials, TokenPayload } from "google-auth-library";
import { type Credentials, type TokenPayload } from "google-auth-library";
import supertokens from "supertokens-node";
import Session from "supertokens-node/recipe/session";
import { Logger } from "@core/logger/winston.logger";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { GaxiosError } from "gaxios";
import { ObjectId } from "mongodb";
import { faker } from "@faker-js/faker";
import { Schema_User } from "@core/types/user.types";
import { type Schema_User } from "@core/types/user.types";
import { getGcalClient } from "@backend/auth/services/google.auth.service";
import { UserError } from "@backend/common/errors/user/user.errors";
import { findCompassUserBy } from "@backend/user/queries/user.queries";
Expand Down
10 changes: 5 additions & 5 deletions packages/backend/src/auth/services/google.auth.service.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { GaxiosError } from "gaxios";
import { OAuth2Client, TokenPayload } from "google-auth-library";
import { WithId } from "mongodb";
import { OAuth2Client, type TokenPayload } from "google-auth-library";
import { type WithId } from "mongodb";
import { calendar } from "@googleapis/calendar";
import { BaseError } from "@core/errors/errors.base";
import { Status } from "@core/errors/status.codes";
import { Logger } from "@core/logger/winston.logger";
import { UserInfo_Google } from "@core/types/auth.types";
import { gCalendar } from "@core/types/gcal";
import { type UserInfo_Google } from "@core/types/auth.types";
import { type gCalendar } from "@core/types/gcal";
import { StringV4Schema } from "@core/types/type.utils";
import { Schema_User } from "@core/types/user.types";
import { type Schema_User } from "@core/types/user.types";
import { ENV } from "@backend/common/constants/env.constants";
import { AuthError } from "@backend/common/errors/auth/auth.errors";
import { error } from "@backend/common/errors/handlers/error.handler";
Expand Down
2 changes: 1 addition & 1 deletion packages/backend/src/calendar/calendar.routes.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Application } from "express";
import { type Application } from "express";
import { verifySession } from "supertokens-node/recipe/session/framework/express";
import { CommonRoutesConfig } from "@backend/common/common.routes.config";
import calendarController from "./controllers/calendar.controller";
Expand Down
Loading
Loading