eslint
This commit is contained in:
parent
7a23e94e9d
commit
cd5fce820c
|
@ -9,11 +9,15 @@ module.exports = {
|
|||
ecmaVersion: 'latest',
|
||||
sourceType: 'module',
|
||||
},
|
||||
// plugins: ["import"],
|
||||
plugins: [
|
||||
'import',
|
||||
'html',
|
||||
],
|
||||
rules: {
|
||||
'import/extensions': ['error', 'always'],
|
||||
'import/prefer-default-export': ['off'],
|
||||
'import/no-unresolved': ['error', { ignore: ['^http'] }],
|
||||
'import/no-absolute-path': ['off'],
|
||||
'no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
|
||||
'max-classes-per-file': ['off'],
|
||||
'no-param-reassign': ['off'],
|
||||
|
|
|
@ -388,6 +388,49 @@
|
|||
"esutils": "^2.0.2"
|
||||
}
|
||||
},
|
||||
"dom-serializer": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-2.0.0.tgz",
|
||||
"integrity": "sha512-wIkAryiqt/nV5EQKqQpo3SToSOV9J0DnbJqwK7Wv/Trc92zIAYZ4FlMu+JPFW1DfGFt81ZTCGgDEabffXeLyJg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.2",
|
||||
"entities": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"domelementtype": {
|
||||
"version": "2.3.0",
|
||||
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz",
|
||||
"integrity": "sha512-OLETBj6w0OsagBwdXnPdN0cnMfF9opN69co+7ZrbfPGrdpPVNBUj02spi6B1N7wChLQiPn4CSH/zJvXw56gmHw==",
|
||||
"dev": true
|
||||
},
|
||||
"domhandler": {
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-5.0.3.tgz",
|
||||
"integrity": "sha512-cgwlv/1iFQiFnU96XXgROh8xTeetsnJiDsTc7TYCLFd9+/WNkIqPTxiM/8pSd8VIrhXGTf1Ny1q1hquVqDJB5w==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"domelementtype": "^2.3.0"
|
||||
}
|
||||
},
|
||||
"domutils": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz",
|
||||
"integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"dom-serializer": "^2.0.0",
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"entities": {
|
||||
"version": "4.4.0",
|
||||
"resolved": "https://registry.npmjs.org/entities/-/entities-4.4.0.tgz",
|
||||
"integrity": "sha512-oYp7156SP8LkeGD0GF85ad1X9Ai79WtRsZ2gxJqtBuzH+98YUV6jkHEKlZkMbcrjJjIVJNIDP/3WL9wQkoPbWA==",
|
||||
"dev": true
|
||||
},
|
||||
"es-abstract": {
|
||||
"version": "1.20.4",
|
||||
"resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.20.4.tgz",
|
||||
|
@ -546,6 +589,15 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
"eslint-plugin-html": {
|
||||
"version": "7.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-7.1.0.tgz",
|
||||
"integrity": "sha512-fNLRraV/e6j8e3XYOC9xgND4j+U7b1Rq+OygMlLcMg+wI/IpVbF+ubQa3R78EjKB9njT6TQOlcK5rFKBVVtdfg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"htmlparser2": "^8.0.1"
|
||||
}
|
||||
},
|
||||
"eslint-plugin-import": {
|
||||
"version": "2.26.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.26.0.tgz",
|
||||
|
@ -927,6 +979,18 @@
|
|||
"has-symbols": "^1.0.2"
|
||||
}
|
||||
},
|
||||
"htmlparser2": {
|
||||
"version": "8.0.1",
|
||||
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-8.0.1.tgz",
|
||||
"integrity": "sha512-4lVbmc1diZC7GUJQtRQ5yBAeUCL1exyMwmForWkRLnwyzWBFxN633SALPMGYaWZvKe9j1pRZJpauvmxENSp/EA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.2",
|
||||
"domutils": "^3.0.1",
|
||||
"entities": "^4.3.0"
|
||||
}
|
||||
},
|
||||
"ignore": {
|
||||
"version": "5.2.0",
|
||||
"resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.0.tgz",
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
"devDependencies": {
|
||||
"eslint": "^8.27.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-html": "^7.1.0",
|
||||
"eslint-plugin-import": "^2.26.0",
|
||||
"prettier": "^2.7.1",
|
||||
"prettier-eslint": "^15.0.1"
|
||||
|
|
|
@ -83,7 +83,7 @@ export class ForumNode extends Actor {
|
|||
}
|
||||
|
||||
// Process an incoming post, received by whatever means
|
||||
processPost(authorId, post, stake) {
|
||||
async processPost(authorId, post, stake) {
|
||||
if (!post.id) {
|
||||
post.id = CryptoUtil.randomUUID();
|
||||
}
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
<div id="availability-test"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { Bench } from "/classes/bench.js";
|
||||
import { Business } from "/classes/business.js";
|
||||
import { Availability } from "/classes/availability.js";
|
||||
import { Box } from "/../classes/box.js";
|
||||
import { Scene } from "/../classes/scene.js";
|
||||
import { Expert } from "/../classes/expert.js";
|
||||
import { Bench } from "/../classes/bench.js";
|
||||
import { Business } from "/../classes/business.js";
|
||||
import { Availability } from "/../classes/availability.js";
|
||||
import { delay } from "/util.js";
|
||||
import { Forum } from "/classes/forum.js";
|
||||
import { Public } from "/classes/public.js";
|
||||
import { Forum } from "/../classes/forum.js";
|
||||
import { Public } from "/../classes/public.js";
|
||||
|
||||
const DELAY_INTERVAL = 500;
|
||||
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<div id="basic"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Box } from "/../classes/box.js";
|
||||
import { Scene } from "/../classes/scene.js";
|
||||
|
||||
const rootElement = document.getElementById("basic");
|
||||
const rootBox = new Box("rootBox", rootElement).flex();
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<div id="debounce-test"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Box } from "/../classes/box.js";
|
||||
import { Scene } from "/../classes/scene.js";
|
||||
import { debounce, delay } from "/util.js";
|
||||
|
||||
const rootElement = document.getElementById("debounce-test");
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<div id="flowchart-test"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Actor } from "/classes/actor.js";
|
||||
import { Action } from "/classes/action.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { Box } from "/../classes/box.js";
|
||||
import { Scene } from "/../classes/scene.js";
|
||||
import { Actor } from "/../classes/actor.js";
|
||||
import { Action } from "/../classes/action.js";
|
||||
import { Expert } from "/../classes/expert.js";
|
||||
import { delay } from "/util.js";
|
||||
|
||||
const DEFAULT_DELAY_INTERVAL = 500;
|
||||
|
|
|
@ -7,13 +7,13 @@
|
|||
<div id="forum-network"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { PostContent } from "/classes/post-content.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { ForumNode } from "/classes/forum-node.js";
|
||||
import { ForumNetwork } from "/classes/forum-network.js";
|
||||
import { CryptoUtil } from "/classes/crypto.js";
|
||||
import { Box } from "/../classes/box.js";
|
||||
import { Scene } from "/../classes/scene.js";
|
||||
import { PostContent } from "/../classes/post-content.js";
|
||||
import { Expert } from "/../classes/expert.js";
|
||||
import { ForumNode } from "/../classes/forum-node.js";
|
||||
import { ForumNetwork } from "/../classes/forum-network.js";
|
||||
import { CryptoUtil } from "/../classes/crypto.js";
|
||||
import { delay } from "/util.js";
|
||||
|
||||
const rootElement = document.getElementById("forum-network");
|
||||
|
|
|
@ -7,34 +7,31 @@
|
|||
<div id="forum-test"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { Bench } from "/classes/bench.js";
|
||||
import { Business } from "/classes/business.js";
|
||||
import { Availability } from "/classes/availability.js";
|
||||
import { delay } from "/util.js";
|
||||
import { Forum } from "/classes/forum.js";
|
||||
import { Public } from "/classes/public.js";
|
||||
import { PostContent } from "/classes/post-content.js";
|
||||
import params from "/params.js";
|
||||
import { Box } from '../classes/box.js';
|
||||
import { Scene } from '../classes/scene.js';
|
||||
import { Expert } from '../classes/expert.js';
|
||||
import { Bench } from '../classes/bench.js';
|
||||
import { delay } from '../util.js';
|
||||
import { Forum } from '../classes/forum.js';
|
||||
import { PostContent } from '../classes/post-content.js';
|
||||
import params from '../params.js';
|
||||
|
||||
const DEFAULT_DELAY_INTERVAL = 500;
|
||||
|
||||
const rootElement = document.getElementById("forum-test");
|
||||
const rootBox = new Box("rootBox", rootElement).flex();
|
||||
const rootElement = document.getElementById('forum-test');
|
||||
const rootBox = new Box('rootBox', rootElement).flex();
|
||||
|
||||
const scene = (window.scene = new Scene("Forum test", rootBox));
|
||||
const scene = (window.scene = new Scene('Forum test', rootBox));
|
||||
scene.withSequenceDiagram();
|
||||
scene.withFlowchart();
|
||||
|
||||
scene.addDisplayValue("c3. stakeForAuthor").set(params.stakeForAuthor);
|
||||
scene.addDisplayValue("q2. revaluationLimit").set(params.revaluationLimit);
|
||||
scene.addDisplayValue('c3. stakeForAuthor').set(params.stakeForAuthor);
|
||||
scene.addDisplayValue('q2. revaluationLimit').set(params.revaluationLimit);
|
||||
scene
|
||||
.addDisplayValue("q3. referenceChainLimit")
|
||||
.addDisplayValue('q3. referenceChainLimit')
|
||||
.set(params.referenceChainLimit);
|
||||
scene.addDisplayValue("q4. leachingValue").set(params.leachingValue);
|
||||
scene.addDisplayValue(" ");
|
||||
scene.addDisplayValue('q4. leachingValue').set(params.leachingValue);
|
||||
scene.addDisplayValue(' ');
|
||||
|
||||
const experts = (window.experts = []);
|
||||
const newExpert = async () => {
|
||||
|
@ -46,8 +43,8 @@
|
|||
return expert;
|
||||
};
|
||||
|
||||
const forum = (window.forum = new Forum("Forum", scene));
|
||||
const bench = (window.bench = new Bench(forum, "Bench", scene));
|
||||
const forum = (window.forum = new Forum('Forum', scene));
|
||||
const bench = (window.bench = new Bench(forum, 'Bench', scene));
|
||||
const expert1 = await newExpert();
|
||||
const expert2 = await newExpert();
|
||||
const expert3 = await newExpert();
|
||||
|
@ -55,12 +52,12 @@
|
|||
const updateDisplayValues = async () => {
|
||||
for (const expert of experts) {
|
||||
await expert.setValue(
|
||||
"rep",
|
||||
bench.reputations.getTokens(expert.reputationPublicKey)
|
||||
'rep',
|
||||
bench.reputations.getTokens(expert.reputationPublicKey),
|
||||
);
|
||||
}
|
||||
await bench.setValue("total rep", bench.getTotalReputation());
|
||||
await forum.setValue("total value", forum.getTotalValue());
|
||||
await bench.setValue('total rep', bench.getTotalReputation());
|
||||
await forum.setValue('total value', forum.getTotalValue());
|
||||
};
|
||||
|
||||
const updateDisplayValuesAndDelay = async (delayMs) => {
|
||||
|
@ -75,13 +72,13 @@
|
|||
const { postId: postId1, pool: pool1 } = await expert1.submitPostWithFee(
|
||||
bench,
|
||||
forum,
|
||||
new PostContent({ hello: "there" }).setTitle("Post 1"),
|
||||
new PostContent({ hello: 'there' }).setTitle('Post 1'),
|
||||
{
|
||||
fee: 10,
|
||||
duration: 1000,
|
||||
tokenLossRatio: 1,
|
||||
// authorStake: 10,
|
||||
}
|
||||
},
|
||||
);
|
||||
await updateDisplayValuesAndDelay(1000);
|
||||
|
||||
|
@ -97,14 +94,14 @@
|
|||
const { postId: postId2, pool: pool2 } = await expert2.submitPostWithFee(
|
||||
bench,
|
||||
forum,
|
||||
new PostContent({ hello: "to you as well" })
|
||||
.setTitle("Post 2")
|
||||
new PostContent({ hello: 'to you as well' })
|
||||
.setTitle('Post 2')
|
||||
.addCitation(postId1, 0.5),
|
||||
{
|
||||
fee: 10,
|
||||
duration: 1000,
|
||||
tokenLossRatio: 1,
|
||||
}
|
||||
},
|
||||
);
|
||||
await updateDisplayValuesAndDelay(1000);
|
||||
|
||||
|
@ -121,13 +118,13 @@
|
|||
bench,
|
||||
forum,
|
||||
new PostContent({ hello: "y'all" })
|
||||
.setTitle("Post 3")
|
||||
.setTitle('Post 3')
|
||||
.addCitation(postId2, -0.5),
|
||||
{
|
||||
fee: 100,
|
||||
duration: 1000,
|
||||
tokenLossRatio: 1,
|
||||
}
|
||||
},
|
||||
);
|
||||
await updateDisplayValuesAndDelay(1000);
|
||||
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<div id="graph-test"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Graph } from "/classes/graph.js";
|
||||
import { Box } from "/../classes/box.js";
|
||||
import { Scene } from "/../classes/scene.js";
|
||||
import { Graph } from "/../classes/graph.js";
|
||||
|
||||
const rootElement = document.getElementById("graph-test");
|
||||
const rootBox = new Box("rootBox", rootElement).flex();
|
||||
|
|
|
@ -7,11 +7,11 @@
|
|||
<div id="validation-pool"></div>
|
||||
</body>
|
||||
<script type="module">
|
||||
import { Box } from "/classes/box.js";
|
||||
import { Scene } from "/classes/scene.js";
|
||||
import { Expert } from "/classes/expert.js";
|
||||
import { Bench } from "/classes/bench.js";
|
||||
import { Forum } from "/classes/forum.js";
|
||||
import { Box } from "/../classes/box.js";
|
||||
import { Scene } from "/../classes/scene.js";
|
||||
import { Expert } from "/../classes/expert.js";
|
||||
import { Bench } from "/../classes/bench.js";
|
||||
import { Forum } from "/../classes/forum.js";
|
||||
import { delay } from "/util.js";
|
||||
|
||||
const rootElement = document.getElementById("validation-pool");
|
||||
|
|
Loading…
Reference in New Issue