From: Jérôme Benoit Date: Sat, 27 Aug 2022 12:00:56 +0000 (+0200) Subject: Refine TS and linter configuration X-Git-Tag: v1.1.68~22 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=6c1761d470507ea23d186be61b94ca7375c5144a;p=e-mobility-charging-stations-simulator.git Refine TS and linter configuration Signed-off-by: Jérôme Benoit --- diff --git a/.vscode/extensions.json b/.vscode/extensions.json index e2e32d61..a7ac4de4 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -8,6 +8,7 @@ "EditorConfig.EditorConfig", "ms-azuretools.vscode-docker", "streetsidesoftware.code-spell-checker", - "Vue.volar" + "Vue.volar", + "Vue.vscode-typescript-vue-plugin" ] } diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 56c97eee..8869a775 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -1,12 +1,12 @@ // Partial Copyright Jerome Benoit. 2021. All Rights Reserved. import PerformanceStatistics from '../performance/PerformanceStatistics'; -import { +import type { AutomaticTransactionGeneratorConfiguration, Status, } from '../types/AutomaticTransactionGenerator'; import { MeterValuesRequest, RequestCommand } from '../types/ocpp/Requests'; -import { MeterValuesResponse } from '../types/ocpp/Responses'; +import type { MeterValuesResponse } from '../types/ocpp/Responses'; import { AuthorizationStatus, AuthorizeRequest, diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 9fc759ff..1fdb9eae 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -8,7 +8,7 @@ import chalk from 'chalk'; import { version } from '../../package.json'; import BaseError from '../exception/BaseError'; -import { Storage } from '../performance/storage/Storage'; +import type { Storage } from '../performance/storage/Storage'; import { StorageFactory } from '../performance/storage/StorageFactory'; import { ChargingStationData, @@ -17,15 +17,15 @@ import { ChargingStationWorkerMessageData, ChargingStationWorkerMessageEvents, } from '../types/ChargingStationWorker'; -import { StationTemplateUrl } from '../types/ConfigurationData'; -import Statistics from '../types/Statistics'; +import type { StationTemplateUrl } from '../types/ConfigurationData'; +import type Statistics from '../types/Statistics'; import Configuration from '../utils/Configuration'; import logger from '../utils/Logger'; import Utils from '../utils/Utils'; -import WorkerAbstract from '../worker/WorkerAbstract'; +import type WorkerAbstract from '../worker/WorkerAbstract'; import WorkerFactory from '../worker/WorkerFactory'; import { ChargingStationUtils } from './ChargingStationUtils'; -import { AbstractUIServer } from './ui-server/AbstractUIServer'; +import type { AbstractUIServer } from './ui-server/AbstractUIServer'; import { UIServiceUtils } from './ui-server/ui-services/UIServiceUtils'; import UIServerFactory from './ui-server/UIServerFactory'; diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index f74cf4bd..c5b89152 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -11,19 +11,19 @@ import WebSocket, { Data, RawData } from 'ws'; import BaseError from '../exception/BaseError'; import OCPPError from '../exception/OCPPError'; import PerformanceStatistics from '../performance/PerformanceStatistics'; -import { AutomaticTransactionGeneratorConfiguration } from '../types/AutomaticTransactionGenerator'; -import ChargingStationConfiguration from '../types/ChargingStationConfiguration'; -import ChargingStationInfo from '../types/ChargingStationInfo'; -import ChargingStationOcppConfiguration from '../types/ChargingStationOcppConfiguration'; +import type { AutomaticTransactionGeneratorConfiguration } from '../types/AutomaticTransactionGenerator'; +import type ChargingStationConfiguration from '../types/ChargingStationConfiguration'; +import type ChargingStationInfo from '../types/ChargingStationInfo'; +import type ChargingStationOcppConfiguration from '../types/ChargingStationOcppConfiguration'; import ChargingStationTemplate, { CurrentType, PowerUnits, WsOptions, } from '../types/ChargingStationTemplate'; import { SupervisionUrlDistribution } from '../types/ConfigurationData'; -import { ConnectorStatus } from '../types/ConnectorStatus'; +import type { ConnectorStatus } from '../types/ConnectorStatus'; import { FileType } from '../types/FileType'; -import { JsonType } from '../types/JsonType'; +import type { JsonType } from '../types/JsonType'; import { ChargePointErrorCode } from '../types/ocpp/ChargePointErrorCode'; import { ChargePointStatus } from '../types/ocpp/ChargePointStatus'; import { ChargingProfile, ChargingRateUnitType } from '../types/ocpp/ChargingProfile'; @@ -79,8 +79,8 @@ import OCPP16IncomingRequestService from './ocpp/1.6/OCPP16IncomingRequestServic import OCPP16RequestService from './ocpp/1.6/OCPP16RequestService'; import OCPP16ResponseService from './ocpp/1.6/OCPP16ResponseService'; import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils'; -import OCPPIncomingRequestService from './ocpp/OCPPIncomingRequestService'; -import OCPPRequestService from './ocpp/OCPPRequestService'; +import type OCPPIncomingRequestService from './ocpp/OCPPIncomingRequestService'; +import type OCPPRequestService from './ocpp/OCPPRequestService'; import SharedLRUCache from './SharedLRUCache'; export default class ChargingStation { diff --git a/src/charging-station/ChargingStationConfigurationUtils.ts b/src/charging-station/ChargingStationConfigurationUtils.ts index 9a37190b..004b95fc 100644 --- a/src/charging-station/ChargingStationConfigurationUtils.ts +++ b/src/charging-station/ChargingStationConfigurationUtils.ts @@ -1,5 +1,5 @@ -import { ConfigurationKey } from '../types/ChargingStationOcppConfiguration'; -import { StandardParametersKey } from '../types/ocpp/Configuration'; +import type { ConfigurationKey } from '../types/ChargingStationOcppConfiguration'; +import type { StandardParametersKey } from '../types/ocpp/Configuration'; import logger from '../utils/Logger'; import type ChargingStation from './ChargingStation'; diff --git a/src/charging-station/ChargingStationUtils.ts b/src/charging-station/ChargingStationUtils.ts index 38dc60c3..645fbd95 100644 --- a/src/charging-station/ChargingStationUtils.ts +++ b/src/charging-station/ChargingStationUtils.ts @@ -5,15 +5,15 @@ import { fileURLToPath } from 'url'; import moment from 'moment'; import BaseError from '../exception/BaseError'; -import ChargingStationInfo from '../types/ChargingStationInfo'; +import type ChargingStationInfo from '../types/ChargingStationInfo'; import ChargingStationTemplate, { AmpereUnits, CurrentType, Voltage, } from '../types/ChargingStationTemplate'; -import { SampledValueTemplate } from '../types/MeasurandPerPhaseSampledValueTemplates'; +import type { SampledValueTemplate } from '../types/MeasurandPerPhaseSampledValueTemplates'; import { ChargingProfileKindType, RecurrencyKindType } from '../types/ocpp/1.6/ChargingProfile'; -import { ChargingProfile, ChargingSchedulePeriod } from '../types/ocpp/ChargingProfile'; +import type { ChargingProfile, ChargingSchedulePeriod } from '../types/ocpp/ChargingProfile'; import { StandardParametersKey } from '../types/ocpp/Configuration'; import { MeterValueMeasurand, MeterValuePhase } from '../types/ocpp/MeterValues'; import { diff --git a/src/charging-station/MessageChannelUtils.ts b/src/charging-station/MessageChannelUtils.ts index e2a7b0b4..3084a388 100644 --- a/src/charging-station/MessageChannelUtils.ts +++ b/src/charging-station/MessageChannelUtils.ts @@ -3,7 +3,7 @@ import { ChargingStationWorkerMessage, ChargingStationWorkerMessageEvents, } from '../types/ChargingStationWorker'; -import Statistics from '../types/Statistics'; +import type Statistics from '../types/Statistics'; import type ChargingStation from './ChargingStation'; export class MessageChannelUtils { diff --git a/src/charging-station/SharedLRUCache.ts b/src/charging-station/SharedLRUCache.ts index a40de802..01e18734 100644 --- a/src/charging-station/SharedLRUCache.ts +++ b/src/charging-station/SharedLRUCache.ts @@ -1,7 +1,7 @@ import LRUCache from 'mnemonist/lru-map-with-delete'; -import ChargingStationConfiguration from '../types/ChargingStationConfiguration'; -import ChargingStationTemplate from '../types/ChargingStationTemplate'; +import type ChargingStationConfiguration from '../types/ChargingStationConfiguration'; +import type ChargingStationTemplate from '../types/ChargingStationTemplate'; import Utils from '../utils/Utils'; enum CacheType { diff --git a/src/charging-station/UIServiceWorkerBroadcastChannel.ts b/src/charging-station/UIServiceWorkerBroadcastChannel.ts index 3916f626..5397e690 100644 --- a/src/charging-station/UIServiceWorkerBroadcastChannel.ts +++ b/src/charging-station/UIServiceWorkerBroadcastChannel.ts @@ -1,4 +1,4 @@ -import { BroadcastChannelResponse, MessageEvent } from '../types/WorkerBroadcastChannel'; +import type { BroadcastChannelResponse, MessageEvent } from '../types/WorkerBroadcastChannel'; import logger from '../utils/Logger'; import type AbstractUIService from './ui-server/ui-services/AbstractUIService'; import WorkerBroadcastChannel from './WorkerBroadcastChannel'; diff --git a/src/charging-station/WorkerBroadcastChannel.ts b/src/charging-station/WorkerBroadcastChannel.ts index ea89dc3d..dba83cbb 100644 --- a/src/charging-station/WorkerBroadcastChannel.ts +++ b/src/charging-station/WorkerBroadcastChannel.ts @@ -1,7 +1,7 @@ import { BroadcastChannel } from 'worker_threads'; import BaseError from '../exception/BaseError'; -import { +import type { BroadcastChannelRequest, BroadcastChannelResponse, MessageEvent, diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 298d6af2..c870fbc1 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -4,12 +4,12 @@ import fs from 'fs'; import path from 'path'; import { URL, fileURLToPath } from 'url'; -import { JSONSchemaType } from 'ajv'; +import type { JSONSchemaType } from 'ajv'; import { Client, FTPResponse } from 'basic-ftp'; import tar from 'tar'; import OCPPError from '../../../exception/OCPPError'; -import { JsonObject, JsonType } from '../../../types/JsonType'; +import type { JsonObject, JsonType } from '../../../types/JsonType'; import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode'; import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus'; import { @@ -21,7 +21,7 @@ import { OCPP16SupportedFeatureProfiles, } from '../../../types/ocpp/1.6/Configuration'; import { OCPP16DiagnosticsStatus } from '../../../types/ocpp/1.6/DiagnosticsStatus'; -import { +import type { OCPP16MeterValuesRequest, OCPP16MeterValuesResponse, } from '../../../types/ocpp/1.6/MeterValues'; @@ -47,7 +47,7 @@ import { SetChargingProfileRequest, UnlockConnectorRequest, } from '../../../types/ocpp/1.6/Requests'; -import { +import type { ChangeAvailabilityResponse, ChangeConfigurationResponse, ClearChargingProfileResponse, @@ -71,10 +71,10 @@ import { OCPP16StopTransactionRequest, OCPP16StopTransactionResponse, } from '../../../types/ocpp/1.6/Transaction'; -import { OCPPConfigurationKey } from '../../../types/ocpp/Configuration'; +import type { OCPPConfigurationKey } from '../../../types/ocpp/Configuration'; import { ErrorType } from '../../../types/ocpp/ErrorType'; -import { IncomingRequestHandler } from '../../../types/ocpp/Requests'; -import { DefaultResponse } from '../../../types/ocpp/Responses'; +import type { IncomingRequestHandler } from '../../../types/ocpp/Requests'; +import type { DefaultResponse } from '../../../types/ocpp/Responses'; import Constants from '../../../utils/Constants'; import logger from '../../../utils/Logger'; import Utils from '../../../utils/Utils'; diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index a0f09bb8..4fa0190e 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -4,11 +4,11 @@ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; -import { JSONSchemaType } from 'ajv'; +import type { JSONSchemaType } from 'ajv'; import OCPPError from '../../../exception/OCPPError'; -import { JsonObject, JsonType } from '../../../types/JsonType'; -import { OCPP16MeterValuesRequest } from '../../../types/ocpp/1.6/MeterValues'; +import type { JsonObject, JsonType } from '../../../types/JsonType'; +import type { OCPP16MeterValuesRequest } from '../../../types/ocpp/1.6/MeterValues'; import { DiagnosticsStatusNotificationRequest, OCPP16BootNotificationRequest, @@ -16,13 +16,13 @@ import { OCPP16RequestCommand, OCPP16StatusNotificationRequest, } from '../../../types/ocpp/1.6/Requests'; -import { +import type { OCPP16AuthorizeRequest, OCPP16StartTransactionRequest, OCPP16StopTransactionRequest, } from '../../../types/ocpp/1.6/Transaction'; import { ErrorType } from '../../../types/ocpp/ErrorType'; -import { RequestParams } from '../../../types/ocpp/Requests'; +import type { RequestParams } from '../../../types/ocpp/Requests'; import Constants from '../../../utils/Constants'; import logger from '../../../utils/Logger'; import Utils from '../../../utils/Utils'; @@ -144,14 +144,14 @@ export default class OCPP16RequestService extends OCPPRequestService { this.validatePayload.bind(this); } - public async requestHandler( + public async requestHandler( chargingStation: ChargingStation, commandName: OCPP16RequestCommand, commandParams?: JsonType, params?: RequestParams - ): Promise { + ): Promise { if (ChargingStationUtils.isRequestCommandSupported(commandName, chargingStation)) { - const requestPayload = this.buildRequestPayload( + const requestPayload = this.buildRequestPayload( chargingStation, commandName, commandParams @@ -163,7 +163,7 @@ export default class OCPP16RequestService extends OCPPRequestService { requestPayload, commandName, params - )) as unknown as Response; + )) as unknown as ResponseType; } throw new OCPPError( ErrorType.NOT_SUPPORTED, diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index cf7e729e..70ae3c25 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -4,14 +4,14 @@ import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; -import { JSONSchemaType } from 'ajv'; +import type { JSONSchemaType } from 'ajv'; import OCPPError from '../../../exception/OCPPError'; -import { JsonObject, JsonType } from '../../../types/JsonType'; +import type { JsonObject, JsonType } from '../../../types/JsonType'; import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode'; import { OCPP16ChargePointStatus } from '../../../types/ocpp/1.6/ChargePointStatus'; import { OCPP16StandardParametersKey } from '../../../types/ocpp/1.6/Configuration'; -import { +import type { OCPP16MeterValuesRequest, OCPP16MeterValuesResponse, } from '../../../types/ocpp/1.6/MeterValues'; @@ -37,7 +37,7 @@ import { OCPP16StopTransactionResponse, } from '../../../types/ocpp/1.6/Transaction'; import { ErrorType } from '../../../types/ocpp/ErrorType'; -import { ResponseHandler } from '../../../types/ocpp/Responses'; +import type { ResponseHandler } from '../../../types/ocpp/Responses'; import logger from '../../../utils/Logger'; import Utils from '../../../utils/Utils'; import type ChargingStation from '../../ChargingStation'; diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index 2a154e7b..0915aa46 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -2,10 +2,10 @@ import OCPPError from '../../../exception/OCPPError'; import { CurrentType, Voltage } from '../../../types/ChargingStationTemplate'; -import MeasurandPerPhaseSampledValueTemplates, { - SampledValueTemplate, -} from '../../../types/MeasurandPerPhaseSampledValueTemplates'; -import MeasurandValues from '../../../types/MeasurandValues'; +import type MeasurandPerPhaseSampledValueTemplates from '../../../types/MeasurandPerPhaseSampledValueTemplates'; +// eslint-disable-next-line no-duplicate-imports +import type { SampledValueTemplate } from '../../../types/MeasurandPerPhaseSampledValueTemplates'; +import type MeasurandValues from '../../../types/MeasurandValues'; import { OCPP16StandardParametersKey, OCPP16SupportedFeatureProfiles, diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index 0e69fcfc..4b68b8a8 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -1,11 +1,11 @@ -import { JSONSchemaType } from 'ajv'; +import type { JSONSchemaType } from 'ajv'; import Ajv from 'ajv-draft-04'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; -import { HandleErrorParams } from '../../types/Error'; -import { JsonType } from '../../types/JsonType'; -import { IncomingRequestCommand } from '../../types/ocpp/Requests'; +import type { HandleErrorParams } from '../../types/Error'; +import type { JsonType } from '../../types/JsonType'; +import type { IncomingRequestCommand } from '../../types/ocpp/Requests'; import logger from '../../utils/Logger'; import type ChargingStation from '../ChargingStation'; import { OCPPServiceUtils } from './OCPPServiceUtils'; diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index 236508bb..c3311b85 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,12 +1,12 @@ -import { JSONSchemaType } from 'ajv'; +import type { JSONSchemaType } from 'ajv'; import Ajv from 'ajv-draft-04'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; import PerformanceStatistics from '../../performance/PerformanceStatistics'; -import { EmptyObject } from '../../types/EmptyObject'; -import { HandleErrorParams } from '../../types/Error'; -import { JsonObject, JsonType } from '../../types/JsonType'; +import type { EmptyObject } from '../../types/EmptyObject'; +import type { HandleErrorParams } from '../../types/Error'; +import type { JsonObject, JsonType } from '../../types/JsonType'; import { ErrorType } from '../../types/ocpp/ErrorType'; import { MessageType } from '../../types/ocpp/MessageType'; import { @@ -16,7 +16,7 @@ import { RequestParams, ResponseType, } from '../../types/ocpp/Requests'; -import { ErrorResponse, Response } from '../../types/ocpp/Responses'; +import type { ErrorResponse, Response } from '../../types/ocpp/Responses'; import Constants from '../../utils/Constants'; import logger from '../../utils/Logger'; import Utils from '../../utils/Utils'; @@ -368,10 +368,10 @@ export default abstract class OCPPRequestService { } // eslint-disable-next-line @typescript-eslint/no-unused-vars - public abstract requestHandler( + public abstract requestHandler( chargingStation: ChargingStation, commandName: RequestCommand, commandParams?: JsonType, params?: RequestParams - ): Promise; + ): Promise; } diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index 94a943d7..3faa4351 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,10 +1,10 @@ -import { JSONSchemaType } from 'ajv'; +import type { JSONSchemaType } from 'ajv'; import Ajv from 'ajv-draft-04'; import ajvFormats from 'ajv-formats'; import OCPPError from '../../exception/OCPPError'; -import { JsonType } from '../../types/JsonType'; -import { RequestCommand } from '../../types/ocpp/Requests'; +import type { JsonType } from '../../types/JsonType'; +import type { RequestCommand } from '../../types/ocpp/Requests'; import logger from '../../utils/Logger'; import type ChargingStation from '../ChargingStation'; import { OCPPServiceUtils } from './OCPPServiceUtils'; diff --git a/src/charging-station/ocpp/OCPPServiceUtils.ts b/src/charging-station/ocpp/OCPPServiceUtils.ts index 39d738af..96b34218 100644 --- a/src/charging-station/ocpp/OCPPServiceUtils.ts +++ b/src/charging-station/ocpp/OCPPServiceUtils.ts @@ -1,4 +1,4 @@ -import { DefinedError, ErrorObject } from 'ajv'; +import type { DefinedError, ErrorObject } from 'ajv'; import { ErrorType } from '../../types/ocpp/ErrorType'; diff --git a/src/charging-station/ui-server/AbstractUIServer.ts b/src/charging-station/ui-server/AbstractUIServer.ts index b8e7c46c..902b6bd5 100644 --- a/src/charging-station/ui-server/AbstractUIServer.ts +++ b/src/charging-station/ui-server/AbstractUIServer.ts @@ -1,9 +1,9 @@ -import { Server as HttpServer } from 'http'; +import type { Server as HttpServer } from 'http'; -import WebSocket from 'ws'; +import type WebSocket from 'ws'; -import { ChargingStationData } from '../../types/ChargingStationWorker'; -import { +import type { ChargingStationData } from '../../types/ChargingStationWorker'; +import type { ProcedureName, ProtocolRequest, ProtocolResponse, diff --git a/src/charging-station/ui-server/UIHttpServer.ts b/src/charging-station/ui-server/UIHttpServer.ts index 6fb8a6ad..dcf4cbc0 100644 --- a/src/charging-station/ui-server/UIHttpServer.ts +++ b/src/charging-station/ui-server/UIHttpServer.ts @@ -3,7 +3,7 @@ import { IncomingMessage, RequestListener, Server, ServerResponse } from 'http'; import { StatusCodes } from 'http-status-codes'; import BaseError from '../../exception/BaseError'; -import { ServerOptions } from '../../types/ConfigurationData'; +import type { ServerOptions } from '../../types/ConfigurationData'; import { ProcedureName, Protocol, diff --git a/src/charging-station/ui-server/UIServerFactory.ts b/src/charging-station/ui-server/UIServerFactory.ts index 90f61c7a..bbbb66b9 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -1,9 +1,9 @@ import chalk from 'chalk'; -import { ServerOptions } from '../../types/ConfigurationData'; +import type { ServerOptions } from '../../types/ConfigurationData'; import { ApplicationProtocol } from '../../types/UIProtocol'; import Configuration from '../../utils/Configuration'; -import { AbstractUIServer } from './AbstractUIServer'; +import type { AbstractUIServer } from './AbstractUIServer'; import { UIServiceUtils } from './ui-services/UIServiceUtils'; import UIHttpServer from './UIHttpServer'; import UIWebSocketServer from './UIWebSocketServer'; diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index be2961c5..e928f9ff 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -1,8 +1,8 @@ -import { IncomingMessage } from 'http'; +import type { IncomingMessage } from 'http'; import WebSocket from 'ws'; -import { ServerOptions } from '../../types/ConfigurationData'; +import type { ServerOptions } from '../../types/ConfigurationData'; import { Protocol, ProtocolVersion } from '../../types/UIProtocol'; import Configuration from '../../utils/Configuration'; import logger from '../../utils/Logger'; diff --git a/src/charging-station/ui-server/ui-services/AbstractUIService.ts b/src/charging-station/ui-server/ui-services/AbstractUIService.ts index 2c541cde..e72af5c0 100644 --- a/src/charging-station/ui-server/ui-services/AbstractUIService.ts +++ b/src/charging-station/ui-server/ui-services/AbstractUIService.ts @@ -1,8 +1,8 @@ -import { RawData } from 'ws'; +import type { RawData } from 'ws'; import BaseError from '../../../exception/BaseError'; import { Bootstrap } from '../../../internal'; -import { JsonType } from '../../../types/JsonType'; +import type { JsonType } from '../../../types/JsonType'; import { ProcedureName, ProtocolRequest, diff --git a/src/charging-station/ui-server/ui-services/UIService001.ts b/src/charging-station/ui-server/ui-services/UIService001.ts index 5061ed78..11925ee4 100644 --- a/src/charging-station/ui-server/ui-services/UIService001.ts +++ b/src/charging-station/ui-server/ui-services/UIService001.ts @@ -8,7 +8,7 @@ import { BroadcastChannelProcedureName, BroadcastChannelRequestPayload, } from '../../../types/WorkerBroadcastChannel'; -import { AbstractUIServer } from '../AbstractUIServer'; +import type { AbstractUIServer } from '../AbstractUIServer'; import AbstractUIService from './AbstractUIService'; export default class UIService001 extends AbstractUIService { diff --git a/src/charging-station/ui-server/ui-services/UIServiceFactory.ts b/src/charging-station/ui-server/ui-services/UIServiceFactory.ts index 8fb55e04..b0dd2f07 100644 --- a/src/charging-station/ui-server/ui-services/UIServiceFactory.ts +++ b/src/charging-station/ui-server/ui-services/UIServiceFactory.ts @@ -1,6 +1,6 @@ import { ProtocolVersion } from '../../../types/UIProtocol'; -import { AbstractUIServer } from '../AbstractUIServer'; -import AbstractUIService from './AbstractUIService'; +import type { AbstractUIServer } from '../AbstractUIServer'; +import type AbstractUIService from './AbstractUIService'; import UIService001 from './UIService001'; export default class UIServiceFactory { diff --git a/src/charging-station/ui-server/ui-services/UIServiceUtils.ts b/src/charging-station/ui-server/ui-services/UIServiceUtils.ts index 06db5a47..a824adaf 100644 --- a/src/charging-station/ui-server/ui-services/UIServiceUtils.ts +++ b/src/charging-station/ui-server/ui-services/UIServiceUtils.ts @@ -1,4 +1,4 @@ -import { IncomingMessage } from 'http'; +import type { IncomingMessage } from 'http'; import { Protocol, ProtocolVersion } from '../../../types/UIProtocol'; import logger from '../../../utils/Logger'; diff --git a/src/exception/OCPPError.ts b/src/exception/OCPPError.ts index 563575a3..90817649 100644 --- a/src/exception/OCPPError.ts +++ b/src/exception/OCPPError.ts @@ -1,8 +1,8 @@ // Partial Copyright Jerome Benoit. 2021. All Rights Reserved. -import { JsonType } from '../types/JsonType'; +import type { JsonType } from '../types/JsonType'; import { ErrorType } from '../types/ocpp/ErrorType'; -import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; +import type { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; import BaseError from './BaseError'; export default class OCPPError extends BaseError { diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index c41b2d59..6a5b454f 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -1,13 +1,15 @@ // Partial Copyright Jerome Benoit. 2021. All Rights Reserved. import { PerformanceEntry, PerformanceObserver, performance } from 'perf_hooks'; -import { URL } from 'url'; +import type { URL } from 'url'; import { parentPort } from 'worker_threads'; import { MessageChannelUtils } from '../charging-station/MessageChannelUtils'; import { MessageType } from '../types/ocpp/MessageType'; -import { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; -import Statistics, { StatisticsData, TimeSeries } from '../types/Statistics'; +import type { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; +import type Statistics from '../types/Statistics'; +// eslint-disable-next-line no-duplicate-imports +import type { StatisticsData, TimeSeries } from '../types/Statistics'; import { CircularArray, DEFAULT_CIRCULAR_ARRAY_SIZE } from '../utils/CircularArray'; import Configuration from '../utils/Configuration'; import logger from '../utils/Logger'; diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index bc28a6cb..d1c294d8 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -5,7 +5,7 @@ import fs from 'fs'; import lockfile from 'proper-lockfile'; import { FileType } from '../../types/FileType'; -import Statistics from '../../types/Statistics'; +import type Statistics from '../../types/Statistics'; import FileUtils from '../../utils/FileUtils'; import { Storage } from './Storage'; diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index df96d6a6..44be7491 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -5,7 +5,7 @@ import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; import { PerformanceData } from '../../types/orm/entities/PerformanceData'; import { PerformanceRecord } from '../../types/orm/entities/PerformanceRecord'; -import Statistics from '../../types/Statistics'; +import type Statistics from '../../types/Statistics'; import { MikroORMDBType, StorageType } from '../../types/Storage'; import Constants from '../../utils/Constants'; import { Storage } from './Storage'; diff --git a/src/performance/storage/MongoDBStorage.ts b/src/performance/storage/MongoDBStorage.ts index d941d7c1..f10481a0 100644 --- a/src/performance/storage/MongoDBStorage.ts +++ b/src/performance/storage/MongoDBStorage.ts @@ -2,7 +2,7 @@ import { MongoClient } from 'mongodb'; -import Statistics from '../../types/Statistics'; +import type Statistics from '../../types/Statistics'; import { StorageType } from '../../types/Storage'; import Constants from '../../utils/Constants'; import { Storage } from './Storage'; diff --git a/src/performance/storage/Storage.ts b/src/performance/storage/Storage.ts index 96188263..d85d8c41 100644 --- a/src/performance/storage/Storage.ts +++ b/src/performance/storage/Storage.ts @@ -2,9 +2,9 @@ import { URL } from 'url'; -import { EmptyObject } from '../../types/EmptyObject'; -import { HandleErrorParams } from '../../types/Error'; -import Statistics from '../../types/Statistics'; +import type { EmptyObject } from '../../types/EmptyObject'; +import type { HandleErrorParams } from '../../types/Error'; +import type Statistics from '../../types/Statistics'; import { DBName, StorageType } from '../../types/Storage'; import logger from '../../utils/Logger'; import Utils from '../../utils/Utils'; diff --git a/src/performance/storage/StorageFactory.ts b/src/performance/storage/StorageFactory.ts index b4c19d58..b0f9da58 100644 --- a/src/performance/storage/StorageFactory.ts +++ b/src/performance/storage/StorageFactory.ts @@ -4,7 +4,7 @@ import { StorageType } from '../../types/Storage'; import { JsonFileStorage } from './JsonFileStorage'; import { MikroOrmStorage } from './MikroOrmStorage'; import { MongoDBStorage } from './MongoDBStorage'; -import { Storage } from './Storage'; +import type { Storage } from './Storage'; export class StorageFactory { private constructor() { diff --git a/src/types/ChargingStationConfiguration.ts b/src/types/ChargingStationConfiguration.ts index d1346306..b81f7675 100644 --- a/src/types/ChargingStationConfiguration.ts +++ b/src/types/ChargingStationConfiguration.ts @@ -1,5 +1,5 @@ -import { ChargingStationInfoConfiguration } from './ChargingStationInfo'; -import ChargingStationOcppConfiguration from './ChargingStationOcppConfiguration'; +import type { ChargingStationInfoConfiguration } from './ChargingStationInfo'; +import type ChargingStationOcppConfiguration from './ChargingStationOcppConfiguration'; export default interface ChargingStationConfiguration extends ChargingStationInfoConfiguration, diff --git a/src/types/ChargingStationInfo.ts b/src/types/ChargingStationInfo.ts index 2baa72ef..4f9697a6 100644 --- a/src/types/ChargingStationInfo.ts +++ b/src/types/ChargingStationInfo.ts @@ -1,4 +1,4 @@ -import ChargingStationTemplate from './ChargingStationTemplate'; +import type ChargingStationTemplate from './ChargingStationTemplate'; export default interface ChargingStationInfo extends Omit< diff --git a/src/types/ChargingStationOcppConfiguration.ts b/src/types/ChargingStationOcppConfiguration.ts index a1da931f..b6d9ec92 100644 --- a/src/types/ChargingStationOcppConfiguration.ts +++ b/src/types/ChargingStationOcppConfiguration.ts @@ -1,4 +1,4 @@ -import { OCPPConfigurationKey } from './ocpp/Configuration'; +import type { OCPPConfigurationKey } from './ocpp/Configuration'; export interface ConfigurationKey extends OCPPConfigurationKey { visible?: boolean; diff --git a/src/types/ChargingStationTemplate.ts b/src/types/ChargingStationTemplate.ts index 71d84bc8..9251909c 100644 --- a/src/types/ChargingStationTemplate.ts +++ b/src/types/ChargingStationTemplate.ts @@ -1,13 +1,13 @@ -import { ClientRequestArgs } from 'http'; +import type { ClientRequestArgs } from 'http'; -import { ClientOptions } from 'ws'; +import type { ClientOptions } from 'ws'; -import { AutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator'; -import ChargingStationOcppConfiguration from './ChargingStationOcppConfiguration'; -import { ConnectorStatus } from './ConnectorStatus'; -import { OCPPProtocol } from './ocpp/OCPPProtocol'; -import { OCPPVersion } from './ocpp/OCPPVersion'; -import { IncomingRequestCommand, RequestCommand } from './ocpp/Requests'; +import type { AutomaticTransactionGeneratorConfiguration } from './AutomaticTransactionGenerator'; +import type ChargingStationOcppConfiguration from './ChargingStationOcppConfiguration'; +import type { ConnectorStatus } from './ConnectorStatus'; +import type { OCPPProtocol } from './ocpp/OCPPProtocol'; +import type { OCPPVersion } from './ocpp/OCPPVersion'; +import type { IncomingRequestCommand, RequestCommand } from './ocpp/Requests'; export enum CurrentType { AC = 'AC', diff --git a/src/types/ChargingStationWorker.ts b/src/types/ChargingStationWorker.ts index fe4bbc30..d3ba12c7 100644 --- a/src/types/ChargingStationWorker.ts +++ b/src/types/ChargingStationWorker.ts @@ -1,8 +1,8 @@ -import ChargingStationInfo from './ChargingStationInfo'; -import { ConnectorStatus } from './ConnectorStatus'; -import { JsonObject } from './JsonType'; -import { BootNotificationResponse } from './ocpp/Responses'; -import Statistics from './Statistics'; +import type ChargingStationInfo from './ChargingStationInfo'; +import type { ConnectorStatus } from './ConnectorStatus'; +import type { JsonObject } from './JsonType'; +import type { BootNotificationResponse } from './ocpp/Responses'; +import type Statistics from './Statistics'; import { WorkerData, WorkerMessage, WorkerMessageEvents } from './Worker'; export interface ChargingStationWorkerOptions extends JsonObject { diff --git a/src/types/ConfigurationData.ts b/src/types/ConfigurationData.ts index 32470f7b..1681fcf5 100644 --- a/src/types/ConfigurationData.ts +++ b/src/types/ConfigurationData.ts @@ -1,11 +1,11 @@ -import { ListenOptions } from 'net'; +import type { ListenOptions } from 'net'; import type { WorkerChoiceStrategy } from 'poolifier'; -import { ServerOptions as WSServerOptions } from 'ws'; +import type { ServerOptions as WSServerOptions } from 'ws'; -import { StorageType } from './Storage'; -import { ApplicationProtocol } from './UIProtocol'; -import { WorkerProcessType } from './Worker'; +import type { StorageType } from './Storage'; +import type { ApplicationProtocol } from './UIProtocol'; +import type { WorkerProcessType } from './Worker'; export type ServerOptions = WSServerOptions & ListenOptions; diff --git a/src/types/ConnectorStatus.ts b/src/types/ConnectorStatus.ts index 6eab4106..abf0c45d 100644 --- a/src/types/ConnectorStatus.ts +++ b/src/types/ConnectorStatus.ts @@ -1,8 +1,8 @@ -import { SampledValueTemplate } from './MeasurandPerPhaseSampledValueTemplates'; -import { ChargePointStatus } from './ocpp/ChargePointStatus'; -import { ChargingProfile } from './ocpp/ChargingProfile'; -import { MeterValue } from './ocpp/MeterValues'; -import { AvailabilityType } from './ocpp/Requests'; +import type { SampledValueTemplate } from './MeasurandPerPhaseSampledValueTemplates'; +import type { ChargePointStatus } from './ocpp/ChargePointStatus'; +import type { ChargingProfile } from './ocpp/ChargingProfile'; +import type { MeterValue } from './ocpp/MeterValues'; +import type { AvailabilityType } from './ocpp/Requests'; export interface ConnectorStatus { availability: AvailabilityType; diff --git a/src/types/MeasurandPerPhaseSampledValueTemplates.ts b/src/types/MeasurandPerPhaseSampledValueTemplates.ts index 9240fde2..2fb8f9ba 100644 --- a/src/types/MeasurandPerPhaseSampledValueTemplates.ts +++ b/src/types/MeasurandPerPhaseSampledValueTemplates.ts @@ -1,4 +1,4 @@ -import { SampledValue } from './ocpp/MeterValues'; +import type { SampledValue } from './ocpp/MeterValues'; export interface SampledValueTemplate extends SampledValue { fluctuationPercent?: number; diff --git a/src/types/Statistics.ts b/src/types/Statistics.ts index 5c7191a8..628ad28b 100644 --- a/src/types/Statistics.ts +++ b/src/types/Statistics.ts @@ -1,5 +1,5 @@ -import { CircularArray } from '../utils/CircularArray'; -import { WorkerData } from './Worker'; +import type { CircularArray } from '../utils/CircularArray'; +import type { WorkerData } from './Worker'; export interface TimeSeries { timestamp: number; diff --git a/src/types/Storage.ts b/src/types/Storage.ts index 1d674edf..bb300c23 100644 --- a/src/types/Storage.ts +++ b/src/types/Storage.ts @@ -1,4 +1,4 @@ -import { Configuration } from '@mikro-orm/core'; +import type { Configuration } from '@mikro-orm/core'; export type MikroORMDBType = keyof typeof Configuration.PLATFORMS; diff --git a/src/types/UIProtocol.ts b/src/types/UIProtocol.ts index 1939fdd5..463b205e 100644 --- a/src/types/UIProtocol.ts +++ b/src/types/UIProtocol.ts @@ -1,4 +1,4 @@ -import { JsonObject } from './JsonType'; +import type { JsonObject } from './JsonType'; export enum Protocol { UI = 'ui', diff --git a/src/types/Worker.ts b/src/types/Worker.ts index 7de7045d..9d9692a7 100644 --- a/src/types/Worker.ts +++ b/src/types/Worker.ts @@ -1,6 +1,6 @@ -import { Worker } from 'worker_threads'; +import type { Worker } from 'worker_threads'; -import { PoolOptions } from 'poolifier'; +import type { PoolOptions } from 'poolifier'; export enum WorkerProcessType { WORKER_SET = 'workerSet', diff --git a/src/types/WorkerBroadcastChannel.ts b/src/types/WorkerBroadcastChannel.ts index 0d6da48d..45168b03 100644 --- a/src/types/WorkerBroadcastChannel.ts +++ b/src/types/WorkerBroadcastChannel.ts @@ -1,4 +1,4 @@ -import { RequestPayload, ResponsePayload } from './UIProtocol'; +import type { RequestPayload, ResponsePayload } from './UIProtocol'; export type BroadcastChannelRequest = [ string, diff --git a/src/types/ocpp/1.6/ChargingProfile.ts b/src/types/ocpp/1.6/ChargingProfile.ts index b33bf066..529bfd1d 100644 --- a/src/types/ocpp/1.6/ChargingProfile.ts +++ b/src/types/ocpp/1.6/ChargingProfile.ts @@ -1,4 +1,4 @@ -import { JsonObject } from '../../JsonType'; +import type { JsonObject } from '../../JsonType'; export interface OCPP16ChargingProfile extends JsonObject { chargingProfileId: number; diff --git a/src/types/ocpp/1.6/MeterValues.ts b/src/types/ocpp/1.6/MeterValues.ts index 0d9d3263..79bad362 100644 --- a/src/types/ocpp/1.6/MeterValues.ts +++ b/src/types/ocpp/1.6/MeterValues.ts @@ -1,5 +1,5 @@ -import { EmptyObject } from '../../EmptyObject'; -import { JsonObject } from '../../JsonType'; +import type { EmptyObject } from '../../EmptyObject'; +import type { JsonObject } from '../../JsonType'; export enum MeterValueUnit { WATT_HOUR = 'Wh', diff --git a/src/types/ocpp/1.6/Requests.ts b/src/types/ocpp/1.6/Requests.ts index 145947ae..db0c7edd 100644 --- a/src/types/ocpp/1.6/Requests.ts +++ b/src/types/ocpp/1.6/Requests.ts @@ -1,10 +1,10 @@ -import { EmptyObject } from '../../EmptyObject'; -import { JsonObject } from '../../JsonType'; -import { OCPP16ChargePointErrorCode } from './ChargePointErrorCode'; -import { OCPP16ChargePointStatus } from './ChargePointStatus'; -import { ChargingProfilePurposeType, OCPP16ChargingProfile } from './ChargingProfile'; -import { OCPP16StandardParametersKey } from './Configuration'; -import { OCPP16DiagnosticsStatus } from './DiagnosticsStatus'; +import type { EmptyObject } from '../../EmptyObject'; +import type { JsonObject } from '../../JsonType'; +import type { OCPP16ChargePointErrorCode } from './ChargePointErrorCode'; +import type { OCPP16ChargePointStatus } from './ChargePointStatus'; +import type { ChargingProfilePurposeType, OCPP16ChargingProfile } from './ChargingProfile'; +import type { OCPP16StandardParametersKey } from './Configuration'; +import type { OCPP16DiagnosticsStatus } from './DiagnosticsStatus'; export enum OCPP16RequestCommand { BOOT_NOTIFICATION = 'BootNotification', diff --git a/src/types/ocpp/1.6/Responses.ts b/src/types/ocpp/1.6/Responses.ts index 08076964..2acee1ea 100644 --- a/src/types/ocpp/1.6/Responses.ts +++ b/src/types/ocpp/1.6/Responses.ts @@ -1,6 +1,6 @@ -import { EmptyObject } from '../../EmptyObject'; -import { JsonObject } from '../../JsonType'; -import { OCPPConfigurationKey } from '../Configuration'; +import type { EmptyObject } from '../../EmptyObject'; +import type { JsonObject } from '../../JsonType'; +import type { OCPPConfigurationKey } from '../Configuration'; export interface OCPP16HeartbeatResponse extends JsonObject { currentTime: string; diff --git a/src/types/ocpp/1.6/Transaction.ts b/src/types/ocpp/1.6/Transaction.ts index 7e9059c3..ca68117d 100644 --- a/src/types/ocpp/1.6/Transaction.ts +++ b/src/types/ocpp/1.6/Transaction.ts @@ -1,5 +1,5 @@ -import { JsonObject } from '../../JsonType'; -import { OCPP16MeterValue } from './MeterValues'; +import type { JsonObject } from '../../JsonType'; +import type { OCPP16MeterValue } from './MeterValues'; export enum OCPP16StopTransactionReason { NONE = '', diff --git a/src/types/ocpp/Configuration.ts b/src/types/ocpp/Configuration.ts index 31d71499..f60c4f1c 100644 --- a/src/types/ocpp/Configuration.ts +++ b/src/types/ocpp/Configuration.ts @@ -1,4 +1,4 @@ -import { JsonObject } from '../JsonType'; +import type { JsonObject } from '../JsonType'; import { OCPP16StandardParametersKey, OCPP16SupportedFeatureProfiles, diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index ed9dac1a..99a3f817 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -1,8 +1,8 @@ import type ChargingStation from '../../charging-station/ChargingStation'; -import OCPPError from '../../exception/OCPPError'; -import { JsonType } from '../JsonType'; +import type OCPPError from '../../exception/OCPPError'; +import type { JsonType } from '../JsonType'; import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus'; -import { OCPP16MeterValuesRequest } from './1.6/MeterValues'; +import type { OCPP16MeterValuesRequest } from './1.6/MeterValues'; import { OCPP16AvailabilityType, OCPP16BootNotificationRequest, @@ -11,7 +11,7 @@ import { OCPP16RequestCommand, OCPP16StatusNotificationRequest, } from './1.6/Requests'; -import { MessageType } from './MessageType'; +import type { MessageType } from './MessageType'; export type RequestCommand = OCPP16RequestCommand; diff --git a/src/types/ocpp/Responses.ts b/src/types/ocpp/Responses.ts index d5b4b7c5..43250047 100644 --- a/src/types/ocpp/Responses.ts +++ b/src/types/ocpp/Responses.ts @@ -1,6 +1,6 @@ import type ChargingStation from '../../charging-station/ChargingStation'; -import { JsonType } from '../JsonType'; -import { OCPP16MeterValuesResponse } from './1.6/MeterValues'; +import type { JsonType } from '../JsonType'; +import type { OCPP16MeterValuesResponse } from './1.6/MeterValues'; import { OCPP16AvailabilityStatus, OCPP16BootNotificationResponse, @@ -13,8 +13,8 @@ import { OCPP16TriggerMessageStatus, OCPP16UnlockStatus, } from './1.6/Responses'; -import { ErrorType } from './ErrorType'; -import { MessageType } from './MessageType'; +import type { ErrorType } from './ErrorType'; +import type { MessageType } from './MessageType'; export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType]; diff --git a/src/types/orm/entities/PerformanceRecord.ts b/src/types/orm/entities/PerformanceRecord.ts index 67ffc700..06114da6 100644 --- a/src/types/orm/entities/PerformanceRecord.ts +++ b/src/types/orm/entities/PerformanceRecord.ts @@ -1,6 +1,6 @@ import { Collection, Entity, OneToMany, PrimaryKey, Property } from '@mikro-orm/core'; -import { PerformanceData } from './PerformanceData'; +import type { PerformanceData } from './PerformanceData'; @Entity() export class PerformanceRecord { diff --git a/src/ui/web/.eslintrc.js b/src/ui/web/.eslintrc.js index 9fdad85f..e048f318 100644 --- a/src/ui/web/.eslintrc.js +++ b/src/ui/web/.eslintrc.js @@ -8,15 +8,12 @@ module.exports = { extends: [ 'plugin:vue/vue3-essential', 'eslint:recommended', - '@vue/typescript/recommended', - 'plugin:prettier/recommended', + '@vue/eslint-config-typescript/recommended', + '@vue/eslint-config-prettier', ], - parser: 'vue-eslint-parser', - parserOptions: { - ecmaVersion: 2020, - parser: '@typescript-eslint/parser', + ecmaVersion: 'latest', }, rules: { diff --git a/src/ui/web/package-lock.json b/src/ui/web/package-lock.json index 73b6f99b..0a6d10b9 100644 --- a/src/ui/web/package-lock.json +++ b/src/ui/web/package-lock.json @@ -30,17 +30,16 @@ "@vue/cli-plugin-typescript": "~5.0.8", "@vue/cli-plugin-unit-mocha": "~5.0.8", "@vue/cli-service": "~5.0.8", + "@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-typescript": "^11.0.0", "@vue/test-utils": "^2.0.2", + "@vue/tsconfig": "^0.1.3", "chai": "^4.3.6", "eslint": "^8.22.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-vue": "^9.4.0", "lint-staged": "^13.0.3", "prettier": "^2.7.1", - "typescript": "^4.8.2", - "vue-eslint-parser": "^9.0.3" + "typescript": "^4.8.2" } }, "node_modules/@achrinza/node-ipc": { @@ -4108,6 +4107,20 @@ "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.1.4.tgz", "integrity": "sha512-IiA0SvDrJEgXvVxjNkHPFfDx6SXw0b/TUkqMcDZWNg9fnCAHbTpoo59YfJ9QLFkwa3raau5vSlRVzMSLDnfdtQ==" }, + "node_modules/@vue/eslint-config-prettier": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-7.0.0.tgz", + "integrity": "sha512-/CTc6ML3Wta1tCe1gUeO0EYnVXfo3nJXsIhZ8WJr3sov+cGASr6yuiibJTL6lmIBm7GobopToOuB3B6AWyV0Iw==", + "dev": true, + "dependencies": { + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^4.0.0" + }, + "peerDependencies": { + "eslint": ">= 7.28.0", + "prettier": ">= 2.0.0" + } + }, "node_modules/@vue/eslint-config-typescript": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-typescript/-/eslint-config-typescript-11.0.0.tgz", @@ -4197,6 +4210,20 @@ "vue": "^3.0.1" } }, + "node_modules/@vue/tsconfig": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@vue/tsconfig/-/tsconfig-0.1.3.tgz", + "integrity": "sha512-kQVsh8yyWPvHpb8gIc9l/HIDiiVUy1amynLNpCy8p+FoCiZXCo6fQos5/097MmnNZc9AtseDsCrfkhqCrJ8Olg==", + "dev": true, + "peerDependencies": { + "@types/node": "*" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, "node_modules/@vue/vue-loader-v15": { "name": "vue-loader", "version": "15.10.0", @@ -22292,6 +22319,16 @@ "resolved": "https://registry.npmjs.org/@vue/devtools-api/-/devtools-api-6.1.4.tgz", "integrity": "sha512-IiA0SvDrJEgXvVxjNkHPFfDx6SXw0b/TUkqMcDZWNg9fnCAHbTpoo59YfJ9QLFkwa3raau5vSlRVzMSLDnfdtQ==" }, + "@vue/eslint-config-prettier": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-7.0.0.tgz", + "integrity": "sha512-/CTc6ML3Wta1tCe1gUeO0EYnVXfo3nJXsIhZ8WJr3sov+cGASr6yuiibJTL6lmIBm7GobopToOuB3B6AWyV0Iw==", + "dev": true, + "requires": { + "eslint-config-prettier": "^8.3.0", + "eslint-plugin-prettier": "^4.0.0" + } + }, "@vue/eslint-config-typescript": { "version": "11.0.0", "resolved": "https://registry.npmjs.org/@vue/eslint-config-typescript/-/eslint-config-typescript-11.0.0.tgz", @@ -22363,6 +22400,13 @@ "dev": true, "requires": {} }, + "@vue/tsconfig": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@vue/tsconfig/-/tsconfig-0.1.3.tgz", + "integrity": "sha512-kQVsh8yyWPvHpb8gIc9l/HIDiiVUy1amynLNpCy8p+FoCiZXCo6fQos5/097MmnNZc9AtseDsCrfkhqCrJ8Olg==", + "dev": true, + "requires": {} + }, "@vue/vue-loader-v15": { "version": "npm:vue-loader@15.10.0", "resolved": "https://registry.npmjs.org/vue-loader/-/vue-loader-15.10.0.tgz", diff --git a/src/ui/web/package.json b/src/ui/web/package.json index dd3ed56b..3c790ec0 100644 --- a/src/ui/web/package.json +++ b/src/ui/web/package.json @@ -32,17 +32,16 @@ "@vue/cli-plugin-typescript": "~5.0.8", "@vue/cli-plugin-unit-mocha": "~5.0.8", "@vue/cli-service": "~5.0.8", + "@vue/eslint-config-prettier": "^7.0.0", "@vue/eslint-config-typescript": "^11.0.0", "@vue/test-utils": "^2.0.2", + "@vue/tsconfig": "^0.1.3", "chai": "^4.3.6", "eslint": "^8.22.0", - "eslint-config-prettier": "^8.5.0", - "eslint-plugin-prettier": "^4.2.1", "eslint-plugin-vue": "^9.4.0", "lint-staged": "^13.0.3", "prettier": "^2.7.1", - "typescript": "^4.8.2", - "vue-eslint-parser": "^9.0.3" + "typescript": "^4.8.2" }, "_id": "webui@0.1.0", "gitHooks": { diff --git a/src/ui/web/src/assets/config.ts b/src/ui/web/src/assets/config.ts index e17a02b8..43170a2c 100644 --- a/src/ui/web/src/assets/config.ts +++ b/src/ui/web/src/assets/config.ts @@ -1,4 +1,4 @@ -import { BaseConfig } from '@/type/ConfigurationType'; +import type { BaseConfig } from '@/type/ConfigurationType'; const config: BaseConfig = { emobility: { diff --git a/src/ui/web/src/composable/UIClient.ts b/src/ui/web/src/composable/UIClient.ts index 2095b167..9ac8923c 100644 --- a/src/ui/web/src/composable/UIClient.ts +++ b/src/ui/web/src/composable/UIClient.ts @@ -1,10 +1,7 @@ -import { JsonType } from '@/type/JsonType'; -import { - ProcedureName, - ProtocolResponse, - ResponsePayload, - ResponseStatus, -} from '@/type/UIProtocol'; +import type { JsonType } from '@/type/JsonType'; +import { ProcedureName, ResponseStatus } from '@/type/UIProtocol'; +import type { ProtocolResponse, ResponsePayload } from '@/type/UIProtocol'; + import Utils from './Utils'; import config from '@/assets/config'; import { v4 as uuidv4 } from 'uuid'; diff --git a/src/ui/web/src/router/index.ts b/src/ui/web/src/router/index.ts index f5d64dfe..0857e041 100644 --- a/src/ui/web/src/router/index.ts +++ b/src/ui/web/src/router/index.ts @@ -1,4 +1,5 @@ -import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'; +import { createRouter, createWebHistory } from 'vue-router'; +import type { RouteRecordRaw } from 'vue-router'; import ChargingStationsView from '@/views/ChargingStationsView.vue'; const routes: Array = [ diff --git a/src/ui/web/src/type/ChargingStationType.ts b/src/ui/web/src/type/ChargingStationType.ts index 537e7b74..dc485451 100644 --- a/src/ui/web/src/type/ChargingStationType.ts +++ b/src/ui/web/src/type/ChargingStationType.ts @@ -1,4 +1,4 @@ -import { JsonObject } from './JsonType'; +import type { JsonObject } from './JsonType'; export type ChargingStationData = { hashId: string; diff --git a/src/ui/web/src/type/UIProtocol.ts b/src/ui/web/src/type/UIProtocol.ts index 23537c3e..d324acc5 100644 --- a/src/ui/web/src/type/UIProtocol.ts +++ b/src/ui/web/src/type/UIProtocol.ts @@ -1,4 +1,4 @@ -import { JsonObject } from './JsonType'; +import type { JsonObject } from './JsonType'; export enum Protocol { UI = 'ui', diff --git a/src/ui/web/tsconfig.json b/src/ui/web/tsconfig.json index f0a1203d..9e934d1f 100644 --- a/src/ui/web/tsconfig.json +++ b/src/ui/web/tsconfig.json @@ -1,19 +1,12 @@ { + "extends": "@vue/tsconfig/tsconfig.node.json", "compilerOptions": { - "target": "esnext", - "module": "esnext", - "strict": true, - "jsx": "preserve", - "moduleResolution": "node", "experimentalDecorators": true, - "skipLibCheck": true, - "esModuleInterop": true, "allowSyntheticDefaultImports": true, - "forceConsistentCasingInFileNames": true, - "useDefineForClassFields": true, "sourceMap": true, "baseUrl": ".", "types": [ + "node", "webpack-env", "mocha", "chai" @@ -25,9 +18,7 @@ }, "lib": [ "esnext", - "dom", - "dom.iterable", - "scripthost" + "dom" ] }, "include": [ diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index f4eb39ad..afc992f8 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -11,8 +11,8 @@ import ConfigurationData, { UIServerConfiguration, WorkerConfiguration, } from '../types/ConfigurationData'; -import { EmptyObject } from '../types/EmptyObject'; -import { HandleErrorParams } from '../types/Error'; +import type { EmptyObject } from '../types/EmptyObject'; +import type { HandleErrorParams } from '../types/Error'; import { FileType } from '../types/FileType'; import { StorageType } from '../types/Storage'; import { ApplicationProtocol } from '../types/UIProtocol'; diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index 10317c73..8de719a1 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -2,10 +2,10 @@ import fs from 'fs'; import chalk from 'chalk'; -import { EmptyObject } from '../types/EmptyObject'; -import { HandleErrorParams } from '../types/Error'; -import { FileType } from '../types/FileType'; -import { JsonType } from '../types/JsonType'; +import type { EmptyObject } from '../types/EmptyObject'; +import type { HandleErrorParams } from '../types/Error'; +import type { FileType } from '../types/FileType'; +import type { JsonType } from '../types/JsonType'; import logger from './Logger'; import Utils from './Utils'; diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index 60a101d0..1baea780 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -1,4 +1,4 @@ -import { Format } from 'logform'; +import type { Format } from 'logform'; import { Logger, createLogger, format, transport } from 'winston'; import DailyRotateFile from 'winston-daily-rotate-file'; import TransportType from 'winston/lib/winston/transports/index.js'; diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 3fbd4a0b..27f947d1 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -1,6 +1,6 @@ import fs from 'fs'; -import { WorkerData, WorkerOptions } from '../types/Worker'; +import type { WorkerData, WorkerOptions } from '../types/Worker'; import WorkerConstants from './WorkerConstants'; export default abstract class WorkerAbstract { diff --git a/src/worker/WorkerDynamicPool.ts b/src/worker/WorkerDynamicPool.ts index 68813e20..b2cd20dd 100644 --- a/src/worker/WorkerDynamicPool.ts +++ b/src/worker/WorkerDynamicPool.ts @@ -1,6 +1,6 @@ import { DynamicThreadPool } from 'poolifier'; -import { WorkerData, WorkerOptions } from '../types/Worker'; +import type { WorkerData, WorkerOptions } from '../types/Worker'; import Utils from '../utils/Utils'; import WorkerAbstract from './WorkerAbstract'; import { WorkerUtils } from './WorkerUtils'; diff --git a/src/worker/WorkerFactory.ts b/src/worker/WorkerFactory.ts index 01adb96e..a6679cca 100644 --- a/src/worker/WorkerFactory.ts +++ b/src/worker/WorkerFactory.ts @@ -1,6 +1,6 @@ import { Worker, isMainThread } from 'worker_threads'; -import { PoolOptions } from 'poolifier'; +import type { PoolOptions } from 'poolifier'; import { WorkerData, WorkerOptions, WorkerProcessType } from '../types/Worker'; import type WorkerAbstract from './WorkerAbstract'; diff --git a/src/worker/WorkerStaticPool.ts b/src/worker/WorkerStaticPool.ts index 99ea301d..6fc91524 100644 --- a/src/worker/WorkerStaticPool.ts +++ b/src/worker/WorkerStaticPool.ts @@ -1,6 +1,6 @@ import { FixedThreadPool } from 'poolifier'; -import { WorkerData, WorkerOptions } from '../types/Worker'; +import type { WorkerData, WorkerOptions } from '../types/Worker'; import Utils from '../utils/Utils'; import WorkerAbstract from './WorkerAbstract'; import { WorkerUtils } from './WorkerUtils'; diff --git a/tsconfig.json b/tsconfig.json index a0c7e162..ff3ae353 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -33,6 +33,7 @@ // "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ // "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ // "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ + "importsNotUsedAsValues": "error", /* Enforce using `import type` instead of `import` for types */ /* Additional Checks */ // "noUnusedLocals": true, /* Report errors on unused locals. */