]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
refactor: enforce consistent-type-imports eslint rule and fix violations
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 16 Mar 2026 23:48:15 +0000 (00:48 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 16 Mar 2026 23:48:15 +0000 (00:48 +0100)
13 files changed:
eslint.config.js
src/charging-station/ocpp/1.6/OCPP16ResponseService.ts
src/charging-station/ocpp/2.0/OCPP20ResponseService.ts
src/charging-station/ocpp/auth/adapters/OCPP20AuthAdapter.ts
src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.ts
src/charging-station/ocpp/auth/strategies/RemoteAuthStrategy.ts
src/charging-station/ocpp/auth/types/AuthTypes.ts
src/charging-station/ocpp/auth/utils/AuthHelpers.ts
tests/charging-station/ocpp/1.6/OCPP16IncomingRequestService-RemoteStartTransaction.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStartTransaction.test.ts
tests/charging-station/ocpp/2.0/OCPP20IncomingRequestService-RequestStopTransaction.test.ts
tests/charging-station/ui-server/UIServerTestUtils.ts
tests/helpers/OCPPAuthIntegrationTest.ts

index 3ce166cf11c9c0d7673c204a5e935576cead1b18..203c4b1f9a51fc83464df7515302a6d183316bd0 100644 (file)
@@ -138,6 +138,12 @@ export default defineConfig([
           tsconfigRootDir: import.meta.dirname,
         },
       },
+      rules: {
+        '@typescript-eslint/consistent-type-imports': [
+          'error',
+          { fixStyle: 'separate-type-imports', prefer: 'type-imports' },
+        ],
+      },
     },
     {
       files: ['**/*.js', '**/*.mjs', '**/*.cjs'],
index 64b4c30d02e7973db67c130c36d4b433372e6c2e..d88a33e0f2e0883106693a97ad354f8398a40091 100644 (file)
@@ -2,6 +2,8 @@ import type { ValidateFunction } from 'ajv'
 
 import { secondsToMilliseconds } from 'date-fns'
 
+import type { OCPP16IncomingRequestCommand } from '../../../types/index.js'
+
 import {
   addConfigurationKey,
   type ChargingStation,
@@ -17,7 +19,6 @@ import {
   type OCPP16AuthorizeResponse,
   type OCPP16BootNotificationResponse,
   OCPP16ChargePointStatus,
-  OCPP16IncomingRequestCommand,
   type OCPP16MeterValue,
   type OCPP16MeterValuesRequest,
   type OCPP16MeterValuesResponse,
index 60611914596d498902ea693afd9d81a34e832125..3ab8940a9a3df245c2397af0f95d68b322c337cf 100644 (file)
@@ -1,5 +1,7 @@
 import type { ValidateFunction } from 'ajv'
 
+import type { OCPP20IncomingRequestCommand } from '../../../types/index.js'
+
 import { addConfigurationKey, type ChargingStation } from '../../../charging-station/index.js'
 import {
   ChargingStationEvents,
@@ -7,7 +9,6 @@ import {
   type OCPP20BootNotificationResponse,
   type OCPP20FirmwareStatusNotificationResponse,
   type OCPP20HeartbeatResponse,
-  OCPP20IncomingRequestCommand,
   type OCPP20LogStatusNotificationResponse,
   type OCPP20MeterValuesResponse,
   type OCPP20NotifyCustomerInformationResponse,
index ce3d3044399b00cd9c0fee1d7ae5a318642d7fe9..75fac487a47ca7c55b79de58c6f291bcd90092e4 100644 (file)
@@ -1,3 +1,4 @@
+import type { RequestStartStopStatusEnumType } from '../../../../types/index.js'
 import type { ChargingStation } from '../../../index.js'
 import type { OCPPAuthAdapter } from '../interfaces/OCPPAuthService.js'
 import type {
@@ -9,11 +10,7 @@ import type {
 
 import { OCPP20ServiceUtils } from '../../2.0/OCPP20ServiceUtils.js'
 import { OCPP20VariableManager } from '../../2.0/OCPP20VariableManager.js'
-import {
-  GetVariableStatusEnumType,
-  type OCPP20IdTokenType,
-  RequestStartStopStatusEnumType,
-} from '../../../../types/index.js'
+import { GetVariableStatusEnumType, type OCPP20IdTokenType } from '../../../../types/index.js'
 import {
   type AdditionalInfoType,
   OCPP20AuthorizationStatusEnumType,
index 03553242f45c80553f546c974aedd481f32d862b..452d8dc240e3d0857def1f45295812418fc4fcc1 100644 (file)
@@ -1,5 +1,6 @@
 import type { OCPP16AuthAdapter } from '../adapters/OCPP16AuthAdapter.js'
 import type { OCPP20AuthAdapter } from '../adapters/OCPP20AuthAdapter.js'
+import type { LocalAuthStrategy } from '../strategies/LocalAuthStrategy.js'
 
 import { OCPPError } from '../../../../exception/OCPPError.js'
 import { ErrorType } from '../../../../types/index.js'
@@ -12,7 +13,6 @@ import {
   type AuthStrategy,
   type OCPPAuthService,
 } from '../interfaces/OCPPAuthService.js'
-import { LocalAuthStrategy } from '../strategies/LocalAuthStrategy.js'
 import {
   type AuthConfiguration,
   AuthContext,
index b51c391e4a9b0d39a5ede786e07277701a0b2cfd..b80b06f99cbf54910a9d5b0d3077bd80c0c7d101 100644 (file)
@@ -1,3 +1,4 @@
+import type { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js'
 import type {
   AuthCache,
   AuthStrategy,
@@ -6,7 +7,6 @@ import type {
 } from '../interfaces/OCPPAuthService.js'
 import type { AuthConfiguration, AuthorizationResult, AuthRequest } from '../types/AuthTypes.js'
 
-import { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js'
 import { ensureError, getErrorMessage, logger } from '../../../../utils/index.js'
 import {
   AuthenticationError,
index ed7bc64fa809ab9bdd1a757871529ca4c64d1867..355c4eb2f4a597f8ff33fde7e31aad378cf7610b 100644 (file)
@@ -1,11 +1,11 @@
 import type { JsonObject } from '../../../../types/JsonType.js'
+import type { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js'
 
 import { OCPP16AuthorizationStatus } from '../../../../types/ocpp/1.6/Transaction.js'
 import {
   OCPP20IdTokenEnumType,
   RequestStartStopStatusEnumType,
 } from '../../../../types/ocpp/2.0/Transaction.js'
-import { OCPPVersion } from '../../../../types/ocpp/OCPPVersion.js'
 
 /**
  * Authentication context for strategy selection
index c83d28877cda5b2acb8e4e7c50765886aa484811..78ef49184be7d9664804d1891fa011e3bf61e584 100644 (file)
@@ -1,6 +1,6 @@
-import type { AuthorizationResult, AuthRequest, UnifiedIdentifier } from '../types/AuthTypes.js'
+import type { AuthContext, AuthenticationMethod, AuthorizationResult, AuthRequest, UnifiedIdentifier } from '../types/AuthTypes.js'
 
-import { AuthContext, AuthenticationMethod, AuthorizationStatus } from '../types/AuthTypes.js'
+import { AuthorizationStatus } from '../types/AuthTypes.js'
 
 /**
  * Compute remaining TTL in seconds from an expiry date.
index 6abb67024ff0d0a0098bd85afa57498e3b84884d..d3ddeeef5ed63f5c7fd85484e86bb38a9eec7dbf 100644 (file)
@@ -3,9 +3,12 @@
  * @description Unit tests for OCPP 1.6 RemoteStartTransaction incoming request handler (§5.11)
  */
 
+import type { mock } from 'node:test'
+
 import assert from 'node:assert/strict'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
+import type { ChargingStation } from '../../../../src/charging-station/ChargingStation.js'
 import type { RemoteStartTransactionRequest } from '../../../../src/types/index.js'
 
 import { OCPP16IncomingRequestService } from '../../../../src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.js'
@@ -170,7 +173,7 @@ await describe('OCPP16IncomingRequestService — RemoteStartTransaction', async
   await describe('REMOTE_START_TRANSACTION event listener', async () => {
     let incomingRequestService: OCPP16IncomingRequestService
     let requestHandlerMock: ReturnType<typeof mock.fn>
-    let listenerStation: import('../../../../src/charging-station/ChargingStation.js').ChargingStation
+    let listenerStation: ChargingStation
 
     beforeEach(() => {
       ;({ requestHandlerMock, station: listenerStation } = createOCPP16ListenerStation(
index 338d0e78f77639760b5d62f50a56ebd375b53855..30cbd128fa7b2438f1e502bcfefcde4fb9326515 100644 (file)
@@ -1,9 +1,11 @@
+import type { mock } from 'node:test'
+
 /**
  * @file Tests for OCPP20IncomingRequestService RequestStartTransaction
  * @description Unit tests for OCPP 2.0 RequestStartTransaction command handling (F01/F02)
  */
 import assert from 'node:assert/strict'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type {
index 51e842e82b6aeccf2c592562c047387269e7f355..70c99756030b55d87aaf5e01e0d61adbbf31e770 100644 (file)
@@ -3,8 +3,10 @@
  * @description Unit tests for OCPP 2.0 RequestStopTransaction command handling (F03)
  */
 
+import type { mock } from 'node:test'
+
 import assert from 'node:assert/strict'
-import { afterEach, beforeEach, describe, it, mock } from 'node:test'
+import { afterEach, beforeEach, describe, it } from 'node:test'
 
 import type { ChargingStation } from '../../../../src/charging-station/index.js'
 import type {
index 3d1acce0703b210ff9368c9a24e9f2390b07231f..c5aff7be1320bacdd3b421f422b420380deb234d 100644 (file)
@@ -8,11 +8,14 @@ import { EventEmitter } from 'node:events'
 
 import type {
   ChargingStationData,
+  ProcedureName,
   ProtocolRequest,
   ProtocolResponse,
+  ProtocolVersion,
   RequestPayload,
+
   UIServerConfiguration,
-  UUIDv4,
+  UUIDv4
 } from '../../../src/types/index.js'
 
 import { UIWebSocketServer } from '../../../src/charging-station/ui-server/UIWebSocketServer.js'
@@ -20,8 +23,6 @@ import {
   ApplicationProtocol,
   ApplicationProtocolVersion,
   AuthenticationType,
-  ProcedureName,
-  ProtocolVersion,
   ResponseStatus,
 } from '../../../src/types/index.js'
 import { MockWebSocket } from '../mocks/MockWebSocket.js'
index f05f97d58ec55a4bcb9c063d94cf9d2b181ed350..18a5b1e8a8ff077ecadf632f81a8d19afdbbdbeb 100644 (file)
@@ -1,3 +1,4 @@
+import type { ChargingStation } from '../../src/charging-station/ChargingStation.js'
 import type {
   AuthConfiguration,
   AuthorizationResult,
@@ -5,7 +6,6 @@ import type {
   UnifiedIdentifier,
 } from '../../src/charging-station/ocpp/auth/types/AuthTypes.js'
 
-import { ChargingStation } from '../../src/charging-station/ChargingStation.js'
 import { OCPPAuthServiceImpl } from '../../src/charging-station/ocpp/auth/services/OCPPAuthServiceImpl.js'
 import {
   AuthContext,