From a1d6671a7b5c372b06f1a32c1aec53d1ec2a53c2 Mon Sep 17 00:00:00 2001 From: Marco Biedermann Date: Wed, 20 Dec 2017 12:04:01 +0100 Subject: [PATCH] fix ESLint auto fixable warnings --- cms/cms.js | 38 ++++---- gatsby-config.js | 30 +++---- gatsby-node.js | 4 +- src/components/Content.js | 6 +- src/layouts/index.js | 2 +- src/pages/index.js | 10 +-- src/templates/about-page.js | 28 +++--- src/templates/blog-post.js | 36 ++++---- src/templates/product-page.js | 161 +++++++++++++++++----------------- 9 files changed, 163 insertions(+), 152 deletions(-) diff --git a/cms/cms.js b/cms/cms.js index 3bb7015..649eeac 100644 --- a/cms/cms.js +++ b/cms/cms.js @@ -1,9 +1,9 @@ -import React from 'react' -import CMS from 'netlify-cms' +import React from 'react'; +import CMS from 'netlify-cms'; -import Features from 'site/components/Features' -import Testimonials from 'site/components/Testimonials' -import Pricing from 'site/components/Pricing' +import Features from 'site/components/Features'; +import Testimonials from 'site/components/Testimonials'; +import Pricing from 'site/components/Pricing'; import { AboutPageTemplate } from 'site/templates/about-page'; import { ProductPageTemplate } from 'site/templates/product-page'; @@ -18,19 +18,19 @@ const BlogPostPreview = ({ entry, widgetFor }) => ( description={entry.getIn(['data', 'description'])} title={entry.getIn(['data', 'title'])} /> -) +); const ProductPagePreview = ({ entry, widgetFor, getAsset }) => { - const entryBlurbs = entry.getIn(['data', 'intro', 'blurbs']) - const blurbs = entryBlurbs ? entryBlurbs.toJS() : [] + const entryBlurbs = entry.getIn(['data', 'intro', 'blurbs']); + const blurbs = entryBlurbs ? entryBlurbs.toJS() : []; - const entryTestimonials = entry.getIn(['data', 'testimonials']) - const testimonials = entryTestimonials ? entryTestimonials.toJS() : [] + const entryTestimonials = entry.getIn(['data', 'testimonials']); + const testimonials = entryTestimonials ? entryTestimonials.toJS() : []; - const entryPricingPlans = entry.getIn(['data', 'pricing', 'plans']) - const pricingPlans = entryPricingPlans ? entryPricingPlans.toJS() : [] + const entryPricingPlans = entry.getIn(['data', 'pricing', 'plans']); + const pricingPlans = entryPricingPlans ? entryPricingPlans.toJS() : []; - return { description: entry.getIn(['data', 'pricing', 'description']), plans: pricingPlans, }} - />; -} + />); +}; -CMS.registerPreviewStyle('/styles.css') -CMS.registerPreviewTemplate('about', AboutPagePreview) -CMS.registerPreviewTemplate('products', ProductPagePreview) -CMS.registerPreviewTemplate('blog', BlogPostPreview) +CMS.registerPreviewStyle('/styles.css'); +CMS.registerPreviewTemplate('about', AboutPagePreview); +CMS.registerPreviewTemplate('products', ProductPagePreview); +CMS.registerPreviewTemplate('blog', BlogPostPreview); diff --git a/gatsby-config.js b/gatsby-config.js index abd7f02..e96712b 100644 --- a/gatsby-config.js +++ b/gatsby-config.js @@ -1,31 +1,31 @@ module.exports = { siteMetadata: { - title: `Gatsby Default Starter` + title: 'Gatsby Default Starter', }, plugins: [ 'gatsby-plugin-react-helmet', - `gatsby-plugin-sass`, + 'gatsby-plugin-sass', { - resolve: `gatsby-source-filesystem`, + resolve: 'gatsby-source-filesystem', options: { path: `${__dirname}/src/pages`, - name: 'pages' - } + name: 'pages', + }, }, { - resolve: `gatsby-source-filesystem`, + resolve: 'gatsby-source-filesystem', options: { path: `${__dirname}/src/img`, - name: 'images' - } + name: 'images', + }, }, - `gatsby-plugin-sharp`, - `gatsby-transformer-sharp`, + 'gatsby-plugin-sharp', + 'gatsby-transformer-sharp', { - resolve: `gatsby-transformer-remark`, + resolve: 'gatsby-transformer-remark', options: { - plugins: [] - } - } - ] + plugins: [], + }, + }, + ], }; diff --git a/gatsby-node.js b/gatsby-node.js index 49641ed..11f5edf 100644 --- a/gatsby-node.js +++ b/gatsby-node.js @@ -63,7 +63,7 @@ exports.createPages = ({ boundActionCreators, graphql }) => { } } } - `).then(result => { + `).then((result) => { if (result.errors) { result.errors.forEach(e => console.error(e.toString())); return Promise.reject(result.errors); @@ -72,7 +72,7 @@ exports.createPages = ({ boundActionCreators, graphql }) => { createPage({ path: node.frontmatter.path, component: path.resolve(`src/templates/${String(node.frontmatter.templateKey)}.js`), - context: {} // additional data can be passed via context + context: {}, // additional data can be passed via context }); }); }); diff --git a/src/components/Content.js b/src/components/Content.js index 8aad799..40cee3a 100644 --- a/src/components/Content.js +++ b/src/components/Content.js @@ -1,7 +1,7 @@ -import React from 'react' +import React from 'react'; export default ({ content, className }) =>
{content}
; -export const HTMLContent = ({ content, className }) =>
(
; +/>); diff --git a/src/layouts/index.js b/src/layouts/index.js index 2998f7c..3cd048a 100644 --- a/src/layouts/index.js +++ b/src/layouts/index.js @@ -44,7 +44,7 @@ const TemplateWrapper = ({ children }) => ( ); TemplateWrapper.propTypes = { - children: PropTypes.func + children: PropTypes.func, }; export default TemplateWrapper; diff --git a/src/pages/index.js b/src/pages/index.js index e723674..7ad09c3 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -6,7 +6,7 @@ import Script from 'react-load-script'; export default class IndexPage extends React.Component { handleScriptLoad() { if (window.netlifyIdentity) { - window.netlifyIdentity.on('init', user => { + window.netlifyIdentity.on('init', (user) => { if (!user) { window.netlifyIdentity.on('login', () => { document.location.href = '/admin/'; @@ -30,9 +30,8 @@ export default class IndexPage extends React.Component {

Latest Stories

- {posts.filter(post => post.node.frontmatter.templateKey === 'blog-post').map(({ node: post }) => { - return ( -
+ {posts.filter(post => post.node.frontmatter.templateKey === 'blog-post').map(({ node: post }) => ( +

{post.frontmatter.title} @@ -49,8 +48,7 @@ export default class IndexPage extends React.Component {

- ); - })} + ))}
); diff --git a/src/templates/about-page.js b/src/templates/about-page.js index ee4b991..30ffdc5 100644 --- a/src/templates/about-page.js +++ b/src/templates/about-page.js @@ -3,27 +3,31 @@ import Content, { HTMLContent } from '../components/Content'; export const AboutPageTemplate = ({ title, content, contentComponent }) => { const PageContent = contentComponent || Content; - return
-
-
-
-
-

{title}

- + + return ( +
+
+
+
+
+

{title}

+ +
-
-
; -} + + ); +}; export default ({ data }) => { const { markdownRemark: post } = data; - return ; + />); }; export const aboutPageQuery = graphql` diff --git a/src/templates/blog-post.js b/src/templates/blog-post.js index b155eeb..10f7181 100644 --- a/src/templates/blog-post.js +++ b/src/templates/blog-post.js @@ -2,32 +2,38 @@ import React from 'react'; import Content, { HTMLContent } from '../components/Content'; import Helmet from 'react-helmet'; -export const BlogPostTemplate = ({ content, contentComponent, description, title, helmet }) => { +export const BlogPostTemplate = ({ + content, contentComponent, description, title, helmet, +}) => { const PostContent = contentComponent || Content; - return
- { helmet ? helmet : ""} -
-
-
-

{title}

-

{description}

- + + return ( +
+ { helmet || ''} +
+
+
+

{title}

+

{description}

+ +
-
-
; -} + + ); +}; export default ({ data }) => { const { markdownRemark: post } = data; - return } title={post.frontmatter.title} - />; -} + />); +}; export const pageQuery = graphql` query BlogPostByPath($path: String!) { diff --git a/src/templates/product-page.js b/src/templates/product-page.js index efbd616..4ce8be4 100644 --- a/src/templates/product-page.js +++ b/src/templates/product-page.js @@ -4,105 +4,108 @@ import Testimonials from '../components/Testimonials'; import Pricing from '../components/Pricing'; export const ProductPageTemplate = ({ - image, title, heading, description, intro, main, testimonials, fullImage, pricing - }) => { - return
-
-
-
-
-
-
( +
+
+
+
+
+
+
+

-

- {title} -

+ {title} + +
+
+
+

{heading}

+

{description}

-
-
-

{heading}

-

{description}

-
+
+ +
+
+

{main.heading}

+

{main.description}

- -
-
-

{main.heading}

-

{main.description}

-
-
-
-
-
-
-
- {main.image1.alt} -
-
-
-
- {main.image2.alt} -
-
+
+
+
+
+
+
+ {main.image1.alt} +
{main.image3.alt}
+
+
+ {main.image3.alt} +
+
- -
-

{pricing.heading}

-

{pricing.description}

-
+ +
+

{pricing.heading}

+

{pricing.description}

+
-
- }; +
+
+); export default ({ data }) => { const { frontmatter } = data.markdownRemark; - return ; + + return ( + + ); }; export const productPageQuery = graphql`