From: Jérôme Benoit Date: Wed, 26 Jul 2023 22:55:11 +0000 (+0200) Subject: refactor: silence linter on code duplication X-Git-Tag: v1.2.20~123 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6913d568424300ebfa5765ca55006a4ce0525ac2;p=e-mobility-charging-stations-simulator.git refactor: silence linter on code duplication Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 6f4b4a13..3be6dfd9 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -1110,9 +1110,11 @@ export class ChargingStation { private getNumberOfReservationsOnConnectorZero(): number { let numberOfReservations = 0; - if (this.hasEvses && this.evses.get(0)?.connectors.get(0)?.reservation) { - ++numberOfReservations; - } else if (this.connectors.get(0)?.reservation) { + if ( + // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing + (this.hasEvses && this.evses.get(0)?.connectors.get(0)?.reservation) || + (!this.hasEvses && this.connectors.get(0)?.reservation) + ) { ++numberOfReservations; } return numberOfReservations;