From df662048f4ebdbf2604e9b93c78d65974fb67d23 Mon Sep 17 00:00:00 2001 From: Hugo Date: Fri, 17 Jan 2020 20:40:06 +0000 Subject: [PATCH] style: fix eslint issues (#437) --- src/components/FavIcon.js | 4 ++-- src/components/Person.js | 11 +++++------ src/components/header.js | 8 ++++++-- src/components/image.js | 14 +++++++------- src/context/FilterContext.js | 4 ++++ src/util/stats.js | 2 +- 6 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/components/FavIcon.js b/src/components/FavIcon.js index 1ea4c906..95b70b37 100644 --- a/src/components/FavIcon.js +++ b/src/components/FavIcon.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState, forwardRef, useRef } from 'react'; +import React, { useEffect, useState, useRef } from 'react'; function useInterval(callback, delay) { const savedCallback = useRef(); @@ -44,7 +44,7 @@ function useWickedFavIcon() { } export default function FavIcon() { - const { letter, index, canvasRef } = useWickedFavIcon(); + const { /* letter, index, */ canvasRef } = useWickedFavIcon(); return (
@@ -23,11 +23,10 @@ export default function Person({ person, currentTag }) { rel="noopener noreferrer" className="displayLink" href={person.url} - >{`${url.host}${ - url.pathname.endsWith('/') - ? url.pathname.substr(0, url.pathname.length - 1) - : url.pathname - }`} + > + {url.host} + {url.pathname.replace(/\/$/, '')} +

{person.description}

diff --git a/src/components/header.js b/src/components/header.js index 9c5e3b62..bcb0466a 100644 --- a/src/components/header.js +++ b/src/components/header.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState, useRef } from 'react'; +import React from 'react'; import { Link } from 'gatsby'; import PropTypes from 'prop-types'; import Helmet from 'react-helmet'; @@ -34,10 +34,14 @@ function Header({ siteTitle, siteDescription, siteUrl }) { } Header.propTypes = { siteTitle: PropTypes.string, + siteDescription: PropTypes.string, + siteUrl: PropTypes.string, }; Header.defaultProps = { - siteTitle: ``, + siteTitle: '', + siteDescription: '', + siteUrl: '', }; export default Header; diff --git a/src/components/image.js b/src/components/image.js index e61edb68..335f03fe 100644 --- a/src/components/image.js +++ b/src/components/image.js @@ -1,6 +1,6 @@ -import React from "react" -import { useStaticQuery, graphql } from "gatsby" -import Img from "gatsby-image" +import React from 'react'; +import { useStaticQuery, graphql } from 'gatsby'; +import Img from 'gatsby-image'; /* * This component is built using `gatsby-image` to automatically serve optimized @@ -24,9 +24,9 @@ const Image = () => { } } } - `) + `); - return -} + return ; +}; -export default Image +export default Image; diff --git a/src/context/FilterContext.js b/src/context/FilterContext.js index 941bc545..e3f32206 100644 --- a/src/context/FilterContext.js +++ b/src/context/FilterContext.js @@ -44,5 +44,9 @@ const FilterProvider = function({ children }) { ); }; +FilterProvider.propTypes = { + children: React.Children, +}; + export default FilterContext; export { FilterProvider }; diff --git a/src/util/stats.js b/src/util/stats.js index 8564df35..6cca642d 100644 --- a/src/util/stats.js +++ b/src/util/stats.js @@ -21,7 +21,7 @@ export function countries() { .reduce((acc, country) => { if (acc[country.name]) { // exists, update - acc[country.name].count = acc[country.name].count + 1; + acc[country.name].count += acc[country.name].count; } else { acc[country.name] = { ...country,