From 80346cadf23305973a175886eb8576d2faeee55e Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:12:43 +1000 Subject: [PATCH 01/13] add prettier pre-commit hook --- .prettierrc | 3 + package.json | 10 +++ yarn.lock | 210 +++++++++++++++++++++++++++++++++++++++++++++++++-- 3 files changed, 218 insertions(+), 5 deletions(-) create mode 100644 .prettierrc diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 00000000..757fd64c --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "trailingComma": "es5" +} diff --git a/package.json b/package.json index 47e59d15..b945b6df 100644 --- a/package.json +++ b/package.json @@ -53,5 +53,15 @@ "last 1 firefox version", "last 1 safari version" ] + }, + "devDependencies": { + "husky": "^3.0.5", + "prettier": "^1.18.2", + "pretty-quick": "^1.11.1" + }, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } } } diff --git a/yarn.lock b/yarn.lock index 34745649..8145a9c9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1658,6 +1658,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-10.14.17.tgz#b96d4dd3e427382482848948041d3754d40fd5ce" integrity sha512-p/sGgiPaathCfOtqu2fx5Mu1bcjuP8ALFg4xpGgNkcin7LwRyzUKniEHBKdcE1RPsenq5JVPIpMTJSygLboygQ== +"@types/normalize-package-data@^2.4.0": + version "2.4.0" + resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" + integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== + "@types/prop-types@*": version "15.7.2" resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.2.tgz#0e58ae66773d7fd7c372a493aff740878ec9ceaa" @@ -2142,6 +2147,11 @@ arr-union@^3.1.0: resolved "https://registry.yarnpkg.com/arr-union/-/arr-union-3.1.0.tgz#e39b09aea9def866a8f206e288af63919bae39c4" integrity sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ= +array-differ@^2.0.3: + version "2.1.0" + resolved "https://registry.yarnpkg.com/array-differ/-/array-differ-2.1.0.tgz#4b9c1c3f14b906757082925769e8ab904f4801b1" + integrity sha512-KbUpJgx909ZscOc/7CLATBFam7P1Z1QRQInvgT0UztM9Q72aGKCunKASAl7WNW0tnPmPyEMeMhdsfWhfmW037w== + array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" @@ -2185,7 +2195,7 @@ array-reduce@~0.0.0: resolved "https://registry.yarnpkg.com/array-reduce/-/array-reduce-0.0.0.tgz#173899d3ffd1c7d9383e4479525dbe278cab5f2b" integrity sha1-FziZ0//Rx9k4PkR5Ul2+J4yrXys= -array-union@^1.0.1: +array-union@^1.0.1, array-union@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/array-union/-/array-union-1.0.2.tgz#9a34410e4f4e3da23dea375be5be70f24778ec39" integrity sha1-mjRBDk9OPaI96jdb5b5w8kd47Dk= @@ -2867,7 +2877,7 @@ caseless@~0.12.0: resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc" integrity sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw= -chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.4.1, chalk@^2.4.2: +chalk@2.4.2, chalk@^2.0.0, chalk@^2.0.1, chalk@^2.1.0, chalk@^2.3.0, chalk@^2.4.1, chalk@^2.4.2: version "2.4.2" resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424" integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ== @@ -3342,6 +3352,15 @@ cross-spawn@6.0.5, cross-spawn@^6.0.0, cross-spawn@^6.0.5: shebang-command "^1.2.0" which "^1.2.9" +cross-spawn@^5.0.1: + version "5.1.0" + resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-5.1.0.tgz#e8bd0efee58fcff6f8f94510a0a554bbfa235449" + integrity sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk= + dependencies: + lru-cache "^4.0.1" + shebang-command "^1.2.0" + which "^1.2.9" + crypto-browserify@^3.11.0: version "3.12.0" resolved "https://registry.yarnpkg.com/crypto-browserify/-/crypto-browserify-3.12.0.tgz#396cf9f3137f03e4b8e532c58f698254e00f80ec" @@ -4393,6 +4412,19 @@ exec-sh@^0.3.2: resolved "https://registry.yarnpkg.com/exec-sh/-/exec-sh-0.3.2.tgz#6738de2eb7c8e671d0366aea0b0db8c6f7d7391b" integrity sha512-9sLAvzhI5nc8TpuQUh4ahMdCrWT00wPWz7j47/emR5+2qEfoZP5zzUXvx+vdx+H6ohhnsYC31iX04QLYJK8zTg== +execa@^0.8.0: + version "0.8.0" + resolved "https://registry.yarnpkg.com/execa/-/execa-0.8.0.tgz#d8d76bbc1b55217ed190fd6dd49d3c774ecfc8da" + integrity sha1-2NdrvBtVIX7RkP1t1J08d07PyNo= + dependencies: + cross-spawn "^5.0.1" + get-stream "^3.0.0" + is-stream "^1.1.0" + npm-run-path "^2.0.0" + p-finally "^1.0.0" + signal-exit "^3.0.0" + strip-eof "^1.0.0" + execa@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/execa/-/execa-1.0.0.tgz#c6236a5bb4df6d6f15e88e7f017798216749ddd8" @@ -4688,6 +4720,14 @@ find-up@^2.0.0, find-up@^2.1.0: dependencies: locate-path "^2.0.0" +find-up@^4.0.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/find-up/-/find-up-4.1.0.tgz#97afe7d6cdc0bc5928584b7c8d7b16e8a9aa5d19" + integrity sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw== + dependencies: + locate-path "^5.0.0" + path-exists "^4.0.0" + firebase@^6.6.0: version "6.6.0" resolved "https://registry.yarnpkg.com/firebase/-/firebase-6.6.0.tgz#4890fa40ef4757dec9cb8524b17a0ed19ceb894e" @@ -4922,6 +4962,16 @@ get-own-enumerable-property-symbols@^3.0.0: resolved "https://registry.yarnpkg.com/get-own-enumerable-property-symbols/-/get-own-enumerable-property-symbols-3.0.0.tgz#b877b49a5c16aefac3655f2ed2ea5b684df8d203" integrity sha512-CIJYJC4GGF06TakLg8z4GQKvDsx9EMspVxOYih7LerEL/WosUnFIww45CGfxfeKHqlg3twgUrYRT1O3WQqjGCg== +get-stdin@^7.0.0: + version "7.0.0" + resolved "https://registry.yarnpkg.com/get-stdin/-/get-stdin-7.0.0.tgz#8d5de98f15171a125c5e516643c7a6d0ea8a96f6" + integrity sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ== + +get-stream@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-3.0.0.tgz#8e943d1358dc37555054ecbe2edb05aa174ede14" + integrity sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ= + get-stream@^4.0.0: version "4.1.0" resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-4.1.0.tgz#c1b255575f3dc21d59bfc79cd3d2b46b1c3a54b5" @@ -5355,6 +5405,23 @@ https-browserify@^1.0.0: resolved "https://registry.yarnpkg.com/https-browserify/-/https-browserify-1.0.0.tgz#ec06c10e0a34c0f2faf199f7fd7fc78fffd03c73" integrity sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM= +husky@^3.0.5: + version "3.0.5" + resolved "https://registry.yarnpkg.com/husky/-/husky-3.0.5.tgz#d7db27c346645a8dc52df02aa534a377ad7925e0" + integrity sha512-cKd09Jy9cDyNIvAdN2QQAP/oA21sle4FWXjIMDttailpLAYZuBE7WaPmhrkj+afS8Sj9isghAtFvWSQ0JiwOHg== + dependencies: + chalk "^2.4.2" + cosmiconfig "^5.2.1" + execa "^1.0.0" + get-stdin "^7.0.0" + is-ci "^2.0.0" + opencollective-postinstall "^2.0.2" + pkg-dir "^4.2.0" + please-upgrade-node "^3.2.0" + read-pkg "^5.1.1" + run-node "^1.0.0" + slash "^3.0.0" + hyphenate-style-name@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/hyphenate-style-name/-/hyphenate-style-name-1.0.3.tgz#097bb7fa0b8f1a9cf0bd5c734cf95899981a9b48" @@ -5408,7 +5475,7 @@ ignore-walk@^3.0.1: dependencies: minimatch "^3.0.4" -ignore@^3.3.5: +ignore@^3.3.5, ignore@^3.3.7: version "3.3.10" resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.10.tgz#0a97fb876986e8081c631160f8f9f389157f0043" integrity sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug== @@ -6682,6 +6749,11 @@ linear-layout-vector@0.0.1: resolved "https://registry.yarnpkg.com/linear-layout-vector/-/linear-layout-vector-0.0.1.tgz#398114d7303b6ecc7fd6b273af7b8401d8ba9c70" integrity sha1-OYEU1zA7bsx/1rJzr3uEAdi6nHA= +lines-and-columns@^1.1.6: + version "1.1.6" + resolved "https://registry.yarnpkg.com/lines-and-columns/-/lines-and-columns-1.1.6.tgz#1c00c743b433cd0a4e80758f7b64a57440d9ff00" + integrity sha1-HADHQ7QzzQpOgHWPe2SldEDZ/wA= + load-json-file@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/load-json-file/-/load-json-file-2.0.0.tgz#7947e42149af80d696cbf797bcaabcfe1fe29ca8" @@ -6740,6 +6812,13 @@ locate-path@^3.0.0: p-locate "^3.0.0" path-exists "^3.0.0" +locate-path@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/locate-path/-/locate-path-5.0.0.tgz#1afba396afd676a6d42504d0a67a3a7eb9f62aa0" + integrity sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g== + dependencies: + p-locate "^4.1.0" + lodash-es@^4.17.14: version "4.17.15" resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.15.tgz#21bd96839354412f23d7a10340e5eac6ee455d78" @@ -6827,6 +6906,14 @@ lower-case@^1.1.1: resolved "https://registry.yarnpkg.com/lower-case/-/lower-case-1.1.4.tgz#9a2cabd1b9e8e0ae993a4bf7d5875c39c42e8eac" integrity sha1-miyr0bno4K6ZOkv31YdcOcQujqw= +lru-cache@^4.0.1: + version "4.1.5" + resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-4.1.5.tgz#8bbe50ea85bed59bc9e33dcab8235ee9bcf443cd" + integrity sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g== + dependencies: + pseudomap "^1.0.2" + yallist "^2.1.2" + lru-cache@^5.1.1: version "5.1.1" resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" @@ -7128,6 +7215,11 @@ move-concurrently@^1.0.1: rimraf "^2.5.4" run-queue "^1.0.3" +mri@^1.1.0: + version "1.1.4" + resolved "https://registry.yarnpkg.com/mri/-/mri-1.1.4.tgz#7cb1dd1b9b40905f1fac053abe25b6720f44744a" + integrity sha512-6y7IjGPm8AzlvoUrwAaw1tLnUBudaS3752vcd8JtrpGGQn+rXIe63LFVHm/YMwtqAuh+LJPCFdlLYPWM1nYn6w== + ms@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/ms/-/ms-2.0.0.tgz#5608aeadfc00be6c2901df5f9861788de0d597c8" @@ -7156,6 +7248,16 @@ multicast-dns@^6.0.1: dns-packet "^1.3.1" thunky "^1.0.2" +multimatch@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/multimatch/-/multimatch-3.0.0.tgz#0e2534cc6bc238d9ab67e1b9cd5fcd85a6dbf70b" + integrity sha512-22foS/gqQfANZ3o+W7ST2x25ueHDVNWl/b9OlGcLpy/iKxjCpvcNCM51YCenUi7Mt/jAjjqv8JwZRs8YP5sRjA== + dependencies: + array-differ "^2.0.3" + array-union "^1.0.2" + arrify "^1.0.1" + minimatch "^3.0.4" + mute-stream@0.0.7: version "0.0.7" resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.7.tgz#3075ce93bc21b8fab43e1bc4da7e8115ed1e7bab" @@ -7334,7 +7436,7 @@ nopt@^4.0.1: abbrev "1" osenv "^0.1.4" -normalize-package-data@^2.3.2: +normalize-package-data@^2.3.2, normalize-package-data@^2.5.0: version "2.5.0" resolved "https://registry.yarnpkg.com/normalize-package-data/-/normalize-package-data-2.5.0.tgz#e66db1838b200c1dfc233225d12cb36520e234a8" integrity sha512-/5CMN3T0R4XTj4DcGaexo+roZSdSFW/0AOOTROrjxzCG1wrWXEsGbRKevjlIL+ZDE4sZlJr5ED4YW0yqmkK+eA== @@ -7567,6 +7669,11 @@ open@^6.3.0: dependencies: is-wsl "^1.1.0" +opencollective-postinstall@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz#5657f1bede69b6e33a45939b061eb53d3c6c3a89" + integrity sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw== + opn@^5.1.0: version "5.5.0" resolved "https://registry.yarnpkg.com/opn/-/opn-5.5.0.tgz#fc7164fab56d235904c51c3b27da6758ca3b9bfc" @@ -7682,7 +7789,7 @@ p-limit@^1.1.0: dependencies: p-try "^1.0.0" -p-limit@^2.0.0: +p-limit@^2.0.0, p-limit@^2.2.0: version "2.2.1" resolved "https://registry.yarnpkg.com/p-limit/-/p-limit-2.2.1.tgz#aa07a788cc3151c939b5131f63570f0dd2009537" integrity sha512-85Tk+90UCVWvbDavCLKPOLC9vvY8OwEX/RtKF+/1OADJMVlFfEHOiMTPVyxg7mk/dKa+ipdHm0OUkTvCpMTuwg== @@ -7703,6 +7810,13 @@ p-locate@^3.0.0: dependencies: p-limit "^2.0.0" +p-locate@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/p-locate/-/p-locate-4.1.0.tgz#a3428bb7088b3a60292f66919278b7c297ad4f07" + integrity sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A== + dependencies: + p-limit "^2.2.0" + p-map@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/p-map/-/p-map-1.2.0.tgz#e4e94f311eabbc8633a1e79908165fca26241b6b" @@ -7778,6 +7892,16 @@ parse-json@^4.0.0: error-ex "^1.3.1" json-parse-better-errors "^1.0.1" +parse-json@^5.0.0: + version "5.0.0" + resolved "https://registry.yarnpkg.com/parse-json/-/parse-json-5.0.0.tgz#73e5114c986d143efa3712d4ea24db9a4266f60f" + integrity sha512-OOY5b7PAEFV0E2Fir1KOkxchnZNCdowAJgQ5NuxjpBKTRP3pQhwkrkxqQjeoKJ+fO7bCpmIZaogI4eZGDMEGOw== + dependencies: + "@babel/code-frame" "^7.0.0" + error-ex "^1.3.1" + json-parse-better-errors "^1.0.1" + lines-and-columns "^1.1.6" + parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" @@ -7820,6 +7944,11 @@ path-exists@^3.0.0: resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-3.0.0.tgz#ce0ebeaa5f78cb18925ea7d810d7b59b010fd515" integrity sha1-zg6+ql94yxiSXqfYENe1mwEP1RU= +path-exists@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/path-exists/-/path-exists-4.0.0.tgz#513bdbe2d3b95d7762e8c1137efa195c6c61b5b3" + integrity sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w== + path-is-absolute@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/path-is-absolute/-/path-is-absolute-1.0.1.tgz#174b9268735534ffbc7ace6bf53a5a9e1b5c5f5f" @@ -7937,6 +8066,13 @@ pkg-dir@^3.0.0: dependencies: find-up "^3.0.0" +pkg-dir@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/pkg-dir/-/pkg-dir-4.2.0.tgz#f099133df7ede422e81d1d8448270eeb3e4261f3" + integrity sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ== + dependencies: + find-up "^4.0.0" + pkg-up@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/pkg-up/-/pkg-up-2.0.0.tgz#c819ac728059a461cab1c3889a2be3c49a004d7f" @@ -7944,6 +8080,13 @@ pkg-up@2.0.0: dependencies: find-up "^2.1.0" +please-upgrade-node@^3.2.0: + version "3.2.0" + resolved "https://registry.yarnpkg.com/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz#aeddd3f994c933e4ad98b99d9a556efa0e2fe942" + integrity sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg== + dependencies: + semver-compare "^1.0.0" + pn@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/pn/-/pn-1.1.0.tgz#e2f4cef0e219f463c179ab37463e4e1ecdccbafb" @@ -8640,6 +8783,11 @@ prelude-ls@~1.1.2: resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.1.2.tgz#21932a549f5e52ffd9a827f570e04be62a97da54" integrity sha1-IZMqVJ9eUv/ZqCf1cOBL5iqX2lQ= +prettier@^1.18.2: + version "1.18.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.18.2.tgz#6823e7c5900017b4bd3acf46fe9ac4b4d7bda9ea" + integrity sha512-OeHeMc0JhFE9idD4ZdtNibzY0+TPHSpSSb9h8FqtP+YnoZZ1sl8Vc9b1sasjfymH3SonAF4QcA2+mzHPhMvIiw== + pretty-bytes@^5.1.0: version "5.3.0" resolved "https://registry.yarnpkg.com/pretty-bytes/-/pretty-bytes-5.3.0.tgz#f2849e27db79fb4d6cfe24764fc4134f165989f2" @@ -8663,6 +8811,18 @@ pretty-format@^24.9.0: ansi-styles "^3.2.0" react-is "^16.8.4" +pretty-quick@^1.11.1: + version "1.11.1" + resolved "https://registry.yarnpkg.com/pretty-quick/-/pretty-quick-1.11.1.tgz#462ffa2b93d24c05b7a0c3a001e08601a0c55ee4" + integrity sha512-kSXCkcETfak7EQXz6WOkCeCqpbC4GIzrN/vaneTGMP/fAtD8NerA9bPhCUqHAks1geo7biZNl5uEMPceeneLuA== + dependencies: + chalk "^2.3.0" + execa "^0.8.0" + find-up "^2.1.0" + ignore "^3.3.7" + mri "^1.1.0" + multimatch "^3.0.0" + private@^0.1.6: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" @@ -8771,6 +8931,11 @@ prr@~1.0.1: resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" integrity sha1-0/wRS6BplaRexok/SEzrHXj19HY= +pseudomap@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3" + integrity sha1-8FKijacOYYkX7wqKw0wa5aaChrM= + psl@^1.1.24, psl@^1.1.28: version "1.3.1" resolved "https://registry.yarnpkg.com/psl/-/psl-1.3.1.tgz#d5aa3873a35ec450bc7db9012ad5a7246f6fc8bd" @@ -9148,6 +9313,16 @@ read-pkg@^3.0.0: normalize-package-data "^2.3.2" path-type "^3.0.0" +read-pkg@^5.1.1: + version "5.2.0" + resolved "https://registry.yarnpkg.com/read-pkg/-/read-pkg-5.2.0.tgz#7bf295438ca5a33e56cd30e053b34ee7250c93cc" + integrity sha512-Ug69mNOpfvKDAc2Q8DRpMjjzdtrnv9HcSMX+4VsZxD1aZ6ZzrIE7rlzXBtWTyhULSMKg076AW6WR5iZpD0JiOg== + dependencies: + "@types/normalize-package-data" "^2.4.0" + normalize-package-data "^2.5.0" + parse-json "^5.0.0" + type-fest "^0.6.0" + "readable-stream@1 || 2", readable-stream@^2.0.0, readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.0.6, readable-stream@^2.1.5, readable-stream@^2.2.2, readable-stream@^2.3.3, readable-stream@^2.3.6, readable-stream@~2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.6.tgz#b11c27d88b8ff1fbe070643cf94b0c79ae1b0aaf" @@ -9501,6 +9676,11 @@ run-async@^2.2.0: dependencies: is-promise "^2.1.0" +run-node@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/run-node/-/run-node-1.0.0.tgz#46b50b946a2aa2d4947ae1d886e9856fd9cabe5e" + integrity sha512-kc120TBlQ3mih1LSzdAJXo4xn/GWS2ec0l3S+syHDXP9uRr0JAT8Qd3mdMuyjqCzeZktgP3try92cEgf9Nks8A== + run-queue@^1.0.0, run-queue@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/run-queue/-/run-queue-1.0.3.tgz#e848396f057d223f24386924618e25694161ec47" @@ -9612,6 +9792,11 @@ selfsigned@^1.9.1: dependencies: node-forge "0.8.2" +semver-compare@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/semver-compare/-/semver-compare-1.0.0.tgz#0dee216a1c941ab37e9efb1788f6afc5ff5537fc" + integrity sha1-De4hahyUGrN+nvsXiPavxf9VN/w= + "semver@2 || 3 || 4 || 5", semver@^5.3.0, semver@^5.4.1, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" @@ -9783,6 +9968,11 @@ slash@^2.0.0: resolved "https://registry.yarnpkg.com/slash/-/slash-2.0.0.tgz#de552851a1759df3a8f206535442f5ec4ddeab44" integrity sha512-ZYKh3Wh2z1PpEXWr0MpSBZ0V6mZHAQfYevttO11c51CaWjGTaadiKZ+wVt1PbMlDV5qhMFslpZCemhwOK7C89A== +slash@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" + integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== + slice-ansi@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/slice-ansi/-/slice-ansi-2.1.0.tgz#cacd7693461a637a5788d92a7dd4fba068e81636" @@ -10464,6 +10654,11 @@ type-check@~0.3.2: dependencies: prelude-ls "~1.1.2" +type-fest@^0.6.0: + version "0.6.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.6.0.tgz#8d2a2370d3df886eb5c90ada1c5bf6188acf838b" + integrity sha512-q+MB8nYR1KDLrgr4G5yemftpMC7/QLqVndBmEEdqzmNj5dcFOO4Oo8qlwZE3ULT3+Zim1F8Kq4cBnikNhlCMlg== + type-is@~1.6.17, type-is@~1.6.18: version "1.6.18" resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" @@ -11200,6 +11395,11 @@ y18n@^3.2.0: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.0.tgz#95ef94f85ecc81d007c264e190a120f0a3c8566b" integrity sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w== +yallist@^2.1.2: + version "2.1.2" + resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52" + integrity sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI= + yallist@^3.0.0, yallist@^3.0.2, yallist@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.0.3.tgz#b4b049e314be545e3ce802236d6cd22cd91c3de9" From 2f07bfb904408038a79e91e399990d2e387d91ae Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:13:39 +1000 Subject: [PATCH 02/13] add baseUrl to tsconfig for non-relative imports --- tsconfig.json | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/tsconfig.json b/tsconfig.json index f2850b71..fa6b7e23 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,7 @@ { "compilerOptions": { "target": "es5", - "lib": [ - "dom", - "dom.iterable", - "esnext" - ], + "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "esModuleInterop": true, @@ -17,9 +13,8 @@ "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, - "jsx": "react" + "jsx": "react", + "baseUrl": "src" }, - "include": [ - "src" - ] + "include": ["src"] } From e06519598af82795e8a692c0d41d208056cfe8f3 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:22:53 +1000 Subject: [PATCH 03/13] add MUI codemod dependency --- package.json | 1 + yarn.lock | 160 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 148 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index b945b6df..46d4c91a 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ ] }, "devDependencies": { + "@material-ui/codemod": "^4.3.0", "husky": "^3.0.5", "prettier": "^1.18.2", "pretty-quick": "^1.11.1" diff --git a/yarn.lock b/yarn.lock index 8145a9c9..4a07cb3b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -29,7 +29,7 @@ semver "^5.4.1" source-map "^0.5.0" -"@babel/core@^7.1.0", "@babel/core@^7.4.5": +"@babel/core@^7.1.0", "@babel/core@^7.1.6", "@babel/core@^7.4.5": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/core/-/core-7.6.0.tgz#9b00f73554edd67bebc86df8303ef678be3d7b48" integrity sha512-FuRhDRtsd6IptKpHXAa+4WPZYY2ZzgowkbLBecEDDSje1X/apG7jQM33or3NdOmjXBKWGOg4JmSiRfUfuTtHXw== @@ -258,7 +258,7 @@ resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.5.5.tgz#02f077ac8817d3df4a832ef59de67565e71cca4b" integrity sha512-E5BN68cqR7dhKan1SfqgPGhQ178bkVKpXTPEXnFJBrEt8/DKRZlybmy+IgYLTeN7tp1R5Ccmbm2rBk17sHYU3g== -"@babel/parser@^7.6.0": +"@babel/parser@^7.1.6", "@babel/parser@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.6.0.tgz#3e05d0647432a8326cb28d0de03895ae5a57f39b" integrity sha512-+o2q111WEx4srBs7L9eJmcwi655eD8sXniLqMB93TBK9GrNzGrxDWSjiqz2hLU0Ha8MTXFIP0yd9fNdP+m43ZQ== @@ -272,7 +272,7 @@ "@babel/helper-remap-async-to-generator" "^7.1.0" "@babel/plugin-syntax-async-generators" "^7.2.0" -"@babel/plugin-proposal-class-properties@7.5.5": +"@babel/plugin-proposal-class-properties@7.5.5", "@babel/plugin-proposal-class-properties@^7.1.0": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.5.5.tgz#a974cfae1e37c3110e71f3c6a2e48b8e71958cd4" integrity sha512-AF79FsnWFxjlaosgdi421vmYG6/jg79bVD0dpD44QdgobzHKuLZ6S3vl8la9qIeSwGi8i1fS0O1mfuDAAdo1/A== @@ -305,7 +305,7 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-syntax-json-strings" "^7.2.0" -"@babel/plugin-proposal-object-rest-spread@7.5.5", "@babel/plugin-proposal-object-rest-spread@^7.5.5": +"@babel/plugin-proposal-object-rest-spread@7.5.5", "@babel/plugin-proposal-object-rest-spread@^7.0.0", "@babel/plugin-proposal-object-rest-spread@^7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz#61939744f71ba76a3ae46b5eea18a54c16d22e58" integrity sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw== @@ -483,7 +483,7 @@ "@babel/helper-builder-binary-assignment-operator-visitor" "^7.1.0" "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-flow-strip-types@7.4.4": +"@babel/plugin-transform-flow-strip-types@7.4.4", "@babel/plugin-transform-flow-strip-types@^7.0.0": version "7.4.4" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.4.4.tgz#d267a081f49a8705fc9146de0768c6b58dccd8f7" integrity sha512-WyVedfeEIILYEaWGAUWzVNyqG4sfsNooMhXWsu/YzOvVGcsnPb5PguysjJqI3t3qiaYj0BR8T2f5njdjTGe44Q== @@ -695,7 +695,7 @@ dependencies: "@babel/helper-plugin-utils" "^7.0.0" -"@babel/plugin-transform-typescript@^7.3.2": +"@babel/plugin-transform-typescript@^7.3.2", "@babel/plugin-transform-typescript@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.6.0.tgz#48d78405f1aa856ebeea7288a48a19ed8da377a6" integrity sha512-yzw7EopOOr6saONZ3KA3lpizKnWRTe+rfBqg4AmQbSow7ik7fqmzrfIqt053osLwLE2AaTqGinLM2tl6+M/uog== @@ -769,7 +769,7 @@ js-levenshtein "^1.1.3" semver "^5.5.0" -"@babel/preset-env@^7.4.5": +"@babel/preset-env@^7.1.6", "@babel/preset-env@^7.4.5": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.6.0.tgz#aae4141c506100bb2bfaa4ac2a5c12b395619e50" integrity sha512-1efzxFv/TcPsNXlRhMzRnkBFMeIqBBgzwmZwlFDw5Ubj0AGLeufxugirwZmkkX/ayi3owsSqoQ4fw8LkfK9SYg== @@ -825,6 +825,14 @@ js-levenshtein "^1.1.3" semver "^5.5.0" +"@babel/preset-flow@^7.0.0": + version "7.0.0" + resolved "https://registry.yarnpkg.com/@babel/preset-flow/-/preset-flow-7.0.0.tgz#afd764835d9535ec63d8c7d4caf1c06457263da2" + integrity sha512-bJOHrYOPqJZCkPVbG1Lot2r5OSsB+iUOaxiHdlOeB1yPWS6evswVHwvkDLZ54WTaTRIk89ds0iHmGZSnxlPejQ== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-flow-strip-types" "^7.0.0" + "@babel/preset-react@7.0.0", "@babel/preset-react@^7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@babel/preset-react/-/preset-react-7.0.0.tgz#e86b4b3d99433c7b3e9e91747e2653958bc6b3c0" @@ -844,6 +852,25 @@ "@babel/helper-plugin-utils" "^7.0.0" "@babel/plugin-transform-typescript" "^7.3.2" +"@babel/preset-typescript@^7.1.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/preset-typescript/-/preset-typescript-7.6.0.tgz#25768cb8830280baf47c45ab1a519a9977498c98" + integrity sha512-4xKw3tTcCm0qApyT6PqM9qniseCE79xGHiUnNdKGdxNsGUc2X7WwZybqIpnTmoukg3nhPceI5KPNzNqLNeIJww== + dependencies: + "@babel/helper-plugin-utils" "^7.0.0" + "@babel/plugin-transform-typescript" "^7.6.0" + +"@babel/register@^7.0.0": + version "7.6.0" + resolved "https://registry.yarnpkg.com/@babel/register/-/register-7.6.0.tgz#76b6f466714680f4becafd45beeb2a7b87431abf" + integrity sha512-78BomdN8el+x/nkup9KwtjJXuptW5oXMFmP11WoM2VJBjxrKv4grC3qjpLL8RGGUYUGsm57xnjYFM2uom+jWUQ== + dependencies: + find-cache-dir "^2.0.0" + lodash "^4.17.13" + mkdirp "^0.5.1" + pirates "^4.0.0" + source-map-support "^0.5.9" + "@babel/runtime@7.5.5": version "7.5.5" resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.5.5.tgz#74fba56d35efbeca444091c7850ccd494fd2f132" @@ -867,7 +894,7 @@ "@babel/parser" "^7.6.0" "@babel/types" "^7.6.0" -"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.5.5", "@babel/traverse@^7.6.0": +"@babel/traverse@^7.0.0", "@babel/traverse@^7.1.0", "@babel/traverse@^7.4.3", "@babel/traverse@^7.4.4", "@babel/traverse@^7.4.5", "@babel/traverse@^7.5.5", "@babel/traverse@^7.6.0": version "7.6.0" resolved "https://registry.yarnpkg.com/@babel/traverse/-/traverse-7.6.0.tgz#389391d510f79be7ce2ddd6717be66d3fed4b516" integrity sha512-93t52SaOBgml/xY74lsmt7xOR4ufYvhb5c5qiM6lu4J/dWGMAfAh6eKw4PjLes6DI6nQgearoxnFJk60YchpvQ== @@ -1279,6 +1306,15 @@ "@types/istanbul-reports" "^1.1.1" "@types/yargs" "^13.0.0" +"@material-ui/codemod@^4.3.0": + version "4.3.0" + resolved "https://registry.yarnpkg.com/@material-ui/codemod/-/codemod-4.3.0.tgz#f78ef9bd0a44ba8fa9661e7158bfec852f4cbfdd" + integrity sha512-cVyc94VC+3cMDOsJ5PrP7q2tXqfcOpR1kx0S0SCwADU67RsLA3Qq0RwuqEk7H2Mp2XJr6xXg+U3Aox8WhrntkA== + dependencies: + "@babel/core" "^7.4.5" + "@babel/traverse" "^7.4.5" + jscodeshift-add-imports "^1.0.1" + "@material-ui/core@^4.4.0": version "4.4.1" resolved "https://registry.yarnpkg.com/@material-ui/core/-/core-4.4.1.tgz#cc9b8e417ced1ab3145fdeda41a6aee657d3524b" @@ -2276,6 +2312,11 @@ ast-types-flow@0.0.7, ast-types-flow@^0.0.7: resolved "https://registry.yarnpkg.com/ast-types-flow/-/ast-types-flow-0.0.7.tgz#f70b735c6bca1a5c9c22d982c3e39e7feba3bdad" integrity sha1-9wtzXGvKGlycItmCw+Oef+ujva0= +ast-types@0.11.7: + version "0.11.7" + resolved "https://registry.yarnpkg.com/ast-types/-/ast-types-0.11.7.tgz#f318bf44e339db6a320be0009ded64ec1471f46c" + integrity sha512-2mP3TwtkY/aTv5X3ZsMpNAbOnyoC/aMJwJSoaELPkHId0nSQgFcnU4dRW3isxiz7+zBexk0ym3WNVjMiQBnJSw== + astral-regex@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/astral-regex/-/astral-regex-1.0.0.tgz#6c8c3fb827dd43ee3918f27b82782ab7658a6fd9" @@ -2352,6 +2393,11 @@ babel-code-frame@^6.22.0: esutils "^2.0.2" js-tokens "^3.0.2" +babel-core@^7.0.0-bridge.0: + version "7.0.0-bridge.0" + resolved "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz#95a492ddd90f9b4e9a4a1da14eb335b87b634ece" + integrity sha512-poPX9mZH/5CSanm50Q+1toVci6pv5KSRv/5TWCwtzQS5XEwn40BcCrgIeMFWP9CKKIniKXNxoIOnOq4VVlGXhg== + babel-eslint@10.0.2: version "10.0.2" resolved "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-10.0.2.tgz#182d5ac204579ff0881684b040560fdcc1558456" @@ -3087,6 +3133,11 @@ color@^3.0.0: color-convert "^1.9.1" color-string "^1.5.2" +colors@^1.1.2: + version "1.3.3" + resolved "https://registry.yarnpkg.com/colors/-/colors-1.3.3.tgz#39e005d546afe01e01f9c4ca8fa50f686a01205d" + integrity sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg== + colour@~0.7.1: version "0.7.1" resolved "https://registry.yarnpkg.com/colour/-/colour-0.7.1.tgz#9cb169917ec5d12c0736d3e8685746df1cadf778" @@ -4348,7 +4399,7 @@ esprima@^3.1.3: resolved "https://registry.yarnpkg.com/esprima/-/esprima-3.1.3.tgz#fdca51cee6133895e3c88d535ce49dbff62a4633" integrity sha1-/cpRzuYTOJXjyI1TXOSdv/YqRjM= -esprima@^4.0.0: +esprima@^4.0.0, esprima@~4.0.0: version "4.0.1" resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== @@ -4765,6 +4816,11 @@ flatten@^1.0.2: resolved "https://registry.yarnpkg.com/flatten/-/flatten-1.0.2.tgz#dae46a9d78fbe25292258cc1e780a41d95c03782" integrity sha1-2uRqnXj74lKSJYzB54CkHZXAN4I= +flow-parser@0.*: + version "0.108.0" + resolved "https://registry.yarnpkg.com/flow-parser/-/flow-parser-0.108.0.tgz#36a8d35e6346b5d18adbafbdc91ad0770d8917d7" + integrity sha512-Ug8VuwlyDIZq5Xgrf+T7XLpKydhqYyNd8lmFtf7PZbu90T5LL+FeHjWzxyrBn35RCCZMw7pXrjCrHOSs+2zXyg== + flush-write-stream@^1.0.0: version "1.1.1" resolved "https://registry.yarnpkg.com/flush-write-stream/-/flush-write-stream-1.1.1.tgz#8dd7d873a1babc207d94ead0c2e0e44276ebf2e8" @@ -6429,6 +6485,45 @@ jsbn@~0.1.0: resolved "https://registry.yarnpkg.com/jsbn/-/jsbn-0.1.1.tgz#a5e654c2e5a2deb5f201d96cefbca80c0ef2f513" integrity sha1-peZUwuWi3rXyAdls77yoDA7y9RM= +jscodeshift-add-imports@^1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/jscodeshift-add-imports/-/jscodeshift-add-imports-1.0.1.tgz#1f7d6295b4461ceae45b5f09a03b6b70734f746d" + integrity sha512-m0M89DKG3yiFG+wtT2tE0INnGdZGUGHvswlXPZO2jHj8S8BEwzO5NEWxB6+UzpCQztTlJEFlMQftzrJsQ2m0QA== + dependencies: + "@babel/traverse" "^7.4.5" + jscodeshift-find-imports "^1.0.2" + +jscodeshift-find-imports@^1.0.2: + version "1.0.2" + resolved "https://registry.yarnpkg.com/jscodeshift-find-imports/-/jscodeshift-find-imports-1.0.2.tgz#27c36ecc5f7572829164bab5092c24ee07ff8ef5" + integrity sha512-O6lbEWWjL/mwwxNcwy/ea2X6YCqE5OhaqTPy2rBRkWJGD/ESXYNoLL7En/LXwe4IbJQOcaMbGIGOGzmxIGR5xQ== + dependencies: + jscodeshift "^0.6.4" + +jscodeshift@^0.6.4: + version "0.6.4" + resolved "https://registry.yarnpkg.com/jscodeshift/-/jscodeshift-0.6.4.tgz#e19ab86214edac86a75c4557fc88b3937d558a8e" + integrity sha512-+NF/tlNbc2WEhXUuc4WEJLsJumF84tnaMUZW2hyJw3jThKKRvsPX4sPJVgO1lPE28z0gNL+gwniLG9d8mYvQCQ== + dependencies: + "@babel/core" "^7.1.6" + "@babel/parser" "^7.1.6" + "@babel/plugin-proposal-class-properties" "^7.1.0" + "@babel/plugin-proposal-object-rest-spread" "^7.0.0" + "@babel/preset-env" "^7.1.6" + "@babel/preset-flow" "^7.0.0" + "@babel/preset-typescript" "^7.1.0" + "@babel/register" "^7.0.0" + babel-core "^7.0.0-bridge.0" + colors "^1.1.2" + flow-parser "0.*" + graceful-fs "^4.1.11" + micromatch "^3.1.10" + neo-async "^2.5.0" + node-dir "^0.1.17" + recast "^0.16.1" + temp "^0.8.1" + write-file-atomic "^2.3.0" + jsdom@^11.5.1: version "11.12.0" resolved "https://registry.yarnpkg.com/jsdom/-/jsdom-11.12.0.tgz#1a80d40ddd378a1de59656e9e6dc5a3ba8657bc8" @@ -7127,7 +7222,7 @@ minimalistic-crypto-utils@^1.0.0, minimalistic-crypto-utils@^1.0.1: resolved "https://registry.yarnpkg.com/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz#f6c00c1c0b082246e5c4d99dfb8c7c083b2b582a" integrity sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo= -minimatch@3.0.4, minimatch@^3.0.4: +minimatch@3.0.4, minimatch@^3.0.2, minimatch@^3.0.4: version "3.0.4" resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083" integrity sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA== @@ -7326,6 +7421,13 @@ no-case@^2.2.0: dependencies: lower-case "^1.1.1" +node-dir@^0.1.17: + version "0.1.17" + resolved "https://registry.yarnpkg.com/node-dir/-/node-dir-0.1.17.tgz#5f5665d93351335caabef8f1c554516cf5f1e4e5" + integrity sha1-X1Zl2TNRM1yqvvjxxVRRbPXx5OU= + dependencies: + minimatch "^3.0.2" + node-fetch@^1.0.1: version "1.7.3" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-1.7.3.tgz#980f6f72d85211a5347c6b2bc18c5b84c3eb47ef" @@ -8038,7 +8140,7 @@ pinkie@^2.0.0: resolved "https://registry.yarnpkg.com/pinkie/-/pinkie-2.0.4.tgz#72556b80cfa0d48a974e80e77248e80ed4f7f870" integrity sha1-clVrgM+g1IqXToDnckjoDtT3+HA= -pirates@^4.0.1: +pirates@^4.0.0, pirates@^4.0.1: version "4.0.1" resolved "https://registry.yarnpkg.com/pirates/-/pirates-4.0.1.tgz#643a92caf894566f91b2b986d2c66950a8e2fb87" integrity sha512-WuNqLTbMI3tmfef2TKxlQmAiLHKtFhlsCZnPIpuv2Ow0RDVO8lfy1Opf4NUzlMXLjPl+Men7AuVdX6TA+s+uGA== @@ -8823,7 +8925,7 @@ pretty-quick@^1.11.1: mri "^1.1.0" multimatch "^3.0.0" -private@^0.1.6: +private@^0.1.6, private@~0.1.5: version "0.1.8" resolved "https://registry.yarnpkg.com/private/-/private-0.1.8.tgz#2381edb3689f7a53d653190060fcf822d2f368ff" integrity sha512-VvivMrbvd2nKkiG38qjULzlc+4Vx4wm/whI9pQD35YrARNnhxeiRktSOhSukRLFNlzg6Br/cJPet5J/u19r/mg== @@ -9361,6 +9463,16 @@ realpath-native@^1.1.0: dependencies: util.promisify "^1.0.0" +recast@^0.16.1: + version "0.16.2" + resolved "https://registry.yarnpkg.com/recast/-/recast-0.16.2.tgz#3796ebad5fe49ed85473b479cd6df554ad725dc2" + integrity sha512-O/7qXi51DPjRVdbrpNzoBQH5dnAPQNbfoOFyRiUwreTMJfIHYOEBzwuH+c0+/BTSJ3CQyKs6ILSWXhESH6Op3A== + dependencies: + ast-types "0.11.7" + esprima "~4.0.0" + private "~0.1.5" + source-map "~0.6.1" + recursive-readdir@2.2.2: version "2.2.2" resolved "https://registry.yarnpkg.com/recursive-readdir/-/recursive-readdir-2.2.2.tgz#9946fb3274e1628de6e36b2f6714953b4845094f" @@ -9656,6 +9768,11 @@ rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.3: dependencies: glob "^7.1.3" +rimraf@~2.2.6: + version "2.2.8" + resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.2.8.tgz#e439be2aaee327321952730f99a8929e4fc50582" + integrity sha1-5Dm+Kq7jJzIZUnMPmaiSnk/FBYI= + ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -10048,7 +10165,7 @@ source-map-resolve@^0.5.0, source-map-resolve@^0.5.2: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@~0.5.12: +source-map-support@^0.5.6, source-map-support@^0.5.9, source-map-support@~0.5.12: version "0.5.13" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.13.tgz#31b24a9c2e73c2de85066c0feb7d44767ed52932" integrity sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w== @@ -10434,6 +10551,14 @@ tar@^4: safe-buffer "^5.1.2" yallist "^3.0.3" +temp@^0.8.1: + version "0.8.3" + resolved "https://registry.yarnpkg.com/temp/-/temp-0.8.3.tgz#e0c6bc4d26b903124410e4fed81103014dfc1f59" + integrity sha1-4Ma8TSa5AxJEEOT+2BEDAU38H1k= + dependencies: + os-tmpdir "^1.0.0" + rimraf "~2.2.6" + terser-webpack-plugin@1.4.1, terser-webpack-plugin@^1.4.1: version "1.4.1" resolved "https://registry.yarnpkg.com/terser-webpack-plugin/-/terser-webpack-plugin-1.4.1.tgz#61b18e40eaee5be97e771cdbb10ed1280888c2b4" @@ -11339,6 +11464,15 @@ write-file-atomic@2.4.1: imurmurhash "^0.1.4" signal-exit "^3.0.2" +write-file-atomic@^2.3.0: + version "2.4.3" + resolved "https://registry.yarnpkg.com/write-file-atomic/-/write-file-atomic-2.4.3.tgz#1fd2e9ae1df3e75b8d8c367443c692d4ca81f481" + integrity sha512-GaETH5wwsX+GcnzhPgKcKjJ6M2Cq3/iZp1WyY/X1CSqrW+jVNM9Y7D8EC2sM4ZG/V8wZlSniJnCKWPmBYAucRQ== + dependencies: + graceful-fs "^4.1.11" + imurmurhash "^0.1.4" + signal-exit "^3.0.2" + write@1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/write/-/write-1.0.3.tgz#0800e14523b923a387e415123c865616aae0f5c3" From 4665347b0eb3edd5f2c7ccfd95d2329558e668cd Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:39:56 +1000 Subject: [PATCH 04/13] remove unnecessary date-fns imports --- src/components/Fields/Date.tsx | 2 +- src/components/Fields/DateTime.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Fields/Date.tsx b/src/components/Fields/Date.tsx index 24af8a10..c844d4b9 100644 --- a/src/components/Fields/Date.tsx +++ b/src/components/Fields/Date.tsx @@ -1,5 +1,5 @@ import React from "react"; -import "date-fns"; + import DateFnsUtils from "@date-io/date-fns"; import { MuiPickersUtilsProvider, diff --git a/src/components/Fields/DateTime.tsx b/src/components/Fields/DateTime.tsx index 487ee1d1..5f9c6d1d 100644 --- a/src/components/Fields/DateTime.tsx +++ b/src/components/Fields/DateTime.tsx @@ -1,5 +1,5 @@ import React from "react"; -import "date-fns"; + import DateFnsUtils from "@date-io/date-fns"; import { MuiPickersUtilsProvider, From ea7475cb50fe7497302223e2fd9ed12e925c27bc Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:43:51 +1000 Subject: [PATCH 05/13] clean up @material-ui/core imports + import order --- src/components/ColumnDailog.tsx | 21 ++++++----- src/components/ColumnDrawer.tsx | 31 +++++++++------- src/components/CreateTableDialog.tsx | 19 ++++++---- src/components/Fields/CheckBox.tsx | 6 ++- src/components/Fields/Date.tsx | 10 ++--- src/components/Fields/DateTime.tsx | 10 ++--- src/components/Fields/Number.tsx | 4 +- src/components/Fields/SimpleText.tsx | 4 +- src/components/Navigation.tsx | 43 +++++++++++++--------- src/components/Table.tsx | 55 ++++++++++++++-------------- src/components/TableCell.tsx | 16 ++++---- src/views/AuthView.tsx | 24 +++++++----- src/views/TableView.tsx | 5 ++- src/views/TablesView.tsx | 28 ++++++++------ 14 files changed, 156 insertions(+), 120 deletions(-) diff --git a/src/components/ColumnDailog.tsx b/src/components/ColumnDailog.tsx index 260fe404..434150ef 100644 --- a/src/components/ColumnDailog.tsx +++ b/src/components/ColumnDailog.tsx @@ -1,15 +1,18 @@ import React, { useState, useEffect } from "react"; -import Button from "@material-ui/core/Button"; -import TextField from "@material-ui/core/TextField"; -import Dialog from "@material-ui/core/Dialog"; -import DialogActions from "@material-ui/core/DialogActions"; -import DialogContent from "@material-ui/core/DialogContent"; -import DialogContentText from "@material-ui/core/DialogContentText"; -import DialogTitle from "@material-ui/core/DialogTitle"; -import Fab from "@material-ui/core/Fab"; -import AddIcon from "@material-ui/icons/Add"; import _camelCase from "lodash/camelCase"; +import { + Button, + TextField, + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, + Fab, +} from "@material-ui/core"; +import AddIcon from "@material-ui/icons/Add"; + export default function ColumnDialog(props: any) { const { classes, columnName, updateColumn } = props; const [open, setOpen] = React.useState(false); diff --git a/src/components/ColumnDrawer.tsx b/src/components/ColumnDrawer.tsx index 21b0d39a..b5ace434 100644 --- a/src/components/ColumnDrawer.tsx +++ b/src/components/ColumnDrawer.tsx @@ -1,31 +1,34 @@ import React, { useState, useEffect } from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import Drawer from "@material-ui/core/Drawer"; -import List from "@material-ui/core/List"; -import Divider from "@material-ui/core/Divider"; -import ListItem from "@material-ui/core/ListItem"; -import ListItemIcon from "@material-ui/core/ListItemIcon"; -import ListItemText from "@material-ui/core/ListItemText"; +import _camelCase from "lodash/camelCase"; +import { + makeStyles, + Drawer, + List, + Divider, + ListItem, + ListItemIcon, + ListItemText, + IconButton, + TextField, +} from "@material-ui/core"; import AddIcon from "@material-ui/icons/Add"; -import IconButton from "@material-ui/core/IconButton"; -import TextField from "@material-ui/core/TextField"; -import _camelCase from "lodash/camelCase"; import { FIELDS } from "./Fields"; + const useStyles = makeStyles({ list: { - width: 250 + width: 250, }, fields: { paddingLeft: 15, - paddingRight: 15 + paddingRight: 15, }, fullList: { - width: "auto" - } + width: "auto", + }, }); export default function ColumnDrawer(props: any) { diff --git a/src/components/CreateTableDialog.tsx b/src/components/CreateTableDialog.tsx index 785b6e67..bda302c5 100644 --- a/src/components/CreateTableDialog.tsx +++ b/src/components/CreateTableDialog.tsx @@ -1,15 +1,18 @@ import React, { useState, useEffect } from "react"; -import Button from "@material-ui/core/Button"; -import TextField from "@material-ui/core/TextField"; -import Dialog from "@material-ui/core/Dialog"; -import DialogActions from "@material-ui/core/DialogActions"; -import DialogContent from "@material-ui/core/DialogContent"; -import DialogContentText from "@material-ui/core/DialogContentText"; -import DialogTitle from "@material-ui/core/DialogTitle"; -import Fab from "@material-ui/core/Fab"; import AddIcon from "@material-ui/icons/Add"; import _camelCase from "lodash/camelCase"; +import { + Button, + TextField, + Dialog, + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, + Fab, +} from "@material-ui/core"; + export default function CreateTableDialog(props: any) { const { classes, createTable } = props; const [open, setOpen] = React.useState(false); diff --git a/src/components/Fields/CheckBox.tsx b/src/components/Fields/CheckBox.tsx index 497fe0ad..b4e92e67 100644 --- a/src/components/Fields/CheckBox.tsx +++ b/src/components/Fields/CheckBox.tsx @@ -1,5 +1,6 @@ import React from "react"; -import Checkbox from "@material-ui/core/Checkbox"; + +import { Checkbox } from "@material-ui/core"; const CheckBox = (props: any) => { const { columnData, cellData, cellActions, rowData, rowIndex } = props; @@ -11,10 +12,11 @@ const CheckBox = (props: any) => { rowIndex, value: !cellData, docRef: rowData.ref, - fieldName: columnData.fieldName + fieldName: columnData.fieldName, }); }} /> ); }; + export default CheckBox; diff --git a/src/components/Fields/Date.tsx b/src/components/Fields/Date.tsx index c844d4b9..6181d128 100644 --- a/src/components/Fields/Date.tsx +++ b/src/components/Fields/Date.tsx @@ -1,13 +1,13 @@ import React from "react"; - import DateFnsUtils from "@date-io/date-fns"; + +import { Button } from "@material-ui/core"; import { MuiPickersUtilsProvider, // KeyboardTimePicker, // KeyboardDatePicker, - DatePicker + DatePicker, } from "@material-ui/pickers"; -import Button from "@material-ui/core/Button"; const Date = (props: any) => { const { @@ -16,7 +16,7 @@ const Date = (props: any) => { cellData, cellActions, rowData, - rowIndex + rowIndex, } = props; function handleDateChange(date: Date | null) { if (date) { @@ -24,7 +24,7 @@ const Date = (props: any) => { rowIndex, value: date, docRef: rowData.ref, - fieldName: columnData.fieldName + fieldName: columnData.fieldName, }; cellActions.updateFirestore(cell); } diff --git a/src/components/Fields/DateTime.tsx b/src/components/Fields/DateTime.tsx index 5f9c6d1d..ee6fcb45 100644 --- a/src/components/Fields/DateTime.tsx +++ b/src/components/Fields/DateTime.tsx @@ -1,13 +1,13 @@ import React from "react"; - import DateFnsUtils from "@date-io/date-fns"; + +import { Button } from "@material-ui/core"; import { MuiPickersUtilsProvider, // KeyboardTimePicker, // KeyboardDatePicker, - DateTimePicker + DateTimePicker, } from "@material-ui/pickers"; -import Button from "@material-ui/core/Button"; const DateTime = (props: any) => { const { @@ -16,7 +16,7 @@ const DateTime = (props: any) => { cellData, cellActions, rowData, - rowIndex + rowIndex, } = props; function handleDateChange(date: Date | null) { if (date) { @@ -24,7 +24,7 @@ const DateTime = (props: any) => { rowIndex, value: date, docRef: rowData.ref, - fieldName: columnData.fieldName + fieldName: columnData.fieldName, }; cellActions.updateFirestore(cell); } diff --git a/src/components/Fields/Number.tsx b/src/components/Fields/Number.tsx index 88278fa0..ce8d7673 100644 --- a/src/components/Fields/Number.tsx +++ b/src/components/Fields/Number.tsx @@ -1,5 +1,7 @@ import React from "react"; -import TextField from "@material-ui/core/TextField"; + +import { TextField } from "@material-ui/core"; + const Number = (props: any) => { const { isFocusedCell, cellData, cellActions } = props; if (isFocusedCell) diff --git a/src/components/Fields/SimpleText.tsx b/src/components/Fields/SimpleText.tsx index f8914f3a..b7feb26c 100644 --- a/src/components/Fields/SimpleText.tsx +++ b/src/components/Fields/SimpleText.tsx @@ -1,5 +1,7 @@ import React from "react"; -import TextField from "@material-ui/core/TextField"; + +import { TextField } from "@material-ui/core"; + const SimpleText = (props: any) => { const { isFocusedCell, cellData, cellActions } = props; diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index 79cb406d..df210f80 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -1,53 +1,60 @@ import React from "react"; -import { createStyles, Theme, makeStyles } from "@material-ui/core/styles"; -import AppBar from "@material-ui/core/AppBar"; -import CssBaseline from "@material-ui/core/CssBaseline"; -import Toolbar from "@material-ui/core/Toolbar"; -import Typography from "@material-ui/core/Typography"; -import IconButton from "@material-ui/core/IconButton"; -import Paper from "@material-ui/core/Paper"; + +import { + createStyles, + makeStyles, + AppBar, + CssBaseline, + Toolbar, + Typography, + IconButton, + Paper, + Button, +} from "@material-ui/core"; +import { Theme } from "@material-ui/core/styles"; import MenuIcon from "@material-ui/icons/Menu"; -import Button from "@material-ui/core/Button"; import Skeleton from "@material-ui/lab/Skeleton"; -import useSettings from "../hooks/useSettings"; import CreateTableDialog from "./CreateTableDialog"; + +import useSettings from "../hooks/useSettings"; import useRouter from "../hooks/useRouter"; + const useStyles = makeStyles((theme: Theme) => createStyles({ text: { - padding: theme.spacing(2, 2, 0) + padding: theme.spacing(2, 2, 0), }, paper: { paddingBottom: 20, - paddingTop: 5 + paddingTop: 5, }, subheader: { - backgroundColor: theme.palette.background.paper + backgroundColor: theme.palette.background.paper, }, appBar: { top: "auto", - bottom: 0 + bottom: 0, }, grow: { - flexGrow: 1 + flexGrow: 1, }, fabButton: { position: "absolute", zIndex: 1, top: -30, right: 20, - margin: "0 auto" + margin: "0 auto", }, button: { color: "#fff", - marginLeft: 8 + marginLeft: 8, }, skeleton: { marginLeft: 8, - borderRadius: 5 - } + borderRadius: 5, + }, }) ); diff --git a/src/components/Table.tsx b/src/components/Table.tsx index 26793a4e..585e0981 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -1,21 +1,22 @@ import React, { useEffect } from "react"; import clsx from "clsx"; + +import { Theme, WithStyles } from "@material-ui/core/styles"; import { + TableCell as MuiTableCell, createStyles, - Theme, withStyles, - WithStyles -} from "@material-ui/core/styles"; -import { TableCell as MuiTableCell } from "@material-ui/core"; -import Paper from "@material-ui/core/Paper"; + Paper, + Button, +} from "@material-ui/core"; + import { AutoSizer, Column, Table as MuiTable, TableCellRenderer, - TableHeaderProps + TableHeaderProps, } from "react-virtualized"; -import Button from "@material-ui/core/Button"; import { FieldType, getFieldIcon } from "./Fields"; import ColumnDrawer from "./ColumnDrawer"; @@ -29,22 +30,22 @@ const styles = (theme: Theme) => flexContainer: { display: "flex", alignItems: "center", - boxSizing: "border-box" + boxSizing: "border-box", }, tableRow: { - cursor: "pointer" + cursor: "pointer", }, tableRowHover: { "&:hover": { - backgroundColor: theme.palette.grey[200] - } + backgroundColor: theme.palette.grey[200], + }, }, tableCell: { - flex: 1 + flex: 1, }, noClick: { - cursor: "initial" - } + cursor: "initial", + }, }); interface ColumnData { @@ -75,14 +76,14 @@ class MuiVirtualizedTable extends React.PureComponent< > { static defaultProps = { headerHeight: 48, - rowHeight: 40 + rowHeight: 40, }; getRowClassName = ({ index }: Row) => { const { classes, onRowClick } = this.props; return clsx(classes.tableRow, classes.flexContainer, { - [classes.tableRowHover]: index !== -1 && onRowClick != null + [classes.tableRowHover]: index !== -1 && onRowClick != null, }); }; @@ -93,7 +94,7 @@ class MuiVirtualizedTable extends React.PureComponent< dataKey, isScrolling, rowData, - rowIndex + rowIndex, }) => { const { columns, @@ -101,7 +102,7 @@ class MuiVirtualizedTable extends React.PureComponent< rowHeight, onRowClick, cellActions, - focusedCell + focusedCell, } = this.props; const fieldType = columnData.fieldType; return ( @@ -125,7 +126,7 @@ class MuiVirtualizedTable extends React.PureComponent< label, columnData, dataKey, - columnIndex + columnIndex, }: TableHeaderProps & { columnIndex: number }) => { const { headerHeight, columns, classes } = this.props; @@ -183,7 +184,7 @@ class MuiVirtualizedTable extends React.PureComponent< headerRenderer={headerProps => this.headerRenderer({ ...headerProps, - columnIndex: index + columnIndex: index, }) } className={classes.flexContainer} @@ -192,7 +193,7 @@ class MuiVirtualizedTable extends React.PureComponent< {...other} /> ); - }) + }), ]} @@ -234,8 +235,8 @@ export default function Table(props: any) { columnData: { fieldType: column.type, fieldName: column.fieldName, - actions: {} - } + actions: {}, + }, }) ), { @@ -246,10 +247,10 @@ export default function Table(props: any) { fieldType: "DELETE", actions: { addColumn: tableActions.column.add, - deleteRow: tableActions.row.delete - } - } - } + deleteRow: tableActions.row.delete, + }, + }, + }, ]} /> diff --git a/src/components/TableCell.tsx b/src/components/TableCell.tsx index 58250e90..e2a2578c 100644 --- a/src/components/TableCell.tsx +++ b/src/components/TableCell.tsx @@ -1,14 +1,16 @@ import React, { useState } from "react"; -import { TableCell as MuiTableCell, Switch } from "@material-ui/core"; import clsx from "clsx"; -import { FieldType } from "./Fields"; -import IconButton from "@material-ui/core/IconButton"; +import { + TableCell as MuiTableCell, + Switch, + IconButton, +} from "@material-ui/core"; import DeleteIcon from "@material-ui/icons/Delete"; +import { FieldType } from "./Fields"; import SimpleText from "./Fields/SimpleText"; import CheckBox from "./Fields/CheckBox"; - import Number from "./Fields/Number"; import Rating from "./Fields/Rating"; import Date from "./Fields/Date"; @@ -28,7 +30,7 @@ const TableCell = (props: any) => { rowHeight, columnIndex, columns, - focusedCell + focusedCell, } = props; const isFocusedCell = focusedCell && @@ -128,7 +130,7 @@ const TableCell = (props: any) => { { @@ -137,7 +139,7 @@ const TableCell = (props: any) => { rowIndex, docRef: rowData.ref, fieldName: columnData.fieldName, - value: cellData + value: cellData, }); }} style={{ height: rowHeight }} diff --git a/src/views/AuthView.tsx b/src/views/AuthView.tsx index 7ddec385..3958c580 100644 --- a/src/views/AuthView.tsx +++ b/src/views/AuthView.tsx @@ -1,11 +1,15 @@ import React from "react"; -import { makeStyles } from "@material-ui/core/styles"; -import Card from "@material-ui/core/Card"; -import CardActions from "@material-ui/core/CardActions"; -import CardContent from "@material-ui/core/CardContent"; -import Button from "@material-ui/core/Button"; -import Typography from "@material-ui/core/Typography"; + import { maxWidth } from "@material-ui/system"; +import { + makeStyles, + Card, + CardActions, + CardContent, + Button, + Typography, +} from "@material-ui/core"; + import { googleProvider, auth } from "../firebase"; import useRouter from "../hooks/useRouter"; @@ -13,14 +17,14 @@ const useStyles = makeStyles({ card: { margin: "auto", minWidth: 275, - maxWidth: 300 + maxWidth: 300, }, button: { - width: "100%" + width: "100%", }, header: { - textAlign: "center" - } + textAlign: "center", + }, }); // googleProvider.addScope("https://www.googleapis.com/auth/contacts.readonly"); diff --git a/src/views/TableView.tsx b/src/views/TableView.tsx index 4d6813e5..d8cecd0f 100644 --- a/src/views/TableView.tsx +++ b/src/views/TableView.tsx @@ -1,9 +1,12 @@ import React, { useEffect } from "react"; -import { makeStyles } from "@material-ui/core/styles"; + +import { makeStyles } from "@material-ui/core"; import Navigation from "../components/Navigation"; import Table from "../components/Table"; + import useRouter from "../hooks/useRouter"; + const useStyles = makeStyles({}); export default function TableView() { diff --git a/src/views/TablesView.tsx b/src/views/TablesView.tsx index b6ff3790..3f0994b5 100644 --- a/src/views/TablesView.tsx +++ b/src/views/TablesView.tsx @@ -1,29 +1,33 @@ import React from "react"; + +import { + makeStyles, + Card, + CardActions, + CardContent, + Button, + Typography, + Grid, +} from "@material-ui/core"; + import useSettings from "../hooks/useSettings"; -import { makeStyles } from "@material-ui/core/styles"; -import Card from "@material-ui/core/Card"; -import CardActions from "@material-ui/core/CardActions"; -import CardContent from "@material-ui/core/CardContent"; -import Button from "@material-ui/core/Button"; -import Typography from "@material-ui/core/Typography"; -import Grid from "@material-ui/core/Grid"; import useRouter from "../hooks/useRouter"; const useStyles = makeStyles({ card: { - minWidth: 275 + minWidth: 275, }, bullet: { display: "inline-block", margin: "0 2px", - transform: "scale(0.8)" + transform: "scale(0.8)", }, title: { - fontSize: 14 + fontSize: 14, }, pos: { - marginBottom: 12 - } + marginBottom: 12, + }, }); const TablesView = (props: any) => { From 018c644b6fb14d273762a1bc99190686daabb743 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:48:35 +1000 Subject: [PATCH 06/13] move MUI theme to own file --- src/App.tsx | 14 +++----------- src/Theme.ts | 12 ++++++++++++ 2 files changed, 15 insertions(+), 11 deletions(-) create mode 100644 src/Theme.ts diff --git a/src/App.tsx b/src/App.tsx index 20cd06aa..ac523bcf 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,6 +1,7 @@ import React from "react"; + import { ThemeProvider } from "@material-ui/styles"; -import { createMuiTheme } from "@material-ui/core"; +import Theme from "./Theme"; import AuthView from "./views/AuthView"; import TableView from "./views/TableView"; @@ -9,20 +10,11 @@ import TablesView from "./views/TablesView"; import { BrowserRouter as Router, Route } from "react-router-dom"; import { AuthProvider } from "./AuthProvider"; import CustomBrowserRouter from "./util/CustomBrowserRouter"; - import PrivateRoute from "./util/PrivateRoute"; -const theme = createMuiTheme({ - spacing: 4, - palette: { - primary: { - main: "#007bff" - } - } -}); const App: React.FC = () => { return ( - +
diff --git a/src/Theme.ts b/src/Theme.ts new file mode 100644 index 00000000..489c6e0d --- /dev/null +++ b/src/Theme.ts @@ -0,0 +1,12 @@ +import { createMuiTheme } from "@material-ui/core"; + +const Theme = createMuiTheme({ + spacing: 4, + palette: { + primary: { + main: "#007bff", + }, + }, +}); + +export default Theme; From ee5182dc9510b7d020bdd4ae8909f0235dd580fe Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:49:39 +1000 Subject: [PATCH 07/13] run prettier on all .ts and .tsx files --- src/App.test.tsx | 10 ++++---- src/AuthProvider.tsx | 2 +- src/components/Fields/Image.tsx | 2 +- src/components/Fields/Rating.tsx | 2 +- src/components/Fields/index.tsx | 4 ++-- src/contexts/authContext.ts | 2 +- src/firebase/config.ts | 2 +- src/hooks/useDoc.ts | 8 +++---- src/hooks/useFiretable/index.ts | 10 ++++---- src/hooks/useFiretable/useCell.ts | 4 ++-- src/hooks/useFiretable/useTable.ts | 14 +++++------ src/hooks/useFiretable/useTableConfig.ts | 6 ++--- src/hooks/useFiretable/useUploader.ts | 8 +++---- src/hooks/useSettings.ts | 4 ++-- src/index.tsx | 10 ++++---- src/serviceWorker.ts | 30 ++++++++++++------------ 16 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/App.test.tsx b/src/App.test.tsx index a754b201..23c181f0 100644 --- a/src/App.test.tsx +++ b/src/App.test.tsx @@ -1,9 +1,9 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; +import React from "react"; +import ReactDOM from "react-dom"; +import App from "./App"; -it('renders without crashing', () => { - const div = document.createElement('div'); +it("renders without crashing", () => { + const div = document.createElement("div"); ReactDOM.render(, div); ReactDOM.unmountComponentAtNode(div); }); diff --git a/src/AuthProvider.tsx b/src/AuthProvider.tsx index a4186101..401a932d 100644 --- a/src/AuthProvider.tsx +++ b/src/AuthProvider.tsx @@ -14,7 +14,7 @@ export const AuthProvider = ({ children }: any) => { return ( {children} diff --git a/src/components/Fields/Image.tsx b/src/components/Fields/Image.tsx index fa5bfd9f..25b23ddb 100644 --- a/src/components/Fields/Image.tsx +++ b/src/components/Fields/Image.tsx @@ -20,7 +20,7 @@ const Image = (props: any) => { const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop, multiple: false, - accept: ["image/png", "image/jpg", "image/jpeg"] + accept: ["image/png", "image/jpg", "image/jpeg"], }); return (
diff --git a/src/components/Fields/Rating.tsx b/src/components/Fields/Rating.tsx index b7c65fc3..db28ddc9 100644 --- a/src/components/Fields/Rating.tsx +++ b/src/components/Fields/Rating.tsx @@ -12,7 +12,7 @@ const Rating = (props: any) => { rowIndex, value: newValue, docRef: rowData.ref, - fieldName: columnData.fieldName + fieldName: columnData.fieldName, }; cellActions.updateFirestore(cell); }} diff --git a/src/components/Fields/index.tsx b/src/components/Fields/index.tsx index c29e8349..f3b2c3cd 100644 --- a/src/components/Fields/index.tsx +++ b/src/components/Fields/index.tsx @@ -25,7 +25,7 @@ export enum FieldType { url = "URL", rating = "RATING", image = "IMAGE", - file = "FILE" + file = "FILE", } export const FIELDS = [ @@ -40,7 +40,7 @@ export const FIELDS = [ { icon: , name: "URL", type: FieldType.url }, { icon: , name: "Rating", type: FieldType.rating }, { icon: , name: "Image", type: FieldType.image }, - { icon: , name: "File", type: FieldType.file } + { icon: , name: "File", type: FieldType.file }, ]; export const getFieldIcon = (type: FieldType) => { diff --git a/src/contexts/authContext.ts b/src/contexts/authContext.ts index 66a96aad..220da20a 100644 --- a/src/contexts/authContext.ts +++ b/src/contexts/authContext.ts @@ -5,7 +5,7 @@ interface AuthContextInterface { } const AuthContext = React.createContext({ - currentUser: undefined + currentUser: undefined, }); export default AuthContext; diff --git a/src/firebase/config.ts b/src/firebase/config.ts index aabf5ce9..d099a088 100644 --- a/src/firebase/config.ts +++ b/src/firebase/config.ts @@ -10,7 +10,7 @@ export const stagingConfig = { databaseURL: `https://${STAGING_PROJECT_NAME}.firebaseio.com`, projectId: STAGING_PROJECT_NAME, storageBucket: `${STAGING_PROJECT_NAME}.appspot.com`, - messagingSenderId: "236015562107" + messagingSenderId: "236015562107", }; export const productionConfig = stagingConfig; diff --git a/src/hooks/useDoc.ts b/src/hooks/useDoc.ts index 6a562feb..f2a9940f 100644 --- a/src/hooks/useDoc.ts +++ b/src/hooks/useDoc.ts @@ -3,7 +3,7 @@ import { useEffect, useReducer } from "react"; export enum DocActions { update, - delete + delete, } const documentReducer = (prevState: any, newProps: any) => { switch (newProps.action) { @@ -22,13 +22,13 @@ const documentIntialState = { prevPath: null, doc: null, ref: null, - loading: true + loading: true, }; const useDoc = (intialOverrides: any) => { const [documentState, documentDispatch] = useReducer(documentReducer, { ...documentIntialState, - ...intialOverrides + ...intialOverrides, }); const setDocumentListner = () => { documentDispatch({ prevPath: documentState.path }); @@ -41,7 +41,7 @@ const useDoc = (intialOverrides: any) => { documentDispatch({ doc, ref: snapshot.ref, - loading: false + loading: false, }); } }); diff --git a/src/hooks/useFiretable/index.ts b/src/hooks/useFiretable/index.ts index 875e645d..7efdfbd4 100644 --- a/src/hooks/useFiretable/index.ts +++ b/src/hooks/useFiretable/index.ts @@ -23,7 +23,7 @@ const useFiretable = (collectionName: string) => { const tab = useKeyCode(9); const [tableConfig, configActions] = useTableConfig(collectionName); const [tableState, tableActions] = useTable({ - path: collectionName + path: collectionName, }); const [cellState, cellActions] = useCell({}); @@ -41,7 +41,7 @@ const useFiretable = (collectionName: string) => { docRef: tableState.rows[nextRowIndex].ref, fieldName: cellState.cell.fieldName, rowIndex: nextRowIndex, - value: tableState.rows[nextRowIndex].value + value: tableState.rows[nextRowIndex].value, }; cellActions.set(nextCell); } @@ -61,7 +61,7 @@ const useFiretable = (collectionName: string) => { docRef: tableState.rows[nextRowIndex].ref, fieldName: cellState.cell.fieldName, rowIndex: nextRowIndex, - value: tableState.rows[nextRowIndex].value + value: tableState.rows[nextRowIndex].value, }; cellActions.set(nextCell); } @@ -76,13 +76,13 @@ const useFiretable = (collectionName: string) => { const state: FiretableState = { cell: cellState.cell, columns: tableConfig.columns, - rows: tableState.rows + rows: tableState.rows, }; const actions: FiretableActions = { cell: { ...cellActions }, column: { add: configActions.addColumn }, row: { add: tableActions.addRow, delete: tableActions.deleteRow }, - table: { set: setTable } + table: { set: setTable }, }; return { tableState: state, tableActions: actions }; diff --git a/src/hooks/useFiretable/useCell.ts b/src/hooks/useFiretable/useCell.ts index 8cc535a3..7ac756ed 100644 --- a/src/hooks/useFiretable/useCell.ts +++ b/src/hooks/useFiretable/useCell.ts @@ -14,7 +14,7 @@ const cellReducer = (prevState: any, newProps: any) => { }; const cellIntialState = { prevCell: null, - cell: null + cell: null, }; const updateCell = (cell: Cell) => { @@ -23,7 +23,7 @@ const updateCell = (cell: Cell) => { const useCell = (intialOverrides: any) => { const [cellState, cellDispatch] = useReducer(cellReducer, { ...cellIntialState, - ...intialOverrides + ...intialOverrides, }); useEffect(() => { const { prevCell, updatedValue } = cellState; diff --git a/src/hooks/useFiretable/useTable.ts b/src/hooks/useFiretable/useTable.ts index fe2d0aaa..0d03883c 100644 --- a/src/hooks/useFiretable/useTable.ts +++ b/src/hooks/useFiretable/useTable.ts @@ -31,13 +31,13 @@ const tableIntialState = { limit: 20, loading: true, sort: { field: "createdAt", direction: "asc" }, - cap: CAP + cap: CAP, }; const useTable = (intialOverrides: any) => { const [tableState, tableDispatch] = useReducer(tableReducer, { ...tableIntialState, - ...intialOverrides + ...intialOverrides, }); const getRows = ( filters: { @@ -59,7 +59,7 @@ const useTable = (intialOverrides: any) => { prevFilters: filters, prevLimit: limit, prevPath: tableState.path, - loading: true + loading: true, }); let query: | firebase.firestore.CollectionReference @@ -90,12 +90,12 @@ const useTable = (intialOverrides: any) => { .filter(doc => doc.id !== "_FIRETABLE_"); //removes schema file tableDispatch({ rows, - loading: false + loading: false, }); } else { tableDispatch({ rows: [], - loading: false + loading: false, }); } }); @@ -110,7 +110,7 @@ const useTable = (intialOverrides: any) => { prevPath, path, sort, - unsubscribe + unsubscribe, } = tableState; if ( !equals(prevFilters, filters) || @@ -141,7 +141,7 @@ const useTable = (intialOverrides: any) => { const addRow = () => { db.collection(tableState.path).add({ createdAt: firebase.firestore.FieldValue.serverTimestamp(), - updatedAt: firebase.firestore.FieldValue.serverTimestamp() + updatedAt: firebase.firestore.FieldValue.serverTimestamp(), }); }; const tableActions = { deleteRow, setTable, addRow }; diff --git a/src/hooks/useFiretable/useTableConfig.ts b/src/hooks/useFiretable/useTableConfig.ts index c3ddc91c..56c072e2 100644 --- a/src/hooks/useFiretable/useTableConfig.ts +++ b/src/hooks/useFiretable/useTableConfig.ts @@ -3,7 +3,7 @@ import useDoc, { DocActions } from "../useDoc"; import { FieldType } from "../../components/Fields"; const useTableConfig = (tablePath: string) => { const [tableConfigState, documentDispatch] = useDoc({ - path: `${tablePath}/_FIRETABLE_` + path: `${tablePath}/_FIRETABLE_`, }); useEffect(() => { const { doc, columns } = tableConfigState; @@ -22,12 +22,12 @@ const useTableConfig = (tablePath: string) => { const { columns } = tableConfigState; documentDispatch({ action: DocActions.update, - data: { columns: [...columns, { columnName, fieldName, type }] } + data: { columns: [...columns, { columnName, fieldName, type }] }, }); }; const actions = { addColumn, - setTable + setTable, }; return [tableConfigState, actions]; }; diff --git a/src/hooks/useFiretable/useUploader.ts b/src/hooks/useFiretable/useUploader.ts index d7113b5d..f96a26a6 100644 --- a/src/hooks/useFiretable/useUploader.ts +++ b/src/hooks/useFiretable/useUploader.ts @@ -8,7 +8,7 @@ const uploadReducer = (prevState: any, newProps: any) => { }; const useUploader = () => { const [uploaderState, uploaderDispatch] = useReducer(uploadReducer, { - ...intialState + ...intialState, }); const upload = ( @@ -64,9 +64,9 @@ const useUploader = () => { downloadURL, name: file.name, type: file.type, - lastModifiedTS: file.lastModified - } - ] + lastModifiedTS: file.lastModified, + }, + ], }); }); } diff --git a/src/hooks/useSettings.ts b/src/hooks/useSettings.ts index ebae4b38..045a6541 100644 --- a/src/hooks/useSettings.ts +++ b/src/hooks/useSettings.ts @@ -4,7 +4,7 @@ import { db } from "../firebase"; const useSettings = () => { const [settingsState, documentDispatch] = useDoc({ - path: "_FIRETABLE_/settings" + path: "_FIRETABLE_/settings", }); useEffect(() => { //updates tables data on document change @@ -19,7 +19,7 @@ const useSettings = () => { // updates the setting doc documentDispatch({ action: DocActions.update, - data: { tables: [...tables, { name, collection }] } + data: { tables: [...tables, { name, collection }] }, }); //create the firetable collection doc with empty columns db.collection(collection) diff --git a/src/index.tsx b/src/index.tsx index 82c1a6b6..c1684e83 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -1,9 +1,9 @@ -import React from 'react'; -import ReactDOM from 'react-dom'; -import App from './App'; -import * as serviceWorker from './serviceWorker'; +import React from "react"; +import ReactDOM from "react-dom"; +import App from "./App"; +import * as serviceWorker from "./serviceWorker"; -ReactDOM.render(, document.getElementById('root')); +ReactDOM.render(, document.getElementById("root")); // If you want your app to work offline and load faster, you can change // unregister() to register() below. Note this comes with some pitfalls. diff --git a/src/serviceWorker.ts b/src/serviceWorker.ts index 15d90cb8..21c461f7 100644 --- a/src/serviceWorker.ts +++ b/src/serviceWorker.ts @@ -11,9 +11,9 @@ // opt-in, read https://bit.ly/CRA-PWA const isLocalhost = Boolean( - window.location.hostname === 'localhost' || + window.location.hostname === "localhost" || // [::1] is the IPv6 localhost address. - window.location.hostname === '[::1]' || + window.location.hostname === "[::1]" || // 127.0.0.1/8 is considered localhost for IPv4. window.location.hostname.match( /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/ @@ -26,7 +26,7 @@ type Config = { }; export function register(config?: Config) { - if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) { + if (process.env.NODE_ENV === "production" && "serviceWorker" in navigator) { // The URL constructor is available in all browsers that support SW. const publicUrl = new URL( (process as { env: { [key: string]: string } }).env.PUBLIC_URL, @@ -39,7 +39,7 @@ export function register(config?: Config) { return; } - window.addEventListener('load', () => { + window.addEventListener("load", () => { const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`; if (isLocalhost) { @@ -50,8 +50,8 @@ export function register(config?: Config) { // service worker/PWA documentation. navigator.serviceWorker.ready.then(() => { console.log( - 'This web app is being served cache-first by a service ' + - 'worker. To learn more, visit https://bit.ly/CRA-PWA' + "This web app is being served cache-first by a service " + + "worker. To learn more, visit https://bit.ly/CRA-PWA" ); }); } else { @@ -72,14 +72,14 @@ function registerValidSW(swUrl: string, config?: Config) { return; } installingWorker.onstatechange = () => { - if (installingWorker.state === 'installed') { + if (installingWorker.state === "installed") { if (navigator.serviceWorker.controller) { // At this point, the updated precached content has been fetched, // but the previous service worker will still serve the older // content until all client tabs are closed. console.log( - 'New content is available and will be used when all ' + - 'tabs for this page are closed. See https://bit.ly/CRA-PWA.' + "New content is available and will be used when all " + + "tabs for this page are closed. See https://bit.ly/CRA-PWA." ); // Execute callback @@ -90,7 +90,7 @@ function registerValidSW(swUrl: string, config?: Config) { // At this point, everything has been precached. // It's the perfect time to display a // "Content is cached for offline use." message. - console.log('Content is cached for offline use.'); + console.log("Content is cached for offline use."); // Execute callback if (config && config.onSuccess) { @@ -102,7 +102,7 @@ function registerValidSW(swUrl: string, config?: Config) { }; }) .catch(error => { - console.error('Error during service worker registration:', error); + console.error("Error during service worker registration:", error); }); } @@ -111,10 +111,10 @@ function checkValidServiceWorker(swUrl: string, config?: Config) { fetch(swUrl) .then(response => { // Ensure service worker exists, and that we really are getting a JS file. - const contentType = response.headers.get('content-type'); + const contentType = response.headers.get("content-type"); if ( response.status === 404 || - (contentType != null && contentType.indexOf('javascript') === -1) + (contentType != null && contentType.indexOf("javascript") === -1) ) { // No service worker found. Probably a different app. Reload the page. navigator.serviceWorker.ready.then(registration => { @@ -129,13 +129,13 @@ function checkValidServiceWorker(swUrl: string, config?: Config) { }) .catch(() => { console.log( - 'No internet connection found. App is running in offline mode.' + "No internet connection found. App is running in offline mode." ); }); } export function unregister() { - if ('serviceWorker' in navigator) { + if ("serviceWorker" in navigator) { navigator.serviceWorker.ready.then(registration => { registration.unregister(); }); From f2def2abdb422310159da289a86512b498577939 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:50:58 +1000 Subject: [PATCH 08/13] fix src/components/ColumnDialog file name typo --- src/components/{ColumnDailog.tsx => ColumnDialog.tsx} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/components/{ColumnDailog.tsx => ColumnDialog.tsx} (100%) diff --git a/src/components/ColumnDailog.tsx b/src/components/ColumnDialog.tsx similarity index 100% rename from src/components/ColumnDailog.tsx rename to src/components/ColumnDialog.tsx From 56cbca2316df489ae056003846a72b4419df1eb5 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 22:55:52 +1000 Subject: [PATCH 09/13] add createStyles call to all useStyles hooks --- src/components/ColumnDrawer.tsx | 27 ++++++++++++++----------- src/components/Navigation.tsx | 5 ++--- src/views/AuthView.tsx | 29 +++++++++++++++------------ src/views/TableView.tsx | 5 ----- src/views/TablesView.tsx | 35 ++++++++++++++++++--------------- 5 files changed, 52 insertions(+), 49 deletions(-) diff --git a/src/components/ColumnDrawer.tsx b/src/components/ColumnDrawer.tsx index b5ace434..f39a47dc 100644 --- a/src/components/ColumnDrawer.tsx +++ b/src/components/ColumnDrawer.tsx @@ -3,6 +3,7 @@ import _camelCase from "lodash/camelCase"; import { makeStyles, + createStyles, Drawer, List, Divider, @@ -16,20 +17,22 @@ import AddIcon from "@material-ui/icons/Add"; import { FIELDS } from "./Fields"; -const useStyles = makeStyles({ - list: { - width: 250, - }, - fields: { - paddingLeft: 15, +const useStyles = makeStyles(() => + createStyles({ + list: { + width: 250, + }, + fields: { + paddingLeft: 15, - paddingRight: 15, - }, + paddingRight: 15, + }, - fullList: { - width: "auto", - }, -}); + fullList: { + width: "auto", + }, + }) +); export default function ColumnDrawer(props: any) { const { addColumn, columns } = props; diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index df210f80..1f7e5941 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -1,8 +1,8 @@ import React from "react"; import { - createStyles, makeStyles, + createStyles, AppBar, CssBaseline, Toolbar, @@ -11,7 +11,6 @@ import { Paper, Button, } from "@material-ui/core"; -import { Theme } from "@material-ui/core/styles"; import MenuIcon from "@material-ui/icons/Menu"; import Skeleton from "@material-ui/lab/Skeleton"; @@ -20,7 +19,7 @@ import CreateTableDialog from "./CreateTableDialog"; import useSettings from "../hooks/useSettings"; import useRouter from "../hooks/useRouter"; -const useStyles = makeStyles((theme: Theme) => +const useStyles = makeStyles(theme => createStyles({ text: { padding: theme.spacing(2, 2, 0), diff --git a/src/views/AuthView.tsx b/src/views/AuthView.tsx index 3958c580..8b220d8e 100644 --- a/src/views/AuthView.tsx +++ b/src/views/AuthView.tsx @@ -3,6 +3,7 @@ import React from "react"; import { maxWidth } from "@material-ui/system"; import { makeStyles, + createStyles, Card, CardActions, CardContent, @@ -13,19 +14,21 @@ import { import { googleProvider, auth } from "../firebase"; import useRouter from "../hooks/useRouter"; -const useStyles = makeStyles({ - card: { - margin: "auto", - minWidth: 275, - maxWidth: 300, - }, - button: { - width: "100%", - }, - header: { - textAlign: "center", - }, -}); +const useStyles = makeStyles(() => + createStyles({ + card: { + margin: "auto", + minWidth: 275, + maxWidth: 300, + }, + button: { + width: "100%", + }, + header: { + textAlign: "center", + }, + }) +); // googleProvider.addScope("https://www.googleapis.com/auth/contacts.readonly"); diff --git a/src/views/TableView.tsx b/src/views/TableView.tsx index d8cecd0f..2984c80b 100644 --- a/src/views/TableView.tsx +++ b/src/views/TableView.tsx @@ -1,18 +1,13 @@ import React, { useEffect } from "react"; -import { makeStyles } from "@material-ui/core"; - import Navigation from "../components/Navigation"; import Table from "../components/Table"; import useRouter from "../hooks/useRouter"; -const useStyles = makeStyles({}); - export default function TableView() { const router = useRouter(); const tableCollection = router.location.pathname.split("/")[2]; - const classes = useStyles(); return ( diff --git a/src/views/TablesView.tsx b/src/views/TablesView.tsx index 3f0994b5..a06a837f 100644 --- a/src/views/TablesView.tsx +++ b/src/views/TablesView.tsx @@ -2,6 +2,7 @@ import React from "react"; import { makeStyles, + createStyles, Card, CardActions, CardContent, @@ -13,22 +14,24 @@ import { import useSettings from "../hooks/useSettings"; import useRouter from "../hooks/useRouter"; -const useStyles = makeStyles({ - card: { - minWidth: 275, - }, - bullet: { - display: "inline-block", - margin: "0 2px", - transform: "scale(0.8)", - }, - title: { - fontSize: 14, - }, - pos: { - marginBottom: 12, - }, -}); +const useStyles = makeStyles(() => + createStyles({ + card: { + minWidth: 275, + }, + bullet: { + display: "inline-block", + margin: "0 2px", + transform: "scale(0.8)", + }, + title: { + fontSize: 14, + }, + pos: { + marginBottom: 12, + }, + }) +); const TablesView = (props: any) => { const [settings, createTable] = useSettings(); From 0e6583d6646b5fdec9d2c43120f2cf11081e92d1 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 23:47:50 +1000 Subject: [PATCH 10/13] switch Route component prop to render prop this change prevents component remounting, see https://reacttraining.com/react-router/web/api/Route/render-func --- src/App.tsx | 6 +++--- src/util/PrivateRoute.tsx | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index ac523bcf..00152814 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -18,9 +18,9 @@ const App: React.FC = () => {
- - - + } /> + } /> + } />
diff --git a/src/util/PrivateRoute.tsx b/src/util/PrivateRoute.tsx index 04f3eac2..9e74fe22 100644 --- a/src/util/PrivateRoute.tsx +++ b/src/util/PrivateRoute.tsx @@ -1,15 +1,19 @@ import React, { useContext } from "react"; -import { Route, Redirect } from "react-router-dom"; +import { Route, RouteProps, Redirect } from "react-router-dom"; import AuthContext from "../contexts/authContext"; -const PrivateRoute = ({ component: RouteComponent, ...rest }: any) => { +interface IPrivateRouteProps extends RouteProps { + render: NonNullable; +} + +const PrivateRoute: React.FC = ({ render, ...rest }) => { const { currentUser } = useContext(AuthContext); return ( !!currentUser ? ( - + render(routeProps) ) : currentUser === null ? ( ) : ( From c4a1397650f21ec5a2767993d5404d934c5e04a3 Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 23:48:08 +1000 Subject: [PATCH 11/13] remove unused logo.svg from create-react-app init --- src/logo.svg | 7 ------- 1 file changed, 7 deletions(-) delete mode 100644 src/logo.svg diff --git a/src/logo.svg b/src/logo.svg deleted file mode 100644 index 6b60c104..00000000 --- a/src/logo.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - From 575e557ac7a2543457266b03dae07f69f99f065f Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 23:49:48 +1000 Subject: [PATCH 12/13] add TODOs to create props interfaces for components --- src/components/ColumnDialog.tsx | 1 + src/components/ColumnDrawer.tsx | 1 + src/components/CreateTableDialog.tsx | 1 + src/components/Fields/CheckBox.tsx | 1 + src/components/Fields/Date.tsx | 1 + src/components/Fields/DateTime.tsx | 1 + src/components/Fields/Image.tsx | 1 + src/components/Fields/Number.tsx | 1 + src/components/Fields/Rating.tsx | 1 + src/components/Fields/SimpleText.tsx | 1 + src/components/Navigation.tsx | 1 + src/components/Table.tsx | 1 + src/components/TableCell.tsx | 1 + src/views/TablesView.tsx | 1 + 14 files changed, 14 insertions(+) diff --git a/src/components/ColumnDialog.tsx b/src/components/ColumnDialog.tsx index 434150ef..b94b6103 100644 --- a/src/components/ColumnDialog.tsx +++ b/src/components/ColumnDialog.tsx @@ -13,6 +13,7 @@ import { } from "@material-ui/core"; import AddIcon from "@material-ui/icons/Add"; +// TODO: Create an interface for props export default function ColumnDialog(props: any) { const { classes, columnName, updateColumn } = props; const [open, setOpen] = React.useState(false); diff --git a/src/components/ColumnDrawer.tsx b/src/components/ColumnDrawer.tsx index f39a47dc..68f106af 100644 --- a/src/components/ColumnDrawer.tsx +++ b/src/components/ColumnDrawer.tsx @@ -34,6 +34,7 @@ const useStyles = makeStyles(() => }) ); +// TODO: Create an interface for props export default function ColumnDrawer(props: any) { const { addColumn, columns } = props; const classes = useStyles(); diff --git a/src/components/CreateTableDialog.tsx b/src/components/CreateTableDialog.tsx index bda302c5..a016e46a 100644 --- a/src/components/CreateTableDialog.tsx +++ b/src/components/CreateTableDialog.tsx @@ -13,6 +13,7 @@ import { Fab, } from "@material-ui/core"; +// TODO: Create an interface for props export default function CreateTableDialog(props: any) { const { classes, createTable } = props; const [open, setOpen] = React.useState(false); diff --git a/src/components/Fields/CheckBox.tsx b/src/components/Fields/CheckBox.tsx index b4e92e67..2f99b175 100644 --- a/src/components/Fields/CheckBox.tsx +++ b/src/components/Fields/CheckBox.tsx @@ -2,6 +2,7 @@ import React from "react"; import { Checkbox } from "@material-ui/core"; +// TODO: Create an interface for props const CheckBox = (props: any) => { const { columnData, cellData, cellActions, rowData, rowIndex } = props; return ( diff --git a/src/components/Fields/Date.tsx b/src/components/Fields/Date.tsx index 6181d128..7a50928a 100644 --- a/src/components/Fields/Date.tsx +++ b/src/components/Fields/Date.tsx @@ -9,6 +9,7 @@ import { DatePicker, } from "@material-ui/pickers"; +// TODO: Create an interface for props const Date = (props: any) => { const { isFocusedCell, diff --git a/src/components/Fields/DateTime.tsx b/src/components/Fields/DateTime.tsx index ee6fcb45..7b243771 100644 --- a/src/components/Fields/DateTime.tsx +++ b/src/components/Fields/DateTime.tsx @@ -9,6 +9,7 @@ import { DateTimePicker, } from "@material-ui/pickers"; +// TODO: Create an interface for props const DateTime = (props: any) => { const { isFocusedCell, diff --git a/src/components/Fields/Image.tsx b/src/components/Fields/Image.tsx index 25b23ddb..08dd5c1e 100644 --- a/src/components/Fields/Image.tsx +++ b/src/components/Fields/Image.tsx @@ -3,6 +3,7 @@ import { useDropzone } from "react-dropzone"; import useUploader from "../../hooks/useFiretable/useUploader"; // TODO: indecate state completion / error +// TODO: Create an interface for props const Image = (props: any) => { const { columnData, cellData, cellActions, rowData, rowIndex } = props; const [uploaderState, upload] = useUploader(); diff --git a/src/components/Fields/Number.tsx b/src/components/Fields/Number.tsx index ce8d7673..3f2f405e 100644 --- a/src/components/Fields/Number.tsx +++ b/src/components/Fields/Number.tsx @@ -2,6 +2,7 @@ import React from "react"; import { TextField } from "@material-ui/core"; +// TODO: Create an interface for props const Number = (props: any) => { const { isFocusedCell, cellData, cellActions } = props; if (isFocusedCell) diff --git a/src/components/Fields/Rating.tsx b/src/components/Fields/Rating.tsx index db28ddc9..96763693 100644 --- a/src/components/Fields/Rating.tsx +++ b/src/components/Fields/Rating.tsx @@ -1,6 +1,7 @@ import React from "react"; import MuiRating from "@material-ui/lab/Rating"; +// TODO: Create an interface for props const Rating = (props: any) => { const { columnData, cellData, cellActions, rowData, rowIndex } = props; return ( diff --git a/src/components/Fields/SimpleText.tsx b/src/components/Fields/SimpleText.tsx index b7feb26c..5daa76d1 100644 --- a/src/components/Fields/SimpleText.tsx +++ b/src/components/Fields/SimpleText.tsx @@ -2,6 +2,7 @@ import React from "react"; import { TextField } from "@material-ui/core"; +// TODO: Create an interface for props const SimpleText = (props: any) => { const { isFocusedCell, cellData, cellActions } = props; diff --git a/src/components/Navigation.tsx b/src/components/Navigation.tsx index 1f7e5941..0b63eb23 100644 --- a/src/components/Navigation.tsx +++ b/src/components/Navigation.tsx @@ -57,6 +57,7 @@ const useStyles = makeStyles(theme => }) ); +// TODO: Create an interface for props const Navigation = (props: any) => { const router = useRouter(); const classes = useStyles(); diff --git a/src/components/Table.tsx b/src/components/Table.tsx index 585e0981..75f299f4 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -205,6 +205,7 @@ class MuiVirtualizedTable extends React.PureComponent< const VirtualizedTable = withStyles(styles)(MuiVirtualizedTable); +// TODO: Create an interface for props export default function Table(props: any) { const { collection } = props; const { tableState, tableActions } = useFiretable(collection); diff --git a/src/components/TableCell.tsx b/src/components/TableCell.tsx index e2a2578c..e1794878 100644 --- a/src/components/TableCell.tsx +++ b/src/components/TableCell.tsx @@ -17,6 +17,7 @@ import Date from "./Fields/Date"; import DateTime from "./Fields/DateTime"; import Image from "./Fields/Image"; +// TODO: Create an interface for props const TableCell = (props: any) => { const { fieldType, diff --git a/src/views/TablesView.tsx b/src/views/TablesView.tsx index a06a837f..e2f5941d 100644 --- a/src/views/TablesView.tsx +++ b/src/views/TablesView.tsx @@ -33,6 +33,7 @@ const useStyles = makeStyles(() => }) ); +// TODO: Create an interface for props const TablesView = (props: any) => { const [settings, createTable] = useSettings(); const tables = settings.tables; From 9fb7569af3aefd19b698b24d1b7f176a9a1862ce Mon Sep 17 00:00:00 2001 From: Sidney Alcantara Date: Sun, 22 Sep 2019 23:50:22 +1000 Subject: [PATCH 13/13] add props interfaces for AuthProvider, CustomBrowserRouter --- src/AuthProvider.tsx | 6 +++++- src/util/CustomBrowserRouter.tsx | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/AuthProvider.tsx b/src/AuthProvider.tsx index 401a932d..332ce6c3 100644 --- a/src/AuthProvider.tsx +++ b/src/AuthProvider.tsx @@ -2,7 +2,11 @@ import React, { useEffect, useState } from "react"; import { auth } from "./firebase"; import AuthContext from "./contexts/authContext"; -export const AuthProvider = ({ children }: any) => { +interface IAuthProviderProps { + children: React.ReactNode; +} + +export const AuthProvider: React.FC = ({ children }) => { const [currentUser, setCurrentUser] = useState(); useEffect(() => { diff --git a/src/util/CustomBrowserRouter.tsx b/src/util/CustomBrowserRouter.tsx index 1c57f920..ab299591 100644 --- a/src/util/CustomBrowserRouter.tsx +++ b/src/util/CustomBrowserRouter.tsx @@ -3,7 +3,11 @@ import { BrowserRouter, Route } from "react-router-dom"; export const RouterContext = React.createContext({}); -const CustomBrowserRouter = ({ children }: any) => ( +interface ICustomBrowserProps { + children: React.ReactNode; +} + +const CustomBrowserRouter: React.FC = ({ children }) => ( {routeProps => (