From 1bbcd57e5e7859dc278050d19b15fbf54072f73f Mon Sep 17 00:00:00 2001 From: Lachlan Kermode Date: Sun, 17 Jan 2021 18:16:28 +1300 Subject: [PATCH] Fix/clean errors (#191) * clean dev errors * add check command * yarn -> npm in travis * fix all warnings * fix base test * :lipstick: --- .travis.yml | 9 +- package.json | 2 +- src/actions/index.js | 1 - src/common/global.js | 4 +- src/common/utilities.js | 1 + src/components/InfoPopup.jsx | 4 +- src/components/Layout.js | 2 - src/components/Map.jsx | 2 +- src/components/Notification.jsx | 9 +- src/components/Overlay/Content.js | 6 +- src/components/Overlay/Controls.js | 4 +- src/components/Overlay/Md.js | 1 - src/components/Overlay/Media.js | 2 +- src/components/Search.jsx | 12 +-- src/components/StateOptions.jsx | 12 +-- src/components/StaticPage.js | 14 +-- src/components/TemplateCover.js | 8 +- src/components/TimelineCategories.jsx | 8 +- src/components/Toolbar/BottomActions.js | 45 +++++----- src/components/Toolbar/CategoriesListPanel.js | 4 +- src/components/presentational/Checkbox.js | 4 +- src/components/presentational/Icons/Info.js | 2 +- .../presentational/Map/Clusters.jsx | 89 ++++++++++--------- .../presentational/Map/DefsMarkers.jsx | 53 ++++++----- src/components/presentational/Map/Events.jsx | 34 +++---- .../presentational/Narrative/Adjust.js | 4 +- .../presentational/Narrative/Close.js | 4 +- .../presentational/Narrative/Controls.js | 4 +- src/components/presentational/Popup.js | 8 +- .../presentational/Timeline/DatetimeBar.js | 4 +- .../presentational/Timeline/DatetimeSquare.js | 12 ++- .../presentational/Timeline/DatetimeStar.js | 12 ++- .../presentational/Timeline/Project.js | 4 +- .../presentational/Timeline/ZoomControls.js | 1 + src/test/App.test.js | 2 +- 35 files changed, 229 insertions(+), 158 deletions(-) diff --git a/.travis.yml b/.travis.yml index 81dcc9d..6d999a7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,11 +5,10 @@ cache: directories: - node_modules before_script: - - npm install -g yarn - cp example.config.js config.js install: - - yarn + - npm install script: - - yarn lint - - yarn build - - yarn test + - npm run lint + - npm run build + - npm run test diff --git a/package.json b/package.json index 3cdce3c..7a14702 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ "test": "node scripts/test.js --silent", "test:ava": "NODE_ENV=production ava --verbose", "test-watch": "ava --watch", - "lint": "echo 'This is a placeholder for Travis'", + "lint": "prettier --check \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"", "lint:fix": "prettier --write \"src/**/*.{js,jsx,ts,tsx,json,css,scss,md}\"" }, "dependencies": { diff --git a/src/actions/index.js b/src/actions/index.js index 8eaaf5d..7c05dbe 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -1,4 +1,3 @@ -/* global fetch, alert */ import { urlFromEnv } from "../common/utilities"; // TODO: relegate these URLs entirely to environment variables diff --git a/src/common/global.js b/src/common/global.js index d9140a6..845ccaf 100644 --- a/src/common/global.js +++ b/src/common/global.js @@ -5,9 +5,11 @@ export const colors = { white: "#fff", }; -export default { +const exports = { fallbackEventColor: colors.fa_red, darkBackground: colors.black, primaryHighlight: colors.fa_red, secondaryHighlight: colors.white, }; + +export default exports; diff --git a/src/common/utilities.js b/src/common/utilities.js index 52516d6..7cbf8cb 100644 --- a/src/common/utilities.js +++ b/src/common/utilities.js @@ -380,6 +380,7 @@ export function getFilterIdxFromColorSet(filter, coloringSet) { coloringSet.map((set, idx) => { const foundIdx = set.indexOf(filter); if (foundIdx !== -1) filterIdx = idx; + return null; }); return filterIdx; } diff --git a/src/components/InfoPopup.jsx b/src/components/InfoPopup.jsx index 35976d5..5c1d73f 100644 --- a/src/components/InfoPopup.jsx +++ b/src/components/InfoPopup.jsx @@ -2,7 +2,7 @@ import React from "react"; import Popup from "./presentational/Popup"; import copy from "../common/data/copy.json"; -export default ({ isOpen, onClose, language, styles }) => ( +const Infopopup = ({ isOpen, onClose, language, styles }) => ( ( styles={styles} /> ); + +export default Infopopup; diff --git a/src/components/Layout.js b/src/components/Layout.js index 43e125f..9c37d0d 100644 --- a/src/components/Layout.js +++ b/src/components/Layout.js @@ -1,4 +1,3 @@ -/* global alert, Event */ import React from "react"; import { bindActionCreators } from "redux"; @@ -11,7 +10,6 @@ import LoadingOverlay from "./Overlay/Loading"; import Map from "./Map.jsx"; import Toolbar from "./Toolbar/Layout"; import CardStack from "./CardStack.jsx"; -// import {CardStack} from '@forensic-architecture/design-system' import NarrativeControls from "./presentational/Narrative/Controls.js"; import InfoPopup from "./InfoPopup.jsx"; import Popup from "./presentational/Popup"; diff --git a/src/components/Map.jsx b/src/components/Map.jsx index 8334a6f..030b552 100644 --- a/src/components/Map.jsx +++ b/src/components/Map.jsx @@ -1,4 +1,4 @@ -/* global L, Event */ +/* global L */ import React from "react"; import { Portal } from "react-portal"; import Supercluster from "supercluster"; diff --git a/src/components/Notification.jsx b/src/components/Notification.jsx index b56043c..5162ba5 100644 --- a/src/components/Notification.jsx +++ b/src/components/Notification.jsx @@ -16,11 +16,11 @@ export default class Notification extends React.Component { if (!items) return ""; return (
- {items.map((item) => { + {items.map((item, idx) => { if (item.error) { - return

{item.error.message}

; + return

{item.error.message}

; } - return ""; + return null; })}
); @@ -47,11 +47,12 @@ export default class Notification extends React.Component { if (notificationsToRender.length > 0) { return (
- {this.props.notifications.map((notification) => { + {this.props.notifications.map((notification, idx) => { return (
this.toggleDetails()} + key={idx} >
); case "Document": - return