summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-05 12:52:47 +0200
committerMatthias Andreas Benkard <code@mail.matthias.benkard.de>2022-06-05 12:52:47 +0200
commit8e885426b538674286675d2566ad057cc83bcab7 (patch)
treeeef54cff37e60c59e15ba006be15b9153f1b2c56
parentc980952cfbb7c14d36cdd1e4755615fd1eb3ff59 (diff)
KB66 Make ESLint happy.
Change-Id: If77c7740cd9b776f9c043b246a444788093b0a42
-rw-r--r--src/main/resources/META-INF/resources/.eslintrc.js12
-rw-r--r--src/main/resources/META-INF/resources/posts/commentBox.js9
2 files changed, 13 insertions, 8 deletions
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);
});