Merge pull request #3436 from bluewave-labs/fix/remaining-lint-errors
fix: resolve remaining ESlint errors
This commit is contained in:
5 files changed
+15
-9
No files matched your search
@@ -32,7 +32,9 @@ export default [
|
|||||||
languageOptions: {
|
languageOptions: {
|
||||||
parser: tseslint.parser,
|
parser: tseslint.parser,
|
||||||
parserOptions: {
|
parserOptions: {
|
||||||
projectService: true,
|
projectService: {
|
||||||
|
allowDefaultProject: ["jest.config.ts"],
|
||||||
|
},
|
||||||
tsconfigRootDir: import.meta.dirname,
|
tsconfigRootDir: import.meta.dirname,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
+2
-2
@@ -4,7 +4,7 @@ import cors from "cors";
|
|||||||
import helmet from "helmet";
|
import helmet from "helmet";
|
||||||
import compression from "compression";
|
import compression from "compression";
|
||||||
import cookieParser from "cookie-parser";
|
import cookieParser from "cookie-parser";
|
||||||
import swaggerUi from "swagger-ui-express";
|
import swaggerUi, { type JsonObject } from "swagger-ui-express";
|
||||||
import { handleErrors } from "@/middleware/handleErrors.js";
|
import { handleErrors } from "@/middleware/handleErrors.js";
|
||||||
import { generalApiLimiter } from "@/middleware/rateLimiter.js";
|
import { generalApiLimiter } from "@/middleware/rateLimiter.js";
|
||||||
import { sanitizeBody, sanitizeQuery } from "@/middleware/sanitization.js";
|
import { sanitizeBody, sanitizeQuery } from "@/middleware/sanitization.js";
|
||||||
@@ -24,7 +24,7 @@ export const createApp = ({
|
|||||||
controllers: InitializedControllers;
|
controllers: InitializedControllers;
|
||||||
envSettings: EnvConfig;
|
envSettings: EnvConfig;
|
||||||
frontendPath: string;
|
frontendPath: string;
|
||||||
openApiSpec: any;
|
openApiSpec: JsonObject;
|
||||||
}) => {
|
}) => {
|
||||||
const allowedOrigin = envSettings.clientHost;
|
const allowedOrigin = envSettings.clientHost;
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
|
import type { Application } from "express";
|
||||||
import { createVerifyJWT } from "../middleware/verifyJWT.js";
|
import { createVerifyJWT } from "../middleware/verifyJWT.js";
|
||||||
import { createVerifyStatusPageAccess } from "../middleware/verifyStatusPageAccess.js";
|
import { createVerifyStatusPageAccess } from "../middleware/verifyStatusPageAccess.js";
|
||||||
import { authApiLimiter } from "../middleware/rateLimiter.js";
|
import { authApiLimiter } from "../middleware/rateLimiter.js";
|
||||||
|
import type { InitializedControllers } from "./controllers.js";
|
||||||
|
import type { InitializedServices } from "./services.js";
|
||||||
|
|
||||||
import AuthRoutes from "../routes/authRoute.js";
|
import AuthRoutes from "../routes/authRoute.js";
|
||||||
import InviteRoutes from "../routes/inviteRoute.js";
|
import InviteRoutes from "../routes/inviteRoute.js";
|
||||||
@@ -17,7 +20,7 @@ import NotificationRoutes from "../routes/notificationRoute.js";
|
|||||||
|
|
||||||
import IncidentRoutes from "../routes/incidentRoute.js";
|
import IncidentRoutes from "../routes/incidentRoute.js";
|
||||||
|
|
||||||
export const setupRoutes = (app: any, controllers: Record<string, any>, services: Record<string, any>) => {
|
export const setupRoutes = (app: Application, controllers: InitializedControllers, services: InitializedServices) => {
|
||||||
const verifyJWT = createVerifyJWT(services.settingsService);
|
const verifyJWT = createVerifyJWT(services.settingsService);
|
||||||
const authRoutes = new AuthRoutes(controllers.authController, verifyJWT);
|
const authRoutes = new AuthRoutes(controllers.authController, verifyJWT);
|
||||||
const monitorRoutes = new MonitorRoutes(controllers.monitorController);
|
const monitorRoutes = new MonitorRoutes(controllers.monitorController);
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { updateAppSettingsBodyValidation } from "@/validation/settingsValidation
|
|||||||
import { sendTestEmailBodyValidation } from "@/validation/notificationValidation.js";
|
import { sendTestEmailBodyValidation } from "@/validation/notificationValidation.js";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { IEmailService, ISettingsService } from "@/service/index.js";
|
import { IEmailService, ISettingsService } from "@/service/index.js";
|
||||||
|
import { Settings } from "@/types/settings.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "SettingsController";
|
const SERVICE_NAME = "SettingsController";
|
||||||
|
|
||||||
@@ -26,11 +27,11 @@ class SettingsController implements ISettingsController {
|
|||||||
return SettingsController.SERVICE_NAME;
|
return SettingsController.SERVICE_NAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
buildAppSettings = (dbSettings: any) => {
|
buildAppSettings = (dbSettings: Settings) => {
|
||||||
const sanitizedSettings = { ...dbSettings };
|
const sanitizedSettings: Record<string, unknown> = { ...dbSettings };
|
||||||
delete sanitizedSettings.version;
|
delete sanitizedSettings.version;
|
||||||
delete sanitizedSettings.jwtSecret;
|
delete sanitizedSettings.jwtSecret;
|
||||||
const returnSettings = {
|
const returnSettings: Record<string, unknown | null> = {
|
||||||
pagespeedKeySet: false,
|
pagespeedKeySet: false,
|
||||||
emailPasswordSet: false,
|
emailPasswordSet: false,
|
||||||
settings: null,
|
settings: null,
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { NextFunction, Request, Response } from "express";
|
|||||||
|
|
||||||
import jwt from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
import { AppError } from "@/utils/AppError.js";
|
import { AppError } from "@/utils/AppError.js";
|
||||||
import { Settings } from "@/types/settings.js";
|
import type { ISettingsService } from "@/service/system/settingsService.js";
|
||||||
import type { User } from "@/types/user.js";
|
import type { User } from "@/types/user.js";
|
||||||
|
|
||||||
const SERVICE_NAME = "verifyJWT";
|
const SERVICE_NAME = "verifyJWT";
|
||||||
@@ -12,7 +12,7 @@ const isUser = (payload: unknown): payload is User => {
|
|||||||
return typeof payload === "object" && payload !== null && "id" in payload && "teamId" in payload && "role" in payload;
|
return typeof payload === "object" && payload !== null && "id" in payload && "teamId" in payload && "role" in payload;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const createVerifyJWT = (settingsService: { getSettings: () => Settings }) => {
|
export const createVerifyJWT = (settingsService: ISettingsService) => {
|
||||||
return (req: Request, res: Response, next: NextFunction) => {
|
return (req: Request, res: Response, next: NextFunction) => {
|
||||||
const token = req.headers["authorization"];
|
const token = req.headers["authorization"];
|
||||||
// Make sure a token is provided
|
// Make sure a token is provided
|
||||||
|
|||||||
Reference in new issue
Block a user