<NME> tests-utils.ts
<BEF> import fs from 'fs';
import path from 'path';
import moment from 'moment';
import * as json2csv from 'json2csv';
import { TransactionsAccount } from '../transactions';

let testsConfig: Record<string, any>;
let configurationLoaded = false;

const MISSING_ERROR_MESSAGE = 'Missing test environment configuration. To troubleshoot this issue open CONTRIBUTING.md file and read the "F.A.Q regarding the tests" section.';

export function getTestsConfig() {
  if (configurationLoaded) {
    if (!testsConfig) {
      throw new Error(MISSING_ERROR_MESSAGE);
    }

    return testsConfig;
  }

  configurationLoaded = true;

  try {
    const environmentConfig = process.env.TESTS_CONFIG;
    if (environmentConfig) {
      testsConfig = JSON.parse(environmentConfig);
      return testsConfig;
    }
  } catch (e) {
  }

  try {
    const configPath = path.join(__dirname,'.tests-config');
    testsConfig = require(configPath).default;
    return testsConfig;
  } catch (e) {
  } catch (e) {
    console.error(e);
    throw new Error(MISSING_ERROR_MESSAGE);
  }
}

export function maybeTestCompanyAPI(scraperId: string, filter?: (config: any) => boolean) {
  if (!configurationLoaded) {
    getTestsConfig();
  }
  return testsConfig && testsConfig.companyAPI.enabled &&
  testsConfig.credentials[scraperId] &&
  (!filter || filter(testsConfig)) ? test : test.skip;
}

export function extendAsyncTimeout(timeout = 120000) {
  jest.setTimeout(timeout);
}
export function exportTransactions(fileName, accounts) {
  const config = getTestsConfig();

  if (!config.companyAPI.enabled || !config.companyAPI.excelFilesDist || !fs.existsSync(config.companyAPI.excelFilesDist)) {
    return;
  }


  let data: any = [];

  for (let i = 0; i < accounts.length; i += 1) {
    const account = accounts[i];
    data = [
      ...data,
      ...account.txns.map((txn) => {
        return Object.assign(
          { account: account.accountNumber },
          txn, {
            date: moment(txn.date).format('DD/MM/YYYY'),
            processedDate: moment(txn.processedDate).format('DD/MM/YYYY'),
          },
        );
      })];
  }

  if (data.length === 0) {
    data = [
      {
        comment: 'no transaction found for requested time frame'
      },
    ];
  }
    ];
  }

  const csv = json2csv.parse(data, { withBOM: true });
  const filePath = `${path.join(config.companyAPI.excelFilesDist, fileName)}.csv`;
  fs.writeFileSync(filePath, csv);
}

<MSG> adjust eslint to air-bnb typescript and fix lint issues

<DFF> @@ -30,7 +30,7 @@ export function getTestsConfig() {
   }
 
   try {
-    const configPath = path.join(__dirname,'.tests-config');
+    const configPath = path.join(__dirname, '.tests-config');
     testsConfig = require(configPath).default;
     return testsConfig;
   } catch (e) {
@@ -55,7 +55,9 @@ export function extendAsyncTimeout(timeout = 120000) {
 export function exportTransactions(fileName, accounts) {
   const config = getTestsConfig();
 
-  if (!config.companyAPI.enabled || !config.companyAPI.excelFilesDist || !fs.existsSync(config.companyAPI.excelFilesDist)) {
+  if (!config.companyAPI.enabled ||
+    !config.companyAPI.excelFilesDist ||
+    !fs.existsSync(config.companyAPI.excelFilesDist)) {
     return;
   }
 
@@ -67,20 +69,19 @@ export function exportTransactions(fileName, accounts) {
     data = [
       ...data,
       ...account.txns.map((txn) => {
-        return Object.assign(
-          { account: account.accountNumber },
-          txn, {
-            date: moment(txn.date).format('DD/MM/YYYY'),
-            processedDate: moment(txn.processedDate).format('DD/MM/YYYY'),
-          },
-        );
+        return {
+          account: account.accountNumber,
+          ...txn,
+          date: moment(txn.date).format('DD/MM/YYYY'),
+          processedDate: moment(txn.processedDate).format('DD/MM/YYYY'),
+        };
       })];
   }
 
   if (data.length === 0) {
     data = [
       {
-        comment: 'no transaction found for requested time frame'
+        comment: 'no transaction found for requested time frame',
       },
     ];
   }

adjust eslint to air-bnb typescript and fix lint issues