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