From: Jérôme Benoit Date: Sat, 2 Dec 2023 19:50:18 +0000 (+0100) Subject: build(ci): fix linter errors X-Git-Tag: v1.2.29~9 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=f1e3871b2a063e5ee0fddbf597df76d02f81e332;p=e-mobility-charging-stations-simulator.git build(ci): fix linter errors Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index f31ee7f0..15bd2c1f 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -6,6 +6,7 @@ import { fileURLToPath } from 'node:url'; import chalk from 'chalk'; import { + type Interval, addDays, addSeconds, addWeeks, diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 2b34342e..a1e4f486 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -6,7 +6,14 @@ import { URL, fileURLToPath } from 'node:url'; import type { JSONSchemaType } from 'ajv'; import { Client, type FTPResponse } from 'basic-ftp'; -import { addSeconds, differenceInSeconds, isDate, maxTime, secondsToMilliseconds } from 'date-fns'; +import { + type Interval, + addSeconds, + differenceInSeconds, + isDate, + maxTime, + secondsToMilliseconds, +} from 'date-fns'; import { create } from 'tar'; import { OCPP16Constants } from './OCPP16Constants'; diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index 197fb6a2..b194e08e 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -2,6 +2,7 @@ import type { JSONSchemaType } from 'ajv'; import { + type Interval, addSeconds, areIntervalsOverlapping, differenceInSeconds, diff --git a/src/utils/Utils.ts b/src/utils/Utils.ts index c37f48cf..d3bee6c6 100644 --- a/src/utils/Utils.ts +++ b/src/utils/Utils.ts @@ -70,7 +70,7 @@ export const isValidTime = (date: unknown): boolean => { if (typeof date === 'number') { return !isNaN(date); } else if (isDate(date)) { - return !isNaN((date as Date).getTime()); + return !isNaN(date.getTime()); } return false; }; @@ -80,12 +80,12 @@ export const convertToDate = (value: Date | string | number | undefined): Date | return value as undefined; } if (isDate(value)) { - return value as Date; + return value; } if (isString(value) || typeof value === 'number') { - const valueToDate = new Date(value as string | number); + const valueToDate = new Date(value!); if (isNaN(valueToDate.getTime())) { - throw new Error(`Cannot convert to date: '${value as string | number}'`); + throw new Error(`Cannot convert to date: '${value!}'`); } return valueToDate; }