From 4016559656565a9ff0f998cb93082fd2582e50c7 Mon Sep 17 00:00:00 2001 From: anshumancanrock Date: Wed, 24 Sep 2025 16:35:20 +0530 Subject: [PATCH] fix(satp-hermes): remove eslint-disable comments and add lint script Signed-off-by: anshumancanrock fix lint Signed-off-by: anshumancanrock --- .../src/main/typescript/gateway/besu-satp-gateway.ts | 1 - .../src/main/typescript/gateway/fabric-satp-gateway.ts | 1 - .../src/main/typescript/gateway/plugin-satp-gateway.ts | 7 ++----- .../gateway/repository/knex-local-log-repository.ts | 4 ++-- .../gateway/repository/knex-remote-log-repository.ts | 4 ++-- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/besu-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/besu-satp-gateway.ts index 248b1b494a..a6525aa19c 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/besu-satp-gateway.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/besu-satp-gateway.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { Configuration } from "@hyperledger/cactus-core-api"; import { SessionDataRollbackActionsPerformedEnum } from "../generated/openapi/typescript-axios"; import { diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/fabric-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/fabric-satp-gateway.ts index 05a4233ee1..3f5b5206b6 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/fabric-satp-gateway.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/fabric-satp-gateway.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import { Configuration } from "@hyperledger/cactus-core-api"; import { DefaultApi as FabricApi, diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts index aa68b799a6..150542fa02 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/plugin-satp-gateway.ts @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/explicit-module-boundary-types */ import type { Server } from "http"; import type { Server as SecureServer } from "https"; import { Optional } from "typescript-optional"; @@ -397,8 +396,7 @@ export abstract class PluginSatpGateway return this.objectSigner.sign(msg); } - // eslint-disable-next-line @typescript-eslint/no-explicit-any - verifySignature(obj: any, pubKey: string): boolean { + verifySignature(obj: IRemoteLog, pubKey: string): boolean { const sourceSignature = new Uint8Array(Buffer.from(obj.signature, "hex")); const sourcePubkey = new Uint8Array(Buffer.from(pubKey, "hex")); @@ -1143,8 +1141,7 @@ export abstract class PluginSatpGateway sessionID: string, request: Promise, message: string, - // eslint-disable-next-line @typescript-eslint/no-explicit-any - ): Promise { + ): Promise { const fnTag = `${this.className}#makeRequest()`; const sessionData = this.sessions.get(sessionID); diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-local-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-local-log-repository.ts index 65c07b10de..d0a5505389 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-local-log-repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-local-log-repository.ts @@ -1,13 +1,13 @@ import { ILocalLog } from "../plugin-satp-gateway"; import { ILocalLogRepository } from "./interfaces/repository"; import knex, { Knex } from "knex"; +import * as knexfileConfig from "../../../knex/knexfile"; export class KnexLocalLogRepository implements ILocalLogRepository { readonly database: Knex; public constructor(config: Knex.Config | undefined) { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const configFile = require("../../../knex/knexfile.ts")[ + const configFile = (knexfileConfig as Record)[ process.env.ENVIRONMENT || "development" ]; diff --git a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-remote-log-repository.ts b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-remote-log-repository.ts index 8d064da275..642557bc4b 100644 --- a/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-remote-log-repository.ts +++ b/packages/cactus-plugin-satp-hermes/src/main/typescript/gateway/repository/knex-remote-log-repository.ts @@ -1,6 +1,7 @@ import { IRemoteLogRepository } from "./interfaces/repository"; import { IRemoteLog } from "../plugin-satp-gateway"; import knex, { Knex } from "knex"; +import * as knexfileRemoteConfig from "../../../knex/knexfile-remote"; export class KnexRemoteLogRepository implements IRemoteLogRepository { readonly database: Knex; @@ -9,8 +10,7 @@ export class KnexRemoteLogRepository implements IRemoteLogRepository { // so that both gateways can have access to the same database // simulating a remote log storage public constructor(config: Knex.Config | undefined) { - // eslint-disable-next-line @typescript-eslint/no-var-requires - const configFile = require("../../../knex/knexfile-remote.ts")[ + const configFile = (knexfileRemoteConfig as Record)[ process.env.ENVIRONMENT || "development" ];