build(ci): reenabled auto code formating and linting on simulator
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 25 Jul 2024 18:04:00 +0000 (20:04 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 25 Jul 2024 18:04:00 +0000 (20:04 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
.github/workflows/autofix.yml
.lintstagedrc.js
src/charging-station/AutomaticTransactionGenerator.ts
src/charging-station/Bootstrap.ts
src/charging-station/ChargingStation.ts
src/charging-station/Helpers.ts
src/charging-station/ocpp/OCPPServiceUtils.ts

index dbfdb997ed6258f4611dd195469d645f95dde7e3..8492b788475e0210fbe97de9bb8e003d3ea88a62 100644 (file)
@@ -30,8 +30,7 @@ jobs:
 
       - run: pnpm install --ignore-scripts
 
-      # - run: pnpm format
-      - run: pnpm lint:fix
+      - run: pnpm format
 
       - working-directory: ui/web
         run: |
index 45396f973d0f3bf6939553de89f36c636d9ecd8c..0eef8bcc26a3092bb53886a1e3579dfb3d443f82 100644 (file)
@@ -1,8 +1,5 @@
 export default {
-  '{src,tests}/**/*.{ts,tsx,cts,mts}': [
-    // 'prettier --cache --write',
-    'eslint --cache --fix',
-  ],
+  '{src,tests}/**/*.{ts,tsx,cts,mts}': ['prettier --cache --write', 'eslint --cache --fix'],
   '**/*.{json,md,yml,yaml}': ['prettier --cache --write'],
   '**/*.{js,jsx,cjs,mjs}': ['prettier --cache --write', 'eslint --cache --fix'],
 }
index 3cfe3253c783aeb440c75f4615cf47f70b4871b1..02419444ba6c6b2e7bf4c30f0b603a35eb37864c 100644 (file)
@@ -229,8 +229,7 @@ export class AutomaticTransactionGenerator {
             )
           )
           logger.info(
-            `${this.logPrefix(connectorId)} transaction started with id ${
-              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            `${this.logPrefix(connectorId)} transaction started with id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             this.chargingStation
               .getConnectorStatus(connectorId)
               ?.transactionId?.toString()} and will stop in ${formatDurationMilliSeconds(waitTrxEnd)}`
@@ -341,8 +340,7 @@ export class AutomaticTransactionGenerator {
     const connectorStatus = this.chargingStation.getConnectorStatus(connectorId)
     if (connectorStatus?.transactionStarted === true) {
       logger.info(
-        `${this.logPrefix(connectorId)} entered in transaction loop while a transaction ${
-          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+        `${this.logPrefix(connectorId)} entered in transaction loop while a transaction ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         connectorStatus.transactionId?.toString()} is already started on connector ${connectorId.toString()}`
       )
       return false
@@ -386,8 +384,7 @@ export class AutomaticTransactionGenerator {
     while (connectorStatus?.transactionStarted === true) {
       if (!logged) {
         logger.info(
-          `${this.logPrefix(connectorId)} transaction loop waiting for started transaction ${
-            // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+          `${this.logPrefix(connectorId)} transaction loop waiting for started transaction ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
           connectorStatus.transactionId?.toString()} on connector ${connectorId.toString()} to be stopped`
         )
         logged = true
index 6f6ac3e322bd1431a97ea7522c1bcd48af2d486d..dfd91916bb4abbce6c531584de2861766af77e11 100644 (file)
@@ -227,14 +227,14 @@ export class Bootstrap extends EventEmitter {
           chalk.green(
             `Charging stations simulator ${this.version} started with ${this.numberOfConfiguredChargingStations.toString()} configured and ${this.numberOfProvisionedChargingStations.toString()} provisioned charging station(s) from ${this.numberOfChargingStationTemplates.toString()} charging station template(s) and ${
               Configuration.workerDynamicPoolInUse()
-                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-                ? `${workerConfiguration.poolMinSize?.toString()}/`
+                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+                  `${workerConfiguration.poolMinSize?.toString()}/`
                 : ''
               // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             }${this.workerImplementation?.size.toString()}${
               Configuration.workerPoolInUse()
-                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
-                ? `/${workerConfiguration.poolMaxSize?.toString()}`
+                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+                  `/${workerConfiguration.poolMaxSize?.toString()}`
                 : ''
               // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             } worker(s) concurrently running in '${workerConfiguration.processType}' mode${
index 32b046504b855a8d6e4a369ebf19bc1482708e14..866302b0ba783980c653805b4842105a9a728c23 100644 (file)
@@ -427,16 +427,16 @@ export class ChargingStation extends EventEmitter {
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       isNaN(connectorAmperageLimitationLimit!)
         ? Number.POSITIVE_INFINITY
-        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        connectorAmperageLimitationLimit!,
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+        connectorAmperageLimitationLimit!,
       isNaN(chargingStationChargingProfilesLimit)
         ? Number.POSITIVE_INFINITY
         : chargingStationChargingProfilesLimit,
       // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
       isNaN(connectorChargingProfilesLimit!)
         ? Number.POSITIVE_INFINITY
-        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        connectorChargingProfilesLimit!
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+        connectorChargingProfilesLimit!
     )
   }
 
index d234dcedc39837bbab62490c34d0a780e5ef92dc..d40bce238d024dfe6682c289c63a8e93bfa86347 100644 (file)
@@ -438,8 +438,7 @@ export const initializeConnectorsMapStatus = (
   for (const connectorId of connectors.keys()) {
     if (connectorId > 0 && connectors.get(connectorId)?.transactionStarted === true) {
       logger.warn(
-        `${logPrefix} Connector id ${connectorId.toString()} at initialization has a transaction started with id ${
-          // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+        `${logPrefix} Connector id ${connectorId.toString()} at initialization has a transaction started with id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
         connectors.get(connectorId)?.transactionId?.toString()}`
       )
     }
@@ -798,8 +797,8 @@ const buildChargingProfilesLimit = (
     case CurrentType.DC:
       return chargingProfile.chargingSchedule.chargingRateUnit === ChargingRateUnitType.WATT
         ? limit
-        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-        DCElectricUtils.power(chargingStation.stationInfo.voltageOut!, limit)
+        // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
+        DCElectricUtils.power(chargingStation.stationInfo.voltageOut!, limit)
     default:
       logger.error(
         `${chargingStation.logPrefix()} ${moduleName}.buildChargingProfilesLimit: ${errorMsg}`
index 1204e2b3aedd94ad65fed1bd2f86e484df487554..eae051adc4d3f64cb08b6391fdbadd091a5fdc68 100644 (file)
@@ -347,8 +347,7 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId.toString()}, transaction id ${
-              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            }: connector id ${connectorId.toString()}, transaction id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             connector?.transactionId?.toString()}, value: ${socMinimumValue.toString()}/${
               meterValue.sampledValue[sampledValuesIndex].value
             }/${socMaximumValue.toString()}`
@@ -681,8 +680,7 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId.toString()}, transaction id ${
-              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            }: connector id ${connectorId.toString()}, transaction id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             connector?.transactionId?.toString()}, value: ${connectorMinimumPowerRounded.toString()}/${
               meterValue.sampledValue[sampledValuesIndex].value
             }/${connectorMaximumPowerRounded.toString()}`
@@ -729,8 +727,7 @@ export const buildMeterValue = (
               }: phase ${
                 // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
-              }, connector id ${connectorId.toString()}, transaction id ${
-                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              }, connector id ${connectorId.toString()}, transaction id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
               connector?.transactionId?.toString()}, value: ${connectorMinimumPowerPerPhaseRounded.toString()}/${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].value
               }/${connectorMaximumPowerPerPhaseRounded.toString()}`
@@ -943,8 +940,7 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId.toString()}, transaction id ${
-              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            }: connector id ${connectorId.toString()}, transaction id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             connector?.transactionId?.toString()}, value: ${connectorMinimumAmperage.toString()}/${
               meterValue.sampledValue[sampledValuesIndex].value
             }/${connectorMaximumAmperage.toString()}`
@@ -981,8 +977,7 @@ export const buildMeterValue = (
               }: phase ${
                 // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].phase
-              }, connector id ${connectorId.toString()}, transaction id ${
-                // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+              }, connector id ${connectorId.toString()}, transaction id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
               connector?.transactionId?.toString()}, value: ${connectorMinimumAmperage.toString()}/${
                 meterValue.sampledValue[sampledValuesPerPhaseIndex].value
               }/${connectorMaximumAmperage.toString()}`
@@ -1057,8 +1052,7 @@ export const buildMeterValue = (
             `${chargingStation.logPrefix()} MeterValues measurand ${
               meterValue.sampledValue[sampledValuesIndex].measurand ??
               MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
-            }: connector id ${connectorId.toString()}, transaction id ${
-              // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
+            }: connector id ${connectorId.toString()}, transaction id ${// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
             connector?.transactionId?.toString()}, value: ${connectorMinimumEnergyRounded.toString()}/${energyValueRounded.toString()}/${connectorMaximumEnergyRounded.toString()}, duration: ${interval.toString()}ms`
           )
         }