From b14828655f917c4fe56752d17da50ef083e441eb Mon Sep 17 00:00:00 2001 From: Nikola Bjelo Date: Tue, 6 Nov 2018 02:38:13 +0100 Subject: [PATCH] Installing a clean linter for the frontend --- client/.eslintrc.js | 21 ++ client/package-lock.json | 295 ++++++++++++++---- client/package.json | 4 + client/src/Components/Event/Edit/index.js | 24 +- client/src/Components/Event/Edit/styles.js | 6 +- client/src/Components/Event/Show/index.js | 24 +- client/src/Components/Event/Show/styles.js | 6 +- client/src/Components/Events/index.js | 10 +- client/src/Components/HostedEvents/Event.js | 32 +- client/src/Components/HostedEvents/New.js | 72 +++-- client/src/Components/HostedEvents/index.js | 55 ++-- client/src/Components/HostedEvents/styles.js | 14 +- client/src/Components/Search/Event.js | 32 +- client/src/Components/Search/Tabs/Future.js | 26 +- client/src/Components/Search/Tabs/History.js | 16 +- client/src/Components/Search/Tabs/Incoming.js | 32 +- client/src/Components/Search/Tabs/Past.js | 26 +- client/src/Components/Search/Tabs/index.js | 12 +- client/src/Components/Search/index.js | 72 +++-- client/src/Components/Search/styles.js | 18 +- client/src/Components/TopBar/data.js | 22 +- client/src/Components/TopBar/index.js | 31 +- client/src/Components/TopBar/styles.js | 24 +- client/src/GraphQL/Calls/hostedEvents.js | 12 +- client/src/GraphQL/Calls/index.js | 10 +- client/src/GraphQL/Calls/listEvents.js | 10 +- client/src/GraphQL/Calls/showEvent.js | 10 +- client/src/GraphQL/Fragments/event.js | 6 +- client/src/GraphQL/Fragments/index.js | 8 +- client/src/index.js | 48 +-- client/src/utils/index.js | 18 +- client/src/utils/local-storage.js | 10 +- server/.eslintrc.js | 2 +- 33 files changed, 607 insertions(+), 401 deletions(-) create mode 100644 client/.eslintrc.js diff --git a/client/.eslintrc.js b/client/.eslintrc.js new file mode 100644 index 000000000..250847da1 --- /dev/null +++ b/client/.eslintrc.js @@ -0,0 +1,21 @@ +module.exports = { + parser: 'babel-eslint', + extends: [ + 'airbnb-base', + 'plugin:react/recommended', + ], + rules: { + 'no-underscore-dangle': 'off', + 'no-param-reassign': 'off', + 'react/prop-types': 0, + }, + settings: { + 'react': { + 'pragma': 'React', + 'version': '16.5', + }, + }, + env: { + 'browser': true, + }, +}; diff --git a/client/package-lock.json b/client/package-lock.json index 9ebb00764..839c3b060 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -227,9 +227,9 @@ "integrity": "sha512-te5lMAWii1uEJ4FwLjzdlbw3+n0FZNOvFXHxQDKeT0dilh7HOzdMzV2TrJVUzq8ep7J4Na8OUYPRLSQkJHAlrg==" }, "acorn": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.2.tgz", - "integrity": "sha512-GXmKIvbrN3TV7aVqAzVFaMW8F8wzVX7voEBRO3bDA64+EX37YSayggRJP5Xig6HYHBkWKpFg9W5gg6orklubhg==", + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.0.4.tgz", + "integrity": "sha512-VY4i5EKSKkofY2I+6QLTbTTN/UvEQPCo6eiwzzSaSWfpaDhOmStMCMod6wmuPciNq+XS0faCglFu2lHZpdHUtg==", "dev": true }, "acorn-jsx": { @@ -239,9 +239,9 @@ "dev": true }, "ajv": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.4.tgz", - "integrity": "sha512-4Wyjt8+t6YszqaXnLDfMmG/8AlO5Zbcsy3ATHncCzjW/NoPzAId8AK6749Ybjmdt+kUY1gP60fCu46oDxPv/mg==", + "version": "6.5.5", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.5.tgz", + "integrity": "sha512-7q7gtRQDJSyuEHjuVgHoUa2VuemFiCMrfQc9Tc08XTAc4Zj/5U1buQJ0HU6i7fKjXU09SVgSmxa4sLvuvS8Iyg==", "dev": true, "requires": { "fast-deep-equal": "^2.0.1", @@ -263,9 +263,9 @@ "dev": true }, "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", + "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", "dev": true }, "ansi-styles": { @@ -381,6 +381,12 @@ "js-tokens": "^3.0.2" }, "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + }, "ansi-styles": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", @@ -496,9 +502,9 @@ "integrity": "sha1-6LL+PX8at9aaMhma/5HqaTFAlRU=" }, "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "dev": true }, "circular-json": { @@ -730,16 +736,16 @@ "dev": true }, "eslint": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz", - "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==", + "version": "5.8.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.8.0.tgz", + "integrity": "sha512-Zok6Bru3y2JprqTNm14mgQ15YQu/SMDkWdnmHfFg770DIUlmMFd/gqqzCHekxzjHZJxXv3tmTpH0C1icaYJsRQ==", "dev": true, "requires": { - "ajv": "^6.5.0", - "babel-code-frame": "^6.26.0", + "@babel/code-frame": "^7.0.0", + "ajv": "^6.5.3", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", - "debug": "^3.1.0", + "debug": "^4.0.1", "doctrine": "^2.1.0", "eslint-scope": "^4.0.0", "eslint-utils": "^1.3.1", @@ -751,11 +757,11 @@ "functional-red-black-tree": "^1.0.1", "glob": "^7.1.2", "globals": "^11.7.0", - "ignore": "^4.0.2", + "ignore": "^4.0.6", "imurmurhash": "^0.1.4", - "inquirer": "^5.2.0", + "inquirer": "^6.1.0", "is-resolvable": "^1.1.0", - "js-yaml": "^3.11.0", + "js-yaml": "^3.12.0", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", "lodash": "^4.17.5", @@ -766,15 +772,24 @@ "path-is-inside": "^1.0.2", "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^2.0.0", + "regexpp": "^2.0.1", "require-uncached": "^1.0.3", - "semver": "^5.5.0", + "semver": "^5.5.1", "strip-ansi": "^4.0.0", "strip-json-comments": "^2.0.1", - "table": "^4.0.3", + "table": "^5.0.2", "text-table": "^0.2.0" }, "dependencies": { + "debug": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.0.tgz", + "integrity": "sha512-heNPJUJIqC+xB6ayLAMHaIrmN9HKa7aQO8MGqKpvCA+uJYVcvR6l5kgdrhRuwPFHU7P5/A1w0BjByPHwpfTDKg==", + "dev": true, + "requires": { + "ms": "^2.1.1" + } + }, "eslint-scope": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", @@ -787,6 +802,17 @@ } } }, + "eslint-config-airbnb-base": { + "version": "13.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-airbnb-base/-/eslint-config-airbnb-base-13.1.0.tgz", + "integrity": "sha512-XWwQtf3U3zIoKO1BbHh6aUhJZQweOwSt4c2JrPDg9FP3Ltv3+YfEv7jIDB8275tVnO/qOHbfuYg3kzw6Je7uWw==", + "dev": true, + "requires": { + "eslint-restricted-globals": "^0.1.1", + "object.assign": "^4.1.0", + "object.entries": "^1.0.4" + } + }, "eslint-config-standard": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz", @@ -953,6 +979,12 @@ "integrity": "sha512-OwxJkR6TQiYMmt1EsNRMe5qG3GsbjlcOhbGUBY4LtavF9DsLaTcoR+j2Tdjqi23oUwKNUqX7qcn5fPStafMdlA==", "dev": true }, + "eslint-restricted-globals": { + "version": "0.1.1", + "resolved": "https://registry.npmjs.org/eslint-restricted-globals/-/eslint-restricted-globals-0.1.1.tgz", + "integrity": "sha1-NfDVy8ZMLj7WLpO0saevBbp+1Nc=", + "dev": true + }, "eslint-scope": { "version": "3.7.1", "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", @@ -1023,13 +1055,13 @@ "dev": true }, "external-editor": { - "version": "2.2.0", - "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.3.tgz", + "integrity": "sha512-bn71H9+qWoOQKyZDo25mOMVpSmXROAsTJVVVYzrrtol3d4y+AsKjf4Iwl2Q+IuT0kFSQ1qo166UuIwqYq7mGnA==", "dev": true, "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", "tmp": "^0.0.33" } }, @@ -1219,6 +1251,14 @@ "dev": true, "requires": { "ansi-regex": "^2.0.0" + }, + "dependencies": { + "ansi-regex": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", + "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "dev": true + } } }, "has-flag": { @@ -1316,21 +1356,21 @@ "dev": true }, "inquirer": { - "version": "5.2.0", - "resolved": "http://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", - "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.2.0.tgz", + "integrity": "sha512-QIEQG4YyQ2UYZGDC4srMZ7BjHOmNk1lR2JQj5UknBapklm6WHA+VVH7N+sUdX3A7NeCfGF8o4X1S3Ao7nAcIeg==", "dev": true, "requires": { "ansi-escapes": "^3.0.0", "chalk": "^2.0.0", "cli-cursor": "^2.1.0", "cli-width": "^2.0.0", - "external-editor": "^2.1.0", + "external-editor": "^3.0.0", "figures": "^2.0.0", - "lodash": "^4.3.0", + "lodash": "^4.17.10", "mute-stream": "0.0.7", "run-async": "^2.2.0", - "rxjs": "^5.5.2", + "rxjs": "^6.1.0", "string-width": "^2.1.0", "strip-ansi": "^4.0.0", "through": "^2.3.6" @@ -1788,6 +1828,30 @@ "integrity": "sha512-FTMyFUm2wBcGHnH2eXmz7tC6IwlqQZ6mVZ+6dm6vZ4IQIHjs6FdNsQBuKGPuUUUY6NfJw2PshC08Tn6LzLDOag==", "dev": true }, + "object.assign": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.0.tgz", + "integrity": "sha512-exHJeq6kBKj58mqGyTQ9DFvrZC/eR6OwxzoM9YRoGBqrXYonaFyGiFMuc9VZrXf7DarreEwMpurG3dd+CNyW5w==", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "function-bind": "^1.1.1", + "has-symbols": "^1.0.0", + "object-keys": "^1.0.11" + } + }, + "object.entries": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.0.4.tgz", + "integrity": "sha1-G/mk3SKI9bM/Opk9JXZh8F0WGl8=", + "dev": true, + "requires": { + "define-properties": "^1.1.2", + "es-abstract": "^1.6.1", + "function-bind": "^1.1.0", + "has": "^1.0.1" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -2327,20 +2391,12 @@ "dev": true }, "rxjs": { - "version": "5.5.12", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz", - "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "version": "6.3.3", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.3.3.tgz", + "integrity": "sha512-JTWmoY9tWCs7zvIk/CvRjhjGaOd+OVBM987mxFo+OW66cGpdKjZcpmc74ES1sB//7Kl/PAe8+wEakuhG4pcgOw==", "dev": true, "requires": { - "symbol-observable": "1.0.1" - }, - "dependencies": { - "symbol-observable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", - "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", - "dev": true - } + "tslib": "^1.9.0" } }, "safer-buffer": { @@ -2463,6 +2519,131 @@ "eslint-plugin-react": "~7.11.1", "eslint-plugin-standard": "~4.0.0", "standard-engine": "~9.0.0" + }, + "dependencies": { + "chardet": { + "version": "0.4.2", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", + "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "dev": true + }, + "eslint": { + "version": "5.4.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz", + "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==", + "dev": true, + "requires": { + "ajv": "^6.5.0", + "babel-code-frame": "^6.26.0", + "chalk": "^2.1.0", + "cross-spawn": "^6.0.5", + "debug": "^3.1.0", + "doctrine": "^2.1.0", + "eslint-scope": "^4.0.0", + "eslint-utils": "^1.3.1", + "eslint-visitor-keys": "^1.0.0", + "espree": "^4.0.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": "^11.7.0", + "ignore": "^4.0.2", + "imurmurhash": "^0.1.4", + "inquirer": "^5.2.0", + "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.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": "^7.0.0", + "progress": "^2.0.0", + "regexpp": "^2.0.0", + "require-uncached": "^1.0.3", + "semver": "^5.5.0", + "strip-ansi": "^4.0.0", + "strip-json-comments": "^2.0.1", + "table": "^4.0.3", + "text-table": "^0.2.0" + } + }, + "eslint-scope": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.0.tgz", + "integrity": "sha512-1G6UTDi7Jc1ELFwnR58HV4fK9OQK4S6N985f166xqXxpjU6plxFISJa2Ba9KCQuFa8RCnj/lSFJbHo7UFDBnUA==", + "dev": true, + "requires": { + "esrecurse": "^4.1.0", + "estraverse": "^4.1.1" + } + }, + "external-editor": { + "version": "2.2.0", + "resolved": "http://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", + "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", + "dev": true, + "requires": { + "chardet": "^0.4.0", + "iconv-lite": "^0.4.17", + "tmp": "^0.0.33" + } + }, + "inquirer": { + "version": "5.2.0", + "resolved": "http://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", + "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", + "dev": true, + "requires": { + "ansi-escapes": "^3.0.0", + "chalk": "^2.0.0", + "cli-cursor": "^2.1.0", + "cli-width": "^2.0.0", + "external-editor": "^2.1.0", + "figures": "^2.0.0", + "lodash": "^4.3.0", + "mute-stream": "0.0.7", + "run-async": "^2.2.0", + "rxjs": "^5.5.2", + "string-width": "^2.1.0", + "strip-ansi": "^4.0.0", + "through": "^2.3.6" + } + }, + "rxjs": { + "version": "5.5.12", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz", + "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", + "dev": true, + "requires": { + "symbol-observable": "1.0.1" + } + }, + "symbol-observable": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", + "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", + "dev": true + }, + "table": { + "version": "4.0.3", + "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", + "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", + "dev": true, + "requires": { + "ajv": "^6.0.1", + "ajv-keywords": "^3.0.0", + "chalk": "^2.1.0", + "lodash": "^4.17.4", + "slice-ansi": "1.0.0", + "string-width": "^2.1.1" + } + } } }, "standard-engine": { @@ -2502,14 +2683,6 @@ "dev": true, "requires": { "ansi-regex": "^3.0.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - } } }, "strip-bom": { @@ -2539,15 +2712,13 @@ "integrity": "sha1-Kb9hXUqnEhvdiYsi1LP5vE4qoD0=" }, "table": { - "version": "4.0.3", - "resolved": "http://registry.npmjs.org/table/-/table-4.0.3.tgz", - "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/table/-/table-5.1.0.tgz", + "integrity": "sha512-e542in22ZLhD/fOIuXs/8yDZ9W61ltF8daM88rkRNtgTIct+vI2fTnAyu/Db2TCfEcI8i7mjZz6meLq0nW7TYg==", "dev": true, "requires": { - "ajv": "^6.0.1", - "ajv-keywords": "^3.0.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", + "ajv": "^6.5.3", + "lodash": "^4.17.10", "slice-ansi": "1.0.0", "string-width": "^2.1.1" } diff --git a/client/package.json b/client/package.json index 96d0f6959..c02059c10 100644 --- a/client/package.json +++ b/client/package.json @@ -13,6 +13,10 @@ }, "devDependencies": { "babel-eslint": "^10.0.1", + "eslint": "^5.8.0", + "eslint-config-airbnb-base": "^13.1.0", + "eslint-plugin-import": "^2.14.0", + "eslint-plugin-react": "^7.11.1", "react-hot-loader": "^4.3.11", "standard": "^12.0.1" }, diff --git a/client/src/Components/Event/Edit/index.js b/client/src/Components/Event/Edit/index.js index 1a17154bb..6fc58c7f0 100644 --- a/client/src/Components/Event/Edit/index.js +++ b/client/src/Components/Event/Edit/index.js @@ -1,15 +1,15 @@ -import React from 'react' -import { Query } from 'react-apollo' +import React from 'react'; +import { Query } from 'react-apollo'; -import Typography from '@material-ui/core/Typography' -import { withStyles } from '@material-ui/core/styles' +import Typography from '@material-ui/core/Typography'; +import { withStyles } from '@material-ui/core/styles'; -import styles from './styles' +import styles from './styles'; -import { showEventCalls } from '../../../GraphQL/Calls/index' +import { showEventCalls } from '../../../GraphQL/Calls/index'; class Edit extends React.Component { - render () { + render() { return ( {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; return (

