diff --git a/package-lock.json b/package-lock.json index 098a564..37db5f2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -177,6 +177,15 @@ "resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz", "integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI=" }, + "array-includes": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", + "requires": { + "define-properties": "1.1.2", + "es-abstract": "1.11.0" + } + }, "array-union": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/array-union/-/array-union-1.0.2.tgz", @@ -1575,6 +1584,11 @@ } } }, + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=" + }, "check-error": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", @@ -2261,6 +2275,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" @@ -2477,7 +2492,6 @@ "version": "1.11.0", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.11.0.tgz", "integrity": "sha512-ZnQrE/lXTTQ39ulXZ+J1DTFazV9qBy61x2bY071B+qGco8Z8q1QddsLdt/EF8Ai9hcWH72dWS0kFqXLxOxqslA==", - "dev": true, "requires": { "es-to-primitive": "1.1.1", "function-bind": "1.1.1", @@ -2490,7 +2504,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", - "dev": true, "requires": { "is-callable": "1.1.3", "is-date-object": "1.0.1", @@ -2609,50 +2622,276 @@ } }, "eslint": { - "version": "3.16.1", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.16.1.tgz", - "integrity": "sha1-m8MfxzQWks93LoBgdQj2fXEcVgk=", + "version": "4.19.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-4.19.1.tgz", + "integrity": "sha512-bT3/1x1EbZB7phzYu7vCr1v3ONuzDtX8WjuM9c0iYxe+cq+pwcKEoQjl7zd3RpC6YOLgnSy3cTN58M2jcoPDIQ==", "requires": { + "ajv": "5.5.2", "babel-code-frame": "6.26.0", - "chalk": "1.1.3", + "chalk": "2.4.0", "concat-stream": "1.6.2", - "debug": "2.6.9", - "doctrine": "1.5.0", - "escope": "3.6.0", + "cross-spawn": "5.1.0", + "debug": "3.1.0", + "doctrine": "2.1.0", + "eslint-scope": "3.7.1", + "eslint-visitor-keys": "1.0.0", "espree": "3.5.4", - "estraverse": "4.2.0", + "esquery": "1.0.1", "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.4.0", "ignore": "3.3.7", "imurmurhash": "0.1.4", - "inquirer": "0.12.0", - "is-my-json-valid": "2.17.2", + "inquirer": "3.3.0", "is-resolvable": "1.1.0", - "js-yaml": "3.7.0", - "json-stable-stringify": "1.0.1", + "js-yaml": "3.11.0", + "json-stable-stringify-without-jsonify": "1.0.1", "levn": "0.3.0", "lodash": "4.17.5", + "minimatch": "3.0.4", "mkdirp": "0.5.1", "natural-compare": "1.4.0", "optionator": "0.8.2", "path-is-inside": "1.0.2", - "pluralize": "1.2.1", - "progress": "1.1.8", + "pluralize": "7.0.0", + "progress": "2.0.0", + "regexpp": "1.1.0", "require-uncached": "1.0.3", - "shelljs": "0.7.8", - "strip-bom": "3.0.0", + "semver": "5.5.0", + "strip-ansi": "4.0.0", "strip-json-comments": "2.0.1", - "table": "3.8.3", - "text-table": "0.2.0", - "user-home": "2.0.0" + "table": "4.0.2", + "text-table": "0.2.0" }, "dependencies": { - "strip-bom": { + "ajv": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-5.5.2.tgz", + "integrity": "sha1-c7Xuyj+rZT49P5Qis0GtQiBdyWU=", + "requires": { + "co": "4.6.0", + "fast-deep-equal": "1.1.0", + "fast-json-stable-stringify": "2.0.0", + "json-schema-traverse": "0.3.1" + } + }, + "ajv-keywords": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-2.1.1.tgz", + "integrity": "sha1-YXmX/F9gV2iUxDX5QNgZ4TW4B2I=" + }, + "ansi-escapes": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", + "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==" + }, + "ansi-regex": { "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=" + }, + "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==", + "requires": { + "color-convert": "1.9.1" + } + }, + "chalk": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.0.tgz", + "integrity": "sha512-Wr/w0f4o9LuE7K53cD0qmbAMM+2XNLzR29vFn5hqko4sxGlUsyy363NvmyGIyk5tpe9cjTr9SJYbysEyPkRnFw==", + "requires": { + "ansi-styles": "3.2.1", + "escape-string-regexp": "1.0.5", + "supports-color": "5.4.0" + } + }, + "cli-cursor": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", + "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", + "requires": { + "restore-cursor": "2.0.0" + } + }, + "cross-spawn": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", + "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", + "requires": { + "lru-cache": "4.1.2", + "shebang-command": "1.2.0", + "which": "1.3.0" + } + }, + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", + "requires": { + "ms": "2.0.0" + } + }, + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "requires": { + "esutils": "2.0.2" + } + }, + "esprima": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.0.tgz", + "integrity": "sha512-oftTcaMu/EGrEIu904mWteKIv8vMuOgGYo7EhVJJN00R/EED9DCua/xxHRdYnKtcECzVg7xOWhflvJMnqcFZjw==" + }, + "figures": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", + "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", + "requires": { + "escape-string-regexp": "1.0.5" + } + }, + "globals": { + "version": "11.4.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.4.0.tgz", + "integrity": "sha512-Dyzmifil8n/TmSqYDEXbm+C8yitzJQqQIlJQLNRMwa+BOUJpRC19pyVeN12JAjt61xonvXjtff+hJruTRXn5HA==" + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=" + }, + "inquirer": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-3.3.0.tgz", + "integrity": "sha512-h+xtnyk4EwKvFWHrUYsWErEVR+igKtLdchu+o0Z1RL7VU/jVMFbYir2bp6bAj8efFNxWqHX0dIss6fJQ+/+qeQ==", + "requires": { + "ansi-escapes": "3.1.0", + "chalk": "2.4.0", + "cli-cursor": "2.1.0", + "cli-width": "2.2.0", + "external-editor": "2.2.0", + "figures": "2.0.0", + "lodash": "4.17.5", + "mute-stream": "0.0.7", + "run-async": "2.3.0", + "rx-lite": "4.0.8", + "rx-lite-aggregates": "4.0.8", + "string-width": "2.1.1", + "strip-ansi": "4.0.0", + "through": "2.3.8" + } + }, + "is-fullwidth-code-point": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", + "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=" + }, + "js-yaml": { + "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==", + "requires": { + "argparse": "1.0.10", + "esprima": "4.0.0" + } + }, + "mute-stream": { + "version": "0.0.7", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", + "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=" + }, + "onetime": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", + "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", + "requires": { + "mimic-fn": "1.2.0" + } + }, + "pluralize": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", + "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==" + }, + "progress": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.0.tgz", + "integrity": "sha1-ihvjZr+Pwj2yvSPxDG/pILQ4nR8=" + }, + "restore-cursor": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", + "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", + "requires": { + "onetime": "2.0.1", + "signal-exit": "3.0.2" + } + }, + "run-async": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", + "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", + "requires": { + "is-promise": "2.1.0" + } + }, + "rx-lite": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-4.0.8.tgz", + "integrity": "sha1-Cx4Rr4vESDbwSmQH6S2kJGe3lEQ=" + }, + "slice-ansi": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", + "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", + "requires": { + "is-fullwidth-code-point": "2.0.0" + } + }, + "string-width": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", + "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", + "requires": { + "is-fullwidth-code-point": "2.0.0", + "strip-ansi": "4.0.0" + } + }, + "strip-ansi": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", + "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", + "requires": { + "ansi-regex": "3.0.0" + } + }, + "supports-color": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", + "integrity": "sha512-zjaXglF5nnWpsq470jSv6P9DwPvgLkuapYmfDm3JWOm0vkNTVF2tI4UrN2r6jH1qM/uc/WtxYY1hYoA2dOKj5w==", + "requires": { + "has-flag": "3.0.0" + } + }, + "table": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/table/-/table-4.0.2.tgz", + "integrity": "sha512-UUkEAPdSGxtRpiV9ozJ5cMTtYiqz7Ni1OGqLXRCynrvzdtR1p+cfOWe2RJLwvUG8hNanaSRjecIqwOjqeatDsA==", + "requires": { + "ajv": "5.5.2", + "ajv-keywords": "2.1.1", + "chalk": "2.4.0", + "lodash": "4.17.5", + "slice-ansi": "1.0.0", + "string-width": "2.1.1" + } } } }, @@ -2814,12 +3053,32 @@ "dev": true }, "eslint-plugin-react": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.4.1.tgz", - "integrity": "sha1-fRqt50fbFYkvce7h/qSt35e8+is=", + "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==", "requires": { - "doctrine": "1.5.0", - "jsx-ast-utils": "1.4.1" + "doctrine": "2.1.0", + "has": "1.0.1", + "jsx-ast-utils": "2.0.1", + "prop-types": "15.6.1" + }, + "dependencies": { + "doctrine": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", + "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "requires": { + "esutils": "2.0.2" + } + }, + "jsx-ast-utils": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz", + "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", + "requires": { + "array-includes": "3.0.3" + } + } } }, "eslint-plugin-standard": { @@ -2828,6 +3087,20 @@ "integrity": "sha1-NNDJFbRe3G8BA5PH7vOCOwhWXPI=", "dev": true }, + "eslint-scope": { + "version": "3.7.1", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", + "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", + "requires": { + "esrecurse": "4.2.1", + "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==" + }, "espree": { "version": "3.5.4", "resolved": "https://registry.npmjs.org/espree/-/espree-3.5.4.tgz", @@ -2842,6 +3115,14 @@ "resolved": "https://registry.npmjs.org/esprima/-/esprima-2.7.3.tgz", "integrity": "sha1-luO3DVd59q1JzQMmc9HDEnZ7pYE=" }, + "esquery": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/esquery/-/esquery-1.0.1.tgz", + "integrity": "sha512-SmiyZ5zIWH9VM+SRUReLS5Q8a7GxtRdxEBVZpm98rJM7Sb+A9DVCndXfkeFUd3byderg+EbDkfnevfCwynWaNA==", + "requires": { + "estraverse": "4.2.0" + } + }, "esrecurse": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", @@ -2973,6 +3254,16 @@ "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.1.tgz", "integrity": "sha1-p1Xqe8Gt/MWjHOfnYtuq3F5jZEQ=" }, + "external-editor": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "requires": { + "chardet": "0.4.2", + "iconv-lite": "0.4.19", + "tmp": "0.0.33" + } + }, "extglob": { "version": "0.3.2", "resolved": "https://registry.npmjs.org/extglob/-/extglob-0.3.2.tgz", @@ -4071,6 +4362,11 @@ "is-callable": "1.1.3" } }, + "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=" + }, "generate-function": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", @@ -4610,8 +4906,7 @@ "is-callable": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", - "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=", - "dev": true + "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=" }, "is-ci": { "version": "1.1.0", @@ -4624,8 +4919,7 @@ "is-date-object": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", - "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", - "dev": true + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=" }, "is-directory": { "version": "0.3.1", @@ -4751,6 +5045,11 @@ "resolved": "https://registry.npmjs.org/is-primitive/-/is-primitive-2.0.0.tgz", "integrity": "sha1-IHurkWOEmcB7Kt8kCkGochADRXU=" }, + "is-promise": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", + "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=" + }, "is-property": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", @@ -4760,7 +5059,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", - "dev": true, "requires": { "has": "1.0.1" } @@ -4798,8 +5096,7 @@ "is-symbol": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", - "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", - "dev": true + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=" }, "is-typedarray": { "version": "1.0.0", @@ -5326,6 +5623,11 @@ "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=" + }, "json-stringify-safe": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", @@ -5770,6 +6072,11 @@ "mime-db": "1.33.0" } }, + "mimic-fn": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", + "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==" + }, "minimatch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", @@ -7359,6 +7666,47 @@ "isarray": "1.0.0" } }, + "eslint": { + "version": "3.16.1", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-3.16.1.tgz", + "integrity": "sha1-m8MfxzQWks93LoBgdQj2fXEcVgk=", + "requires": { + "babel-code-frame": "6.26.0", + "chalk": "1.1.3", + "concat-stream": "1.6.2", + "debug": "2.6.9", + "doctrine": "1.3.0", + "escope": "3.6.0", + "espree": "3.5.4", + "estraverse": "4.2.0", + "esutils": "2.0.2", + "file-entry-cache": "2.0.0", + "glob": "7.1.2", + "globals": "9.18.0", + "ignore": "3.3.7", + "imurmurhash": "0.1.4", + "inquirer": "0.12.0", + "is-my-json-valid": "2.17.2", + "is-resolvable": "1.1.0", + "js-yaml": "3.7.0", + "json-stable-stringify": "1.0.1", + "levn": "0.3.0", + "lodash": "4.17.5", + "mkdirp": "0.5.1", + "natural-compare": "1.4.0", + "optionator": "0.8.2", + "path-is-inside": "1.0.2", + "pluralize": "1.2.1", + "progress": "1.1.8", + "require-uncached": "1.0.3", + "shelljs": "0.7.8", + "strip-bom": "3.0.0", + "strip-json-comments": "2.0.1", + "table": "3.8.3", + "text-table": "0.2.0", + "user-home": "2.0.0" + } + }, "eslint-import-resolver-node": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.2.3.tgz", @@ -7405,6 +7753,15 @@ "pkg-up": "1.0.0" } }, + "eslint-plugin-react": { + "version": "6.4.1", + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-6.4.1.tgz", + "integrity": "sha1-fRqt50fbFYkvce7h/qSt35e8+is=", + "requires": { + "doctrine": "1.3.0", + "jsx-ast-utils": "1.4.1" + } + }, "ms": { "version": "0.7.1", "resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", @@ -7418,6 +7775,11 @@ "asap": "2.0.6" } }, + "strip-bom": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", + "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=" + }, "whatwg-fetch": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.2.tgz", @@ -7622,6 +7984,11 @@ "is-equal-shallow": "0.1.3" } }, + "regexpp": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-1.1.0.tgz", + "integrity": "sha512-LOPw8FpgdQF9etWMaAfG/WRthIdXJGYp4mJ2Jgn/2lpkbod9jPn0t9UqN7AxBOKNfzRbYyVfgc7Vk4t/MpnXgw==" + }, "regexpu-core": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-2.0.0.tgz", @@ -7849,6 +8216,14 @@ "resolved": "https://registry.npmjs.org/rx-lite/-/rx-lite-3.1.2.tgz", "integrity": "sha1-Gc5QLKVyZl87ZHsQk5+X/RYV8QI=" }, + "rx-lite-aggregates": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/rx-lite-aggregates/-/rx-lite-aggregates-4.0.8.tgz", + "integrity": "sha1-dTuHqJoRyVRnxKwWJsTvxOBcZ74=", + "requires": { + "rx-lite": "3.1.2" + } + }, "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", @@ -7967,6 +8342,19 @@ "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.2.6.tgz", "integrity": "sha1-F93t3F9yL7ZlAWWIlUYZd4ZzFbo=" }, + "shebang-command": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", + "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "requires": { + "shebang-regex": "1.0.0" + } + }, + "shebang-regex": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", + "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" + }, "shelljs": { "version": "0.7.8", "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.7.8.tgz", @@ -7982,6 +8370,11 @@ "resolved": "https://registry.npmjs.org/shellwords/-/shellwords-0.1.1.tgz", "integrity": "sha512-vFwSUfQvqybiICwZY5+DAWIPLKsWO31Q91JSKl3UYv+K5c2QRPzn0qzec6QPu1Qc9eHYItiP3NdJqNVqetYAww==" }, + "signal-exit": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", + "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=" + }, "sinon": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/sinon/-/sinon-4.5.0.tgz", @@ -8429,6 +8822,14 @@ "setimmediate": "1.0.5" } }, + "tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "requires": { + "os-tmpdir": "1.0.2" + } + }, "tmpl": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.4.tgz", diff --git a/package.json b/package.json index c83bb2e..f329a0c 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,8 @@ "babel-preset-airbnb": "^2.4.0", "babel-preset-es2015": "^6.24.1", "babel-preset-react": "^6.24.1", + "eslint": "^4.19.1", + "eslint-plugin-react": "^7.7.0", "react": "^16.3.1", "react-dom": "^16.3.1", "react-redux": "^5.0.7", diff --git a/src/actions/accounts.js b/src/actions/accounts.js index 4f84c8a..328aa1e 100644 --- a/src/actions/accounts.js +++ b/src/actions/accounts.js @@ -1,25 +1,23 @@ -import Network from '../network' -import AlertActions from './alerts' -import * as ActionTypes from '../actiontypes' +import Network from '../network'; +import AlertActions from './alerts'; +import * as ActionTypes from '../actiontypes'; const AccountActions = { - - findAccount() { - return async function(dispatch) { + findAccount () { + return async function (dispatch) { try { - const addresses = await Network.getAccounts() - const mainAddress = addresses[0] - dispatch(AccountActions.receiveAccount(mainAddress)) - } catch(error) { - dispatch(AlertActions.showError(error)) + const addresses = await Network.getAccounts(); + const mainAddress = addresses[0]; + dispatch(AccountActions.receiveAccount(mainAddress)); + } catch (error) { + dispatch(AlertActions.showError(error)); } - } + }; }, - receiveAccount(address) { - return { type: ActionTypes.RECEIVE_ACCOUNT, address } + receiveAccount (address) { + return { type: ActionTypes.RECEIVE_ACCOUNT, address }; }, +}; -} - -export default AccountActions +export default AccountActions; diff --git a/src/actions/alerts.js b/src/actions/alerts.js index a699936..65ae506 100644 --- a/src/actions/alerts.js +++ b/src/actions/alerts.js @@ -1,14 +1,14 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; const AlertActions = { - showError(error, message = null) { - console.error(error) - return { type: ActionTypes.SHOW_ERROR, message: (message || error.message) } + showError (error, message = null) { + console.error(error); + return { type: ActionTypes.SHOW_ERROR, message: (message || error.message) }; }, - reset() { - return { type: ActionTypes.RESET_ERROR } - } -} + reset () { + return { type: ActionTypes.RESET_ERROR }; + }, +}; -export default AlertActions +export default AlertActions; diff --git a/src/actions/fetching.js b/src/actions/fetching.js index f7a2306..c61f0b9 100644 --- a/src/actions/fetching.js +++ b/src/actions/fetching.js @@ -1,13 +1,13 @@ import * as ActionTypes from '../actiontypes'; const FetchingActions = { - start(message) { - return { type: ActionTypes.START_FETCHING, message } + start (message) { + return { type: ActionTypes.START_FETCHING, message }; }, - stop() { - return { type: ActionTypes.STOP_FETCHING } + stop () { + return { type: ActionTypes.STOP_FETCHING }; }, -} +}; -export default FetchingActions +export default FetchingActions; diff --git a/src/actions/jurisdiction.js b/src/actions/jurisdiction.js index da1a744..714380f 100644 --- a/src/actions/jurisdiction.js +++ b/src/actions/jurisdiction.js @@ -1,26 +1,25 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; -import { Jurisdiction } from '../contracts' -import { JURISDICTION_ADDRESS } from '../constants' +import { Jurisdiction } from '../contracts'; +import { JURISDICTION_ADDRESS } from '../constants'; const JurisdictionActions = { - - find() { - return async function(dispatch) { - const jurisdiction = await Jurisdiction.at(JURISDICTION_ADDRESS) - dispatch(JurisdictionActions.receive(jurisdiction)) - } + find () { + return async function (dispatch) { + const jurisdiction = await Jurisdiction.at(JURISDICTION_ADDRESS); + dispatch(JurisdictionActions.receive(jurisdiction)); + }; }, - receive(jurisdiction) { - return async function(dispatch) { - const owner = (await jurisdiction.owner()).toString() + receive (jurisdiction) { + return async function (dispatch) { + const owner = (await jurisdiction.owner()).toString(); dispatch({ type: ActionTypes.RECEIVE_JURISDICTION, jurisdiction: { owner }, - }) - } + }); + }; }, -} +}; -export default JurisdictionActions +export default JurisdictionActions; diff --git a/src/actions/network.js b/src/actions/network.js index bc2c7d7..8e9ee8f 100644 --- a/src/actions/network.js +++ b/src/actions/network.js @@ -1,23 +1,22 @@ -import Network from '../network' -import * as ActionTypes from '../actiontypes' +import Network from '../network'; +import * as ActionTypes from '../actiontypes'; const NetworkActions = { - checkConnection() { + checkConnection () { return dispatch => { - Network.web3().isConnected() ? - dispatch(NetworkActions.connectionSucceeded()) : - dispatch(NetworkActions.connectionFailed()) - } + Network.web3().isConnected() + ? dispatch(NetworkActions.connectionSucceeded()) + : dispatch(NetworkActions.connectionFailed()); + }; }, - connectionSucceeded() { - return { type: ActionTypes.CONNECTION_SUCCEEDED } + connectionSucceeded () { + return { type: ActionTypes.CONNECTION_SUCCEEDED }; }, - connectionFailed() { - return { type: ActionTypes.CONNECTION_FAILED } + connectionFailed () { + return { type: ActionTypes.CONNECTION_FAILED }; }, +}; -} - -export default NetworkActions +export default NetworkActions; diff --git a/src/actions/validation.js b/src/actions/validation.js index 38afe50..7618424 100644 --- a/src/actions/validation.js +++ b/src/actions/validation.js @@ -4,20 +4,19 @@ import { Jurisdiction, DummyValidator } from '../contracts'; import { JURISDICTION_ADDRESS, VALIDATOR_ADDRESS } from '../constants'; const ValidationActions = { - - checkValidated(address) { + checkValidated (address) { return async function (dispatch) { const jurisdiction = await Jurisdiction.at(JURISDICTION_ADDRESS); - const isValidated = await jurisdiction.hasAttribute(address, "VALID"); + const isValidated = await jurisdiction.hasAttribute(address, 'VALID'); dispatch(ValidationActions.update(address, isValidated)); - } + }; }, - update(address, isValidated) { + update (address, isValidated) { return { type: ActionTypes.VALIDATION_UPDATED, address, isValidated }; }, - validate(address) { + validate (address) { return async function (dispatch) { const validator = await DummyValidator.at(VALIDATOR_ADDRESS); await validator.validate({ from: address }); diff --git a/src/actions/validators.js b/src/actions/validators.js index 3dbe192..027f2ad 100644 --- a/src/actions/validators.js +++ b/src/actions/validators.js @@ -1,29 +1,28 @@ -import { Jurisdiction } from '../contracts' -import AlertActions from './alerts' -import * as ActionTypes from '../actiontypes' -import { JURISDICTION_ADDRESS } from '../constants' +import { Jurisdiction } from '../contracts'; +import AlertActions from './alerts'; +import * as ActionTypes from '../actiontypes'; +import { JURISDICTION_ADDRESS } from '../constants'; const ValidatorsActions = { - - findAll() { - return async function(dispatch) { - const jurisdiction = await Jurisdiction.at(JURISDICTION_ADDRESS) + findAll () { + return async function (dispatch) { + const jurisdiction = await Jurisdiction.at(JURISDICTION_ADDRESS); // FIXME this is very slow. We have to add a function to the Jurisdiction // contract that returns all the validators. // See https://github.com/TPL-protocol/tpl-contracts/issues/2 // --elopio - 20180704 const events = jurisdiction.ValidatorAdded({}, { fromBlock: 0, toBlock: 'latest' }); // FIXME this is not taking reorgs into account - events.watch(function(error, result) { - if(error) AlertActions.showError(error) - else dispatch(ValidatorsActions.add(result.args.validator)) - }) - } + events.watch(function (error, result) { + if (error) AlertActions.showError(error); + else dispatch(ValidatorsActions.add(result.args.validator)); + }); + }; }, - add(validator) { - return { type: ActionTypes.ADD_VALIDATOR, validator } + add (validator) { + return { type: ActionTypes.ADD_VALIDATOR, validator }; }, -} +}; -export default ValidatorsActions +export default ValidatorsActions; diff --git a/src/actions/wallet.js b/src/actions/wallet.js index 2e5ca9d..141e4ee 100644 --- a/src/actions/wallet.js +++ b/src/actions/wallet.js @@ -1,16 +1,11 @@ import * as ActionTypes from '../actiontypes'; -import Network from '../network' - -import { SampleCrowdsale } from '../contracts'; -import { SAMPLE_CROWDSALE_ADDRESS } from '../constants'; -import { SAMPLE_TOKEN_ADDRESS } from '../constants'; -import { SampleToken, } from '../contracts'; - +import Network from '../network'; +import { SampleCrowdsale, SampleToken } from '../contracts'; +import { SAMPLE_CROWDSALE_ADDRESS, SAMPLE_TOKEN_ADDRESS } from '../constants'; const WalletActions = { - - getBalance(address) { + getBalance (address) { return async function (dispatch) { const sampleToken = await SampleToken.at(SAMPLE_TOKEN_ADDRESS); const balance = await sampleToken.balanceOf(address); @@ -18,19 +13,17 @@ const WalletActions = { }; }, - updateBalance(address, balance) { + updateBalance (address, balance) { return { type: ActionTypes.BALANCE_UPDATED, address, balance }; }, - - buy(address) { + buy (address) { return async function (dispatch) { const sampleCrowdsale = await SampleCrowdsale.at(SAMPLE_CROWDSALE_ADDRESS); - await sampleCrowdsale.sendTransaction({ from: address, value: Network.web3().toWei(0.1, "ether") }); + await sampleCrowdsale.sendTransaction({ from: address, value: Network.web3().toWei(0.1, 'ether') }); dispatch(WalletActions.getBalance(address)); }; }, - }; export default WalletActions; diff --git a/src/actiontypes.js b/src/actiontypes.js index 485ba0f..3e46a34 100644 --- a/src/actiontypes.js +++ b/src/actiontypes.js @@ -1,13 +1,13 @@ export const SHOW_ERROR = 'SHOW_ERROR'; export const RESET_ERROR = 'RESET_ERROR'; -export const START_FETCHING = 'START_FETCHING' -export const STOP_FETCHING = 'STOP_FETCHING' +export const START_FETCHING = 'START_FETCHING'; +export const STOP_FETCHING = 'STOP_FETCHING'; -export const CONNECTION_FAILED = 'CONNECTION_FAILED' -export const CONNECTION_SUCCEEDED = 'CONNECTION_SUCCEEDED' +export const CONNECTION_FAILED = 'CONNECTION_FAILED'; +export const CONNECTION_SUCCEEDED = 'CONNECTION_SUCCEEDED'; -export const RECEIVE_JURISDICTION = 'RECEIVE_JURISDICTION' +export const RECEIVE_JURISDICTION = 'RECEIVE_JURISDICTION'; export const ADD_VALIDATOR = 'ADD_VALIDATOR'; diff --git a/src/components/Account.react.js b/src/components/Account.react.js index cf54a70..0ee58ad 100644 --- a/src/components/Account.react.js +++ b/src/components/Account.react.js @@ -1,35 +1,33 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; -import AccountActions from "../actions/accounts"; +import AccountActions from '../actions/accounts'; class Account extends Component { - - componentWillMount() { + componentWillMount () { this.props.findAccount(); } - render() { + render () { return (

My address is { this.props.address }

); } - } -function mapStateToProps({ accounts }) { +function mapStateToProps ({ accounts }) { return { address: accounts.address }; } -function mapDispatchToProps(dispatch) { - return({ +function mapDispatchToProps (dispatch) { + return ({ findAccount: () => dispatch(AccountActions.findAccount()), }); } export default connect( mapStateToProps, - mapDispatchToProps + mapDispatchToProps, )(Account); diff --git a/src/components/Alert.react.js b/src/components/Alert.react.js index cc62def..1fd0cf0 100644 --- a/src/components/Alert.react.js +++ b/src/components/Alert.react.js @@ -1,16 +1,15 @@ -import React from 'react' -import { connect } from 'react-redux' -import AlertActions from '../actions/alerts' +import React from 'react'; +import { connect } from 'react-redux'; +import AlertActions from '../actions/alerts'; class Alert extends React.Component { - - render() { + render () { const alert = this.props.alert; return !alert ?
:

{alert.message} x

-
+
; } _cleanAlert = e => { @@ -19,17 +18,17 @@ class Alert extends React.Component { } } -function mapStateToProps({ alert }) { - return { alert } +function mapStateToProps ({ alert }) { + return { alert }; } -function mapDispatchToProps(dispatch) { - return({ - reset: () => dispatch(AlertActions.reset()) +function mapDispatchToProps (dispatch) { + return ({ + reset: () => dispatch(AlertActions.reset()), }); } export default connect( mapStateToProps, - mapDispatchToProps -)(Alert) + mapDispatchToProps, +)(Alert); diff --git a/src/components/App.react.js b/src/components/App.react.js index 46a59ab..8d750b0 100644 --- a/src/components/App.react.js +++ b/src/components/App.react.js @@ -1,51 +1,51 @@ import React, { Component } from 'react'; -import { connect } from 'react-redux' -import Alert from './Alert.react' -import NetworkActions from "../actions/network"; -import Modal from "./Modal.react" +import { connect } from 'react-redux'; +import Alert from './Alert.react'; +import NetworkActions from '../actions/network'; +import Modal from './Modal.react'; import Account from './Account.react'; import Jurisdiction from './Jurisdiction.react'; import ValidateMe from './ValidateMe.react'; import Wallet from './Wallet.react'; class App extends Component { - - componentWillMount() { + componentWillMount () { this.props.checkConnection(); } - render() { - const network = this.props.network + render () { + const network = this.props.network; const fetching = this.props.fetching; - return (network.connected) ? - (fetching ? - : -
- - - - - -
- ) : -
+ return (network.connected) + ? (fetching + ? + : ( +
+ + + + + +
+ ) + ) + :
-
+
; } } -function mapStateToProps({ fetching, network }) { - return { fetching, network } +function mapStateToProps ({ fetching, network }) { + return { fetching, network }; } -function mapDispatchToProps(dispatch) { +function mapDispatchToProps (dispatch) { return ({ - checkConnection: () => dispatch(NetworkActions.checkConnection()) + checkConnection: () => dispatch(NetworkActions.checkConnection()), }); } - export default connect( mapStateToProps, mapDispatchToProps diff --git a/src/components/Jurisdiction.react.js b/src/components/Jurisdiction.react.js index 22589f7..b7add5f 100644 --- a/src/components/Jurisdiction.react.js +++ b/src/components/Jurisdiction.react.js @@ -1,33 +1,32 @@ -import React, { Component } from 'react' -import { connect } from 'react-redux' +import React, { Component } from 'react'; +import { connect } from 'react-redux'; -import JurisdictionActions from '../actions/jurisdiction' -import ValidatorsList from './ValidatorsList.react' +import JurisdictionActions from '../actions/jurisdiction'; +import ValidatorsList from './ValidatorsList.react'; - -const RootDAO = connect(({jurisdiction}) => ({jurisdiction}))((props) => { - return

RootDAO: { props.jurisdiction.owner }

-}) +const RootDAO = connect(({ jurisdiction }) => ({ jurisdiction }))((props) => { + return

RootDAO: { props.jurisdiction.owner }

; +}); class Transparency extends Component { - componentWillMount() { - this.props.find() + componentWillMount () { + this.props.find(); } - render() { + render () { return (

Jurisdiction

- ) + ); } } -function mapDispatchToProps(dispatch) { +function mapDispatchToProps (dispatch) { return ({ - find: () => dispatch(JurisdictionActions.find()) + find: () => dispatch(JurisdictionActions.find()), }); } diff --git a/src/components/Modal.react.js b/src/components/Modal.react.js index d3cee68..ff688ab 100644 --- a/src/components/Modal.react.js +++ b/src/components/Modal.react.js @@ -1,10 +1,9 @@ -import React from 'react' +import React from 'react'; class Modal extends React.Component { - - render() { - let cssClass = this.props.open ? '' : 'hidden' - cssClass += this.props.dark ? ' dark' : '' + render () { + let cssClass = this.props.open ? '' : 'hidden'; + cssClass += this.props.dark ? ' dark' : ''; return (
@@ -12,15 +11,17 @@ class Modal extends React.Component { {this._renderProgressBar()}
- ) + ); } - _renderProgressBar() { - if(this.props.progressBar) return ( -
-
-
- ) + _renderProgressBar () { + if (this.props.progressBar) { + return ( +
+
+
+ ); + } } } diff --git a/src/components/ValidateMe.react.js b/src/components/ValidateMe.react.js index 9169414..a73becd 100644 --- a/src/components/ValidateMe.react.js +++ b/src/components/ValidateMe.react.js @@ -1,39 +1,37 @@ import React, { Component } from 'react'; -import { connect } from 'react-redux' +import { connect } from 'react-redux'; -import ValidationActions from "../actions/validation"; +import ValidationActions from '../actions/validation'; class ValidateMe extends Component { - - componentDidUpdate(prevProps, prevState, snapshot) { + componentDidUpdate (prevProps, prevState, snapshot) { if (this.props.address !== prevProps.address) { this.props.checkValidated(this.props.address); } } - render() { + render () { return (
-

Am I validated? { this.props.isValidated ? "Yes" : "No" }

+

Am I validated? { this.props.isValidated ? 'Yes' : 'No' }

- ) + ); } - } -function mapStateToProps({ accounts, validations }) { +function mapStateToProps ({ accounts, validations }) { return { address: accounts.address, isValidated: validations.isValidated }; } -function mapDispatchToProps(dispatch) { - return({ +function mapDispatchToProps (dispatch) { + return ({ validate: (address) => dispatch(ValidationActions.validate(address)), - checkValidated: (address) => dispatch(ValidationActions.checkValidated(address)) + checkValidated: (address) => dispatch(ValidationActions.checkValidated(address)), }); } export default connect( mapStateToProps, - mapDispatchToProps + mapDispatchToProps, )(ValidateMe); diff --git a/src/components/ValidatorsList.react.js b/src/components/ValidatorsList.react.js index 9832a51..483c7aa 100644 --- a/src/components/ValidatorsList.react.js +++ b/src/components/ValidatorsList.react.js @@ -1,50 +1,48 @@ -import React, { Component } from 'react' -import { connect } from 'react-redux' +import React, { Component } from 'react'; +import { connect } from 'react-redux'; -import ValidatorsActions from '../actions/validators' +import ValidatorsActions from '../actions/validators'; class ValidatorsList extends Component { - componentWillMount() { + componentWillMount () { this.props.findAll(); } - render() { - const validators = this.props.validators.list + render () { + const validators = this.props.validators.list; return (

Validators:

- { validators.length === 0 ? ( - No validators - ) : ( -
    {this._buildValidatorsList(validators)}
- ) + { validators.length === 0 + ? No validators + :
    {this._buildValidatorsList(validators)}
}
- ) + ); } - _buildValidatorsList(validators) { + _buildValidatorsList (validators) { return validators.map((validator) => { return (
  • {validator}
  • - ) - }) + ); + }); } } -function mapStateToProps({ validators }) { - return { validators } +function mapStateToProps ({ validators }) { + return { validators }; } -function mapDispatchToProps(dispatch) { - return({ - findAll: () => dispatch(ValidatorsActions.findAll()) +function mapDispatchToProps (dispatch) { + return ({ + findAll: () => dispatch(ValidatorsActions.findAll()), }); } export default connect( mapStateToProps, - mapDispatchToProps + mapDispatchToProps, )(ValidatorsList); diff --git a/src/components/Wallet.react.js b/src/components/Wallet.react.js index d266e7c..7e29cd5 100644 --- a/src/components/Wallet.react.js +++ b/src/components/Wallet.react.js @@ -1,17 +1,16 @@ import React, { Component } from 'react'; import { connect } from 'react-redux'; -import WalletActions from "../actions/wallet"; +import WalletActions from '../actions/wallet'; class Wallet extends Component { - - componentDidUpdate(prevProps, prevState, snapshot) { + componentDidUpdate (prevProps, prevState, snapshot) { if (this.props.address !== prevProps.address) { this.props.getBalance(this.props.address); } } - render() { + render () { return (

    I have { this.props.balance.toString() } tokens.

    @@ -19,21 +18,20 @@ class Wallet extends Component {
    ); } - } -function mapStateToProps({ accounts, wallet }) { +function mapStateToProps ({ accounts, wallet }) { return { address: accounts.address, balance: wallet.balance }; } -function mapDispatchToProps(dispatch) { - return({ +function mapDispatchToProps (dispatch) { + return ({ getBalance: (address) => dispatch(WalletActions.getBalance(address)), - buyTokens: (address) => dispatch(WalletActions.buy(address)) + buyTokens: (address) => dispatch(WalletActions.buy(address)), }); } export default connect( mapStateToProps, - mapDispatchToProps + mapDispatchToProps, )(Wallet); diff --git a/src/contracts.js b/src/contracts.js index c6a4baf..62942a2 100644 --- a/src/contracts.js +++ b/src/contracts.js @@ -1,9 +1,9 @@ -import Network from './network' -import contract from 'truffle-contract' +import Network from './network'; +import contract from 'truffle-contract'; const provider = Network.provider(); -function getContract(name) { +function getContract (name) { const C = contract(require('../build/contracts/' + name + '.json')); C.setProvider(provider); return C; @@ -18,5 +18,5 @@ export { Jurisdiction, DummyValidator, SampleToken, - SampleCrowdsale -} + SampleCrowdsale, +}; diff --git a/src/index.js b/src/index.js index fd5f4e4..4015f5c 100644 --- a/src/index.js +++ b/src/index.js @@ -1,13 +1,13 @@ -import React from 'react' -import ReactDOM from 'react-dom' -import App from './components/App.react' -import './index.css' -import { Provider } from 'react-redux' -import Store from './store' +import React from 'react'; +import ReactDOM from 'react-dom'; +import App from './components/App.react'; +import './index.css'; +import { Provider } from 'react-redux'; +import Store from './store'; ReactDOM.render( , document.getElementById('root') -) +); diff --git a/src/network.js b/src/network.js index a5be1a6..d9c3632 100644 --- a/src/network.js +++ b/src/network.js @@ -1,40 +1,40 @@ import Web3 from 'web3'; -import { PROVIDER } from 'constants' +import { PROVIDER } from 'constants'; const Network = { - web3() { - return new Web3(this.provider()) + web3 () { + return new Web3(this.provider()); }, - eth() { + eth () { return this.web3().eth; }, - provider() { + provider () { if (typeof window.web3 !== 'undefined') { - return window.web3.currentProvider + return window.web3.currentProvider; } else { - return new Web3.providers.HttpProvider(PROVIDER) + return new Web3.providers.HttpProvider(PROVIDER); } }, - getAccounts() { + getAccounts () { return new Promise(function (resolve, reject) { - Network.eth().getAccounts(Network._web3Callback(resolve, reject)) + Network.eth().getAccounts(Network._web3Callback(resolve, reject)); }); }, - _web3Callback(resolve, reject) { + _web3Callback (resolve, reject) { return function (error, value) { if (error) { reject(error); } else { resolve(value); } - } - } + }; + }, -} +}; -export default Network +export default Network; diff --git a/src/reducers/accounts.js b/src/reducers/accounts.js index b7c2c31..edf90ba 100644 --- a/src/reducers/accounts.js +++ b/src/reducers/accounts.js @@ -1,13 +1,13 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; -const initialState = { address: ''}; +const initialState = { address: '' }; const AccountsReducer = (state = initialState, action) => { switch (action.type) { - case ActionTypes.RECEIVE_ACCOUNT: - return {...state, address: action.address }; - default: - return state + case ActionTypes.RECEIVE_ACCOUNT: + return { ...state, address: action.address }; + default: + return state; } }; diff --git a/src/reducers/alerts.js b/src/reducers/alerts.js index bd5f193..86c5b7f 100644 --- a/src/reducers/alerts.js +++ b/src/reducers/alerts.js @@ -1,13 +1,13 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; const AlertsReducer = (state = null, action) => { switch (action.type) { - case ActionTypes.SHOW_ERROR: - return { message: action.message }; - case ActionTypes.RESET_ERROR: - return null; - default: - return state + case ActionTypes.SHOW_ERROR: + return { message: action.message }; + case ActionTypes.RESET_ERROR: + return null; + default: + return state; } }; diff --git a/src/reducers/fetching.js b/src/reducers/fetching.js index 82a9f0d..375043f 100644 --- a/src/reducers/fetching.js +++ b/src/reducers/fetching.js @@ -1,13 +1,13 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; const FetchingReducer = (state = null, action) => { switch (action.type) { - case ActionTypes.START_FETCHING: - return action.message - case ActionTypes.STOP_FETCHING: - return null - default: - return state + case ActionTypes.START_FETCHING: + return action.message; + case ActionTypes.STOP_FETCHING: + return null; + default: + return state; } }; diff --git a/src/reducers/jurisdiction.js b/src/reducers/jurisdiction.js index 7ecc672..da9f690 100644 --- a/src/reducers/jurisdiction.js +++ b/src/reducers/jurisdiction.js @@ -1,11 +1,11 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; const JurisdictionReducer = (state = { owner: 'undefined' }, action) => { switch (action.type) { - case ActionTypes.RECEIVE_JURISDICTION: - return action.jurisdiction; - default: - return state + case ActionTypes.RECEIVE_JURISDICTION: + return action.jurisdiction; + default: + return state; } }; diff --git a/src/reducers/network.js b/src/reducers/network.js index b999f7e..4034ece 100644 --- a/src/reducers/network.js +++ b/src/reducers/network.js @@ -1,16 +1,16 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; -const initialState = { connected: null } +const initialState = { connected: null }; const NetworkReducer = (state = initialState, action) => { switch (action.type) { - case ActionTypes.CONNECTION_FAILED: - return {...state, connected: false }; - case ActionTypes.CONNECTION_SUCCEEDED: - return {...state, connected: true}; - default: - return state + case ActionTypes.CONNECTION_FAILED: + return { ...state, connected: false }; + case ActionTypes.CONNECTION_SUCCEEDED: + return { ...state, connected: true }; + default: + return state; } -} +}; -export default NetworkReducer +export default NetworkReducer; diff --git a/src/reducers/validations.js b/src/reducers/validations.js index 3b4f245..c0f3ffa 100644 --- a/src/reducers/validations.js +++ b/src/reducers/validations.js @@ -1,13 +1,13 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; -const initialState = { address: "", isValidated: false }; +const initialState = { address: '', isValidated: false }; const ValidationsReducer = (state = initialState, action) => { switch (action.type) { - case ActionTypes.VALIDATION_UPDATED: - return {...state, address: action.address, isValidated: action.isValidated }; - default: - return state + case ActionTypes.VALIDATION_UPDATED: + return { ...state, address: action.address, isValidated: action.isValidated }; + default: + return state; } }; diff --git a/src/reducers/validators.js b/src/reducers/validators.js index 6b46503..c732e7e 100644 --- a/src/reducers/validators.js +++ b/src/reducers/validators.js @@ -1,14 +1,14 @@ -import * as ActionTypes from '../actiontypes' +import * as ActionTypes from '../actiontypes'; -const initialState = { list: [], validator: null } +const initialState = { list: [], validator: null }; const ValidatorsReducer = (state = initialState, action) => { switch (action.type) { - case ActionTypes.ADD_VALIDATOR: - let validators = state.list; - return {...state, list: [action.validator].concat(validators)}; - default: - return state + case ActionTypes.ADD_VALIDATOR: + let validators = state.list; + return { ...state, list: [action.validator].concat(validators) }; + default: + return state; } }; diff --git a/src/reducers/wallet.js b/src/reducers/wallet.js index 208d24b..c6844e2 100644 --- a/src/reducers/wallet.js +++ b/src/reducers/wallet.js @@ -1,13 +1,13 @@ import * as ActionTypes from '../actiontypes'; -const initialState = { address: "", balance: 0 }; +const initialState = { address: '', balance: 0 }; const WalletReducer = (state = initialState, action) => { switch (action.type) { - case ActionTypes.BALANCE_UPDATED: - return {...state, address: action.address, balance: action.balance }; - default: - return state; + case ActionTypes.BALANCE_UPDATED: + return { ...state, address: action.address, balance: action.balance }; + default: + return state; } }; diff --git a/src/store.js b/src/store.js index e6e7335..3ac75ca 100644 --- a/src/store.js +++ b/src/store.js @@ -1,14 +1,14 @@ -import thunkMiddleware from 'redux-thunk' -import logger from 'redux-logger' -import alerts from './reducers/alerts' -import accounts from './reducers/accounts' -import network from './reducers/network' -import fetching from './reducers/fetching' -import jurisdiction from './reducers/jurisdiction' -import validators from './reducers/validators' -import validations from './reducers/validations' -import wallet from './reducers/wallet' -import { createStore, combineReducers, applyMiddleware } from 'redux' +import thunkMiddleware from 'redux-thunk'; +import logger from 'redux-logger'; +import alerts from './reducers/alerts'; +import accounts from './reducers/accounts'; +import network from './reducers/network'; +import fetching from './reducers/fetching'; +import jurisdiction from './reducers/jurisdiction'; +import validators from './reducers/validators'; +import validations from './reducers/validations'; +import wallet from './reducers/wallet'; +import { createStore, combineReducers, applyMiddleware } from 'redux'; const mainReducer = combineReducers({ alerts, diff --git a/test/contracts/DummyValidator.test.js b/test/contracts/DummyValidator.test.js index 5730657..0f59620 100644 --- a/test/contracts/DummyValidator.test.js +++ b/test/contracts/DummyValidator.test.js @@ -1,18 +1,17 @@ const Jurisdiction = artifacts.require('Jurisdiction'); const DummyValidator = artifacts.require('DummyValidator'); -var should = require('chai').should(); +require('chai').should(); contract('DummyValidator', function ([investor]) { + beforeEach(async function () { + this.jurisdiction = await Jurisdiction.new(); + this.dummyValidator = await DummyValidator.new(this.jurisdiction.address); + await this.jurisdiction.addValidator(this.dummyValidator.address); + }); - beforeEach(async function () { - this.jurisdiction = await Jurisdiction.new(); - this.dummyValidator = await DummyValidator.new(this.jurisdiction.address); - await this.jurisdiction.addValidator(this.dummyValidator.address); - }); - - it('should validate', async function () { - await this.dummyValidator.validate({from: investor}); - (await this.jurisdiction.hasAttribute(investor, 'VALID')).should.be.true; - }); + it('should validate', async function () { + await this.dummyValidator.validate({ from: investor }); + (await this.jurisdiction.hasAttribute(investor, 'VALID')).should.be.true; + }); }); diff --git a/test/contracts/SampleCrowdsale.test.js b/test/contracts/SampleCrowdsale.test.js index 825d63f..d8475eb 100644 --- a/test/contracts/SampleCrowdsale.test.js +++ b/test/contracts/SampleCrowdsale.test.js @@ -4,53 +4,52 @@ const SampleCrowdsale = artifacts.require('SampleCrowdsale'); const BigNumber = web3.BigNumber; -var should = require('chai') - .use(require('chai-as-promised')) - .use(require('chai-bignumber')(BigNumber)) - .should(); +require('chai') + .use(require('chai-as-promised')) + .use(require('chai-bignumber')(BigNumber)) + .should(); contract('SampleCrowdsale', function ([owner, wallet, investor]) { - - const RATE = new BigNumber(1); - - beforeEach(async function () { - this.jurisdiction = await Jurisdiction.new(); - await this.jurisdiction.addValidator(owner); - - this.token = await SampleToken.new(this.jurisdiction.address); - this.crowdsale = await SampleCrowdsale.new( - RATE, wallet, this.token.address); - await this.token.transferOwnership(this.crowdsale.address); - }); - - it('should create crowdsale with correct parameters', async function () { - (await this.crowdsale.rate()).should.be.bignumber.equal(RATE); - (await this.crowdsale.wallet()).should.be.equal(wallet); - }); - - it('should not accept payment not validated', async function () { - const investmentAmount = new BigNumber(web3.toWei(1, 'ether')); - await this.crowdsale.buyTokens( - investor, - { value: investmentAmount, from: investor } - ).should.be.rejectedWith('revert'); - (await this.token.balanceOf(investor)) - .should.be.bignumber.equal(0); - (await this.token.totalSupply()) - .should.be.bignumber.equal(0); - }); - - it('should accept payment validated', async function () { - await this.jurisdiction.addAttribute(investor, 'VALID', 1); - - const investmentAmount = new BigNumber(web3.toWei(1, 'ether')); - await this.crowdsale.buyTokens( - investor, - { value: investmentAmount, from: investor } - ).should.be.fulfilled; - (await this.token.balanceOf(investor)) - .should.be.bignumber.equal(investmentAmount); - (await this.token.totalSupply()) - .should.be.bignumber.equal(investmentAmount); - }); + const RATE = new BigNumber(1); + + beforeEach(async function () { + this.jurisdiction = await Jurisdiction.new(); + await this.jurisdiction.addValidator(owner); + + this.token = await SampleToken.new(this.jurisdiction.address); + this.crowdsale = await SampleCrowdsale.new( + RATE, wallet, this.token.address); + await this.token.transferOwnership(this.crowdsale.address); + }); + + it('should create crowdsale with correct parameters', async function () { + (await this.crowdsale.rate()).should.be.bignumber.equal(RATE); + (await this.crowdsale.wallet()).should.be.equal(wallet); + }); + + it('should not accept payment not validated', async function () { + const investmentAmount = new BigNumber(web3.toWei(1, 'ether')); + await this.crowdsale.buyTokens( + investor, + { value: investmentAmount, from: investor } + ).should.be.rejectedWith('revert'); + (await this.token.balanceOf(investor)) + .should.be.bignumber.equal(0); + (await this.token.totalSupply()) + .should.be.bignumber.equal(0); + }); + + it('should accept payment validated', async function () { + await this.jurisdiction.addAttribute(investor, 'VALID', 1); + + const investmentAmount = new BigNumber(web3.toWei(1, 'ether')); + await this.crowdsale.buyTokens( + investor, + { value: investmentAmount, from: investor } + ).should.be.fulfilled; + (await this.token.balanceOf(investor)) + .should.be.bignumber.equal(investmentAmount); + (await this.token.totalSupply()) + .should.be.bignumber.equal(investmentAmount); + }); }); diff --git a/test/contracts/SampleToken.test.js b/test/contracts/SampleToken.test.js index af45d96..0a991a3 100644 --- a/test/contracts/SampleToken.test.js +++ b/test/contracts/SampleToken.test.js @@ -3,13 +3,12 @@ const SampleToken = artifacts.require('SampleToken'); const BigNumber = web3.BigNumber; -var should = require('chai') - .use(require('chai-as-promised')) - .use(require('chai-bignumber')(BigNumber)) - .should(); +require('chai') + .use(require('chai-as-promised')) + .use(require('chai-bignumber')(BigNumber)) + .should(); contract('SampleToken', function ([owner, investor1, investor2]) { - beforeEach(async function () { this.jurisdiction = await Jurisdiction.new(); await this.jurisdiction.addValidator(owner); @@ -125,5 +124,4 @@ contract('SampleToken', function ([owner, investor1, investor2]) { (await this.token.balanceOf(investor2)) .should.be.bignumber.equal(investmentAmount); }); - }); diff --git a/test/react/setup.js b/test/react/setup.js index 015b8c3..1a627b0 100644 --- a/test/react/setup.js +++ b/test/react/setup.js @@ -11,19 +11,19 @@ const { JSDOM } = require('jsdom'); const jsdom = new JSDOM(''); const { window } = jsdom; -function copyProps(src, target) { - const props = Object.getOwnPropertyNames(src) - .filter(prop => typeof target[prop] === 'undefined') - .reduce((result, prop) => ({ - ...result, - [prop]: Object.getOwnPropertyDescriptor(src, prop), - }), {}); - Object.defineProperties(target, props); +function copyProps (src, target) { + const props = Object.getOwnPropertyNames(src) + .filter(prop => typeof target[prop] === 'undefined') + .reduce((result, prop) => ({ + ...result, + [prop]: Object.getOwnPropertyDescriptor(src, prop), + }), {}); + Object.defineProperties(target, props); } global.window = window; global.document = window.document; global.navigator = { - userAgent: 'node.js', + userAgent: 'node.js', }; copyProps(window, global); diff --git a/test/react/test.js b/test/react/test.js index e487e39..9927367 100644 --- a/test/react/test.js +++ b/test/react/test.js @@ -8,10 +8,10 @@ import ValidatorsList from '../../src/components/ValidatorsList.react'; spy(ValidatorsList.prototype, 'componentDidMount'); describe('', () => { - it('calls componentDidMount', () => { - const initialState = {}; - const store = createMockStore(initialState); - const wrapper = shallow(, {context: {store}}); - expect(ValidatorsList.prototype.componentDidMount.calledOnce).to.equal(true); - }); + it('calls componentDidMount', () => { + const initialState = {}; + const store = createMockStore(initialState); + shallow(, { context: { store } }); + expect(ValidatorsList.prototype.componentDidMount.calledOnce).to.equal(true); + }); }); diff --git a/truffle.js b/truffle.js index 90808a7..60ee264 100644 --- a/truffle.js +++ b/truffle.js @@ -1,10 +1,10 @@ module.exports = { networks: { development: { - host: "localhost", + host: 'localhost', port: 8545, - network_id: "*", + network_id: '*', // eslint-disable-line camelcase gas: 1000000, }, }, -} +};