diff --git a/.eslintrc.json b/.eslintrc.json index c409610e..18ed0784 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -31,6 +31,6 @@ "deprecation/deprecation": "warn", "@typescript-eslint/no-non-null-assertion": "error", "@typescript-eslint/no-unused-vars": "warn", - "@typescript-eslint/no-this-alias": "warn" + "@typescript-eslint/no-this-alias": "error" } } diff --git a/src/signed-xml.ts b/src/signed-xml.ts index 072201ff..13bf3d08 100644 --- a/src/signed-xml.ts +++ b/src/signed-xml.ts @@ -821,21 +821,20 @@ export class SignedXml { const signedInfoNode = signedInfoNodes[0]; if (typeof callback === "function") { - const self = this; - //Asynchronous flow - this.calculateSignatureValue(doc, function (err, signature) { + // Asynchronous flow + this.calculateSignatureValue(doc, (err, signature) => { if (err) { callback(err); } else { - self.signatureValue = signature || ""; - signatureDoc.insertBefore(self.createSignature(prefix), signedInfoNode.nextSibling); - self.signatureXml = signatureDoc.toString(); - self.signedXml = doc.toString(); - callback(null, self); + this.signatureValue = signature || ""; + signatureDoc.insertBefore(this.createSignature(prefix), signedInfoNode.nextSibling); + this.signatureXml = signatureDoc.toString(); + this.signedXml = doc.toString(); + callback(null, this); } }); } else { - //Synchronous flow + // Synchronous flow this.calculateSignatureValue(doc); signatureDoc.insertBefore(this.createSignature(prefix), signedInfoNode.nextSibling); this.signatureXml = signatureDoc.toString();