From: Jérôme Benoit Date: Sat, 13 Jan 2024 17:03:19 +0000 (+0100) Subject: refactor: remove unneeded eslint-disable X-Git-Tag: v1.2.32~20 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=3423c8a57047b3da28558538712aca35611c8214;p=e-mobility-charging-stations-simulator.git refactor: remove unneeded eslint-disable Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index aa372812..f0d20739 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -377,14 +377,10 @@ export class AutomaticTransactionGenerator { ) : undefined if (connectorStatus != null) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - connectorStatus.startDate = convertToDate(connectorStatus.startDate)! - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - connectorStatus.lastRunDate = convertToDate(connectorStatus.lastRunDate)! - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - connectorStatus.stopDate = convertToDate(connectorStatus.stopDate)! - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - connectorStatus.stoppedDate = convertToDate(connectorStatus.stoppedDate)! + connectorStatus.startDate = convertToDate(connectorStatus.startDate) + connectorStatus.lastRunDate = convertToDate(connectorStatus.lastRunDate) + connectorStatus.stopDate = convertToDate(connectorStatus.stopDate) + connectorStatus.stoppedDate = convertToDate(connectorStatus.stoppedDate) if ( !this.started && (connectorStatus.start || diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 69e700a3..a61dedd8 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -726,10 +726,9 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { chargingProfile.chargingProfileId } startSchedule property is not a Date instance. Trying to convert it to a Date instance` ) - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion chargingProfile.chargingSchedule.startSchedule = convertToDate( chargingProfile.chargingSchedule.startSchedule - )! + ) } if (chargingProfile.chargingSchedule.duration == null) { logger.debug( @@ -740,7 +739,8 @@ export class OCPP16IncomingRequestService extends OCPPIncomingRequestService { // OCPP specifies that if duration is not defined, it should be infinite chargingProfile.chargingSchedule.duration = differenceInSeconds( maxTime, - chargingProfile.chargingSchedule.startSchedule + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + chargingProfile.chargingSchedule.startSchedule! ) } if ( diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index e567be4f..1ffd6f5e 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -164,12 +164,9 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion chargingStation.getConnectorStatus(connectorId)!.chargingProfiles = [] } - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - cp.chargingSchedule.startSchedule = convertToDate(cp.chargingSchedule.startSchedule)! - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - cp.validFrom = convertToDate(cp.validFrom)! - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - cp.validTo = convertToDate(cp.validTo)! + cp.chargingSchedule.startSchedule = convertToDate(cp.chargingSchedule.startSchedule) + cp.validFrom = convertToDate(cp.validFrom) + cp.validTo = convertToDate(cp.validTo) let cpReplaced = false if (isNotEmptyArray(chargingStation.getConnectorStatus(connectorId)?.chargingProfiles)) { // eslint-disable-next-line @typescript-eslint/no-non-null-assertion