From 8e885426b538674286675d2566ad057cc83bcab7 Mon Sep 17 00:00:00 2001 From: Matthias Andreas Benkard Date: Sun, 5 Jun 2022 12:52:47 +0200 Subject: KB66 Make ESLint happy. Change-Id: If77c7740cd9b776f9c043b246a444788093b0a42 --- src/main/resources/META-INF/resources/.eslintrc.js | 12 +++++++++--- src/main/resources/META-INF/resources/posts/commentBox.js | 9 ++++----- 2 files changed, 13 insertions(+), 8 deletions(-) (limited to 'src/main/resources/META-INF') diff --git a/src/main/resources/META-INF/resources/.eslintrc.js b/src/main/resources/META-INF/resources/.eslintrc.js index 44b9041..2d7f0df 100644 --- a/src/main/resources/META-INF/resources/.eslintrc.js +++ b/src/main/resources/META-INF/resources/.eslintrc.js @@ -94,7 +94,7 @@ module.exports = { "max-lines": "error", "max-lines-per-function": "error", "max-nested-callbacks": "error", - "max-params": "error", + "max-params": "off", "max-statements": "off", "max-statements-per-line": "error", "multiline-comment-style": [ @@ -145,7 +145,13 @@ module.exports = { "no-lone-blocks": "error", "no-lonely-if": "error", "no-loop-func": "error", - "no-magic-numbers": "error", + "no-magic-numbers": [ + "error", + { + ignore: [0], + ignoreArrayIndexes: true + } + ], "no-mixed-operators": "error", "no-mixed-requires": "error", "no-multi-assign": "error", @@ -164,7 +170,7 @@ module.exports = { "no-octal-escape": "error", "no-param-reassign": "error", "no-path-concat": "error", - "no-plusplus": "error", + "no-plusplus": "off", "no-process-env": "error", "no-process-exit": "error", "no-proto": "error", diff --git a/src/main/resources/META-INF/resources/posts/commentBox.js b/src/main/resources/META-INF/resources/posts/commentBox.js index d802a63..96605f9 100644 --- a/src/main/resources/META-INF/resources/posts/commentBox.js +++ b/src/main/resources/META-INF/resources/posts/commentBox.js @@ -1,9 +1,8 @@ document.addEventListener('DOMContentLoaded', () => { const messageEncoder = new TextEncoder(); + const hashcashAttemptBatchSize = 1000; - const acceptableHash = (hash) => - hash[0] === 0 && - hash[1] === 0; + const acceptableHash = (hash) => hash[0] === 0 && hash[1] === 0; const checkSalt = (message, salt, thenC, elseC) => { const saltedMessage = `Hashcash-Salt: ${salt}\n\n${message}`; @@ -33,8 +32,8 @@ document.addEventListener('DOMContentLoaded', () => { commentForm.submit(); }, () => { ++salt; - if (salt % 1000 === 0) { - console.log(`hashcash fail ${salt}, retrying`) + if (salt % hashcashAttemptBatchSize === 0) { + console.log(`hashcash fail ${salt}, retrying`); } setTimeout(tryHashcash, 0); }); -- cgit v1.2.3