diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index 9666f3d75..9d555b566 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -1,5 +1,5 @@ -import Ajv, { type JSONSchemaType, type ValidateFunction } from 'ajv'; -import ajvFormats from 'ajv-formats'; +import _Ajv, { type JSONSchemaType, type ValidateFunction } from 'ajv'; +import _ajvFormats from 'ajv-formats'; import { OCPPConstants } from './OCPPConstants.js'; import { OCPPServiceUtils } from './OCPPServiceUtils.js'; @@ -13,6 +13,9 @@ import type { OCPPVersion, } from '../../types/index.js'; import { logger, setDefaultErrorParams } from '../../utils/index.js'; +type Ajv = _Ajv.default; +const Ajv = _Ajv.default; +const ajvFormats = _ajvFormats.default; const moduleName = 'OCPPIncomingRequestService'; @@ -25,7 +28,6 @@ export abstract class OCPPIncomingRequestService { protected constructor(version: OCPPVersion) { this.version = version; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.ajv = new Ajv({ keywords: ['javaType'], multipleOfPrecision: 2, @@ -118,7 +120,6 @@ export abstract class OCPPIncomingRequestService { schema: JSONSchemaType, ) { if (this.jsonValidateFunctions.has(commandName) === false) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access this.jsonValidateFunctions.set(commandName, this.ajv.compile(schema).bind(this)); } return this.jsonValidateFunctions.get(commandName)!; diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index c772fec1e..8b5f0cc3a 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,5 +1,5 @@ -import Ajv, { type JSONSchemaType, type ValidateFunction } from 'ajv'; -import ajvFormats from 'ajv-formats'; +import _Ajv, { type JSONSchemaType, type ValidateFunction } from 'ajv'; +import _ajvFormats from 'ajv-formats'; import { OCPPConstants } from './OCPPConstants.js'; import type { OCPPResponseService } from './OCPPResponseService.js'; @@ -30,6 +30,9 @@ import { isNullOrUndefined, logger, } from '../../utils/index.js'; +type Ajv = _Ajv.default; +const Ajv = _Ajv.default; +const ajvFormats = _ajvFormats.default; const moduleName = 'OCPPRequestService'; @@ -49,7 +52,6 @@ export abstract class OCPPRequestService { protected constructor(version: OCPPVersion, ocppResponseService: OCPPResponseService) { this.version = version; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.ajv = new Ajv({ keywords: ['javaType'], multipleOfPrecision: 2, @@ -234,7 +236,6 @@ export abstract class OCPPRequestService { if (this.jsonValidateFunctions.has(commandName) === false) { this.jsonValidateFunctions.set( commandName, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access this.ajv.compile(this.jsonSchemas.get(commandName)!).bind(this), ); } @@ -289,11 +290,8 @@ export abstract class OCPPRequestService { ) { this.ocppResponseService.jsonIncomingRequestResponseValidateFunctions.set( commandName, - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call this.ajv - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access .compile(this.ocppResponseService.jsonIncomingRequestResponseSchemas.get(commandName)!) - // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access .bind(this), ); } diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index e386e432a..a80bc2b73 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,5 +1,5 @@ -import Ajv, { type JSONSchemaType, type ValidateFunction } from 'ajv'; -import ajvFormats from 'ajv-formats'; +import _Ajv, { type JSONSchemaType, type ValidateFunction } from 'ajv'; +import _ajvFormats from 'ajv-formats'; import { OCPPServiceUtils } from './OCPPServiceUtils.js'; import type { ChargingStation } from '../../charging-station/index.js'; @@ -11,6 +11,9 @@ import type { RequestCommand, } from '../../types/index.js'; import { logger } from '../../utils/index.js'; +type Ajv = _Ajv.default; +const Ajv = _Ajv.default; +const ajvFormats = _ajvFormats.default; const moduleName = 'OCPPResponseService'; @@ -33,7 +36,6 @@ export abstract class OCPPResponseService { protected constructor(version: OCPPVersion) { this.version = version; - // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment this.ajv = new Ajv({ keywords: ['javaType'], multipleOfPrecision: 2, @@ -102,7 +104,6 @@ export abstract class OCPPResponseService { schema: JSONSchemaType, ) { if (this.jsonRequestValidateFunctions.has(commandName) === false) { - // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access this.jsonRequestValidateFunctions.set(commandName, this.ajv.compile(schema).bind(this)); } return this.jsonRequestValidateFunctions.get(commandName)!;