{data.events_Event.description}

- ) + ); }}
- ) + ); } } -export default withStyles(styles)(Edit) +export default withStyles(styles)(Edit); diff --git a/client/src/Components/Event/Edit/styles.js b/client/src/Components/Event/Edit/styles.js index 175dc52e5..12fd82051 100644 --- a/client/src/Components/Event/Edit/styles.js +++ b/client/src/Components/Event/Edit/styles.js @@ -1,4 +1,4 @@ -const styles = theme => ({ -}) +const styles = () => ({ +}); -export default styles +export default styles; diff --git a/client/src/Components/Event/Show/index.js b/client/src/Components/Event/Show/index.js index aaf59fb06..86b2b61bc 100644 --- a/client/src/Components/Event/Show/index.js +++ b/client/src/Components/Event/Show/index.js @@ -1,15 +1,15 @@ -import React from 'react' -import { Query } from 'react-apollo' +import React from 'react'; +import { Query } from 'react-apollo'; -import Typography from '@material-ui/core/Typography' -import { withStyles } from '@material-ui/core/styles' +import Typography from '@material-ui/core/Typography'; +import { withStyles } from '@material-ui/core/styles'; -import styles from './styles' +import styles from './styles'; -import { showEventCalls } from '../../../GraphQL/Calls/index' +import { showEventCalls } from '../../../GraphQL/Calls/index'; class Show extends React.Component { - render () { + render() { return ( {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; return (

{data.events_Event.description}

- ) + ); }}
- ) + ); } } -export default withStyles(styles)(Show) +export default withStyles(styles)(Show); diff --git a/client/src/Components/Event/Show/styles.js b/client/src/Components/Event/Show/styles.js index 175dc52e5..12fd82051 100644 --- a/client/src/Components/Event/Show/styles.js +++ b/client/src/Components/Event/Show/styles.js @@ -1,4 +1,4 @@ -const styles = theme => ({ -}) +const styles = () => ({ +}); -export default styles +export default styles; diff --git a/client/src/Components/Events/index.js b/client/src/Components/Events/index.js index 96d83a55d..dde254d73 100644 --- a/client/src/Components/Events/index.js +++ b/client/src/Components/Events/index.js @@ -1,9 +1,5 @@ -import React from 'react' +import React from 'react'; -class Index extends React.Component { - render () { - return

Here will come a list the competitions you applied for

- } -} +const Index = () =>

