Silence some linter errors
authorJérôme Benoit <jerome.benoit@sap.com>
Sun, 17 Oct 2021 22:50:28 +0000 (00:50 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sun, 17 Oct 2021 22:50:28 +0000 (00:50 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package-lock.json
package.json
src/charging-station/ChargingStation.ts
src/charging-station/ocpp/1.6/OCPP16IncomingRequestService.ts
src/charging-station/ocpp/1.6/OCPP16RequestService.ts

index 1b4ca438572f84a8a908d9c931d2f741cf76ebd0..84344d6ae851bf6c376819329ba0a652bcd2d7ec 100644 (file)
       }
     },
     "expect": {
-      "version": "27.2.5",
-      "resolved": "https://registry.npmjs.org/expect/-/expect-27.2.5.tgz",
-      "integrity": "sha512-ZrO0w7bo8BgGoP/bLz+HDCI+0Hfei9jUSZs5yI/Wyn9VkG9w8oJ7rHRgYj+MA7yqqFa0IwHA3flJzZtYugShJA==",
+      "version": "27.3.0",
+      "resolved": "https://registry.npmjs.org/expect/-/expect-27.3.0.tgz",
+      "integrity": "sha512-JBRU82EBkZUBqLBAoF3ovzNGEBm14QQnePK4PmZdm6de6q/UzPnmIuWP3dRCw/FE8wRQhf/1eKzy1p1q8d6EvQ==",
       "dev": true,
       "requires": {
         "@jest/types": "^27.2.5",
         "ansi-styles": "^5.0.0",
         "jest-get-type": "^27.0.6",
-        "jest-matcher-utils": "^27.2.5",
-        "jest-message-util": "^27.2.5",
+        "jest-matcher-utils": "^27.3.0",
+        "jest-message-util": "^27.3.0",
         "jest-regex-util": "^27.0.6"
       },
       "dependencies": {
       }
     },
     "jest-diff": {
-      "version": "27.2.5",
-      "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.2.5.tgz",
-      "integrity": "sha512-7gfwwyYkeslOOVQY4tVq5TaQa92mWfC9COsVYMNVYyJTOYAqbIkoD3twi5A+h+tAPtAelRxkqY6/xu+jwTr0dA==",
+      "version": "27.3.0",
+      "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.3.0.tgz",
+      "integrity": "sha512-Nl2rE58B2ye+RvPcU4hN+6wBCHxX7aWz6RMTMFxe9jAg8ZueMj5QQ+T/nmHRutbBc5BEjrbbEWOrRzp9rUEsYA==",
       "dev": true,
       "requires": {
         "chalk": "^4.0.0",
         "diff-sequences": "^27.0.6",
         "jest-get-type": "^27.0.6",
-        "pretty-format": "^27.2.5"
+        "pretty-format": "^27.3.0"
       }
     },
     "jest-get-type": {
       "dev": true
     },
     "jest-matcher-utils": {
-      "version": "27.2.5",
-      "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.2.5.tgz",
-      "integrity": "sha512-qNR/kh6bz0Dyv3m68Ck2g1fLW5KlSOUNcFQh87VXHZwWc/gY6XwnKofx76Qytz3x5LDWT09/2+yXndTkaG4aWg==",
+      "version": "27.3.0",
+      "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.3.0.tgz",
+      "integrity": "sha512-AK2ds5J29PJcZhfJ/5J8ycbjCXTHnwc6lQeOV1a1GahU1MCpSvyHG1iIevyvp6PXPy6r0q9ywGdCObWHmkK16g==",
       "dev": true,
       "requires": {
         "chalk": "^4.0.0",
-        "jest-diff": "^27.2.5",
+        "jest-diff": "^27.3.0",
         "jest-get-type": "^27.0.6",
-        "pretty-format": "^27.2.5"
+        "pretty-format": "^27.3.0"
       }
     },
     "jest-message-util": {
-      "version": "27.2.5",
-      "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.2.5.tgz",
-      "integrity": "sha512-ggXSLoPfIYcbmZ8glgEJZ8b+e0Msw/iddRmgkoO7lDAr9SmI65IIfv7VnvTnV4FGnIIUIjzM+fHRHO5RBvyAbQ==",
+      "version": "27.3.0",
+      "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.3.0.tgz",
+      "integrity": "sha512-0c79aomiyE3mlta4NCWsICydvv2W0HlM/eVx46YEO+vdDuwUvNuQn8LqOtcHC1hSd25i03RrPvscrWgHBJQpRQ==",
       "dev": true,
       "requires": {
         "@babel/code-frame": "^7.12.13",
         "chalk": "^4.0.0",
         "graceful-fs": "^4.2.4",
         "micromatch": "^4.0.4",
-        "pretty-format": "^27.2.5",
+        "pretty-format": "^27.3.0",
         "slash": "^3.0.0",
         "stack-utils": "^2.0.3"
       },
       "dev": true
     },
     "mocha": {
-      "version": "9.1.2",
-      "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.2.tgz",
-      "integrity": "sha512-ta3LtJ+63RIBP03VBjMGtSqbe6cWXRejF9SyM9Zyli1CKZJZ+vfCTj3oW24V7wAphMJdpOFLoMI3hjJ1LWbs0w==",
+      "version": "9.1.3",
+      "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.1.3.tgz",
+      "integrity": "sha512-Xcpl9FqXOAYqI3j79pEtHBBnQgVXIhpULjGQa7DVb0Po+VzmSIK9kanAiWLHoRR/dbZ2qpdPshuXr8l1VaHCzw==",
       "dev": true,
       "requires": {
         "@ungap/promise-all-settled": "1.1.2",
       "dev": true
     },
     "pretty-format": {
-      "version": "27.2.5",
-      "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.2.5.tgz",
-      "integrity": "sha512-+nYn2z9GgicO9JiqmY25Xtq8SYfZ/5VCpEU3pppHHNAhd1y+ZXxmNPd1evmNcAd6Hz4iBV2kf0UpGth5A/VJ7g==",
+      "version": "27.3.0",
+      "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.3.0.tgz",
+      "integrity": "sha512-Nkdd0xmxZdjCe6GoJomHnrLcCYGYzZKI/fRnUX0sCwDai2mmCHJfC9Ecx33lYgaxAFS/pJCAqhfxmWlm1wNVag==",
       "dev": true,
       "requires": {
         "@jest/types": "^27.2.5",
index 44a56170a2eef4041089291dc162e613962abe26..eca63f40764c44623c32cfcce46c8f6ea63a2c51 100644 (file)
     "eslint-plugin-import": "^2.25.2",
     "eslint-plugin-jsdoc": "^36.1.1",
     "eslint-plugin-node": "^11.1.0",
-    "expect": "^27.2.5",
-    "mocha": "^9.1.2",
+    "expect": "^27.3.0",
+    "mocha": "^9.1.3",
     "mochawesome": "^6.3.1",
     "npm-check": "^5.9.2",
     "nyc": "^15.1.0",
index b0ca0117c6b2da7eedec99fa278652d13aab497a..92e4a912b652d2a508c5ebb796e3aa1257b46040 100644 (file)
@@ -443,7 +443,7 @@ export default class ChargingStation {
       stationTemplateFromFile = JSON.parse(fs.readFileSync(fileDescriptor, 'utf8')) as ChargingStationTemplate;
       fs.closeSync(fileDescriptor);
     } catch (error) {
-      FileUtils.handleFileException(this.logPrefix(), 'Template', this.stationTemplateFile, error);
+      FileUtils.handleFileException(this.logPrefix(), 'Template', this.stationTemplateFile, error as NodeJS.ErrnoException);
     }
     const stationInfo: ChargingStationInfo = stationTemplateFromFile ?? {} as ChargingStationInfo;
     stationInfo.wsOptions = stationTemplateFromFile?.wsOptions ?? {};
@@ -710,7 +710,7 @@ export default class ChargingStation {
       // Log
       logger.error('%s Incoming OCPP message %j matching cached request %j processing error %j', this.logPrefix(), data.toString(), this.requests.get(messageId), error);
       // Send error
-      messageType === MessageType.CALL_MESSAGE && await this.ocppRequestService.sendError(messageId, error, commandName);
+      messageType === MessageType.CALL_MESSAGE && await this.ocppRequestService.sendError(messageId, error as OCPPError, commandName);
     }
   }
 
@@ -749,7 +749,7 @@ export default class ChargingStation {
         authorizedTags = JSON.parse(fs.readFileSync(fileDescriptor, 'utf8')) as string[];
         fs.closeSync(fileDescriptor);
       } catch (error) {
-        FileUtils.handleFileException(this.logPrefix(), 'Authorization', authorizationFile, error);
+        FileUtils.handleFileException(this.logPrefix(), 'Authorization', authorizationFile, error as NodeJS.ErrnoException);
       }
     } else {
       logger.info(this.logPrefix() + ' No authorization file given in template file ' + this.stationTemplateFile);
@@ -952,7 +952,7 @@ export default class ChargingStation {
     if (this.isWebSocketConnectionOpened() && forceCloseOpened) {
       this.wsConnection.close();
     }
-    let protocol;
+    let protocol: string;
     switch (this.getOCPPVersion()) {
       case OCPPVersion.VERSION_16:
         protocol = 'ocpp' + OCPPVersion.VERSION_16;
@@ -987,7 +987,7 @@ export default class ChargingStation {
           }
         });
       } catch (error) {
-        FileUtils.handleFileException(this.logPrefix(), 'Authorization', authorizationFile, error);
+        FileUtils.handleFileException(this.logPrefix(), 'Authorization', authorizationFile, error as NodeJS.ErrnoException);
       }
     } else {
       logger.info(this.logPrefix() + ' No authorization file given in template file ' + this.stationTemplateFile + '. Not monitoring changes');
@@ -1020,7 +1020,7 @@ export default class ChargingStation {
         }
       });
     } catch (error) {
-      FileUtils.handleFileException(this.logPrefix(), 'Template', this.stationTemplateFile, error);
+      FileUtils.handleFileException(this.logPrefix(), 'Template', this.stationTemplateFile, error as NodeJS.ErrnoException);
     }
   }
 
