From 99f750edaff8554a4f911231ff1964ffa8719dab Mon Sep 17 00:00:00 2001 From: Antoni Spaanderman <56turtle56@gmail.com> Date: Sun, 9 Oct 2022 19:04:14 +0200 Subject: [PATCH] fix eslint command glob pattern --- .eslintignore | 2 ++ dist/src/controllers/botapi/pay.js | 2 +- dist/src/controllers/botapi/pay.js.map | 2 +- dist/src/utils/decode/index.js | 20 ++++++++++---------- dist/src/utils/decode/index.js.map | 2 +- package.json | 2 +- src/controllers/botapi/pay.ts | 2 +- src/utils/decode/index.ts | 20 ++++++++++---------- 8 files changed, 27 insertions(+), 25 deletions(-) diff --git a/.eslintignore b/.eslintignore index 9a041884a..6885e1859 100644 --- a/.eslintignore +++ b/.eslintignore @@ -10,3 +10,5 @@ src/utils/config.ts !src/utils/msg.ts !src/grpc +*.js + diff --git a/dist/src/controllers/botapi/pay.js b/dist/src/controllers/botapi/pay.js index e43d34fe4..145201375 100644 --- a/dist/src/controllers/botapi/pay.js +++ b/dist/src/controllers/botapi/pay.js @@ -26,7 +26,7 @@ function pay(a) { const ret = yield (0, index_1.validateAction)(a); if (!ret) return; - let { chat, owner } = ret; + const { chat, owner } = ret; const tenant = owner.id; const alias = bot_name || owner.alias; const botContactId = -1; diff --git a/dist/src/controllers/botapi/pay.js.map b/dist/src/controllers/botapi/pay.js.map index 9281fdee7..4bafcdf28 100644 --- a/dist/src/controllers/botapi/pay.js.map +++ b/dist/src/controllers/botapi/pay.js.map @@ -1 +1 @@ -{"version":3,"file":"pay.js","sourceRoot":"","sources":["../../../../src/controllers/botapi/pay.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,yCAAwC;AACxC,yCAA8C;AAC9C,oCAAmC;AACnC,8CAA6C;AAC7C,6CAA4C;AAC5C,+CAAuC;AACvC,+CAAiD;AACjD,mCAAgD;AAEhD,SAA8B,GAAG,CAAC,CAAS;;QACzC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EA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;QACtE,MAAM,CAAC,QAAQ,CACb;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC;SACxD,EACD,MAAM,CACP,CAAA;QAED,MAAM,OAAO,CAAC,WAAW,CAAC;YACxB,IAAI,EAAE,IAAW;YACjB,MAAM,kCACD,KAAK,CAAC,UAAU,KACnB,KAAK,EACL,EAAE,EAAE,YAAY,EAChB,IAAI,EAAE,mBAAS,CAAC,UAAU,CAAC,KAAK,GACjC;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,EAAE;gBACX,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,CAAC;aAChC;YACD,IAAI,EAAE,mBAAS,CAAC,aAAa,CAAC,KAAK;YACnC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,OAAO,qBAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YAC9B,CAAC;YACD,WAAW,EAAE,IAAI;YACjB,iBAAiB,EAAE,YAAY;SAChC,CAAC,CAAA;IACJ,CAAC;CAAA;AA9DD,sBA8DC"} \ No newline at end of file +{"version":3,"file":"pay.js","sourceRoot":"","sources":["../../../../src/controllers/botapi/pay.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,yCAAwC;AACxC,yCAA8C;AAC9C,oCAAmC;AACnC,8CAA6C;AAC7C,6CAA4C;AAC5C,+CAAuC;AACvC,+CAAiD;AACjD,mCAAgD;AAEhD,SAA8B,GAAG,CAAC,CAAS;;QACzC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,E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AC,MAAM,CAAC,GAAG,CAAC,CAAY,CAAA;QACtE,MAAM,CAAC,QAAQ,CACb;YACE,IAAI,EAAE,OAAO;YACb,QAAQ,EAAE,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC;SACxD,EACD,MAAM,CACP,CAAA;QAED,MAAM,OAAO,CAAC,WAAW,CAAC;YACxB,IAAI,EAAE,IAAW;YACjB,MAAM,kCACD,KAAK,CAAC,UAAU,KACnB,KAAK,EACL,EAAE,EAAE,YAAY,EAChB,IAAI,EAAE,mBAAS,CAAC,UAAU,CAAC,KAAK,GACjC;YACD,OAAO,EAAE;gBACP,OAAO,EAAE,EAAE;gBACX,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,EAAE,EAAE,OAAO,CAAC,EAAE;gBACd,IAAI,EAAE,OAAO,CAAC,IAAI;gBAClB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,CAAC;aAChC;YACD,IAAI,EAAE,mBAAS,CAAC,aAAa,CAAC,KAAK;YACnC,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;YAClC,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE;gBACb,OAAO,qBAAY,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;YAC9B,CAAC;YACD,WAAW,EAAE,IAAI;YACjB,iBAAiB,EAAE,YAAY;SAChC,CAAC,CAAA;IACJ,CAAC;CAAA;AA9DD,sBA8DC"} \ No newline at end of file diff --git a/dist/src/utils/decode/index.js b/dist/src/utils/decode/index.js index cc92ba13f..9e69806d7 100644 --- a/dist/src/utils/decode/index.js +++ b/dist/src/utils/decode/index.js @@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.decodePaymentRequest = void 0; const decodeUtils = require("./decode"); function decodePaymentRequest(paymentRequest) { - var decodedPaymentRequest = decodeUtils.decode(paymentRequest); - var expirationSeconds = 3600; - var paymentHash = ''; - var memo = ''; - for (var i = 0; i < decodedPaymentRequest.data.tags.length; i++) { - let tag = decodedPaymentRequest.data.tags[i]; + const decodedPaymentRequest = decodeUtils.decode(paymentRequest); + let expirationSeconds = 3600; + let paymentHash = ''; + let memo = ''; + for (let i = 0; i < decodedPaymentRequest.data.tags.length; i++) { + const tag = decodedPaymentRequest.data.tags[i]; if (tag) { if (tag.description == 'payment_hash') { paymentHash = tag.value; @@ -22,10 +22,10 @@ function decodePaymentRequest(paymentRequest) { } } expirationSeconds = parseInt(expirationSeconds.toString() + '000'); - let invoiceDate = parseInt(decodedPaymentRequest.data.time_stamp.toString() + '000'); - let amount = decodedPaymentRequest['human_readable_part']['amount']; - var msat = 0; - var sat = 0; + const invoiceDate = parseInt(decodedPaymentRequest.data.time_stamp.toString() + '000'); + const amount = decodedPaymentRequest['human_readable_part']['amount']; + let msat = 0; + let sat = 0; if (Number.isInteger(amount)) { msat = amount; sat = amount / 1000; diff --git a/dist/src/utils/decode/index.js.map b/dist/src/utils/decode/index.js.map index f6d1077d9..bae2b61ff 100644 --- a/dist/src/utils/decode/index.js.map +++ b/dist/src/utils/decode/index.js.map @@ -1 +1 @@ -{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/decode/index.ts"],"names":[],"mappings":";;;AAAA,wCAAuC;AAEvC,SAAgB,oBAAoB,CAAC,cAAc;IACjD,IAAI,qBAAqB,GAAQ,WAAW,CAAC,MAAM,CAAC,cAAc,CAAC,CAAA;IACnE,IAAI,iBAAiB,GAAG,IAAI,CAAA;IAC5B,IAAI,WAAW,GAAG,EAAE,CAAA;IACpB,IAAI,IAAI,GAAG,EAAE,CAAA;IAEb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAC/D,IAAI,GAAG,GAAG,qBAAqB,CAAC,IAAI,CAAC,I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261bb 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "dev": "rm -rf dist/ && tsc && cp -r public dist/public && node --inspect ./dist/app.js", "build-binaries": "rm -rf dist/ && tsc && cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && pkg . --target node12-alpine-x64,node12-macos-x64 --out-path binaries", "start-ecs": "cp config/app.json dist/config/app.json && cp config/config.json dist/config/config.json && export NODE_ENV=production && node --max-old-space-size=128 dist/app.js", - "lint": "eslint ./src/*.ts ./src/**/*.ts --fix --max-warnings 466" + "lint": "eslint src --fix --max-warnings 479" }, "keywords": [], "author": "", diff --git a/src/controllers/botapi/pay.ts b/src/controllers/botapi/pay.ts index 078fae910..30210823a 100644 --- a/src/controllers/botapi/pay.ts +++ b/src/controllers/botapi/pay.ts @@ -14,7 +14,7 @@ export default async function pay(a: Action): Promise { if (!a.recipient_id) return sphinxLogger.error(`no recipient_id`) const ret = await validateAction(a) if (!ret) return - let { chat, owner } = ret + const { chat, owner } = ret const tenant: number = owner.id const alias = bot_name || owner.alias const botContactId = -1 diff --git a/src/utils/decode/index.ts b/src/utils/decode/index.ts index 930b73427..54a6ce842 100644 --- a/src/utils/decode/index.ts +++ b/src/utils/decode/index.ts @@ -1,13 +1,13 @@ import * as decodeUtils from './decode' export function decodePaymentRequest(paymentRequest) { - var decodedPaymentRequest: any = decodeUtils.decode(paymentRequest) - var expirationSeconds = 3600 - var paymentHash = '' - var memo = '' + const decodedPaymentRequest: any = decodeUtils.decode(paymentRequest) + let expirationSeconds = 3600 + let paymentHash = '' + let memo = '' - for (var i = 0; i < decodedPaymentRequest.data.tags.length; i++) { - let tag = decodedPaymentRequest.data.tags[i] + for (let i = 0; i < decodedPaymentRequest.data.tags.length; i++) { + const tag = decodedPaymentRequest.data.tags[i] if (tag) { if (tag.description == 'payment_hash') { paymentHash = tag.value @@ -20,13 +20,13 @@ export function decodePaymentRequest(paymentRequest) { } expirationSeconds = parseInt(expirationSeconds.toString() + '000') - let invoiceDate = parseInt( + const invoiceDate = parseInt( decodedPaymentRequest.data.time_stamp.toString() + '000' ) - let amount = decodedPaymentRequest['human_readable_part']['amount'] - var msat = 0 - var sat = 0 + const amount = decodedPaymentRequest['human_readable_part']['amount'] + let msat = 0 + let sat = 0 if (Number.isInteger(amount)) { msat = amount sat = amount / 1000