From db448ba9d1603b82af6a277038b956894c8b7493 Mon Sep 17 00:00:00 2001 From: Simon Reinsperger Date: Wed, 8 Mar 2017 17:16:26 +0100 Subject: [PATCH] refactor: fixes linting errors pages/index.jsx --- pages/index.jsx | 101 +++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 52 deletions(-) diff --git a/pages/index.jsx b/pages/index.jsx index fcbeeed..c0d87b3 100644 --- a/pages/index.jsx +++ b/pages/index.jsx @@ -1,61 +1,58 @@ -import React from 'react' -import { Link } from 'react-router' -import sortBy from 'lodash/sortBy' -import moment from 'moment' -import Helmet from 'react-helmet' -import { prefixLink } from 'gatsby-helpers' -import access from 'safe-access' -import { config } from 'config' -import SitePost from '../components/SitePost' -import SiteSidebar from '../components/SiteSidebar' +import React from 'react'; +import { Link } from 'react-router'; +import sortBy from 'lodash/sortBy'; +import moment from 'moment'; +import Helmet from 'react-helmet'; +import { prefixLink } from 'gatsby-helpers'; +import access from 'safe-access'; +import { config } from 'config'; +import SiteSidebar from '../components/SiteSidebar'; class SiteIndex extends React.Component { - render() { - const pageLinks = [] - // Sort pages. - const sortedPages = sortBy(this.props.route.pages, (page) => access(page, 'data.date') - ).reverse() - sortedPages.forEach((page) => { - if (access(page, 'file.ext') === 'md' && access(page, 'data.layout') === 'post') { - const title = access(page, 'data.title') || page.path - const description = access(page, 'data.description') - const datePublished = access(page, 'data.date') - const category = access(page, 'data.category') + render() { + const pageLinks = []; + // Sort pages. + const sortedPages = sortBy(this.props.route.pages, page => access(page, 'data.date')).reverse(); + sortedPages.forEach((page) => { + if (access(page, 'file.ext') === 'md' && access(page, 'data.layout') === 'post') { + const title = access(page, 'data.title') || page.path; + const description = access(page, 'data.description'); + const datePublished = access(page, 'data.date'); + const category = access(page, 'data.category'); - pageLinks.push( -
- - - { category } -

{ title }

-

- Read - -

- ) - } - }) + pageLinks.push(( +
+ + + {category} +

{title}

+

+ Read +

+ )); + } + }); - return ( -
- - -
-
-
- { pageLinks } -
-
-
+ return ( +
+ + +
+
+
+ {pageLinks}
- ) - } +
+
+
+ ); + } } SiteIndex.propTypes = { - route: React.PropTypes.object, -} + route: React.PropTypes.object, +}; -export default SiteIndex +export default SiteIndex;