index 1aa5a9bb2ddedb1f416c6dfbff13ac5a99cc3440..eb0bdb8036a67f2063a8ef19ac09d385831aea28 100644 (file)
@@ -409,7 +409,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
         if (ftpClient) {
           ftpClient.close();
         }
-        return this.handleIncomingRequestError(OCPP16IncomingRequestCommand.GET_DIAGNOSTICS, error, Constants.OCPP_RESPONSE_EMPTY);
+        return this.handleIncomingRequestError(OCPP16IncomingRequestCommand.GET_DIAGNOSTICS, error as Error, Constants.OCPP_RESPONSE_EMPTY);
       }
     } else {
       logger.error(`${this.chargingStation.logPrefix()} Unsupported protocol ${uri.protocol} to transfer the diagnostic logs archive`);
@@ -437,7 +437,7 @@ export default class OCPP16IncomingRequestService extends OCPPIncomingRequestSer
           return Constants.OCPP_TRIGGER_MESSAGE_RESPONSE_NOT_IMPLEMENTED;
       }
     } catch (error) {
-      return this.handleIncomingRequestError(OCPP16IncomingRequestCommand.TRIGGER_MESSAGE, error, Constants.OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED);
+      return this.handleIncomingRequestError(OCPP16IncomingRequestCommand.TRIGGER_MESSAGE, error as Error, Constants.OCPP_TRIGGER_MESSAGE_RESPONSE_REJECTED);
     }
   }
 }
