refactor: silence two linter errors
authorJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 25 Jul 2024 19:17:48 +0000 (21:17 +0200)
committerJérôme Benoit <jerome.benoit@piment-noir.org>
Thu, 25 Jul 2024 19:17:48 +0000 (21:17 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
src/charging-station/Helpers.ts
src/charging-station/IdTagsCache.ts

index d40bce238d024dfe6682c289c63a8e93bfa86347..e8ef83c43f23741f025cfc96a99eb48e9435ecde 100644 (file)
@@ -1314,8 +1314,8 @@ const getRandomSerialNumberSuffix = (params?: {
   randomBytesLength?: number
   upperCase?: boolean
 }): string => {
-  const randomSerialNumberSuffix = randomBytes(params.randomBytesLength ?? 16).toString('hex')
-  if (params.upperCase) {
+  const randomSerialNumberSuffix = randomBytes(params?.randomBytesLength ?? 16).toString('hex')
+  if (params?.upperCase) {
     return randomSerialNumberSuffix.toUpperCase()
   }
   return randomSerialNumberSuffix
index 60fa9c4c43c10cee2a5cb2bddbd393abfe4d24be..71e038be5a2868267b40edabb2847352240eecbc 100644 (file)
@@ -50,7 +50,7 @@ export class IdTagsCache {
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
     const hashId = chargingStation.stationInfo!.hashId
     // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
-    const idTagsFile = getIdTagsFile(chargingStation.stationInfo)!
+    const idTagsFile = getIdTagsFile(chargingStation.stationInfo!)!
     switch (distribution) {
       case IdTagDistribution.RANDOM:
         return this.getRandomIdTag(hashId, idTagsFile)