Here will come a list the competitions you applied for

; -export default Index +export default Index; diff --git a/client/src/Components/HostedEvents/Event.js b/client/src/Components/HostedEvents/Event.js index 47ad49c54..7ccb22ec7 100644 --- a/client/src/Components/HostedEvents/Event.js +++ b/client/src/Components/HostedEvents/Event.js @@ -1,27 +1,27 @@ -import React from 'react' -import { Link } from 'react-router-dom' +import React from 'react'; +import { Link } from 'react-router-dom'; import { Grid, Paper, Typography, - Button -} from '@material-ui/core' -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' + Button, +} from '@material-ui/core'; +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { toLocalTime } from '../../utils' +import { toLocalTime } from '../../utils'; class Event extends React.Component { - render () { - const classes = this.props.classes + render() { + const { classes } = this.props; const { name, designator, startDatetime, finishDatetime, host, - description - } = this.props.event + description, + } = this.props.event; return ( @@ -31,7 +31,9 @@ class Event extends React.Component { To : {toLocalTime(finishDatetime)} - Hosted by: {host.alias} ({host.lastName} {host.firstName}) + + Hosted by: {host.alias} ({host.lastName} {host.firstName}) + Formula: First prize: @@ -58,7 +60,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={'/show/' + designator} + to={`/show/${designator}`} > Show @@ -67,8 +69,8 @@ class Event extends React.Component { - ) + ); } } -export default withStyles(styles)(Event) +export default withStyles(styles)(Event); diff --git a/client/src/Components/HostedEvents/New.js b/client/src/Components/HostedEvents/New.js index 61b4d72ff..3b2d41245 100644 --- a/client/src/Components/HostedEvents/New.js +++ b/client/src/Components/HostedEvents/New.js @@ -1,64 +1,70 @@ -import React from 'react' -import { Mutation } from 'react-apollo' -import { hostedEventsCalls } from '../../GraphQL/Calls/index' -import { DateTime } from 'luxon' +import React from 'react'; +import { Mutation } from 'react-apollo'; +import { DateTime } from 'luxon'; import { Button, - TextField -} from '@material-ui/core' -import { ChevronLeft, ChevronRight } from '@material-ui/icons' -import { DateTimePicker } from 'material-ui-pickers' + TextField, +} from '@material-ui/core'; +import { ChevronLeft, ChevronRight } from '@material-ui/icons'; +import { DateTimePicker } from 'material-ui-pickers'; +import { hostedEventsCalls } from '../../GraphQL/Calls/index'; class New extends React.Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { name: '', description: '', startDatetime: DateTime.local().plus({ days: 1 }).startOf('day'), - finishDatetime: DateTime.local().plus({ days: 8 }).startOf('day') - } + finishDatetime: DateTime.local().plus({ days: 8 }).startOf('day'), + }; } - render () { - const { name, description, startDatetime, finishDatetime } = this.state + render() { + const { + name, description, startDatetime, finishDatetime, + } = this.state; return ( { - const { events_EventsByHost: hostedEvents } = store.readQuery({ query: hostedEventsCalls.EVENTS_EVENTSBYHOST }) + const { events_EventsByHost: hostedEvents } = store.readQuery({ + query: hostedEventsCalls.EVENTS_EVENTSBYHOST, + }); store.writeQuery({ query: hostedEventsCalls.EVENTS_EVENTSBYHOST, - data: { events_EventsByHost: hostedEvents.concat([data.events_HostEvent]) } - }) - this.props.handleNewEvent(data.events_HostEvent) + data: { events_EventsByHost: hostedEvents.concat([data.events_HostEvent]) }, + }); + this.props.handleNewEvent(data.events_HostEvent); } } > - {(hostEvent, { data }) => ( + {hostEvent => (
{ - e.preventDefault() - hostEvent({ variables: { - name: name, - description: description, - startDatetime: startDatetime.valueOf() / 1000, - finishDatetime: startDatetime.valueOf() / 1000 - } }) + onSubmit={(e) => { + e.preventDefault(); + hostEvent({ + variables: { + name, + description, + startDatetime: startDatetime.valueOf() / 1000, + finishDatetime: startDatetime.valueOf() / 1000, + }, + }); }} > this.setState({ name: e.target.value })} + onChange={e => this.setState({ name: e.target.value })} fullWidth /> this.setState({ description: e.target.value })} + onChange={e => this.setState({ description: e.target.value })} fullWidth /> } rightArrowIcon={} value={startDatetime} - onChange={(date) => this.setState({ startDatetime: date })} + onChange={date => this.setState({ startDatetime: date })} helperText='Competition start date' /> } rightArrowIcon={} value={finishDatetime} - onChange={(date) => this.setState({ finishDatetime: date })} + onChange={date => this.setState({ finishDatetime: date })} helperText='Competition finishing date' /> @@ -91,8 +97,8 @@ class New extends React.Component {
)}
- ) + ); } } -export default New +export default New; diff --git a/client/src/Components/HostedEvents/index.js b/client/src/Components/HostedEvents/index.js index 248d0d929..dfd5b8353 100644 --- a/client/src/Components/HostedEvents/index.js +++ b/client/src/Components/HostedEvents/index.js @@ -1,41 +1,41 @@ -import React from 'react' -import { Query } from 'react-apollo' +import React from 'react'; +import { Query } from 'react-apollo'; import { Button, Dialog, DialogContent, DialogContentText, - DialogTitle -} from '@material-ui/core' + DialogTitle, +} from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { hostedEventsCalls } from '../../GraphQL/Calls/index' +import { hostedEventsCalls } from '../../GraphQL/Calls/index'; -import New from './New' -import Event from './Event' +import New from './New'; +import Event from './Event'; class HostedEvent extends React.Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { - isNewEventOpen: false - } + isNewEventOpen: false, + }; } handleNewEvent = (event) => { - this.props.history.push(`/edit/${event.designator}`) + this.props.history.push(`/edit/${event.designator}`); }; - render () { - const { classes } = this.props + render() { + const { classes } = this.props; return ( @@ -43,24 +43,22 @@ class HostedEvent extends React.Component { query={hostedEventsCalls.EVENTS_EVENTSBYHOST} > {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` - const list = data.events_EventsByHost.map((event, index) => { - return ( + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; + const list = data.events_EventsByHost.map((event, index) => ( - ) - }) + )); return ( { list } - ) + ); }} { this.setState({ isNewEventOpen: false }) }} + onClose={() => { this.setState({ isNewEventOpen: false }); }} aria-labelledby='addEvent-dialog-title' > @@ -68,14 +66,15 @@ class HostedEvent extends React.Component { - Here you will add just the minimal information, will be settable in the edit page of your event. + Here you will add just the minimal information, + will be settable in the edit page of your event. - ) + ); } } -export default withStyles(styles)(HostedEvent) +export default withStyles(styles)(HostedEvent); diff --git a/client/src/Components/HostedEvents/styles.js b/client/src/Components/HostedEvents/styles.js index e867e8174..8a55c4d41 100644 --- a/client/src/Components/HostedEvents/styles.js +++ b/client/src/Components/HostedEvents/styles.js @@ -5,22 +5,22 @@ const styles = theme => ({ marginTop: 20, marginBottom: 20, marginLeft: 400, - marginRight: 400 + marginRight: 400, }, buttonList: { margin: theme.spacing.unit, - float: 'right' + float: 'right', }, buttonGrid: { - marginTop: -20 + marginTop: -20, }, addButton: { display: 'block', padding: 20, marginTop: 20, marginRight: 20, - marginLeft: 'auto' - } -}) + marginLeft: 'auto', + }, +}); -export default styles +export default styles; diff --git a/client/src/Components/Search/Event.js b/client/src/Components/Search/Event.js index 8a3579416..42865cc2c 100644 --- a/client/src/Components/Search/Event.js +++ b/client/src/Components/Search/Event.js @@ -1,27 +1,27 @@ -import React from 'react' -import { Link } from 'react-router-dom' +import React from 'react'; +import { Link } from 'react-router-dom'; import { Grid, Paper, Typography, - Button -} from '@material-ui/core' -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' + Button, +} from '@material-ui/core'; +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { toLocalTime } from '../../utils' +import { toLocalTime } from '../../utils'; class Event extends React.Component { - render () { - const classes = this.props.classes + render() { + const { classes } = this.props; const { name, designator, startDatetime, finishDatetime, host, - description - } = this.props.event + description, + } = this.props.event; return ( @@ -31,7 +31,9 @@ class Event extends React.Component { To : {toLocalTime(finishDatetime)} - Hosted by: {host.alias} ({host.lastName} {host.firstName}) + + Hosted by: {host.alias} ({host.lastName} {host.firstName}) + Formula: First prize: @@ -48,7 +50,7 @@ class Event extends React.Component { color='primary' size='small' component={Link} - to={'/show/' + designator} + to={`/show/${designator}`} > Show @@ -57,8 +59,8 @@ class Event extends React.Component { - ) + ); } } -export default withStyles(styles)(Event) +export default withStyles(styles)(Event); diff --git a/client/src/Components/Search/Tabs/Future.js b/client/src/Components/Search/Tabs/Future.js index 2a46f4995..6a83bf3c9 100644 --- a/client/src/Components/Search/Tabs/Future.js +++ b/client/src/Components/Search/Tabs/Future.js @@ -1,21 +1,19 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; -import Event from '../Event' +import Event from '../Event'; class Future extends React.Component { - render () { - const classes = this.props.classes - const { FutureEvents } = this.props + render() { + const { classes } = this.props; + const { FutureEvents } = this.props; - const futureEvents = FutureEvents.map((event, index) => { - return ( + const futureEvents = FutureEvents.map((event, index) => ( - ) - }) + )); return ( {futureEvents} - ) + ); } } -export default withStyles(styles)(Future) +export default withStyles(styles)(Future); diff --git a/client/src/Components/Search/Tabs/History.js b/client/src/Components/Search/Tabs/History.js index 0db046e5c..21d848289 100644 --- a/client/src/Components/Search/Tabs/History.js +++ b/client/src/Components/Search/Tabs/History.js @@ -1,12 +1,12 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; class History extends React.Component { - render () { - const classes = this.props.classes + render() { + const { classes } = this.props; return ( Your old events (maybe here, maybe not, who knows) - ) + ); } } -export default withStyles(styles)(History) +export default withStyles(styles)(History); diff --git a/client/src/Components/Search/Tabs/Incoming.js b/client/src/Components/Search/Tabs/Incoming.js index 3956aa6d7..94fe6b93b 100644 --- a/client/src/Components/Search/Tabs/Incoming.js +++ b/client/src/Components/Search/Tabs/Incoming.js @@ -1,26 +1,22 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; -import Event from '../Event' +import Event from '../Event'; class Incoming extends React.Component { - render () { - const classes = this.props.classes - const { IncomingEvents, OngoingEvents } = this.props + render() { + const { classes } = this.props; + const { IncomingEvents, OngoingEvents } = this.props; - const incomingEvents = IncomingEvents.map((event, index) => { - return ( + const incomingEvents = IncomingEvents.map((event, index) => ( - ) - }) - const ongoingEvents = OngoingEvents.map((event, index) => { - return ( + )); + const ongoingEvents = OngoingEvents.map((event, index) => ( - ) - }) + )); return ( {incomingEvents} - ) + ); } } -export default withStyles(styles)(Incoming) +export default withStyles(styles)(Incoming); diff --git a/client/src/Components/Search/Tabs/Past.js b/client/src/Components/Search/Tabs/Past.js index 60a6bc5aa..5ca060c67 100644 --- a/client/src/Components/Search/Tabs/Past.js +++ b/client/src/Components/Search/Tabs/Past.js @@ -1,21 +1,19 @@ -import React from 'react' -import { Typography } from '@material-ui/core' +import React from 'react'; +import { Typography } from '@material-ui/core'; -import { withStyles } from '@material-ui/core/styles' -import styles from '../styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from '../styles'; -import Event from '../Event' +import Event from '../Event'; class Past extends React.Component { - render () { - const classes = this.props.classes - const { PastEvents } = this.props + render() { + const { classes } = this.props; + const { PastEvents } = this.props; - const pastEvents = PastEvents.map((event, index) => { - return ( + const pastEvents = PastEvents.map((event, index) => ( - ) - }) + )); return ( {pastEvents} - ) + ); } } -export default withStyles(styles)(Past) +export default withStyles(styles)(Past); diff --git a/client/src/Components/Search/Tabs/index.js b/client/src/Components/Search/Tabs/index.js index a4077c1ac..d15abeb9c 100644 --- a/client/src/Components/Search/Tabs/index.js +++ b/client/src/Components/Search/Tabs/index.js @@ -1,11 +1,11 @@ -import Future from './Future' -import History from './History' -import Incoming from './Incoming' -import Past from './Past' +import Future from './Future'; +import History from './History'; +import Incoming from './Incoming'; +import Past from './Past'; export { Future, History, Incoming, - Past -} + Past, +}; diff --git a/client/src/Components/Search/index.js b/client/src/Components/Search/index.js index 0d50b2f86..d1799aa7f 100644 --- a/client/src/Components/Search/index.js +++ b/client/src/Components/Search/index.js @@ -1,68 +1,70 @@ -import React from 'react' -import { Query } from 'react-apollo' -import { DateTime } from 'luxon' +import React from 'react'; +import { Query } from 'react-apollo'; +import { DateTime } from 'luxon'; import { Typography, AppBar, Tabs, - Tab -} from '@material-ui/core' + Tab, +} from '@material-ui/core'; import { GetApp as IncomingIcon, AlarmAdd as FutureIcon, - History as HistoryIcon -} from '@material-ui/icons' + History as HistoryIcon, +} from '@material-ui/icons'; -import { withStyles } from '@material-ui/core/styles' -import styles from './styles' +import { withStyles } from '@material-ui/core/styles'; +import styles from './styles'; -import { listEventsCalls } from '../../GraphQL/Calls/index' +import { listEventsCalls } from '../../GraphQL/Calls/index'; import { Future, History, Incoming, - Past -} from './Tabs' + Past, +} from './Tabs'; -function TabContainer (props) { +function TabContainer(props) { return ( {props.children} - ) + ); } class Search extends React.Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { - value: 0 - } + value: 0, + }; } handleChange = (event, value) => { - this.setState({ value }) + this.setState({ value }); } - render () { - const classes = this.props.classes - const { value } = this.state + render() { + const { classes } = this.props; + const { value } = this.state; return ( {({ loading, error, data }) => { - if (loading) return 'Loading...' - if (error) return `Error! ${error.message}` - const now = ~~(DateTime.local().valueOf() / 1000) - const inTwoWeeks = ~~(DateTime.local().plus({ weeks: 2 }).valueOf() / 1000) + if (loading) return 'Loading...'; + if (error) return `Error! ${error.message}`; + const now = Math.floor(DateTime.local().valueOf() / 1000); + const inTwoWeeks = Math.floor(DateTime.local().plus({ weeks: 2 }).valueOf() / 1000); - const IncomingEvents = data.events_Events.filter(event => event.startDatetime > now && event.startDatetime < inTwoWeeks) - const OngoingEvents = data.events_Events.filter(event => event.finishDatetime > now && event.startDatetime < now) - const FutureEvents = data.events_Events.filter(event => event.startDatetime > now) - const PastEvents = data.events_Events.filter(event => event.finishDatetime < now) + const IncomingEvents = data.events_Events.filter(event => event.startDatetime > now + && event.startDatetime < inTwoWeeks); + const OngoingEvents = data.events_Events.filter(event => event.finishDatetime > now + && event.startDatetime < now); + const FutureEvents = data.events_Events.filter(event => event.startDatetime > now); + const PastEvents = data.events_Events.filter(event => event.finishDatetime < now); return ( @@ -98,17 +100,19 @@ class Search extends React.Component { /> - {value === 0 && } + {value === 0 && + + } {value === 1 && } {value === 2 && } {value === 3 && } - ) + ); }} - ) + ); } } -export default withStyles(styles)(Search) +export default withStyles(styles)(Search); diff --git a/client/src/Components/Search/styles.js b/client/src/Components/Search/styles.js index 9981d904a..139e732cb 100644 --- a/client/src/Components/Search/styles.js +++ b/client/src/Components/Search/styles.js @@ -4,11 +4,11 @@ const styles = theme => ({ width: '100%', backgroundColor: theme.palette.background.paper, padding: 0, - margin: 0 + margin: 0, }, tabTitle: { width: '25%', - maxWidth: 'none' + maxWidth: 'none', }, card: { flexGrow: 1, @@ -16,18 +16,18 @@ const styles = theme => ({ marginTop: 20, marginBottom: 20, marginLeft: 400, - marginRight: 400 + marginRight: 400, }, buttonList: { margin: theme.spacing.unit, - float: 'right' + float: 'right', }, buttonGrid: { - marginTop: -20 + marginTop: -20, }, title: { - marginTop: 20 - } -}) + marginTop: 20, + }, +}); -export default styles +export default styles; diff --git a/client/src/Components/TopBar/data.js b/client/src/Components/TopBar/data.js index 8726e606d..918c91daa 100644 --- a/client/src/Components/TopBar/data.js +++ b/client/src/Components/TopBar/data.js @@ -1,11 +1,17 @@ -import GamesIcon from '@material-ui/icons/Games' -import SearchIcon from '@material-ui/icons/Search' -import LibraryAddIcon from '@material-ui/icons/LibraryAdd' +import GamesIcon from '@material-ui/icons/Games'; +import SearchIcon from '@material-ui/icons/Search'; +import LibraryAddIcon from '@material-ui/icons/LibraryAdd'; const data = [ - { title: 'Look for an event', to: '/', icon: SearchIcon, text: '' }, - { title: 'Events you are enrolled in', to: '/my', icon: GamesIcon, text: '' }, - { title: 'Host your own competition', to: '/host', icon: LibraryAddIcon, text: '' } -] + { + title: 'Look for an event', to: '/', icon: SearchIcon, text: '', + }, + { + title: 'Events you are enrolled in', to: '/my', icon: GamesIcon, text: '', + }, + { + title: 'Host your own competition', to: '/host', icon: LibraryAddIcon, text: '', + }, +]; -export default data +export default data; diff --git a/client/src/Components/TopBar/index.js b/client/src/Components/TopBar/index.js index 06fe761f6..c3ac67581 100644 --- a/client/src/Components/TopBar/index.js +++ b/client/src/Components/TopBar/index.js @@ -1,16 +1,18 @@ -import React from 'react' -import { Link } from 'react-router-dom' -import classNames from 'classnames' +import React from 'react'; +import { Link } from 'react-router-dom'; +import classNames from 'classnames'; -import { AppBar, Toolbar, Typography, Button } from '@material-ui/core' -import { withStyles } from '@material-ui/core/styles' +import { + AppBar, Toolbar, Typography, Button, +} from '@material-ui/core'; +import { withStyles } from '@material-ui/core/styles'; -import datas from './data' -import styles from './styles' +import datas from './data'; +import styles from './styles'; -const TopBar = ({ classes, user, match }) => { +const TopBar = ({ classes }) => { const buttons = datas.map((data, index) => { - const Icon = data.icon + const Icon = data.icon; return ( ) - } - ) + ); + }); return (
@@ -36,7 +37,7 @@ const TopBar = ({ classes, user, match }) => {
- ) -} + ); +}; -export default withStyles(styles)(TopBar) +export default withStyles(styles)(TopBar); diff --git a/client/src/Components/TopBar/styles.js b/client/src/Components/TopBar/styles.js index 25cf9ab3b..6202592d6 100644 --- a/client/src/Components/TopBar/styles.js +++ b/client/src/Components/TopBar/styles.js @@ -1,37 +1,37 @@ const styles = theme => ({ root: { - flexGrow: 1 + flexGrow: 1, }, flex: { flexGrow: 1, - marginLeft: 30 + marginLeft: 30, }, menuButton: { marginLeft: -12, - marginRight: 20 + marginRight: 20, }, cssRoot: { color: '#FFFFFF', backgroundColor: theme.palette.secondary, '&:hover': { - backgroundColor: theme.palette.dark + backgroundColor: theme.palette.dark, }, whiteSpace: 'nowrap', paddingRight: 2 * theme.spacing.unit, - paddingLeft: 2 * theme.spacing.unit + paddingLeft: 2 * theme.spacing.unit, }, button: { - margin: theme.spacing.unit + margin: theme.spacing.unit, }, leftIcon: { - marginRight: theme.spacing.unit + marginRight: theme.spacing.unit, }, rightIcon: { - marginLeft: theme.spacing.unit + marginLeft: theme.spacing.unit, }, iconSmall: { - fontSize: 20 - } -}) + fontSize: 20, + }, +}); -export default styles +export default styles; diff --git a/client/src/GraphQL/Calls/hostedEvents.js b/client/src/GraphQL/Calls/hostedEvents.js index 05b3f77f2..badd88e1e 100644 --- a/client/src/GraphQL/Calls/hostedEvents.js +++ b/client/src/GraphQL/Calls/hostedEvents.js @@ -1,5 +1,5 @@ -import gql from 'graphql-tag' -import { eventMinimalInfo } from '../Fragments' +import gql from 'graphql-tag'; +import { eventMinimalInfo } from '../Fragments'; const EVENTS_HOSTEVENT = gql` mutation Hosts_HostEvent($name: String!, $description: String!, $startDatetime: Int!, $finishDatetime: Int!) { @@ -8,7 +8,7 @@ const EVENTS_HOSTEVENT = gql` } } ${eventMinimalInfo} -` +`; const EVENTS_EVENTSBYHOST = gql` query Hosts_EventsByHost{ events_EventsByHost { @@ -16,8 +16,8 @@ const EVENTS_EVENTSBYHOST = gql` } } ${eventMinimalInfo} -` +`; export default { EVENTS_HOSTEVENT, - EVENTS_EVENTSBYHOST -} + EVENTS_EVENTSBYHOST, +}; diff --git a/client/src/GraphQL/Calls/index.js b/client/src/GraphQL/Calls/index.js index d3fe57c6d..334af1c78 100644 --- a/client/src/GraphQL/Calls/index.js +++ b/client/src/GraphQL/Calls/index.js @@ -1,9 +1,9 @@ -import hostedEventsCalls from './hostedEvents' -import listEventsCalls from './listEvents' -import showEventCalls from './showEvent' +import hostedEventsCalls from './hostedEvents'; +import listEventsCalls from './listEvents'; +import showEventCalls from './showEvent'; export { hostedEventsCalls, listEventsCalls, - showEventCalls -} + showEventCalls, +}; diff --git a/client/src/GraphQL/Calls/listEvents.js b/client/src/GraphQL/Calls/listEvents.js index c115eb746..f5c3204e0 100644 --- a/client/src/GraphQL/Calls/listEvents.js +++ b/client/src/GraphQL/Calls/listEvents.js @@ -1,5 +1,5 @@ -import gql from 'graphql-tag' -import { eventMinimalInfo } from '../Fragments' +import gql from 'graphql-tag'; +import { eventMinimalInfo } from '../Fragments'; const EVENTS_EVENTS = gql` query Hosts_Events{ @@ -8,7 +8,7 @@ const EVENTS_EVENTS = gql` } } ${eventMinimalInfo} -` +`; export default { - EVENTS_EVENTS -} + EVENTS_EVENTS, +}; diff --git a/client/src/GraphQL/Calls/showEvent.js b/client/src/GraphQL/Calls/showEvent.js index b26b0e0dc..105e09779 100644 --- a/client/src/GraphQL/Calls/showEvent.js +++ b/client/src/GraphQL/Calls/showEvent.js @@ -1,5 +1,5 @@ -import gql from 'graphql-tag' -import { eventFullInfo } from '../Fragments' +import gql from 'graphql-tag'; +import { eventFullInfo } from '../Fragments'; const EVENTS_EVENT = gql` query Hosts_Event($designator: ID!) { @@ -8,8 +8,8 @@ const EVENTS_EVENT = gql` } } ${eventFullInfo} -` +`; export default { - EVENTS_EVENT -} + EVENTS_EVENT, +}; diff --git a/client/src/GraphQL/Fragments/event.js b/client/src/GraphQL/Fragments/event.js index 9fd7a4610..bf1bba058 100644 --- a/client/src/GraphQL/Fragments/event.js +++ b/client/src/GraphQL/Fragments/event.js @@ -1,4 +1,4 @@ -import gql from 'graphql-tag' +import gql from 'graphql-tag'; export const eventMinimalInfo = gql` fragment EventMinimalInfo on events_Event { @@ -13,7 +13,7 @@ export const eventMinimalInfo = gql` } description } -` +`; export const eventFullInfo = gql` fragment EventFullInfo on events_Event { @@ -58,4 +58,4 @@ export const eventFullInfo = gql` } } } -` +`; diff --git a/client/src/GraphQL/Fragments/index.js b/client/src/GraphQL/Fragments/index.js index 93d8f9971..cb2ce691c 100644 --- a/client/src/GraphQL/Fragments/index.js +++ b/client/src/GraphQL/Fragments/index.js @@ -1,9 +1,9 @@ import { eventMinimalInfo, - eventFullInfo -} from './event' + eventFullInfo, +} from './event'; export { eventMinimalInfo, - eventFullInfo -} + eventFullInfo, +}; diff --git a/client/src/index.js b/client/src/index.js index 6989c8551..3f1c182da 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -1,40 +1,40 @@ -import React, { Component } from 'react' -import { Route, BrowserRouter, Switch } from 'react-router-dom' +import React, { Component } from 'react'; +import { Route, BrowserRouter, Switch } from 'react-router-dom'; -import { MuiPickersUtilsProvider } from 'material-ui-pickers' -import LuxonUtils from 'material-ui-pickers/utils/luxon-utils' +import { MuiPickersUtilsProvider } from 'material-ui-pickers'; +import LuxonUtils from 'material-ui-pickers/utils/luxon-utils'; -import { getItem } from './utils/local-storage' +import { getItem } from './utils/local-storage'; -import TopBar from './Components/TopBar' -import Search from './Components/Search' -import Events from './Components/Events' -import HostedEvents from './Components/HostedEvents' -import EditEvent from './Components/Event/Edit' +import TopBar from './Components/TopBar'; +import Search from './Components/Search'; +import Events from './Components/Events'; +import HostedEvents from './Components/HostedEvents'; +import EditEvent from './Components/Event/Edit'; class App extends Component { - constructor (props) { - super(props) + constructor(props) { + super(props); this.state = { - user: null - } + user: null, + }; } - async componentDidMount () { - let user = await getItem('user') + async componentDidMount() { + let user = await getItem('user'); if (user !== null && user !== undefined && user !== 'undefined') { - user = JSON.parse(user) - this.setState({ user }) + user = JSON.parse(user); + this.setState({ user }); } } - render () { - let loggedIn + render() { + let loggedIn; if (this.state.user !== null) { - loggedIn = () + loggedIn = (); } else { - loggedIn = '' + loggedIn = ''; } return ( @@ -51,8 +51,8 @@ class App extends Component { - ) + ); } } -export default App +export default App; diff --git a/client/src/utils/index.js b/client/src/utils/index.js index 36ed3a467..2d2a69e07 100644 --- a/client/src/utils/index.js +++ b/client/src/utils/index.js @@ -1,10 +1,12 @@ export const toLocalTime = (epoch) => { - let localDate = new Date(0) - localDate.setUTCSeconds(epoch) - var options = { year: 'numeric', month: 'long', day: '2-digit' } + const localDate = new Date(0); + localDate.setUTCSeconds(epoch); + const options = { year: 'numeric', month: 'long', day: '2-digit' }; return ( - localDate.toLocaleDateString(options) + - ' at ' + - localDate.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' }) - ) -} + `${localDate.toLocaleDateString(options) + } at ${ + localDate.toLocaleTimeString('en-US', { hour: '2-digit', minute: '2-digit' })}` + ); +}; + +export const temporaryFunction = input => input; diff --git a/client/src/utils/local-storage.js b/client/src/utils/local-storage.js index 963ba0f36..9da53f424 100644 --- a/client/src/utils/local-storage.js +++ b/client/src/utils/local-storage.js @@ -1,9 +1,9 @@ -const getItem = async name => window.localStorage.getItem(name) -const setItem = async (name, value) => window.localStorage.setItem(name, value) -const removeItem = async name => window.localStorage.removeItem(name) +const getItem = async name => window.localStorage.getItem(name); +const setItem = async (name, value) => window.localStorage.setItem(name, value); +const removeItem = async name => window.localStorage.removeItem(name); export { getItem, setItem, - removeItem -} + removeItem, +}; diff --git a/server/.eslintrc.js b/server/.eslintrc.js index b41dc444e..800621670 100644 --- a/server/.eslintrc.js +++ b/server/.eslintrc.js @@ -3,6 +3,6 @@ module.exports = { extends: 'airbnb-base', rules: { 'no-underscore-dangle': 'off', - 'no-param-reassign': 'off' + 'no-param-reassign': 'off', } };