fix(ocpp-server): silence linter
[e-mobility-charging-stations-simulator.git] / src / charging-station / ConfigurationKeyUtils.ts
index 556cf54a57745f8563c9b9373729e79ecd976908..4b9eb40aa211f9c5d5c651aae0203bc8f330fb74 100644 (file)
@@ -1,6 +1,6 @@
-import type { ChargingStation } from './ChargingStation.js'
 import type { ConfigurationKey, ConfigurationKeyType } from '../types/index.js'
 import { logger } from '../utils/index.js'
+import type { ChargingStation } from './ChargingStation.js'
 
 interface ConfigurationKeyOptions {
   readonly?: boolean
@@ -21,7 +21,7 @@ export const getConfigurationKey = (
   key: ConfigurationKeyType,
   caseInsensitive = false
 ): ConfigurationKey | undefined => {
-  return chargingStation.ocppConfiguration?.configurationKey?.find((configElement) => {
+  return chargingStation.ocppConfiguration?.configurationKey?.find(configElement => {
     if (caseInsensitive) {
       return configElement.key.toLowerCase() === key.toLowerCase()
     }
@@ -46,7 +46,7 @@ export const addConfigurationKey = (
   }
   params = { ...{ overwrite: false, save: false }, ...params }
   let keyFound = getConfigurationKey(chargingStation, key)
-  if (keyFound != null && params?.overwrite === true) {
+  if (keyFound != null && params.overwrite === true) {
     deleteConfigurationKey(chargingStation, keyFound.key, {
       save: false
     })
@@ -61,7 +61,7 @@ export const addConfigurationKey = (
       visible: options.visible,
       reboot: options.reboot
     })
-    params?.save === true && chargingStation.saveOcppConfiguration()
+    params.save === true && chargingStation.saveOcppConfiguration()
   } else {
     logger.error(
       `${chargingStation.logPrefix()} Trying to add an already existing configuration key: %j`,
@@ -99,13 +99,13 @@ export const deleteConfigurationKey = (
   params?: DeleteConfigurationKeyParams
 ): ConfigurationKey[] | undefined => {
   params = { ...{ save: true, caseInsensitive: false }, ...params }
-  const keyFound = getConfigurationKey(chargingStation, key, params?.caseInsensitive)
+  const keyFound = getConfigurationKey(chargingStation, key, params.caseInsensitive)
   if (keyFound != null) {
     const deletedConfigurationKey = chargingStation.ocppConfiguration?.configurationKey?.splice(
       chargingStation.ocppConfiguration.configurationKey.indexOf(keyFound),
       1
     )
-    params?.save === true && chargingStation.saveOcppConfiguration()
+    params.save === true && chargingStation.saveOcppConfiguration()
     return deletedConfigurationKey
   }
 }