diff --git a/.babelrc b/.babelrc new file mode 100644 index 00000000..5256f969 --- /dev/null +++ b/.babelrc @@ -0,0 +1,9 @@ +{ + "presets": [ + "@babel/preset-react", + ["@babel/preset-env", { "targets": { "browsers": ["last 2 versions"] } }] + ], + "plugins": [ + "@babel/plugin-proposal-class-properties" + ] +} diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 00000000..a0ec1226 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,6 @@ +**/*.json +**/*.html +**/*.md +**/*.scss +dist/ +coverage/ diff --git a/.eslintrc b/.eslintrc new file mode 100644 index 00000000..79b209cb --- /dev/null +++ b/.eslintrc @@ -0,0 +1,21 @@ +{ + "extends": "airbnb", + "env": { + "browser": true, + "jest": true, + "node": true + }, + "parser": "babel-eslint", + "plugins": [ + "react-hooks" + ], + "rules": { + "func-style": ["error", "expression"], + "import/prefer-default-export": "off", + "no-plusplus": "off", + "object-curly-newline": "off", + "no-console": ["error", { allow: ["warn", "error", "info"] }], + "react/no-array-index-key": "off", + "react-hooks/rules-of-hooks": "error" + } +} diff --git a/.gitignore b/.gitignore index 03dccdb7..abe3feaf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,23 +1,52 @@ -# See https://help.github.com/ignore-files/ for more about ignoring files. +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* -# dependencies -/node_modules -/server/dataServer/node_modules +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov -# testing -/coverage +# Coverage directory used by tools like istanbul +coverage -# production -server/dataServer/build -/build +# Bower dependency directory (https://bower.io/) +bower_components -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local +# node-waf configuration +.lock-wscript -npm-debug.log* -yarn-debug.log* -yarn-error.log* +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules/ +dist/ + +# Typescript v1 declaration files +typings/ + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + +# Yarn Integrity file +.yarn-integrity + +# dotenv environment variables file +.env + +# Additional +.DS_Store +config.js +dump.rdb +*.dump \ No newline at end of file diff --git a/LICENSE.sublime-workspace b/LICENSE.sublime-workspace deleted file mode 100644 index ea7c952a..00000000 --- a/LICENSE.sublime-workspace +++ /dev/null @@ -1,292 +0,0 @@ -{ - "auto_complete": - { - "selected_items": - [ - [ - "lo", - "log" - ], - [ - "for", - "for\tfor (…) {…}" - ] - ] - }, - "buffers": - [ - ], - "build_system": "", - "build_system_choices": - [ - ], - "build_varint": "", - "command_palette": - { - "height": 299.0, - "last_filter": "pretty", - "selected_items": - [ - [ - "pretty", - "Pretty JSON: Format and Sort JSON" - ], - [ - "json", - "Pretty JSON: Format (Pretty Print) JSON" - ], - [ - "pack", - "Package Control: Install Package" - ], - [ - "prett", - "Pretty JSON: Format (Pretty Print) JSON" - ] - ], - "width": 412.0 - }, - "console": - { - "height": 130.0, - "history": - [ - "ls" - ] - }, - "distraction_free": - { - "menu_visible": true, - "show_minimap": false, - "show_open_files": false, - "show_tabs": false, - "side_bar_visible": false, - "status_bar_visible": false - }, - "file_history": - [ - "/Users/will_su/Downloads/Su1995-03-30.json", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-04/oj-client/node_modules/@angular/common/locales/extra/it.js", - "/Users/will_su/Downloads/frontend-stuff-master/README.md", - "/Users/will_su/Downloads/dataa.json", - "/Users/will_su/Downloads/build/asset-manifest.json", - "/Users/will_su/Downloads/refugee-flow8.06 production/dataServer/build/index.html", - "/Users/will_su/Downloads/refugee-flow8.06 production/dataServer/package.json", - "/Users/will_su/Downloads/build/manifest.json", - "/Users/will_su/Documents/UNGC/ungc-survey/survey_viz/README.md", - "/Users/will_su/Documents/THESIS/development/refugee-flow/src/App/data/route_desc.json", - "/Users/will_su/Documents/THESIS/development/refugee-flow/server/dataServer/data/route_death.json", - "/Users/will_su/Documents/UNGC/dataSchema.md", - "/Users/will_su/Documents/THESIS/development/refugee-flow/src/App/components/GlobeTimeline.js", - "/Users/will_su/Documents/THESIS/development/refugee-flow/src/App/components/Conflict.js", - "/Users/will_su/Documents/redis-4.0.5/README.md", - "/Users/will_su/Documents/case_study_reverse_engineering/leaflet_setup_map/sketch.js", - "/Users/will_su/Documents/THESIS/development/refugee-flow/src/App/components/RefugeeRoute_map.js", - "/Users/will_su/Documents/THESIS/development/refugee-flow/server/dataServer/data/country_route_list.json", - "/Users/will_su/Documents/THESIS/development/refugee-flow/server/dataServer/data/asy_application_all.json", - "/Users/will_su/Documents/THESIS/development/refugee-flow/src/App/data/IBC_crossingCountByCountry.json", - "/Users/will_su/Downloads/refugee-flow7.17 production/dataServer/package.json", - "/Users/will_su/Downloads/ddd/dataServer/package.json", - "/Users/will_su/Downloads/_ionicons_svg_md-download.svg", - "/Users/will_su/Documents/redis-4.0.5/deps/lua/src/lobject.h", - "/Users/will_su/Downloads/will/form_page/src/App/components/FormContainer.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/ROUTE_IRC/index.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/ROUTE_Death/index_2.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/ROUTE_IRC/country_route_crossCount.json", - "/Users/will_su/Documents/THESIS/development/refugee-flow/server/dataServer/data/reduced_war_data.json", - "/Users/will_su/Documents/THESIS/development/refugee-flow/server/dataServer/data/IBC_all.json", - "/Users/will_su/Documents/THESIS/development/refugee-flow/src/App/data/warDictionary.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/archiveCode/migrantFileAnalysis.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/ROUTE/IBC_all.json", - "/Users/will_su/Documents/parsley_interview_code/recruiting/frontend-engineer-interactive/will/README.md", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-04/oj-server/routes/rest.js", - "/Users/will_su/Documents/THESIS/development/refugee-flow/server/dataServer/b.json", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-04/oj-client/node_modules/node-forge/js/xhr.js", - "/Users/will_su/Documents/parsley_interview_code/recruiting/frontend-engineer-interactive/README.md", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-04/oj-server/server.js", - "/Users/will_su/Documents/THESIS/development/refugee-flow/public/manifest.json", - "/Users/will_su/Downloads/dataServer/build/static/js/main.a2b8b5e3.js", - "/Users/will_su/Downloads/dataServer/app.js", - "/Users/will_su/Downloads/csvjson.json", - "/Users/will_su/Documents/THESIS/react-stuff/react-official-tutorial/step6_challenge/my-app/src/index.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/ACLED/addDataToMongo.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/UNHCR/asy_application.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/UNHCR/country_list_unhcr.json", - "/Users/will_su/Documents/THESIS/dataAnalysis/UNHCR/unhcr_popstats_export_asylum_seekers_monthly_2018_04_05_031620.csv", - "/Users/will_su/Documents/THESIS/dataAnalysis/UNHCR/country_list_id_unhcr.json", - "/Users/will_su/Documents/THESIS/dataAnalysis/ACLED-final/database.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/process ACLED data nodeJS/d.json", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-05/web_server/client/src/NewsPanel/NewsPanel.js", - "/Users/will_su/Downloads/download/app.json", - "/Users/will_su/Downloads/t.js", - "/Users/will_su/Documents/THESIS/dataAnalysis/README.md", - "/Users/will_su/Documents/THESIS/dataAnalysis/package.json", - "/Users/will_su/Documents/THESIS/3d_globe_webgl/webgl-globe/globe/index.html", - "/Users/will_su/Documents/THESIS/dataAnalysis/MM.json", - "/Users/will_su/Documents/THESIS/PhysicsRenderer/willsu-test/data_generator/dg.js", - "/Users/will_su/Documents/case_study_reverse_engineering/3.js_bufferGeom/dummy data generator/node_modules/fast-csv/index.js", - "/Users/will_su/Downloads/tes/del.js", - "/Users/will_su/Documents/THESIS/InClass-workshop/package-lock.json", - "/Users/will_su/Downloads/hello.json", - "/Users/will_su/Downloads/del_copy.json", - "/Users/will_su/Documents/THESIS/PhysicsRenderer/willsu-test/text_gravity.html", - "/Users/will_su/Downloads/restaurant_data_viz-master 2/second_draft_mar_25/index.html", - "/Users/will_su/Downloads/del.js", - "/Users/will_su/Downloads/del.json", - "/Users/will_su/Documents/Human Flow.md", - "/Users/will_su/Documents/aaa.md", - "/Users/will_su/Documents/master-thesis/README.md", - "/Users/will_su/.docker/daemon.json", - "/Users/will_su/.docker/config.json", - "/Users/will_su/Documents/full-stack-bittiger/week-03/oj-server/node_modules/redis/README.md", - "/Users/will_su/Downloads/proxy (1).pac", - "/Users/will_su/Downloads/proxy (3).pac", - "/Users/will_su/Documents/case_study_reverse_engineering/3.js_bufferGeom/lib/CopyShader.js", - "/Users/will_su/Documents/README.md", - "/Users/will_su/Documents/Viacom/github/STP-VIZ/archive/viacom_plotlyDash_first_draft/README.md", - "/Users/will_su/Documents/Viacom/github/STP_PDF_pipeline_demo-master/style.css", - "/Users/will_su/Documents/Viacom/mtv-music/public/assets/Artboard 1.svg", - "/Users/will_su/Documents/Viacom/github/STP-VIZ/viacom_baseball_card_final_version/STP_index.js", - "/Users/will_su/Documents/Viacom/github/STP_PDF_pipeline_demo-master/index.js", - "/Users/will_su/Documents/Viacom/github/viacom-bryson-dash/style.css", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-01/oj-client/src/app/components/problem-detail/problem-detail.component.ts", - "/Users/will_su/Downloads/web-advanced-jS-assignment-resubmission/tangrams/map+yaml/scene.yaml", - "/Users/will_su/Downloads/web-advanced-jS-assignment-resubmission/interactive-website/README.md", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-01/assignment/.angular-cli.json", - "/Users/will_su/Documents/case_study_reverse_engineering/tangrams/simple-demo/scene.yaml", - "/Users/will_su/Downloads/test.js", - "/Users/will_su/Documents/full-stack-bittiger/bittigercs503-1705/week-01/assignment/src/app/components/problem-list/problem-list.component.ts", - "/Users/will_su/Documents/3d-map-exercise/p5_projection/p5/empty-example/sketch.js", - "/Users/will_su/Documents/3d-map-exercise/p5_projection/p5/empty-example/data.json", - "/Users/will_su/Documents/3d-map-exercise/p5_projection/p5/empty-example/particleDataFeed.json", - "/Users/will_su/Documents/lib_for_render_geojson_threejs/ThreeGeoJSON/test_will/node_manipulation.js", - "/Users/will_su/Documents/lib_for_render_geojson_threejs/ThreeGeoJSON/test_will/a.json", - "/Users/will_su/Downloads/Building Footprints.geojson", - "/Users/will_su/Downloads/imposm-shapefiles/ex_JNSBADmL8pmVCxvdbAoeSq8y8AdGs_osm_buildings.dbf", - "/Users/will_su/Downloads/ex_JNSBADmL8pmVCxvdbAoeSq8y8AdGs.osm.pbf", - "/Users/will_su/Documents/case_study_reverse_engineering/3dmap_3js_test/assets/curve.js", - "/Users/will_su/Documents/case_study_reverse_engineering/3JS_basic_tutorial_collection/basic/js_01.js", - "/Users/will_su/Downloads/e.js", - "/Users/will_su/Documents/case_study_reverse_engineering/echart-3dMap/lib/echarts.js" - ], - "find": - { - "height": 23.0 - }, - "find_in_files": - { - "height": 0.0, - "where_history": - [ - ] - }, - "find_state": - { - "case_sensitive": false, - "find_history": - [ - ], - "highlight": true, - "in_selection": false, - "preserve_case": false, - "regex": false, - "replace_history": - [ - ], - "reverse": false, - "show_context": true, - "use_buffer2": true, - "whole_word": false, - "wrap": false - }, - "groups": - [ - { - "sheets": - [ - ] - } - ], - "incremental_find": - { - "height": 23.0 - }, - "input": - { - "height": 0.0 - }, - "layout": - { - "cells": - [ - [ - 0, - 0, - 1, - 1 - ] - ], - "cols": - [ - 0.0, - 1.0 - ], - "rows": - [ - 0.0, - 1.0 - ] - }, - "menu_visible": true, - "output.find_results": - { - "height": 0.0 - }, - "pinned_build_system": "", - "project": "LICENSE.sublime-project", - "replace": - { - "height": 42.0 - }, - "save_all_on_build": true, - "select_file": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "select_project": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "select_symbol": - { - "height": 0.0, - "last_filter": "", - "selected_items": - [ - ], - "width": 0.0 - }, - "selected_group": 0, - "settings": - { - }, - "show_minimap": true, - "show_open_files": false, - "show_tabs": true, - "side_bar_visible": true, - "side_bar_width": 150.0, - "status_bar_visible": true, - "template_settings": - { - } -} diff --git a/config.example.js b/config.example.js new file mode 100644 index 00000000..f630bc52 --- /dev/null +++ b/config.example.js @@ -0,0 +1,14 @@ +/* +Create a new file named "config.js" and add your configuration. +The config.js file is in the .gitignore and will not be included in your commits. +*/ + +module.exports = { + // API Credentials + mapboxToken: '', + + // Database Connection + database: { + connection: '', + }, +}; diff --git a/config/env.js b/config/env.js deleted file mode 100644 index 30a6c7f1..00000000 --- a/config/env.js +++ /dev/null @@ -1,93 +0,0 @@ -'use strict'; - -const fs = require('fs'); -const path = require('path'); -const paths = require('./paths'); - -// Make sure that including paths.js after env.js will read .env variables. -delete require.cache[require.resolve('./paths')]; - -const NODE_ENV = process.env.NODE_ENV; -if (!NODE_ENV) { - throw new Error( - 'The NODE_ENV environment variable is required but was not specified.' - ); -} - -// https://github.com/bkeepers/dotenv#what-other-env-files-can-i-use -var dotenvFiles = [ - `${paths.dotenv}.${NODE_ENV}.local`, - `${paths.dotenv}.${NODE_ENV}`, - // Don't include `.env.local` for `test` environment - // since normally you expect tests to produce the same - // results for everyone - NODE_ENV !== 'test' && `${paths.dotenv}.local`, - paths.dotenv, -].filter(Boolean); - -// Load environment variables from .env* files. Suppress warnings using silent -// if this file is missing. dotenv will never modify any environment variables -// that have already been set. Variable expansion is supported in .env files. -// https://github.com/motdotla/dotenv -// https://github.com/motdotla/dotenv-expand -dotenvFiles.forEach(dotenvFile => { - if (fs.existsSync(dotenvFile)) { - require('dotenv-expand')( - require('dotenv').config({ - path: dotenvFile, - }) - ); - } -}); - -// We support resolving modules according to `NODE_PATH`. -// This lets you use absolute paths in imports inside large monorepos: -// https://github.com/facebookincubator/create-react-app/issues/253. -// It works similar to `NODE_PATH` in Node itself: -// https://nodejs.org/api/modules.html#modules_loading_from_the_global_folders -// Note that unlike in Node, only *relative* paths from `NODE_PATH` are honored. -// Otherwise, we risk importing Node.js core modules into an app instead of Webpack shims. -// https://github.com/facebookincubator/create-react-app/issues/1023#issuecomment-265344421 -// We also resolve them to make sure all tools using them work consistently. -const appDirectory = fs.realpathSync(process.cwd()); -process.env.NODE_PATH = (process.env.NODE_PATH || '') - .split(path.delimiter) - .filter(folder => folder && !path.isAbsolute(folder)) - .map(folder => path.resolve(appDirectory, folder)) - .join(path.delimiter); - -// Grab NODE_ENV and REACT_APP_* environment variables and prepare them to be -// injected into the application via DefinePlugin in Webpack configuration. -const REACT_APP = /^REACT_APP_/i; - -function getClientEnvironment(publicUrl) { - const raw = Object.keys(process.env) - .filter(key => REACT_APP.test(key)) - .reduce( - (env, key) => { - env[key] = process.env[key]; - return env; - }, - { - // Useful for determining whether we’re running in production mode. - // Most importantly, it switches React into the correct mode. - NODE_ENV: process.env.NODE_ENV || 'development', - // Useful for resolving the correct path to static assets in `public`. - // For example, . - // This should only be used as an escape hatch. Normally you would put - // images into the `src` and `import` them in code to get their paths. - PUBLIC_URL: publicUrl, - } - ); - // Stringify all values so we can feed into Webpack DefinePlugin - const stringified = { - 'process.env': Object.keys(raw).reduce((env, key) => { - env[key] = JSON.stringify(raw[key]); - return env; - }, {}), - }; - - return { raw, stringified }; -} - -module.exports = getClientEnvironment; diff --git a/config/jest/cssTransform.js b/config/jest/cssTransform.js deleted file mode 100644 index 8f651148..00000000 --- a/config/jest/cssTransform.js +++ /dev/null @@ -1,14 +0,0 @@ -'use strict'; - -// This is a custom Jest transformer turning style imports into empty objects. -// http://facebook.github.io/jest/docs/en/webpack.html - -module.exports = { - process() { - return 'module.exports = {};'; - }, - getCacheKey() { - // The output is always the same. - return 'cssTransform'; - }, -}; diff --git a/config/jest/fileTransform.js b/config/jest/fileTransform.js deleted file mode 100644 index 9e4047d3..00000000 --- a/config/jest/fileTransform.js +++ /dev/null @@ -1,12 +0,0 @@ -'use strict'; - -const path = require('path'); - -// This is a custom Jest transformer turning file imports into filenames. -// http://facebook.github.io/jest/docs/en/webpack.html - -module.exports = { - process(src, filename) { - return `module.exports = ${JSON.stringify(path.basename(filename))};`; - }, -}; diff --git a/config/paths.js b/config/paths.js deleted file mode 100644 index 6d16efc9..00000000 --- a/config/paths.js +++ /dev/null @@ -1,55 +0,0 @@ -'use strict'; - -const path = require('path'); -const fs = require('fs'); -const url = require('url'); - -// Make sure any symlinks in the project folder are resolved: -// https://github.com/facebookincubator/create-react-app/issues/637 -const appDirectory = fs.realpathSync(process.cwd()); -const resolveApp = relativePath => path.resolve(appDirectory, relativePath); - -const envPublicUrl = process.env.PUBLIC_URL; - -function ensureSlash(path, needsSlash) { - const hasSlash = path.endsWith('/'); - if (hasSlash && !needsSlash) { - return path.substr(path, path.length - 1); - } else if (!hasSlash && needsSlash) { - return `${path}/`; - } else { - return path; - } -} - -const getPublicUrl = appPackageJson => - envPublicUrl || require(appPackageJson).homepage; - -// We use `PUBLIC_URL` environment variable or "homepage" field to infer -// "public path" at which the app is served. -// Webpack needs to know it to put the right - - - - - - - - - - -