eslint suggestions

This commit is contained in:
viktor 2018-03-22 13:04:05 +03:00
parent 32386d5580
commit 9fb30fcb88
26 changed files with 380 additions and 248 deletions

15
.eslintrc Normal file
View File

@ -0,0 +1,15 @@
{
"extends": "react-app",
"rules": {
"no-unused-vars": "off",
"no-trailing-spaces": "error",
"no-mixed-spaces-and-tabs": "error",
"no-whitespace-before-property": "error",
"comma-spacing": "error",
"brace-style": "error",
"func-names": "error",
"no-duplicate-imports": "error",
"no-dupe-class-members": "error",
"arrow-spacing": "error"
}
}

318
package-lock.json generated
View File

@ -62,6 +62,7 @@
"version": "3.0.1",
"resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-3.0.1.tgz",
"integrity": "sha1-r9+UiPsezvyDSPb7IvRk4ypYs2s=",
"dev": true,
"requires": {
"acorn": "3.3.0"
},
@ -69,7 +70,8 @@
"acorn": {
"version": "3.3.0",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-3.3.0.tgz",
"integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo="
"integrity": "sha1-ReN/s56No/JbruP/U2niu18iAXo=",
"dev": true
}
}
},
@ -210,11 +212,13 @@
}
},
"aria-query": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-0.7.0.tgz",
"integrity": "sha512-/r2lHl09V3o74+2MLKEdewoj37YZqiQZnfen1O4iNlrOjUgeKuu1U2yF3iKh6HJxqF+OXkLMfQv65Z/cvxD6vA==",
"version": "0.7.1",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-0.7.1.tgz",
"integrity": "sha1-Jsu1r/ZBRLCoJb4YRuCxbPoAsR4=",
"dev": true,
"requires": {
"ast-types-flow": "0.0.7"
"ast-types-flow": "0.0.7",
"commander": "2.12.2"
}
},
"arr-diff": {
@ -338,7 +342,8 @@
"ast-types-flow": {
"version": "0.0.7",
"resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.7.tgz",
"integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0="
"integrity": "sha1-9wtzXGvKGlycItmCw+Oef+ujva0=",
"dev": true
},
"async": {
"version": "2.6.0",
@ -400,6 +405,7 @@
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-0.1.0.tgz",
"integrity": "sha1-YvWdvFnJ+SQnWco0mWDnov48NsA=",
"dev": true,
"requires": {
"ast-types-flow": "0.0.7"
}
@ -451,6 +457,7 @@
"version": "7.2.3",
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-7.2.3.tgz",
"integrity": "sha1-sv4tgBJkcPXBlELcdXJTqJdxCCc=",
"dev": true,
"requires": {
"babel-code-frame": "6.26.0",
"babel-traverse": "6.26.0",
@ -1703,6 +1710,12 @@
"resolved": "https://registry.npmjs.org/buffer-crc32/-/buffer-crc32-0.2.13.tgz",
"integrity": "sha1-DTM+PwDqxQqhRUq9MO+MKl2ackI="
},
"buffer-from": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.0.0.tgz",
"integrity": "sha512-83apNb8KK0Se60UE1+4Ukbe3HbfELJ6UlI4ldtOGs7So4KD26orJM8hIY9lxdzP+UpItH1Yh/Y8GUvNFWFFRxA==",
"dev": true
},
"buffer-indexof": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/buffer-indexof/-/buffer-indexof-1.1.1.tgz",
@ -1763,6 +1776,7 @@
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz",
"integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=",
"dev": true,
"requires": {
"callsites": "0.2.0"
}
@ -1770,7 +1784,8 @@
"callsites": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz",
"integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo="
"integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=",
"dev": true
},
"camel-case": {
"version": "3.0.0",
@ -1920,7 +1935,8 @@
"circular-json": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz",
"integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A=="
"integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==",
"dev": true
},
"clap": {
"version": "1.2.3",
@ -2191,10 +2207,12 @@
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"concat-stream": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.0.tgz",
"integrity": "sha1-CqxmL9Ur54lk1VMvaUeE5wEQrPc=",
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"dev": true,
"requires": {
"buffer-from": "1.0.0",
"inherits": "2.0.3",
"readable-stream": "2.3.3",
"typedarray": "0.0.6"
@ -2249,7 +2267,8 @@
"contains-path": {
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/contains-path/-/contains-path-0.1.0.tgz",
"integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo="
"integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=",
"dev": true
},
"content-disposition": {
"version": "0.5.2",
@ -2658,7 +2677,8 @@
"damerau-levenshtein": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.4.tgz",
"integrity": "sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ="
"integrity": "sha1-AxkcQyy27qFou3fzpV/9zLiXhRQ=",
"dev": true
},
"dashdash": {
"version": "1.14.1",
@ -2928,9 +2948,10 @@
}
},
"doctrine": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.2.tgz",
"integrity": "sha512-y0tm5Pq6ywp3qSTZ1vPgVdAnbDEoeoc5wlOHXoY1c4Wug/a7JvqHIl7BTvwodaHmejWkK/9dSb3sCYfyo/om8A==",
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz",
"integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==",
"dev": true,
"requires": {
"esutils": "2.0.2"
}
@ -3073,7 +3094,8 @@
"emoji-regex": {
"version": "6.5.1",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-6.5.1.tgz",
"integrity": "sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ=="
"integrity": "sha512-PAHp6TxrCy7MGMFidro8uikr+zlJJKJ/Q6mm2ExZ7HwkyR9lSVFfE3kt36qcwa24BQL7y0G9axycGjK1A/0uNQ==",
"dev": true
},
"emojis-list": {
"version": "2.1.0",
@ -3271,32 +3293,33 @@
}
},
"eslint": {
"version": "4.10.0",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-4.10.0.tgz",
"integrity": "sha512-MMVl8P/dYUFZEvolL8PYt7qc5LNdS2lwheq9BYa5Y07FblhcZqFyaUqlS8TW5QITGex21tV4Lk0a3fK8lsJIkA==",
"version": "4.19.1",
"resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz",
"integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==",
"dev": true,
"requires": {
"ajv": "5.5.1",
"babel-code-frame": "6.26.0",
"chalk": "2.3.0",
"concat-stream": "1.6.0",
"chalk": "2.3.2",
"concat-stream": "1.6.2",
"cross-spawn": "5.1.0",
"debug": "3.1.0",
"doctrine": "2.0.2",
"doctrine": "2.1.0",
"eslint-scope": "3.7.1",
"espree": "3.5.2",
"eslint-visitor-keys": "1.0.0",
"espree": "3.5.4",
"esquery": "1.0.0",
"estraverse": "4.2.0",
"esutils": "2.0.2",
"file-entry-cache": "2.0.0",
"functional-red-black-tree": "1.0.1",
"glob": "7.1.2",
"globals": "9.18.0",
"globals": "11.3.0",
"ignore": "3.3.7",
"imurmurhash": "0.1.4",
"inquirer": "3.3.0",
"is-resolvable": "1.0.0",
"js-yaml": "3.10.0",
"json-stable-stringify": "1.0.1",
"is-resolvable": "1.1.0",
"js-yaml": "3.11.0",
"json-stable-stringify-without-jsonify": "1.0.1",
"levn": "0.3.0",
"lodash": "4.17.4",
"minimatch": "3.0.4",
@ -3306,6 +3329,7 @@
"path-is-inside": "1.0.2",
"pluralize": "7.0.0",
"progress": "2.0.0",
"regexpp": "1.0.1",
"require-uncached": "1.0.3",
"semver": "5.4.1",
"strip-ansi": "4.0.0",
@ -3317,22 +3341,34 @@
"ansi-regex": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz",
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
"integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=",
"dev": true
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"color-convert": "1.9.1"
}
},
"chalk": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz",
"integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==",
"dev": true,
"requires": {
"ansi-styles": "3.2.0",
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
"supports-color": "5.3.0"
}
},
"debug": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
"integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
"dev": true,
"requires": {
"ms": "2.0.0"
}
@ -3340,12 +3376,26 @@
"esprima": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz",
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw=="
"integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==",
"dev": true
},
"globals": {
"version": "11.3.0",
"resolved": "https://registry.npmjs.org/globals/-/globals-11.3.0.tgz",
"integrity": "sha512-kkpcKNlmQan9Z5ZmgqKH/SMbSmjxQ7QjyNqfXVc8VJcoBV2UEg+sxQD15GQofGRh2hfpwUb70VC31DR7Rq5Hdw==",
"dev": true
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"js-yaml": {
"version": "3.10.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.10.0.tgz",
"integrity": "sha512-O2v52ffjLa9VeM43J4XocZE//WT9N0IiwDa3KSHH7Tu8CtH+1qM8SIZvnsTh6v+4yFy5KUY3BHUVwjpfAWsjIA==",
"version": "3.11.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.11.0.tgz",
"integrity": "sha512-saJstZWv7oNeOyBh3+Dx1qWzhW0+e6/8eDzo7p5rDFqxntSztloLtuKu+Ejhtq82jsilwOIZYsCz+lIjthg1Hw==",
"dev": true,
"requires": {
"argparse": "1.0.9",
"esprima": "4.0.0"
@ -3355,21 +3405,33 @@
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz",
"integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=",
"dev": true,
"requires": {
"ansi-regex": "3.0.0"
}
},
"supports-color": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz",
"integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==",
"dev": true,
"requires": {
"has-flag": "3.0.0"
}
}
}
},
"eslint-config-react-app": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-2.0.1.tgz",
"integrity": "sha512-gHtkzfEjKXhgZJ0Bf+EmztFSWwTiMDgoy85sFaTqrxU1BHSJ9i4i/JJtXJofVCU/SOKxYs46LO3ajvuzFQH5rw=="
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-2.1.0.tgz",
"integrity": "sha512-8QZrKWuHVC57Fmu+SsKAVxnI9LycZl7NFQ4H9L+oeISuCXhYdXqsOOIVSjQFW6JF5MXZLFE+21Syhd7mF1IRZQ==",
"dev": true
},
"eslint-import-resolver-node": {
"version": "0.3.1",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.1.tgz",
"integrity": "sha512-yUtXS15gIcij68NmXmP9Ni77AQuCN0itXbCc/jWd8C6/yKZaSNXicpC8cgvjnxVdmfsosIXrjpzFq7GcDryb6A==",
"version": "0.3.2",
"resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.2.tgz",
"integrity": "sha512-sfmTqJfPSizWu4aymbPr4Iidp5yKm8yDkHp+Ir3YiTHiiDfxh69mOUsmiqW6RZ9zRXFaF64GtYmN7e+8GHBv6Q==",
"dev": true,
"requires": {
"debug": "2.6.9",
"resolve": "1.5.0"
@ -3391,6 +3453,7 @@
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.1.1.tgz",
"integrity": "sha512-jDI/X5l/6D1rRD/3T43q8Qgbls2nq5km5KSqiwlyUbGo5+04fXhMKdCPhjwbqAa6HXWaMxj8Q4hQDIh7IadJQw==",
"dev": true,
"requires": {
"debug": "2.6.9",
"pkg-dir": "1.0.0"
@ -3400,6 +3463,7 @@
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-1.1.2.tgz",
"integrity": "sha1-ay6YIrGizgpgq2TWEOzK1TyyTQ8=",
"dev": true,
"requires": {
"path-exists": "2.1.0",
"pinkie-promise": "2.0.1"
@ -3409,6 +3473,7 @@
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-2.1.0.tgz",
"integrity": "sha1-D+tsZPD8UY2adU3V77YscCJ2H0s=",
"dev": true,
"requires": {
"pinkie-promise": "2.0.1"
}
@ -3417,6 +3482,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-1.0.0.tgz",
"integrity": "sha1-ektQio1bstYp1EcFb/TpyTFM89Q=",
"dev": true,
"requires": {
"find-up": "1.1.2"
}
@ -3424,26 +3490,28 @@
}
},
"eslint-plugin-flowtype": {
"version": "2.39.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.39.1.tgz",
"integrity": "sha512-RiQv+7Z9QDJuzt+NO8sYgkLGT+h+WeCrxP7y8lI7wpU41x3x/2o3PGtHk9ck8QnA9/mlbNcy/hG0eKvmd7npaA==",
"version": "2.46.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-2.46.1.tgz",
"integrity": "sha512-GJzxW7QwiIiW0ZA/+nY+N5TuK3es4Uei0D4xuy14dLZBYEFhM6e7c0J1u4+/iwfPqFtkr5a0oSApnSKF4U6KHw==",
"dev": true,
"requires": {
"lodash": "4.17.4"
}
},
"eslint-plugin-import": {
"version": "2.8.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.8.0.tgz",
"integrity": "sha512-Rf7dfKJxZ16QuTgVv1OYNxkZcsu/hULFnC+e+w0Gzi6jMC3guQoWQgxYxc54IDRinlb6/0v5z/PxxIKmVctN+g==",
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.9.0.tgz",
"integrity": "sha1-JgAu+/ylmJtyiKwEdQi9JPIXsWk=",
"dev": true,
"requires": {
"builtin-modules": "1.1.1",
"contains-path": "0.1.0",
"debug": "2.6.9",
"doctrine": "1.5.0",
"eslint-import-resolver-node": "0.3.1",
"eslint-import-resolver-node": "0.3.2",
"eslint-module-utils": "2.1.1",
"has": "1.0.1",
"lodash.cond": "4.5.2",
"lodash": "4.17.4",
"minimatch": "3.0.4",
"read-pkg-up": "2.0.0"
},
@ -3452,6 +3520,7 @@
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz",
"integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=",
"dev": true,
"requires": {
"esutils": "2.0.2",
"isarray": "1.0.0"
@ -3461,6 +3530,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz",
"integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=",
"dev": true,
"requires": {
"graceful-fs": "4.1.11",
"parse-json": "2.2.0",
@ -3472,6 +3542,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz",
"integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=",
"dev": true,
"requires": {
"pify": "2.3.0"
}
@ -3480,6 +3551,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz",
"integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=",
"dev": true,
"requires": {
"load-json-file": "2.0.0",
"normalize-package-data": "2.4.0",
@ -3490,6 +3562,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz",
"integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=",
"dev": true,
"requires": {
"find-up": "2.1.0",
"read-pkg": "2.0.0"
@ -3498,7 +3571,8 @@
"strip-bom": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz",
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM="
"integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=",
"dev": true
}
}
},
@ -3506,8 +3580,9 @@
"version": "5.1.1",
"resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-5.1.1.tgz",
"integrity": "sha512-5I9SpoP7gT4wBFOtXT8/tXNPYohHBVfyVfO17vkbC7r9kEIxYJF12D3pKqhk8+xnk12rfxKClS3WCFpVckFTPQ==",
"dev": true,
"requires": {
"aria-query": "0.7.0",
"aria-query": "0.7.1",
"array-includes": "3.0.3",
"ast-types-flow": "0.0.7",
"axobject-query": "0.1.0",
@ -3517,11 +3592,12 @@
}
},
"eslint-plugin-react": {
"version": "7.4.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.4.0.tgz",
"integrity": "sha512-tvjU9u3VqmW2vVuYnE8Qptq+6ji4JltjOjJ9u7VAOxVYkUkyBZWRvNYKbDv5fN+L6wiA+4we9+qQahZ0m63XEA==",
"version": "7.7.0",
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.7.0.tgz",
"integrity": "sha512-KC7Snr4YsWZD5flu6A5c0AcIZidzW3Exbqp7OT67OaD2AppJtlBr/GuPrW/vaQM/yfZotEvKAdrxrO+v8vwYJA==",
"dev": true,
"requires": {
"doctrine": "2.0.2",
"doctrine": "2.1.0",
"has": "1.0.1",
"jsx-ast-utils": "2.0.1",
"prop-types": "15.6.0"
@ -3531,6 +3607,7 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz",
"integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=",
"dev": true,
"requires": {
"array-includes": "3.0.3"
}
@ -3541,18 +3618,34 @@
"version": "3.7.1",
"resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz",
"integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=",
"dev": true,
"requires": {
"esrecurse": "4.2.0",
"estraverse": "4.2.0"
}
},
"eslint-visitor-keys": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz",
"integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==",
"dev": true
},
"espree": {
"version": "3.5.2",
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.2.tgz",
"integrity": "sha512-sadKeYwaR/aJ3stC2CdvgXu1T16TdYN+qwCpcWbMnGJ8s0zNWemzrvb2GbD4OhmJ/fwpJjudThAlLobGbWZbCQ==",
"version": "3.5.4",
"resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz",
"integrity": "sha512-yAcIQxtmMiB/jL32dzEp2enBeidsB7xWPLNiw3IIkpVds1P+h7qF9YwJq1yUNzp2OKXgAprs4F61ih66UsoD1A==",
"dev": true,
"requires": {
"acorn": "5.2.1",
"acorn": "5.5.3",
"acorn-jsx": "3.0.1"
},
"dependencies": {
"acorn": {
"version": "5.5.3",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-5.5.3.tgz",
"integrity": "sha512-jd5MkIUlbbmb07nXH0DT3y7rDVtkzDi4XZOUVWAer8ajmF/DTSSbl5oNFyDOl/OXA33Bl79+ypHhl2pN20VeOQ==",
"dev": true
}
}
},
"esprima": {
@ -3564,6 +3657,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.0.tgz",
"integrity": "sha1-z7qLV9f7qT8XKYqKAGoEzaE9gPo=",
"dev": true,
"requires": {
"estraverse": "4.2.0"
}
@ -3894,6 +3988,7 @@
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz",
"integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=",
"dev": true,
"requires": {
"flat-cache": "1.3.0",
"object-assign": "4.1.1"
@ -3985,6 +4080,7 @@
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.0.tgz",
"integrity": "sha1-0wMLMrOBVPTjt+nHCfSQ9++XxIE=",
"dev": true,
"requires": {
"circular-json": "0.3.3",
"del": "2.2.2",
@ -4910,7 +5006,8 @@
"functional-red-black-tree": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc="
"integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"dev": true
},
"gauge": {
"version": "2.7.4",
@ -5673,7 +5770,8 @@
"ignore": {
"version": "3.3.7",
"resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.7.tgz",
"integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA=="
"integrity": "sha512-YGG3ejvBNHRqu0559EOxxNFihD0AjpvHlC/pdGKd3X3ofe+CoJkYazwNJYTNebqpPKN+VVQbh4ZFn1DivMNuHA==",
"dev": true
},
"ignore-by-default": {
"version": "1.0.1",
@ -6119,12 +6217,10 @@
}
},
"is-resolvable": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz",
"integrity": "sha1-jfV8YeouPFAUCNEA+wE8+NbgzGI=",
"requires": {
"tryit": "1.0.3"
}
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz",
"integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==",
"dev": true
},
"is-retry-allowed": {
"version": "1.1.0",
@ -6685,6 +6781,12 @@
"jsonify": "0.0.0"
}
},
"json-stable-stringify-without-jsonify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz",
"integrity": "sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE=",
"dev": true
},
"json-stringify-safe": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@ -6732,7 +6834,8 @@
"jsx-ast-utils": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-1.4.1.tgz",
"integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE="
"integrity": "sha1-OGchPo3Xm/Ho8jAMDPwe+xgsDfE=",
"dev": true
},
"keccakjs": {
"version": "0.2.1",
@ -6911,11 +7014,6 @@
"resolved": "https://registry.npmjs.org/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz",
"integrity": "sha1-4j8/nE+Pvd6HJSnBBxhXoIblzO8="
},
"lodash.cond": {
"version": "4.5.2",
"resolved": "https://registry.npmjs.org/lodash.cond/-/lodash.cond-4.5.2.tgz",
"integrity": "sha1-9HGh2khr5g9quVXRcRVSPdHSVdU="
},
"lodash.debounce": {
"version": "4.0.8",
"resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz",
@ -8792,7 +8890,8 @@
"pluralize": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz",
"integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow=="
"integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==",
"dev": true
},
"portfinder": {
"version": "1.0.13",
@ -10017,7 +10116,8 @@
"progress": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz",
"integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8="
"integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=",
"dev": true
},
"promise": {
"version": "8.0.1",
@ -10497,6 +10597,12 @@
"extend-shallow": "2.0.1"
}
},
"regexpp": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.0.1.tgz",
"integrity": "sha512-8Ph721maXiOYSLtaDGKVmDn5wdsNaF6Px85qFNeMPQq0r8K5Y10tgP6YuR65Ws35n4DvzFcCxEnRNBIXQunzLw==",
"dev": true
},
"regexpu-core": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz",
@ -10639,6 +10745,7 @@
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz",
"integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=",
"dev": true,
"requires": {
"caller-path": "0.1.0",
"resolve-from": "1.0.1"
@ -10684,7 +10791,8 @@
"resolve-from": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz",
"integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY="
"integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=",
"dev": true
},
"resolve-pathname": {
"version": "2.2.0",
@ -11096,6 +11204,7 @@
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz",
"integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==",
"dev": true,
"requires": {
"is-fullwidth-code-point": "2.0.0"
}
@ -11783,23 +11892,49 @@
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz",
"integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==",
"dev": true,
"requires": {
"ajv": "5.5.1",
"ajv-keywords": "2.1.1",
"chalk": "2.3.0",
"chalk": "2.3.2",
"lodash": "4.17.4",
"slice-ansi": "1.0.0",
"string-width": "2.1.1"
},
"dependencies": {
"chalk": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.0.tgz",
"integrity": "sha512-Az5zJR2CBujap2rqXGaJKaPHyJ0IrUimvYNX+ncCy8PJP4ltOGTrHUIo097ZaL2zMeKYpiCdqDvS6zdrTFok3Q==",
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"dev": true,
"requires": {
"ansi-styles": "3.2.0",
"color-convert": "1.9.1"
}
},
"chalk": {
"version": "2.3.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.3.2.tgz",
"integrity": "sha512-ZM4j2/ld/YZDc3Ma8PgN7gyAk+kHMMMyzLNryCPGhWrsfAuDVeuid5bpRFTDgMH9JBK2lA4dyyAkkZYF/WcqDQ==",
"dev": true,
"requires": {
"ansi-styles": "3.2.1",
"escape-string-regexp": "1.0.5",
"supports-color": "4.5.0"
"supports-color": "5.3.0"
}
},
"has-flag": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
"integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
"dev": true
},
"supports-color": {
"version": "5.3.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.3.0.tgz",
"integrity": "sha512-0aP01LLIskjKs3lq52EC0aGBAJhLq7B2Rd8HC/DR/PtNNpcLilNmHC12O+hu0usQpo7wtHNRqtrhBwtDb0+dNg==",
"dev": true,
"requires": {
"has-flag": "3.0.0"
}
}
}
@ -12166,11 +12301,6 @@
}
}
},
"tryit": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/tryit/-/tryit-1.0.3.tgz",
"integrity": "sha1-OTvnMKlEb9Hq1tpZoBQwjzbCics="
},
"tty-browserify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz",
@ -12210,7 +12340,8 @@
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c="
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
"typedarray-to-buffer": {
"version": "3.1.2",
@ -13590,6 +13721,7 @@
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz",
"integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=",
"dev": true,
"requires": {
"mkdirp": "0.5.1"
}

View File

@ -6,7 +6,6 @@
"dependencies": {
"autoprefixer": "7.1.6",
"babel-core": "6.26.0",
"babel-eslint": "7.2.3",
"babel-jest": "20.0.3",
"babel-loader": "7.1.2",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
@ -20,13 +19,7 @@
"chalk": "1.1.3",
"css-loader": "0.28.7",
"dotenv": "4.0.0",
"eslint": "4.10.0",
"eslint-config-react-app": "^2.0.1",
"eslint-loader": "1.9.0",
"eslint-plugin-flowtype": "2.39.1",
"eslint-plugin-import": "2.8.0",
"eslint-plugin-jsx-a11y": "5.1.1",
"eslint-plugin-react": "7.4.0",
"extract-text-webpack-plugin": "3.0.2",
"file-loader": "1.1.5",
"fs-extra": "3.0.1",
@ -115,5 +108,14 @@
},
"eslintConfig": {
"extends": "react-app"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.19.1",
"eslint-config-react-app": "^2.1.0",
"eslint-plugin-flowtype": "^2.46.1",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^5.1.1",
"eslint-plugin-react": "^7.7.0"
}
}

