refactor: remove unneeded eslint-disable
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 13 Jan 2024 17:03:19 +0000 (18:03 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 13 Jan 2024 17:03:19 +0000 (18:03 +0100)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts

index aa3728129b74c9f1ca6f4c00d3fd0fa09748dde6..f0d20739b57970477e367a04c560268e42e3e88d 100644 (file)
@@ -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 ||
index 69e700a32803a6ec0eb7df41421f4b8fc6f6f881..a61dedd8edcfebfd6e0b26a17672ae7695f6d7d5 100644 (file)
@@ -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 (
index e567be4f820c394e7b1b9230733f809f38dc3c1e..1ffd6f5efc5af45114a0a311285e0c9aa4e328ce 100644 (file)
@@ -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