From: Jérôme Benoit Date: Thu, 12 Jan 2023 18:59:43 +0000 (+0100) Subject: Linter fixes X-Git-Tag: v1.1.90~18 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=78202038ffd2aca15aa97f45bc66ba42f40f2ec4;p=e-mobility-charging-stations-simulator.git Linter fixes Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 80c9a517..60760be1 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -2,6 +2,8 @@ import { AsyncResource } from 'async_hooks'; +import type ChargingStation from './ChargingStation'; +import { ChargingStationUtils } from './ChargingStationUtils'; import BaseError from '../exception/BaseError'; import PerformanceStatistics from '../performance/PerformanceStatistics'; import { @@ -22,8 +24,6 @@ import { import Constants from '../utils/Constants'; import logger from '../utils/Logger'; import Utils from '../utils/Utils'; -import type ChargingStation from './ChargingStation'; -import { ChargingStationUtils } from './ChargingStationUtils'; const moduleName = 'AutomaticTransactionGenerator'; diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 89721197..7b2db1c7 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -6,6 +6,9 @@ import { type Worker, isMainThread } from 'worker_threads'; import chalk from 'chalk'; +import { ChargingStationUtils } from './ChargingStationUtils'; +import type { AbstractUIServer } from './ui-server/AbstractUIServer'; +import UIServerFactory from './ui-server/UIServerFactory'; import { version } from '../../package.json'; import BaseError from '../exception/BaseError'; import type { Storage } from '../performance/storage/Storage'; @@ -25,9 +28,6 @@ import logger from '../utils/Logger'; import Utils from '../utils/Utils'; import type WorkerAbstract from '../worker/WorkerAbstract'; import WorkerFactory from '../worker/WorkerFactory'; -import { ChargingStationUtils } from './ChargingStationUtils'; -import type { AbstractUIServer } from './ui-server/AbstractUIServer'; -import UIServerFactory from './ui-server/UIServerFactory'; const moduleName = 'Bootstrap'; diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 6f93e650..ce5677a4 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -9,6 +9,23 @@ import { parentPort } from 'worker_threads'; import merge from 'just-merge'; import WebSocket, { type RawData } from 'ws'; +import AuthorizedTagsCache from './AuthorizedTagsCache'; +import AutomaticTransactionGenerator from './AutomaticTransactionGenerator'; +import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; +import { ChargingStationUtils } from './ChargingStationUtils'; +import ChargingStationWorkerBroadcastChannel from './ChargingStationWorkerBroadcastChannel'; +import { MessageChannelUtils } from './MessageChannelUtils'; +import OCPP16IncomingRequestService from './ocpp/1.6/OCPP16IncomingRequestService'; +import OCPP16RequestService from './ocpp/1.6/OCPP16RequestService'; +import OCPP16ResponseService from './ocpp/1.6/OCPP16ResponseService'; +import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils'; +import OCPP20IncomingRequestService from './ocpp/2.0/OCPP20IncomingRequestService'; +import OCPP20RequestService from './ocpp/2.0/OCPP20RequestService'; +import OCPP20ResponseService from './ocpp/2.0/OCPP20ResponseService'; +import type OCPPIncomingRequestService from './ocpp/OCPPIncomingRequestService'; +import type OCPPRequestService from './ocpp/OCPPRequestService'; +import { OCPPServiceUtils } from './ocpp/OCPPServiceUtils'; +import SharedLRUCache from './SharedLRUCache'; import BaseError from '../exception/BaseError'; import OCPPError from '../exception/OCPPError'; import PerformanceStatistics from '../performance/PerformanceStatistics'; @@ -76,23 +93,6 @@ import { ACElectricUtils, DCElectricUtils } from '../utils/ElectricUtils'; import FileUtils from '../utils/FileUtils'; import logger from '../utils/Logger'; import Utils from '../utils/Utils'; -import AuthorizedTagsCache from './AuthorizedTagsCache'; -import AutomaticTransactionGenerator from './AutomaticTransactionGenerator'; -import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; -import { ChargingStationUtils } from './ChargingStationUtils'; -import ChargingStationWorkerBroadcastChannel from './ChargingStationWorkerBroadcastChannel'; -import { MessageChannelUtils } from './MessageChannelUtils'; -import OCPP16IncomingRequestService from './ocpp/1.6/OCPP16IncomingRequestService'; -import OCPP16RequestService from './ocpp/1.6/OCPP16RequestService'; -import OCPP16ResponseService from './ocpp/1.6/OCPP16ResponseService'; -import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils'; -import OCPP20IncomingRequestService from './ocpp/2.0/OCPP20IncomingRequestService'; -import OCPP20RequestService from './ocpp/2.0/OCPP20RequestService'; -import OCPP20ResponseService from './ocpp/2.0/OCPP20ResponseService'; -import type OCPPIncomingRequestService from './ocpp/OCPPIncomingRequestService'; -import type OCPPRequestService from './ocpp/OCPPRequestService'; -import { OCPPServiceUtils } from './ocpp/OCPPServiceUtils'; -import SharedLRUCache from './SharedLRUCache'; export default class ChargingStation { public readonly index: number; diff --git a/src/charging-station/ChargingStationConfigurationUtils.ts b/src/charging-station/ChargingStationConfigurationUtils.ts index f79a7375..bfd9838b 100644 --- a/src/charging-station/ChargingStationConfigurationUtils.ts +++ b/src/charging-station/ChargingStationConfigurationUtils.ts @@ -1,7 +1,7 @@ +import type ChargingStation from './ChargingStation'; import type { ConfigurationKey } from '../types/ChargingStationOcppConfiguration'; import type { StandardParametersKey } from '../types/ocpp/Configuration'; import logger from '../utils/Logger'; -import type ChargingStation from './ChargingStation'; type ConfigurationKeyOptions = { readonly?: boolean; visible?: boolean; reboot?: boolean }; type DeleteConfigurationKeyParams = { save?: boolean; caseInsensitive?: boolean }; diff --git a/src/charging-station/ChargingStationWorker.ts b/src/charging-station/ChargingStationWorker.ts index 62bad35f..2204f308 100644 --- a/src/charging-station/ChargingStationWorker.ts +++ b/src/charging-station/ChargingStationWorker.ts @@ -4,12 +4,12 @@ import { parentPort, workerData } from 'worker_threads'; import { ThreadWorker } from 'poolifier'; +import ChargingStation from './ChargingStation'; +import { ChargingStationUtils } from './ChargingStationUtils'; import type { ChargingStationWorkerData } from '../types/ChargingStationWorker'; import { type WorkerMessage, WorkerMessageEvents } from '../types/Worker'; import Utils from '../utils/Utils'; import WorkerConstants from '../worker/WorkerConstants'; -import ChargingStation from './ChargingStation'; -import { ChargingStationUtils } from './ChargingStationUtils'; // Conditionally export ThreadWorker instance for pool usage export let threadWorker: ThreadWorker; diff --git a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts index 1c7121ec..4dc295c3 100644 --- a/src/charging-station/ChargingStationWorkerBroadcastChannel.ts +++ b/src/charging-station/ChargingStationWorkerBroadcastChannel.ts @@ -1,3 +1,7 @@ +import type ChargingStation from './ChargingStation'; +import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; +import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils'; +import WorkerBroadcastChannel from './WorkerBroadcastChannel'; import BaseError from '../exception/BaseError'; import type OCPPError from '../exception/OCPPError'; import { StandardParametersKey } from '../types/ocpp/Configuration'; @@ -43,10 +47,6 @@ import { import Constants from '../utils/Constants'; import logger from '../utils/Logger'; import Utils from '../utils/Utils'; -import type ChargingStation from './ChargingStation'; -import { ChargingStationConfigurationUtils } from './ChargingStationConfigurationUtils'; -import { OCPP16ServiceUtils } from './ocpp/1.6/OCPP16ServiceUtils'; -import WorkerBroadcastChannel from './WorkerBroadcastChannel'; const moduleName = 'ChargingStationWorkerBroadcastChannel'; diff --git a/src/charging-station/MessageChannelUtils.ts b/src/charging-station/MessageChannelUtils.ts index 77adae8e..40496b60 100644 --- a/src/charging-station/MessageChannelUtils.ts +++ b/src/charging-station/MessageChannelUtils.ts @@ -1,10 +1,10 @@ +import type ChargingStation from './ChargingStation'; import { type ChargingStationData, type ChargingStationWorkerMessage, ChargingStationWorkerMessageEvents, } from '../types/ChargingStationWorker'; import type { Statistics } from '../types/Statistics'; -import type ChargingStation from './ChargingStation'; export class MessageChannelUtils { private constructor() { diff --git a/src/charging-station/UIServiceWorkerBroadcastChannel.ts b/src/charging-station/UIServiceWorkerBroadcastChannel.ts index e323056c..cdbe108d 100644 --- a/src/charging-station/UIServiceWorkerBroadcastChannel.ts +++ b/src/charging-station/UIServiceWorkerBroadcastChannel.ts @@ -1,3 +1,5 @@ +import type AbstractUIService from './ui-server/ui-services/AbstractUIService'; +import WorkerBroadcastChannel from './WorkerBroadcastChannel'; import { type ResponsePayload, ResponseStatus } from '../types/UIProtocol'; import type { BroadcastChannelResponse, @@ -5,8 +7,6 @@ import type { MessageEvent, } from '../types/WorkerBroadcastChannel'; import logger from '../utils/Logger'; -import type AbstractUIService from './ui-server/ui-services/AbstractUIService'; -import WorkerBroadcastChannel from './WorkerBroadcastChannel'; const moduleName = 'UIServiceWorkerBroadcastChannel'; diff --git a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts index 3db474c7..68d9da4d 100644 --- a/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts @@ -8,6 +8,7 @@ import type { JSONSchemaType } from 'ajv'; import { Client, type FTPResponse } from 'basic-ftp'; import tar from 'tar'; +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; import OCPPError from '../../../exception/OCPPError'; import type { JsonObject, JsonType } from '../../../types/JsonType'; import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode'; @@ -87,7 +88,6 @@ import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigur import { ChargingStationUtils } from '../../ChargingStationUtils'; import OCPPConstants from '../OCPPConstants'; import OCPPIncomingRequestService from '../OCPPIncomingRequestService'; -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; const moduleName = 'OCPP16IncomingRequestService'; diff --git a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts index a24e0a07..bf63ba2e 100644 --- a/src/charging-station/ocpp/1.6/OCPP16RequestService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16RequestService.ts @@ -6,6 +6,7 @@ import { fileURLToPath } from 'url'; import type { JSONSchemaType } from 'ajv'; +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; import OCPPError from '../../../exception/OCPPError'; import type { JsonObject, JsonType } from '../../../types/JsonType'; import type { OCPP16MeterValuesRequest } from '../../../types/ocpp/1.6/MeterValues'; @@ -31,7 +32,6 @@ import Utils from '../../../utils/Utils'; import type ChargingStation from '../../ChargingStation'; import OCPPRequestService from '../OCPPRequestService'; import type OCPPResponseService from '../OCPPResponseService'; -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; const moduleName = 'OCPP16RequestService'; diff --git a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts index 61d1ffad..0af8ad16 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ResponseService.ts @@ -6,6 +6,7 @@ import { fileURLToPath } from 'url'; import type { JSONSchemaType } from 'ajv'; +import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; import OCPPError from '../../../exception/OCPPError'; import type { JsonObject, JsonType } from '../../../types/JsonType'; import { OCPP16ChargePointErrorCode } from '../../../types/ocpp/1.6/ChargePointErrorCode'; @@ -60,7 +61,6 @@ import Utils from '../../../utils/Utils'; import type ChargingStation from '../../ChargingStation'; import { ChargingStationConfigurationUtils } from '../../ChargingStationConfigurationUtils'; import OCPPResponseService from '../OCPPResponseService'; -import { OCPP16ServiceUtils } from './OCPP16ServiceUtils'; const moduleName = 'OCPP16ResponseService'; diff --git a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts index 7a0b1e6f..7e92a9ca 100644 --- a/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20IncomingRequestService.ts @@ -6,6 +6,7 @@ import { fileURLToPath } from 'url'; import type { JSONSchemaType } from 'ajv'; +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; import OCPPError from '../../../exception/OCPPError'; import type { JsonObject, JsonType } from '../../../types/JsonType'; import { @@ -18,7 +19,6 @@ import type { IncomingRequestHandler } from '../../../types/ocpp/Requests'; import logger from '../../../utils/Logger'; import type ChargingStation from '../../ChargingStation'; import OCPPIncomingRequestService from '../OCPPIncomingRequestService'; -import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; const moduleName = 'OCPP20IncomingRequestService'; diff --git a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts index d550e4d1..989ca41c 100644 --- a/src/charging-station/ocpp/2.0/OCPP20RequestService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20RequestService.ts @@ -6,6 +6,7 @@ import { fileURLToPath } from 'url'; import type { JSONSchemaType } from 'ajv'; +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; import OCPPError from '../../../exception/OCPPError'; import type { JsonObject, JsonType } from '../../../types/JsonType'; import { @@ -21,7 +22,6 @@ import Utils from '../../../utils/Utils'; import type ChargingStation from '../../ChargingStation'; import OCPPRequestService from '../OCPPRequestService'; import type OCPPResponseService from '../OCPPResponseService'; -import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; const moduleName = 'OCPP20RequestService'; diff --git a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts index f9d8fde9..6bc6a5c2 100644 --- a/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts +++ b/src/charging-station/ocpp/2.0/OCPP20ResponseService.ts @@ -6,6 +6,7 @@ import { fileURLToPath } from 'url'; import type { JSONSchemaType } from 'ajv'; +import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; import OCPPError from '../../../exception/OCPPError'; import type { JsonObject, JsonType } from '../../../types/JsonType'; import { @@ -24,7 +25,6 @@ import { RegistrationStatusEnumType, ResponseHandler } from '../../../types/ocpp import logger from '../../../utils/Logger'; import type ChargingStation from '../../ChargingStation'; import OCPPResponseService from '../OCPPResponseService'; -import { OCPP20ServiceUtils } from './OCPP20ServiceUtils'; const moduleName = 'OCPP20ResponseService'; diff --git a/src/charging-station/ocpp/OCPPIncomingRequestService.ts b/src/charging-station/ocpp/OCPPIncomingRequestService.ts index 876e71d8..ddffa657 100644 --- a/src/charging-station/ocpp/OCPPIncomingRequestService.ts +++ b/src/charging-station/ocpp/OCPPIncomingRequestService.ts @@ -3,6 +3,8 @@ import { AsyncResource } from 'async_hooks'; import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; +import OCPPConstants from './OCPPConstants'; +import { OCPPServiceUtils } from './OCPPServiceUtils'; import OCPPError from '../../exception/OCPPError'; import type { HandleErrorParams } from '../../types/Error'; import type { JsonObject, JsonType } from '../../types/JsonType'; @@ -12,8 +14,6 @@ import type { ClearCacheResponse } from '../../types/ocpp/Responses'; import logger from '../../utils/Logger'; import type ChargingStation from '../ChargingStation'; import { ChargingStationUtils } from '../ChargingStationUtils'; -import OCPPConstants from './OCPPConstants'; -import { OCPPServiceUtils } from './OCPPServiceUtils'; const moduleName = 'OCPPIncomingRequestService'; diff --git a/src/charging-station/ocpp/OCPPRequestService.ts b/src/charging-station/ocpp/OCPPRequestService.ts index aba9bfd0..f561a446 100644 --- a/src/charging-station/ocpp/OCPPRequestService.ts +++ b/src/charging-station/ocpp/OCPPRequestService.ts @@ -1,6 +1,8 @@ import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; +import type OCPPResponseService from './OCPPResponseService'; +import { OCPPServiceUtils } from './OCPPServiceUtils'; import OCPPError from '../../exception/OCPPError'; import PerformanceStatistics from '../../performance/PerformanceStatistics'; import type { EmptyObject } from '../../types/EmptyObject'; @@ -23,8 +25,6 @@ import Constants from '../../utils/Constants'; import logger from '../../utils/Logger'; import Utils from '../../utils/Utils'; import type ChargingStation from '../ChargingStation'; -import type OCPPResponseService from './OCPPResponseService'; -import { OCPPServiceUtils } from './OCPPServiceUtils'; const moduleName = 'OCPPRequestService'; diff --git a/src/charging-station/ocpp/OCPPResponseService.ts b/src/charging-station/ocpp/OCPPResponseService.ts index 7cedf888..80d5a686 100644 --- a/src/charging-station/ocpp/OCPPResponseService.ts +++ b/src/charging-station/ocpp/OCPPResponseService.ts @@ -1,13 +1,13 @@ import Ajv, { type JSONSchemaType } from 'ajv'; import ajvFormats from 'ajv-formats'; +import { OCPPServiceUtils } from './OCPPServiceUtils'; import OCPPError from '../../exception/OCPPError'; import type { JsonObject, JsonType } from '../../types/JsonType'; import type { OCPPVersion } from '../../types/ocpp/OCPPVersion'; import type { IncomingRequestCommand, RequestCommand } from '../../types/ocpp/Requests'; import logger from '../../utils/Logger'; import type ChargingStation from '../ChargingStation'; -import { OCPPServiceUtils } from './OCPPServiceUtils'; const moduleName = 'OCPPResponseService'; diff --git a/src/charging-station/ui-server/AbstractUIServer.ts b/src/charging-station/ui-server/AbstractUIServer.ts index cc1f82f5..f69b9b34 100644 --- a/src/charging-station/ui-server/AbstractUIServer.ts +++ b/src/charging-station/ui-server/AbstractUIServer.ts @@ -2,6 +2,8 @@ import { type IncomingMessage, Server, type ServerResponse } from 'http'; import type { WebSocket } from 'ws'; +import type AbstractUIService from './ui-services/AbstractUIService'; +import UIServiceFactory from './ui-services/UIServiceFactory'; import type { ChargingStationData } from '../../types/ChargingStationWorker'; import type { UIServerConfiguration } from '../../types/ConfigurationData'; import { @@ -13,8 +15,6 @@ import { type RequestPayload, type ResponsePayload, } from '../../types/UIProtocol'; -import type AbstractUIService from './ui-services/AbstractUIService'; -import UIServiceFactory from './ui-services/UIServiceFactory'; export abstract class AbstractUIServer { public readonly chargingStations: Map; diff --git a/src/charging-station/ui-server/UIHttpServer.ts b/src/charging-station/ui-server/UIHttpServer.ts index 60bd7fdc..87f10a5e 100644 --- a/src/charging-station/ui-server/UIHttpServer.ts +++ b/src/charging-station/ui-server/UIHttpServer.ts @@ -2,6 +2,8 @@ import type { IncomingMessage, RequestListener, ServerResponse } from 'http'; import { StatusCodes } from 'http-status-codes'; +import { AbstractUIServer } from './AbstractUIServer'; +import { UIServerUtils } from './UIServerUtils'; import BaseError from '../../exception/BaseError'; import type { UIServerConfiguration } from '../../types/ConfigurationData'; import { @@ -15,8 +17,6 @@ import { } from '../../types/UIProtocol'; import logger from '../../utils/Logger'; import Utils from '../../utils/Utils'; -import { AbstractUIServer } from './AbstractUIServer'; -import { UIServerUtils } from './UIServerUtils'; const moduleName = 'UIHttpServer'; diff --git a/src/charging-station/ui-server/UIServerFactory.ts b/src/charging-station/ui-server/UIServerFactory.ts index 2a125af0..9d2bc574 100644 --- a/src/charging-station/ui-server/UIServerFactory.ts +++ b/src/charging-station/ui-server/UIServerFactory.ts @@ -1,12 +1,12 @@ import chalk from 'chalk'; -import type { UIServerConfiguration } from '../../types/ConfigurationData'; -import { ApplicationProtocol } from '../../types/UIProtocol'; -import Configuration from '../../utils/Configuration'; import type { AbstractUIServer } from './AbstractUIServer'; import UIHttpServer from './UIHttpServer'; import { UIServerUtils } from './UIServerUtils'; import UIWebSocketServer from './UIWebSocketServer'; +import type { UIServerConfiguration } from '../../types/ConfigurationData'; +import { ApplicationProtocol } from '../../types/UIProtocol'; +import Configuration from '../../utils/Configuration'; export default class UIServerFactory { private constructor() { diff --git a/src/charging-station/ui-server/UIWebSocketServer.ts b/src/charging-station/ui-server/UIWebSocketServer.ts index 27d8ce84..e217305f 100644 --- a/src/charging-station/ui-server/UIWebSocketServer.ts +++ b/src/charging-station/ui-server/UIWebSocketServer.ts @@ -4,13 +4,13 @@ import type internal from 'stream'; import { StatusCodes } from 'http-status-codes'; import WebSocket, { type RawData, WebSocketServer } from 'ws'; +import { AbstractUIServer } from './AbstractUIServer'; +import { UIServerUtils } from './UIServerUtils'; import type { UIServerConfiguration } from '../../types/ConfigurationData'; import type { ProtocolRequest, ProtocolResponse } from '../../types/UIProtocol'; import { WebSocketCloseEventStatusCode } from '../../types/WebSocket'; import logger from '../../utils/Logger'; import Utils from '../../utils/Utils'; -import { AbstractUIServer } from './AbstractUIServer'; -import { UIServerUtils } from './UIServerUtils'; const moduleName = 'UIWebSocketServer'; diff --git a/src/charging-station/ui-server/ui-services/UIService001.ts b/src/charging-station/ui-server/ui-services/UIService001.ts index de7ba257..0ac0daa0 100644 --- a/src/charging-station/ui-server/ui-services/UIService001.ts +++ b/src/charging-station/ui-server/ui-services/UIService001.ts @@ -1,10 +1,10 @@ +import AbstractUIService from './AbstractUIService'; import { ProcedureName, type ProtocolRequestHandler, ProtocolVersion, } from '../../../types/UIProtocol'; import type { AbstractUIServer } from '../AbstractUIServer'; -import AbstractUIService from './AbstractUIService'; export default class UIService001 extends AbstractUIService { constructor(uiServer: AbstractUIServer) { diff --git a/src/charging-station/ui-server/ui-services/UIServiceFactory.ts b/src/charging-station/ui-server/ui-services/UIServiceFactory.ts index b0dd2f07..551869f0 100644 --- a/src/charging-station/ui-server/ui-services/UIServiceFactory.ts +++ b/src/charging-station/ui-server/ui-services/UIServiceFactory.ts @@ -1,7 +1,7 @@ -import { ProtocolVersion } from '../../../types/UIProtocol'; -import type { AbstractUIServer } from '../AbstractUIServer'; import type AbstractUIService from './AbstractUIService'; import UIService001 from './UIService001'; +import { ProtocolVersion } from '../../../types/UIProtocol'; +import type { AbstractUIServer } from '../AbstractUIServer'; export default class UIServiceFactory { private constructor() { diff --git a/src/exception/OCPPError.ts b/src/exception/OCPPError.ts index e3c127fd..8e7dcc2f 100644 --- a/src/exception/OCPPError.ts +++ b/src/exception/OCPPError.ts @@ -1,9 +1,9 @@ // Partial Copyright Jerome Benoit. 2021-2023. All Rights Reserved. +import BaseError from './BaseError'; import type { JsonType } from '../types/JsonType'; import { ErrorType } from '../types/ocpp/ErrorType'; import type { IncomingRequestCommand, RequestCommand } from '../types/ocpp/Requests'; -import BaseError from './BaseError'; export default class OCPPError extends BaseError { code: ErrorType; diff --git a/src/performance/storage/JsonFileStorage.ts b/src/performance/storage/JsonFileStorage.ts index 2f90fc46..63d12a43 100644 --- a/src/performance/storage/JsonFileStorage.ts +++ b/src/performance/storage/JsonFileStorage.ts @@ -4,11 +4,11 @@ import fs from 'fs'; import lockfile from 'proper-lockfile'; +import { Storage } from './Storage'; import { FileType } from '../../types/FileType'; import type { Statistics } from '../../types/Statistics'; import FileUtils from '../../utils/FileUtils'; import Utils from '../../utils/Utils'; -import { Storage } from './Storage'; export class JsonFileStorage extends Storage { private fd: number | null = null; diff --git a/src/performance/storage/MikroOrmStorage.ts b/src/performance/storage/MikroOrmStorage.ts index f9c21290..70a89030 100644 --- a/src/performance/storage/MikroOrmStorage.ts +++ b/src/performance/storage/MikroOrmStorage.ts @@ -3,12 +3,12 @@ import { Configuration, Connection, IDatabaseDriver, MikroORM, Options } from '@mikro-orm/core'; import { TsMorphMetadataProvider } from '@mikro-orm/reflection'; +import { Storage } from './Storage'; import { PerformanceData } from '../../types/orm/entities/PerformanceData'; import { PerformanceRecord } from '../../types/orm/entities/PerformanceRecord'; import type { Statistics } from '../../types/Statistics'; import { MikroORMDBType, StorageType } from '../../types/Storage'; import Constants from '../../utils/Constants'; -import { Storage } from './Storage'; export class MikroOrmStorage extends Storage { private storageType: StorageType; diff --git a/src/performance/storage/MongoDBStorage.ts b/src/performance/storage/MongoDBStorage.ts index 153f32ae..54fc4334 100644 --- a/src/performance/storage/MongoDBStorage.ts +++ b/src/performance/storage/MongoDBStorage.ts @@ -2,10 +2,10 @@ import { MongoClient } from 'mongodb'; +import { Storage } from './Storage'; import type { Statistics } from '../../types/Statistics'; import { StorageType } from '../../types/Storage'; import Constants from '../../utils/Constants'; -import { Storage } from './Storage'; export class MongoDBStorage extends Storage { private readonly client: MongoClient | null; diff --git a/src/performance/storage/StorageFactory.ts b/src/performance/storage/StorageFactory.ts index 741b1631..2007e8f4 100644 --- a/src/performance/storage/StorageFactory.ts +++ b/src/performance/storage/StorageFactory.ts @@ -1,10 +1,10 @@ // Copyright Jerome Benoit. 2021-2023. All Rights Reserved. -import { StorageType } from '../../types/Storage'; import { JsonFileStorage } from './JsonFileStorage'; import { MikroOrmStorage } from './MikroOrmStorage'; import { MongoDBStorage } from './MongoDBStorage'; import type { Storage } from './Storage'; +import { StorageType } from '../../types/Storage'; export class StorageFactory { private constructor() { diff --git a/src/types/Statistics.ts b/src/types/Statistics.ts index fb9ededb..6abc1287 100644 --- a/src/types/Statistics.ts +++ b/src/types/Statistics.ts @@ -1,6 +1,6 @@ -import type { CircularArray } from '../utils/CircularArray'; import type { IncomingRequestCommand, RequestCommand } from './ocpp/Requests'; import type { WorkerData } from './Worker'; +import type { CircularArray } from '../utils/CircularArray'; export type TimeSeries = { timestamp: number; diff --git a/src/types/ocpp/1.6/Requests.ts b/src/types/ocpp/1.6/Requests.ts index 47b110ab..f8a19570 100644 --- a/src/types/ocpp/1.6/Requests.ts +++ b/src/types/ocpp/1.6/Requests.ts @@ -1,10 +1,10 @@ -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'; +import type { EmptyObject } from '../../EmptyObject'; +import type { JsonObject } from '../../JsonType'; export enum OCPP16RequestCommand { BOOT_NOTIFICATION = 'BootNotification', diff --git a/src/types/ocpp/1.6/Transaction.ts b/src/types/ocpp/1.6/Transaction.ts index a11de78d..e2aa3d81 100644 --- a/src/types/ocpp/1.6/Transaction.ts +++ b/src/types/ocpp/1.6/Transaction.ts @@ -1,5 +1,5 @@ -import type { JsonObject } from '../../JsonType'; import type { OCPP16MeterValue } from './MeterValues'; +import type { JsonObject } from '../../JsonType'; export enum OCPP16StopTransactionReason { NONE = '', diff --git a/src/types/ocpp/Configuration.ts b/src/types/ocpp/Configuration.ts index 6289a77d..c094aab3 100644 --- a/src/types/ocpp/Configuration.ts +++ b/src/types/ocpp/Configuration.ts @@ -1,9 +1,9 @@ -import type { JsonObject } from '../JsonType'; import { OCPP16StandardParametersKey, OCPP16SupportedFeatureProfiles, OCPP16VendorDefaultParametersKey, } from './1.6/Configuration'; +import type { JsonObject } from '../JsonType'; export const StandardParametersKey = { ...OCPP16StandardParametersKey, diff --git a/src/types/ocpp/Requests.ts b/src/types/ocpp/Requests.ts index 35933c83..6e61fcc1 100644 --- a/src/types/ocpp/Requests.ts +++ b/src/types/ocpp/Requests.ts @@ -1,6 +1,3 @@ -import type ChargingStation from '../../charging-station/ChargingStation'; -import type OCPPError from '../../exception/OCPPError'; -import type { JsonType } from '../JsonType'; import { OCPP16DiagnosticsStatus } from './1.6/DiagnosticsStatus'; import type { OCPP16MeterValuesRequest } from './1.6/MeterValues'; import { @@ -23,6 +20,9 @@ import { type OCPP20StatusNotificationRequest, } from './2.0/Requests'; import type { MessageType } from './MessageType'; +import type ChargingStation from '../../charging-station/ChargingStation'; +import type OCPPError from '../../exception/OCPPError'; +import type { JsonType } from '../JsonType'; export const RequestCommand = { ...OCPP16RequestCommand, diff --git a/src/types/ocpp/Responses.ts b/src/types/ocpp/Responses.ts index 55c5c338..df4bdf90 100644 --- a/src/types/ocpp/Responses.ts +++ b/src/types/ocpp/Responses.ts @@ -1,5 +1,3 @@ -import type ChargingStation from '../../charging-station/ChargingStation'; -import type { JsonType } from '../JsonType'; import type { OCPP16MeterValuesResponse } from './1.6/MeterValues'; import { OCPP16AvailabilityStatus, @@ -23,6 +21,8 @@ import type { } from './2.0/Responses'; import type { ErrorType } from './ErrorType'; import type { MessageType } from './MessageType'; +import type ChargingStation from '../../charging-station/ChargingStation'; +import type { JsonType } from '../JsonType'; export type Response = [MessageType.CALL_RESULT_MESSAGE, string, JsonType]; diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index d832d0de..0d0f68e7 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -6,6 +6,7 @@ import chalk from 'chalk'; import merge from 'just-merge'; import { WorkerChoiceStrategies } from 'poolifier'; +import Constants from './Constants'; import { type ConfigurationData, type StationTemplateUrl, @@ -21,7 +22,6 @@ import { StorageType } from '../types/Storage'; import { ApplicationProtocol } from '../types/UIProtocol'; import { WorkerProcessType } from '../types/Worker'; import WorkerConstants from '../worker/WorkerConstants'; -import Constants from './Constants'; export default class Configuration { private static configurationFile = path.join( diff --git a/src/utils/FileUtils.ts b/src/utils/FileUtils.ts index 8de719a1..0efccbc3 100644 --- a/src/utils/FileUtils.ts +++ b/src/utils/FileUtils.ts @@ -2,12 +2,12 @@ import fs from 'fs'; import chalk from 'chalk'; +import logger from './Logger'; +import Utils from './Utils'; 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'; export default class FileUtils { private constructor() { diff --git a/src/utils/Logger.ts b/src/utils/Logger.ts index 7528d202..7e08136c 100644 --- a/src/utils/Logger.ts +++ b/src/utils/Logger.ts @@ -1,7 +1,7 @@ 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'; +import DailyRotateFile from 'winston-daily-rotate-file'; import Configuration from './Configuration'; import Utils from './Utils'; diff --git a/src/worker/WorkerAbstract.ts b/src/worker/WorkerAbstract.ts index 356e1a7a..0fccdb81 100644 --- a/src/worker/WorkerAbstract.ts +++ b/src/worker/WorkerAbstract.ts @@ -1,7 +1,7 @@ import fs from 'fs'; -import type { WorkerData, WorkerOptions } from '../types/Worker'; import WorkerConstants from './WorkerConstants'; +import type { WorkerData, WorkerOptions } from '../types/Worker'; export default abstract class WorkerAbstract { protected readonly workerScript: string; diff --git a/src/worker/WorkerDynamicPool.ts b/src/worker/WorkerDynamicPool.ts index 5e235879..f842614f 100644 --- a/src/worker/WorkerDynamicPool.ts +++ b/src/worker/WorkerDynamicPool.ts @@ -2,10 +2,10 @@ import type { Worker } from 'worker_threads'; import { DynamicThreadPool, type ErrorHandler, type ExitHandler } from 'poolifier'; -import type { WorkerData, WorkerOptions } from '../types/Worker'; -import Utils from '../utils/Utils'; import WorkerAbstract from './WorkerAbstract'; import { WorkerUtils } from './WorkerUtils'; +import type { WorkerData, WorkerOptions } from '../types/Worker'; +import Utils from '../utils/Utils'; export default class WorkerDynamicPool extends WorkerAbstract { private readonly pool: DynamicThreadPool; diff --git a/src/worker/WorkerFactory.ts b/src/worker/WorkerFactory.ts index 668d447a..4e1cea02 100644 --- a/src/worker/WorkerFactory.ts +++ b/src/worker/WorkerFactory.ts @@ -2,12 +2,12 @@ import { type Worker, isMainThread } from 'worker_threads'; import type { PoolOptions } from 'poolifier'; -import { type WorkerData, type WorkerOptions, WorkerProcessType } from '../types/Worker'; import type WorkerAbstract from './WorkerAbstract'; import WorkerConstants from './WorkerConstants'; import WorkerDynamicPool from './WorkerDynamicPool'; import WorkerSet from './WorkerSet'; import WorkerStaticPool from './WorkerStaticPool'; +import { type WorkerData, type WorkerOptions, WorkerProcessType } from '../types/Worker'; export default class WorkerFactory { private constructor() { diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index 8a1aeb30..c82e79fc 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -2,6 +2,8 @@ import { Worker } from 'worker_threads'; +import WorkerAbstract from './WorkerAbstract'; +import { WorkerUtils } from './WorkerUtils'; import { type MessageHandler, type WorkerData, @@ -10,8 +12,6 @@ import { type WorkerSetElement, } from '../types/Worker'; import Utils from '../utils/Utils'; -import WorkerAbstract from './WorkerAbstract'; -import { WorkerUtils } from './WorkerUtils'; export default class WorkerSet extends WorkerAbstract { private readonly workerSet: Set; diff --git a/src/worker/WorkerStaticPool.ts b/src/worker/WorkerStaticPool.ts index c3209c25..2dd2bc80 100644 --- a/src/worker/WorkerStaticPool.ts +++ b/src/worker/WorkerStaticPool.ts @@ -2,10 +2,10 @@ import type { Worker } from 'worker_threads'; import { type ErrorHandler, type ExitHandler, FixedThreadPool } from 'poolifier'; -import type { WorkerData, WorkerOptions } from '../types/Worker'; -import Utils from '../utils/Utils'; import WorkerAbstract from './WorkerAbstract'; import { WorkerUtils } from './WorkerUtils'; +import type { WorkerData, WorkerOptions } from '../types/Worker'; +import Utils from '../utils/Utils'; export default class WorkerStaticPool extends WorkerAbstract { private readonly pool: FixedThreadPool;