From 6913d568424300ebfa5765ca55006a4ce0525ac2 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 27 Jul 2023 00:55:11 +0200 Subject: [PATCH] refactor: silence linter on code duplication MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/charging-station/ChargingStation.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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; -- 2.34.1