View File

@ -6,7 +6,7 @@ import './assets/App.css';
import Loading from './Loading';
import { inject, observer } from 'mobx-react';
@inject("commonStore","contractsStore")
@inject("commonStore", "contractsStore")
@observer
class App extends Component {
onBallotsRender = () => {
@ -37,8 +37,8 @@ class App extends Component {
shouldShowNavPan = () => {
const { commonStore } = this.props;
const currentPath = this.props.location.pathname;
let showNavPan =
currentPath === `${commonStore.rootPath}`
let showNavPan =
currentPath === `${commonStore.rootPath}`
|| currentPath === "/"
|| currentPath === `${commonStore.rootPath}/`
|| currentPath === `${commonStore.rootPath}/active`

View File

@ -90,7 +90,7 @@ export class BallotCard extends React.Component {
@action("Get start time of keys ballot")
getStartTime = async () => {
const { contractsStore, id, votingType } = this.props;
let startTime = startTime = await this.repeatGetProperty(contractsStore, votingType, id, "getStartTime", 0);
let startTime = await this.repeatGetProperty(contractsStore, votingType, id, "getStartTime", 0);
this.startTime = moment.utc(startTime * 1000).format(USDateTimeFormat);
}
@ -134,7 +134,7 @@ export class BallotCard extends React.Component {
let formattedMs = hours + moment.utc(ms).format(":mm:ss");
return formattedMs;
}
@action("Get times")
getTimes = async () => {
@ -247,7 +247,9 @@ export class BallotCard extends React.Component {
}
finalize = async (e) => {
if (this.isFinalized) { return; }
if (this.isFinalized) {
return;
}
if (this.timeToStart.val > 0) {
swal("Warning!", messages.ballotIsNotActiveMsg(this.timeTo.displayValue), "warning");

View File

@ -17,13 +17,13 @@ export class BallotKeysCard extends React.Component {
getBallotTypeDisplayName(ballotType) {
const { ballotStore } = this.props;
switch(parseInt(ballotType, 10)) {
case ballotStore.KeysBallotType.add:
case ballotStore.KeysBallotType.add:
this.ballotTypeDisplayName = "add";
break;
case ballotStore.KeysBallotType.remove:
case ballotStore.KeysBallotType.remove:
this.ballotTypeDisplayName = "remove";
break;
case ballotStore.KeysBallotType.swap:
case ballotStore.KeysBallotType.swap:
this.ballotTypeDisplayName = "swap";
break;
default:
@ -36,13 +36,13 @@ export class BallotKeysCard extends React.Component {
getAffectedKeyTypeDisplayName(affectedKeyType) {
const { ballotStore } = this.props;
switch(parseInt(affectedKeyType, 10)) {
case ballotStore.KeyType.mining:
case ballotStore.KeyType.mining:
this.affectedKeyTypeDisplayName = "mining";
break;
case ballotStore.KeyType.voting:
case ballotStore.KeyType.voting:
this.affectedKeyTypeDisplayName = "voting";
break;
case ballotStore.KeyType.payout:
case ballotStore.KeyType.payout:
this.affectedKeyTypeDisplayName = "payout";
break;
default:

View File

@ -15,9 +15,9 @@ export class BallotKeysMetadata extends React.Component {
<div className="left">
<div className="form-el">
<label htmlFor="key">Affected Key</label>
<input type="text" id="key"
value={ballotStore.ballotKeys.affectedKey}
onChange={e => ballotStore.changeBallotMetadata(e, "affectedKey", "ballotKeys")}
<input type="text" id="key"
value={ballotStore.ballotKeys.affectedKey}
onChange={e => ballotStore.changeBallotMetadata(e, "affectedKey", "ballotKeys")}
/>
<p className="hint">
Affected key address of validator to vote for. Example: 0xc70760D23557A4FDE612C0bE63b26EBD023C51Ee.
@ -30,8 +30,8 @@ export class BallotKeysMetadata extends React.Component {
<Select.Creatable
name="form-field-name"
id="mining-key"
value={ballotStore.ballotKeys.miningKey}
onChange={ballotStore.setMiningKey}
value={ballotStore.ballotKeys.miningKey}
onChange={ballotStore.setMiningKey}
options={options}
/>
<p className="hint">
@ -45,7 +45,7 @@ export class BallotKeysMetadata extends React.Component {
<input type="datetime-local" id="datetime-local"
value={ballotStore.endTime}
min={ballotStore.endTime}
onChange={e => ballotStore.changeBallotMetadata(e, "endTime")}
onChange={e => ballotStore.changeBallotMetadata(e, "endTime")}
/>
<p className="hint">
Ballot's end time.

View File

@ -12,9 +12,9 @@ export class BallotMinThresholdMetadata extends React.Component {
<div className="left">
<div className="form-el">
<label htmlFor="key">Proposed Value</label>
<input type="number" id="key"
value={ballotStore.ballotMinThreshold.proposedValue}
onChange={e => ballotStore.changeBallotMetadata(e, "proposedValue", "ballotMinThreshold")}
<input type="number" id="key"
value={ballotStore.ballotMinThreshold.proposedValue}
onChange={e => ballotStore.changeBallotMetadata(e, "proposedValue", "ballotMinThreshold")}
/>
<p className="hint">
Proposed value of the minimum threshold for keys ballot consensus.
@ -24,9 +24,9 @@ export class BallotMinThresholdMetadata extends React.Component {
<div className="right">
<div className="form-el">
<label htmlFor="datetime-local">Ballot End</label>
<input type="datetime-local" id="datetime-local"
value={ballotStore.endTime}
onChange={e => ballotStore.changeBallotMetadata(e, "endTime")}
<input type="datetime-local" id="datetime-local"
value={ballotStore.endTime}
onChange={e => ballotStore.changeBallotMetadata(e, "endTime")}
/>
<p className="hint">
Ballot's end time.

View File

@ -25,7 +25,7 @@ export class BallotProxyCard extends React.Component {
getContractType = async () => {
const { contractsStore, id } = this.props;
let contractType;
try {
try {
contractType = await contractsStore.votingToChangeProxy.getContractType(id);
} catch(e) {
console.log(e.message);

View File

@ -13,9 +13,9 @@ export class BallotProxyMetadata extends React.Component {
<div className="left">
<div className="form-el">
<label htmlFor="key">Proposed Address</label>
<input type="text" id="key"
value={ballotStore.ballotProxy.proposedAddress}
onChange={e => ballotStore.changeBallotMetadata(e, "proposedAddress", "ballotProxy")}
<input type="text" id="key"
value={ballotStore.ballotProxy.proposedAddress}
onChange={e => ballotStore.changeBallotMetadata(e, "proposedAddress", "ballotProxy")}
/>
<p className="hint">
Proposed address of a new proxy contract.
@ -46,9 +46,9 @@ export class BallotProxyMetadata extends React.Component {
<div className="left">
<div className="form-el">
<label htmlFor="datetime-local">Ballot End</label>
<input type="datetime-local" id="datetime-local"
value={ballotStore.endTime}
onChange={e => ballotStore.changeBallotMetadata(e, "endTime")}
<input type="datetime-local" id="datetime-local"
value={ballotStore.endTime}
onChange={e => ballotStore.changeBallotMetadata(e, "endTime")}
/>
<p className="hint">
Ballot's end time.

View File

@ -10,9 +10,9 @@ export class KeysTypes extends React.Component {
<div className="hidden">
<div className="left">
<div className="radio-container">
<input type="radio" name="key-control" id="add-key"
<input type="radio" name="key-control" id="add-key"
value={ballotStore.KeysBallotType.add}
checked={ballotStore.isAddKeysBallotType}
checked={ballotStore.isAddKeysBallotType}
onChange={e => ballotStore.changeKeysBallotType(e, ballotStore.KeysBallotType.add)}
/>
<label htmlFor="add-key" className="radio radio_icon radio_add">Add key</label>
@ -21,9 +21,9 @@ export class KeysTypes extends React.Component {
</p>
</div>
<div className="radio-container">
<input type="radio" name="key-control" id="remove-key"
<input type="radio" name="key-control" id="remove-key"
value={ballotStore.KeysBallotType.remove}
checked={ballotStore.isRemoveKeysBallotType}
checked={ballotStore.isRemoveKeysBallotType}
onChange={e => ballotStore.changeKeysBallotType(e, ballotStore.KeysBallotType.remove)}
/>
<label htmlFor="remove-key" className="radio radio_icon radio_remove">Remove key</label>
@ -32,9 +32,9 @@ export class KeysTypes extends React.Component {
</p>
</div>
<div className="radio-container">
<input type="radio" name="key-control" id="swap-key"
<input type="radio" name="key-control" id="swap-key"
value={ballotStore.KeysBallotType.swap}
checked={ballotStore.isSwapKeysBallotType}
checked={ballotStore.isSwapKeysBallotType}
onChange={e => ballotStore.changeKeysBallotType(e, ballotStore.KeysBallotType.swap)}
/>
<label htmlFor="swap-key" className="radio radio_icon radio_swap">Swap key</label>
@ -45,9 +45,9 @@ export class KeysTypes extends React.Component {
</div>
<div className="right">
<div className="radio-container">
<input type="radio" name="keys" id="mining-key"
<input type="radio" name="keys" id="mining-key"
value={ballotStore.KeyType.mining}
checked={ballotStore.isMiningKeyType}
checked={ballotStore.isMiningKeyType}
onChange={e => ballotStore.changeKeyType(e, ballotStore.KeyType.mining)}
/>
<label htmlFor="mining-key" className="radio">Mining Key</label>
@ -56,9 +56,9 @@ export class KeysTypes extends React.Component {
</p>
</div>
<div className="radio-container">
<input type="radio" name="keys" id="payout-key"
<input type="radio" name="keys" id="payout-key"
value={ballotStore.KeyType.payout}
checked={ballotStore.isPayoutKeyType}
checked={ballotStore.isPayoutKeyType}
onChange={e => ballotStore.changeKeyType(e, ballotStore.KeyType.payout)}
/>
<label htmlFor="payout-key" className="radio">Payout Key</label>
@ -67,9 +67,9 @@ export class KeysTypes extends React.Component {
</p>
</div>
<div className="radio-container">
<input type="radio" name="keys" id="voting-key"
<input type="radio" name="keys" id="voting-key"
value={ballotStore.KeyType.voting}
checked={ballotStore.isVotingKeyType}
checked={ballotStore.isVotingKeyType}
onChange={e => ballotStore.changeKeyType(e, ballotStore.KeyType.voting)}
/>
<label htmlFor="voting-key" className="radio">Voting Key</label>

View File

@ -261,19 +261,19 @@ export class NewBallot extends React.Component {
<form action="" className="new-form">
<div className="new-form-side new-form-side_left">
<div className="ballot-types">
<div
<div
className={this.menuItemActive(ballotStore.BallotType.keys)}
onClick={(e) => ballotStore.changeBallotType(e, ballotStore.BallotType.keys)}
>
Validator Management Ballot
</div>
<div
<div
className={this.menuItemActive(ballotStore.BallotType.minThreshold)}
onClick={(e) => ballotStore.changeBallotType(e, ballotStore.BallotType.minThreshold)}
>
Consenus Thershold Ballot
</div>
<div
<div
className={this.menuItemActive(ballotStore.BallotType.proxy)}
onClick={(e) => ballotStore.changeBallotType(e, ballotStore.BallotType.proxy)}
>

View File

@ -62,8 +62,8 @@ export class Validator extends React.Component {
<div className="left">
<div className="form-el">
<label htmlFor="full-name">Full Name</label>
<input type="text" id="full-name"
value={validatorStore.fullName}
<input type="text" id="full-name"
value={validatorStore.fullName}
onChange={e => validatorStore.changeValidatorMetadata(e, "fullName")}
/>
<p className="hint">
@ -151,8 +151,8 @@ export class Validator extends React.Component {
<div className="right">
<div className="form-el">
<label htmlFor="zip-code">Zip Code</label>
<input type="number" id="zip-code"
value={validatorStore.zipCode}
<input type="number" id="zip-code"
value={validatorStore.zipCode}
onChange={e => validatorStore.changeValidatorMetadata(e, "zipCode")}
/>
<p className="hint">
@ -163,8 +163,8 @@ export class Validator extends React.Component {
<div className="left">
<div className="form-el">
<label htmlFor="license-id">License ID</label>
<input type="text" id="license-id"
value={validatorStore.licenseID}
<input type="text" id="license-id"
value={validatorStore.licenseID}
onChange={e => validatorStore.changeValidatorMetadata(e, "licenseID")}
/>
<p className="hint">
@ -175,8 +175,8 @@ export class Validator extends React.Component {
<div className="right">
<div className="form-el">
<label htmlFor="license-expiration">License Expiration</label>
<input type="date" id="license-expiration"
value={validatorStore.licenseExpiration}
<input type="date" id="license-expiration"
value={validatorStore.licenseExpiration}
onChange={e => validatorStore.changeValidatorMetadata(e, "licenseExpiration")}
/>
<p className="hint">

View File

@ -3,14 +3,14 @@ import { networkAddresses } from './addresses';
import helpers from "./helpers";
export default class BallotsStorage {
async init({web3, netId}){
const {BALLOTS_STORAGE_ADDRESS} = networkAddresses(netId);
console.log('Ballots Storage address', BALLOTS_STORAGE_ADDRESS);
let web3_10 = new Web3(web3.currentProvider);
const branch = helpers.getBranch(netId);
async init({web3, netId}){
const {BALLOTS_STORAGE_ADDRESS} = networkAddresses(netId);
console.log('Ballots Storage address', BALLOTS_STORAGE_ADDRESS);
let web3_10 = new Web3(web3.currentProvider);
const branch = helpers.getBranch(netId);
let ballotsStorageAbi = await helpers.getABI(branch, 'BallotStorage')
let ballotsStorageAbi = await helpers.getABI(branch, 'BallotStorage')
this.ballotsStorageInstance = new web3_10.eth.Contract(ballotsStorageAbi, BALLOTS_STORAGE_ADDRESS);
}
this.ballotsStorageInstance = new web3_10.eth.Contract(ballotsStorageAbi, BALLOTS_STORAGE_ADDRESS);
}
}

View File

@ -4,7 +4,7 @@ import helpers from "./helpers";
export default class POAConsensus {
async init({web3, netId}) {
const {POA_ADDRESS} = networkAddresses(netId);
const {POA_ADDRESS} = networkAddresses(netId);
console.log('POA address', POA_ADDRESS)
let web3_10 = new Web3(web3.currentProvider);

View File

@ -2,22 +2,7 @@ import Web3 from 'web3';
import moment from 'moment';
import { networkAddresses } from './addresses';
import helpers from "./helpers";
var toAscii = function(hex) {
var str = '',
i = 0,
l = hex.length;
if (hex.substring(0, 2) === '0x') {
i = 2;
}
for (; i < l; i+=2) {
var code = parseInt(hex.substr(i, 2), 16);
if (code === 0) continue; // this is added
str += String.fromCharCode(code);
}
return str;
};
import { toAscii } from "../helpers";
export default class ValidatorMetadata {
async init({web3, netId}) {

View File

@ -1,7 +1,7 @@
import Web3 from 'web3';
import { networkAddresses } from './addresses';
import helpers from "./helpers";
export default class VotingToChangeKeys {
async init({web3, netId}) {
const {VOTING_TO_CHANGE_KEYS_ADDRESS} = networkAddresses(netId);
@ -94,8 +94,7 @@ export default class VotingToChangeKeys {
let miningKey;
try {
miningKey = await this.getMiningByVotingKey(_votingKey);
}
catch(e) {
} catch(e) {
miningKey = "0x0000000000000000000000000000000000000000";
}
return await this.votingToChangeKeysInstance.methods.validatorActiveBallots(miningKey).call();

View File

@ -78,8 +78,7 @@ export default class VotingToChangeMinThreshold {
let miningKey;
try {
miningKey = await this.getMiningByVotingKey(_votingKey);
}
catch(e) {
} catch(e) {
miningKey = "0x0000000000000000000000000000000000000000";
}
return await this.votingToChangeMinThresholdInstance.methods.validatorActiveBallots(miningKey).call();

View File

@ -82,8 +82,7 @@ export default class VotingToChangeProxy {
let miningKey;
try {
miningKey = await this.getMiningByVotingKey(_votingKey);
}
catch(e) {
} catch(e) {
miningKey = "0x0000000000000000000000000000000000000000";
}
return await this.votingToChangeProxyInstance.methods.validatorActiveBallots(miningKey).call();

View File

@ -14,7 +14,7 @@ function ABIURL(branch, contract) {
function getABI(branch, contract) {
let addr = ABIURL(branch, contract);
return fetch(addr).then(function(response) {
return fetch(addr).then((response) => {
return response.json();
})
}

View File

@ -1,9 +1,9 @@
import { messages } from "./messages";
let getWeb3 = () => {
return new Promise(function (resolve, reject) {
return new Promise((resolve, reject) => {
// Wait for loading completion to avoid race conditions with web3 injection timing.
window.addEventListener('load', function () {
window.addEventListener('load', () => {
var results
var web3 = window.web3
@ -51,7 +51,7 @@ let getWeb3 = () => {
} else {
reject({message: messages.NO_METAMASK_MSG})
console.error('Metamask not found');
console.error('Metamask not found');
}
})
})

View File

@ -1,4 +1,4 @@
var toAscii = function(hex) {
var toAscii = (hex) => {
var str = '',
i = 0,
l = hex.length;

View File

@ -36,9 +36,9 @@ class AppMainRouter extends Component {
let getSokolContractsAddresses = getContractsAddresses('sokol');
let getCoreContractsAddresses = getContractsAddresses('core');
await Promise.all([getSokolContractsAddresses, getCoreContractsAddresses]);
contractsStore.setWeb3Instance(web3Config);
let setPoaConsensus = contractsStore.setPoaConsensus(web3Config);
let setBallotsStorage = contractsStore.setBallotsStorage(web3Config);
let setVotingToChangeKeys = contractsStore.setVotingToChangeKeys(web3Config);

View File

@ -1,5 +1,5 @@
let messages = {};
messages.invalidVotingKeyMsg = function(key) {
messages.invalidVotingKeyMsg = (key) => {
return `The key ${key} is not valid voting Key! Please make sure you have loaded correct voting key in metamask`;
};
messages.VOTED_SUCCESS_MSG = "You successfully voted";
@ -19,7 +19,7 @@ Check POA Network <a href='https://github.com/poanetwork/wiki' target='blank'>wi
messages.WRONG_NETWORK_MSG = `You aren't connected to POA Network.
Please, switch on POA plugin and refresh the page.
Check POA Network <a href='https://github.com/poanetwork/wiki' target='blank'>wiki</a> for more info.`;
messages.ballotIsNotActiveMsg = function(timeToStart) {
messages.ballotIsNotActiveMsg = (timeToStart) => {
return `The ballot is not active yet. Time to start: ${timeToStart}`;
};
messages.SHOULD_BE_MORE_THAN_TWO_DAYS = (duration, neededHours, neededMinutes) => {
@ -33,7 +33,7 @@ messages.SHOULD_BE_LESS_OR_EQUAL_14_DAYS = (duration) => {
messages.FAILED_TX = `Your transaction was failed. Please make sure you set correct parameters for ballot creation.
Make sure you don't have Transaction Error. Exception thrown in contract code message in metamask before you sign it.`
messages.DESCRIPTION_IS_EMPTY = "Description cannot be empty";
messages.wrongRepo = function(repo) {
messages.wrongRepo = (repo) => {
return `There is no contracts.json in configured repo ${repo}`;
};
module.exports = {

View File

@ -100,8 +100,8 @@ class BallotStore {
}
@computed get isNewValidatorPersonalData() {
return ballotStore.isBallotForKey
&& ballotStore.isAddKeysBallotType
return ballotStore.isBallotForKey
&& ballotStore.isAddKeysBallotType
&& ballotStore.isMiningKeyType;
}

View File

@ -75,7 +75,7 @@ class ContractsStore {
await this.poaConsensus.init({
web3: web3Config.web3Instance,
netId: web3Config.netId
});
});
}
@action("Set Ballots Storage contract")
@ -84,7 +84,7 @@ class ContractsStore {
await this.ballotsStorage.init({
web3: web3Config.web3Instance,
netId: web3Config.netId
});
});
}
@action("Set VotingToChangeKeys contract")
@ -93,7 +93,7 @@ class ContractsStore {
await this.votingToChangeKeys.init({
web3: web3Config.web3Instance,
netId: web3Config.netId
});
});
}
@action("Set VotingToChangeMinThreshold contract")
@ -102,7 +102,7 @@ class ContractsStore {
await this.votingToChangeMinThreshold.init({
web3: web3Config.web3Instance,
netId: web3Config.netId
});
});
}
@action("Set VotingToChangeProxy contract")
@ -111,7 +111,7 @@ class ContractsStore {
await this.votingToChangeProxy.init({
web3: web3Config.web3Instance,
netId: web3Config.netId
});
});
}
@action("Set ValidatorMetadata contract")
@ -120,7 +120,7 @@ class ContractsStore {
await this.validatorMetadata.init({
web3: web3Config.web3Instance,
netId: web3Config.netId
});
});
}
@action("Get validators length")
@ -137,8 +137,7 @@ class ContractsStore {
setMiningKey = async (web3Config) => {
try {
this.miningKey = await this.votingToChangeKeys.votingToChangeKeysInstance.methods.getMiningByVotingKey(web3Config.defaultAccount).call();
}
catch(e) {
} catch(e) {
console.log(e)
this.miningKey = "0x0000000000000000000000000000000000000000";
}
@ -159,64 +158,64 @@ class ContractsStore {
await Promise.all([allKeysBallotsIDs, allMinThresholdBallotsIDs, allProxyBallotsIDs]);
let allBallotsIDsLength = allKeysBallotsIDs.length + allMinThresholdBallotsIDs.length + allProxyBallotsIDs.length;
let allBallotsIDsLength = allKeysBallotsIDs.length + allMinThresholdBallotsIDs.length + allProxyBallotsIDs.length;
if (allBallotsIDsLength == 0) {
commonStore.hideLoading();
}
if (allBallotsIDsLength == 0) {
commonStore.hideLoading();
}
}
getCards = async (allBallots, contractType) => {
let allBallotsIDs = [];
if (allBallots) {
allBallotsIDs = allBallots.map((event) => event.returnValues.id)
for (let i = allBallotsIDs.length - 1; i >= 0; i--) {
for (let i = allBallotsIDs.length - 1; i >= 0; i--) {
let startTime = 0;
try {
startTime = await this[contractType].getStartTime(allBallotsIDs[i]);
} catch(e) {
console.log(e.message);
}
let startTime = 0;
try {
startTime = await this[contractType].getStartTime(allBallotsIDs[i]);
} catch(e) {
console.log(e.message);
}
let card;
switch(contractType) {
case "votingToChangeKeys":
card = <BallotKeysCard
id={allBallotsIDs[i]}
type={ballotStore.BallotType.keys}
key={ballotsStore.ballotCards.length}
startTime={startTime}/>
break;
case "votingToChangeMinThreshold":
card = <BallotMinThresholdCard
id={allBallotsIDs[i]}
type={ballotStore.BallotType.minThreshold}
key={ballotsStore.ballotCards.length}
startTime={startTime}/>
break;
case "votingToChangeProxy":
card = <BallotProxyCard
id={allBallotsIDs[i]}
type={ballotStore.BallotType.proxy}
key={ballotsStore.ballotCards.length}
startTime={startTime}/>
break;
}
let card;
switch(contractType) {
case "votingToChangeKeys":
card = <BallotKeysCard
id={allBallotsIDs[i]}
type={ballotStore.BallotType.keys}
key={ballotsStore.ballotCards.length}
startTime={startTime}/>
break;
case "votingToChangeMinThreshold":
card = <BallotMinThresholdCard
id={allBallotsIDs[i]}
type={ballotStore.BallotType.minThreshold}
key={ballotsStore.ballotCards.length}
startTime={startTime}/>
break;
case "votingToChangeProxy":
card = <BallotProxyCard
id={allBallotsIDs[i]}
type={ballotStore.BallotType.proxy}
key={ballotsStore.ballotCards.length}
startTime={startTime}/>
break;
}
ballotsStore.ballotCards.push(card);
}
ballotsStore.ballotCards.push(card);
}
return allBallotsIDs;
return allBallotsIDs;
}
}
@action("Get all keys ballots internal")
getAllBallotsIDsInternal = async () => {
let getAllKeysBallotsIDs = this.votingToChangeKeys.votingToChangeKeysInstance.getPastEvents('BallotCreated', {fromBlock: 0});
let getAllMinThresholdBallotsIDs = this.votingToChangeMinThreshold.votingToChangeMinThresholdInstance.getPastEvents('BallotCreated', {fromBlock: 0});
let getAllProxyBallotsIDs = this.votingToChangeProxy.votingToChangeProxyInstance.getPastEvents('BallotCreated', {fromBlock: 0});
let getAllMinThresholdBallotsIDs = this.votingToChangeMinThreshold.votingToChangeMinThresholdInstance.getPastEvents('BallotCreated', {fromBlock: 0});
let getAllProxyBallotsIDs = this.votingToChangeProxy.votingToChangeProxyInstance.getPastEvents('BallotCreated', {fromBlock: 0});
return Promise.all([getAllKeysBallotsIDs, getAllMinThresholdBallotsIDs, getAllProxyBallotsIDs]);
}
@ -253,7 +252,7 @@ class ContractsStore {
keys.forEach(async (key) => {
const metadata = await this.validatorMetadata.getValidatorData({miningKey: key})
this.validatorsMetadata.push({label: `${key} ${metadata.lastName}`, value: key})
})
})
}
@action
async getValidatorMetadata(miningKey) {