From cb53037a8b6b46f360aefac69abf37f22eab2999 Mon Sep 17 00:00:00 2001 From: Jonas Braathen Date: Sat, 4 May 2019 16:01:50 +0200 Subject: [PATCH] Satisfy linter in event template --- .eslintrc.json | 10 +++++++--- src/templates/event.js | 25 +++++++++++++++++-------- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 7b7380b..ace6f1f 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -5,13 +5,17 @@ "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], "react/prefer-stateless-function": "off", "react/require-default-props": "off", - "react/prop-types": "off", - "react/no-danger": "off" + "react/no-danger": "off", + "react/jsx-one-expression-per-line": "off" }, "settings": { "import/core-modules": [] }, "env": { - "browser": true + "browser": true, + "commonjs": true, + "es6": true, + "jest": true, + "node": true } } diff --git a/src/templates/event.js b/src/templates/event.js index 10d3544..2b437c0 100644 --- a/src/templates/event.js +++ b/src/templates/event.js @@ -2,22 +2,23 @@ import React from 'react' import PropTypes from 'prop-types' import Helmet from 'react-helmet' import { graphql, Link } from 'gatsby' -import Layout from '../components/Layout' import Img from 'gatsby-image' - import moment from 'moment' import 'moment/locale/nb' + +import Layout from '../components/Layout' + moment.locale('nb') const formatPrices = (regular, student) => { let cc = '' - if (regular && regular != 0) { + if (regular && regular !== 0) { cc += regular } - if (student && student != 0) { - cc += ' / ' + student + if (student && student !== 0) { + cc += ` / ${student}` } - return cc == '' ? 'Gratis' : cc + return cc === '' ? 'Gratis' : cc } export const EventTemplate = ({ @@ -106,8 +107,16 @@ export const EventTemplate = ({ EventTemplate.propTypes = { content: PropTypes.node.isRequired, - title: PropTypes.string, - featuredImage: PropTypes.object, + title: PropTypes.string.isRequired, + featuredMedia: PropTypes.shape({}), + startTime: PropTypes.string.isRequired, + endTime: PropTypes.string, + venue: PropTypes.string, + facebookUrl: PropTypes.string, + ticketUrl: PropTypes.string, + priceStudent: PropTypes.string, + priceRegular: PropTypes.string, + eventTypes: PropTypes.arrayOf(PropTypes.string), } const Event = ({ data }) => {