index 4daf9628b905aa08ceecffa78b8cc6abf3e35fd2..4acaaac128400a85fc01f864d7001abe9409e719 100644 (file)
@@ -27,7 +27,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       const payload: HeartbeatRequest = {};
       await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.HEARTBEAT);
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.HEARTBEAT, error);
+      this.handleRequestError(OCPP16RequestCommand.HEARTBEAT, error as Error);
     }
   }
 
@@ -47,7 +47,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       return await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.BOOT_NOTIFICATION, true) as OCPP16BootNotificationResponse;
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.BOOT_NOTIFICATION, error);
+      this.handleRequestError(OCPP16RequestCommand.BOOT_NOTIFICATION, error as Error);
     }
   }
 
@@ -61,7 +61,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.STATUS_NOTIFICATION);
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.STATUS_NOTIFICATION, error);
+      this.handleRequestError(OCPP16RequestCommand.STATUS_NOTIFICATION, error as Error);
     }
   }
 
@@ -73,7 +73,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       this.chargingStation.getConnectorStatus(connectorId).authorizeIdTag = idTag;
       return await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.AUTHORIZE) as OCPP16AuthorizeResponse;
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.AUTHORIZE, error);
+      this.handleRequestError(OCPP16RequestCommand.AUTHORIZE, error as Error);
     }
   }
 
@@ -87,7 +87,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       return await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.START_TRANSACTION) as OCPP16StartTransactionResponse;
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.START_TRANSACTION, error);
+      this.handleRequestError(OCPP16RequestCommand.START_TRANSACTION, error as Error);
     }
   }
 
@@ -115,7 +115,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       return await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.STOP_TRANSACTION) as OCPP16StartTransactionResponse;
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.STOP_TRANSACTION, error);
+      this.handleRequestError(OCPP16RequestCommand.STOP_TRANSACTION, error as Error);
     }
   }
 
@@ -337,7 +337,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.METER_VALUES);
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error);
+      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error as Error);
     }
   }
 
@@ -350,7 +350,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.METER_VALUES);
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error);
+      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error as Error);
     }
   }
 
@@ -363,7 +363,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.METER_VALUES);
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error);
+      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error as Error);
     }
   }
 
@@ -374,7 +374,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       };
       await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, OCPP16RequestCommand.DIAGNOSTICS_STATUS_NOTIFICATION);
     } catch (error) {
-      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error);
+      this.handleRequestError(OCPP16RequestCommand.METER_VALUES, error as Error);
     }
   }
 
@@ -383,7 +383,7 @@ export default class OCPP16RequestService extends OCPPRequestService {
       // Send error
       return await this.sendMessage(messageId, error, MessageType.CALL_ERROR_MESSAGE, commandName);
     } catch (err) {
-      this.handleRequestError(commandName as OCPP16RequestCommand, err);
+      this.handleRequestError(commandName as OCPP16RequestCommand, err as Error);
     }
   }
 }