From cda7a91382559eb2e5a4da6f129ba075697d80d1 Mon Sep 17 00:00:00 2001
From: Benoit Lavenier <benoit.lavenier@e-is.pro>
Date: Fri, 16 Jun 2023 11:59:29 +0200
Subject: [PATCH] fix(ts): format code

---
 app/lib/blockchain/DuniterBlockchain.ts          | 16 +++++++++-------
 app/lib/dal/fileDAL.ts                           |  4 ++--
 app/lib/indexer.ts                               |  3 ++-
 app/modules/crawler/lib/sync.ts                  |  3 +--
 .../crawler/lib/sync/v2/GlobalIndexStream.ts     |  3 ++-
 5 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/app/lib/blockchain/DuniterBlockchain.ts b/app/lib/blockchain/DuniterBlockchain.ts
index 86f7a7111..70e8c2dd9 100644
--- a/app/lib/blockchain/DuniterBlockchain.ts
+++ b/app/lib/blockchain/DuniterBlockchain.ts
@@ -715,11 +715,13 @@ export function requiredBindexSizeForTail(
   TAIL: { issuersCount: number; issuersFrame: number },
   conf: { medianTimeBlocks: number; dtDiffEval: number; forksize: number }
 ) {
-  return conf.forksize +
-      [
-        TAIL.issuersCount,
-        TAIL.issuersFrame,
-        conf.medianTimeBlocks,
-        conf.dtDiffEval,
-      ].reduce((max, value) => Math.max(max, value), 0);
+  return (
+    conf.forksize +
+    [
+      TAIL.issuersCount,
+      TAIL.issuersFrame,
+      conf.medianTimeBlocks,
+      conf.dtDiffEval,
+    ].reduce((max, value) => Math.max(max, value), 0)
+  );
 }
diff --git a/app/lib/dal/fileDAL.ts b/app/lib/dal/fileDAL.ts
index 7964a8941..83f911f12 100644
--- a/app/lib/dal/fileDAL.ts
+++ b/app/lib/dal/fileDAL.ts
@@ -1309,7 +1309,7 @@ export class FileDAL implements ServerDAO {
 
   @MonitorExecutionTime()
   async trimIndexes(maxNumber: number) {
-    logger.trace('Trim indexes below block #%s', maxNumber)
+    logger.trace("Trim indexes below block #%s", maxNumber);
     if (!cliprogram.notrim) {
       await this.bindexDAL.trimBlocks(maxNumber);
       await this.iindexDAL.trimRecords(maxNumber);
@@ -1323,7 +1323,7 @@ export class FileDAL implements ServerDAO {
   }
 
   async trimSandboxes(block: { medianTime: number }) {
-    logger.trace('Trim sandboxes below median time %s', block.medianTime)
+    logger.trace("Trim sandboxes below median time %s", block.medianTime);
     await this.certDAL.trimExpiredCerts(block.medianTime);
     await this.msDAL.trimExpiredMemberships(block.medianTime);
     await this.idtyDAL.trimExpiredIdentities(block.medianTime);
diff --git a/app/lib/indexer.ts b/app/lib/indexer.ts
index 8759a80d8..3a9bdf3b9 100644
--- a/app/lib/indexer.ts
+++ b/app/lib/indexer.ts
@@ -601,7 +601,8 @@ export class Indexer {
     const HEAD_1 = await head(1);
 
     // CHECK Bindex is valid
-    if (HEAD_1 && HEAD_1.number !== HEAD.number - 1) throw new Error('Invalid bindex: cannot found HEAD-1!');
+    if (HEAD_1 && HEAD_1.number !== HEAD.number - 1)
+      throw new Error("Invalid bindex: cannot found HEAD-1!");
 
     // BR_G04
     await Indexer.prepareIssuersCount(HEAD, range, HEAD_1);
diff --git a/app/modules/crawler/lib/sync.ts b/app/modules/crawler/lib/sync.ts
index 6a5d4dded..d5d7bbbee 100644
--- a/app/modules/crawler/lib/sync.ts
+++ b/app/modules/crawler/lib/sync.ts
@@ -260,8 +260,7 @@ export class Synchroniser extends stream.Duplex {
         );
       this.watcher.end();
       throw err;
-    }
-    finally {
+    } finally {
       // Make sure to enable check constraints, even if failed
       await this.server.dal.enableCheckConstraints();
     }
diff --git a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
index 48a28c8cc..b77c6add6 100644
--- a/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
+++ b/app/modules/crawler/lib/sync/v2/GlobalIndexStream.ts
@@ -205,7 +205,8 @@ export class GlobalIndexStream extends Duplex {
 
       const requiredBindexSize = requiredBindexSizeForTail(block, this.conf);
       if (
-        (block.number <= this.to - requiredBindexSize - 1 || cliprogram.noSources) &&
+        (block.number <= this.to - requiredBindexSize - 1 ||
+          cliprogram.noSources) &&
         !this.cautious
       ) {
         // If we require nosources option, this blockchain can't be valid so we don't make checks
-- 
GitLab