Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
Switching to eslint parser to babel-eslint
Browse files Browse the repository at this point in the history
  • Loading branch information
haysclark committed Jan 5, 2018
1 parent 1d0fd37 commit c119bfe
Show file tree
Hide file tree
Showing 10 changed files with 206 additions and 41 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.json
@@ -1,4 +1,14 @@
{
"parser": "babel-eslint",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": true,
"modules": true,
"experimentalObjectRestSpread": true
}
},
"extends": ["airbnb", "prettier"],
"plugins": ["react", "jsx-a11y", "import"],
"rules": {
Expand Down
7 changes: 4 additions & 3 deletions data/SiteConfig.js
Expand Up @@ -4,12 +4,13 @@ module.exports = {
blogAuthorId: "casper", // The default and fallback author ID used for blog posts without a defined author.
siteTitle: "Gatsby Casper Starter", // Site title.
siteTitleAlt: "GatsbyJS Casper Theme Starter", // Alternative site title for SEO.
siteLogo: "https://raw.githubusercontent.com/gatsbyjs/gatsby/master/www/static/android-chrome-512x512.png", // Logo used for SEO and manifest. e.g. "/logos/logo-1024.png",
siteLogo:
"https://raw.githubusercontent.com/gatsbyjs/gatsby/master/www/static/android-chrome-512x512.png", // Logo used for SEO and manifest. e.g. "/logos/logo-1024.png",
siteUrl: "https://haysclark.github.io", // Domain of your website without pathPrefix.
pathPrefix: "/gatsby-starter-casper", // Prefixes all links. For cases when deployed to example.github.io/gatsby-starter-casper/.
siteDescription:
"A Casper themed GatsbyJS stater based on the Advanced Starter.", // Website description used for RSS feeds/meta description tag.
siteCover: "https://unsplash.it/1280/500/?random?gatsby-starter-casper", // optional, the cover image used in header for home page. e.g: "/images/blog-cover.jpg",
siteCover: "https://unsplash.it/1280/500/?random?gatsby-starter-casper", // Optional, the cover image used in header for home page. e.g: "/images/blog-cover.jpg",
siteNavigation: true, // If navigation is enabled the Menu button will be visible
siteRss: "/rss.xml", // Path to the RSS file.
siteRssAuthor: "Casper User", // The author name used in the RSS file
Expand Down Expand Up @@ -42,7 +43,7 @@ module.exports = {
],
// Copyright string for the footer of the website and RSS feed.
copyright: {
label: "Gatsby Casper Starter" // label used before the year
label: "Gatsby Casper Starter" // Label used before the year
// year: "2018" // optional, set specific copyright year or range of years, defaults to current year
// url: "https://www.gatsbyjs.org/" // optional, set link address of copyright, defaults to site root
},
Expand Down
8 changes: 4 additions & 4 deletions gatsby-node.js
@@ -1,7 +1,7 @@
const path = require("path");
const _ = require("lodash");
const webpackLodashPlugin = require("lodash-webpack-plugin");
const config = require("./data/SiteConfig");
const siteConfig = require("./data/SiteConfig");
const {
createPaginationPages,
createLinkedPages
Expand Down Expand Up @@ -85,7 +85,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
createPage,
edges: result.data.allMarkdownRemark.edges,
component: indexPage,
limit: config.sitePaginationLimit
limit: siteConfig.sitePaginationLimit
});

// Creates Posts
Expand All @@ -106,7 +106,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
const tagMap = new Map();
const categorySet = new Set();
const authorSet = new Set();
authorSet.add(config.blogAuthorId);
authorSet.add(siteConfig.blogAuthorId);

result.data.allMarkdownRemark.edges.forEach(edge => {
if (edge.node.frontmatter.tags) {
Expand Down Expand Up @@ -138,7 +138,7 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
edges: tagMap.get(tag),
component: tagPage,
pathFormatter: tagFormatter(tag),
limit: config.sitePaginationLimit,
limit: siteConfig.sitePaginationLimit,
context: {
tag
}
Expand Down
163 changes: 160 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -4,6 +4,7 @@
"version": "1.0.0",
"author": "Hays Clark <hays.clark@gmail.com>",
"dependencies": {
"babel-eslint": "^8.1.2",
"babel-plugin-lodash": "^3.2.11",
"classnames": "^2.2.5",
"gatsby": "^1.9.130",
Expand Down
14 changes: 7 additions & 7 deletions src/components/PostShare/PostShare.jsx
Expand Up @@ -5,13 +5,13 @@ import "./PostShare.css";
const formatSiteUrl = (siteUrl, pathPrefix, path) =>
siteUrl + (pathPrefix === "/" ? "" : pathPrefix) + path;

const getCover = post => {
const { cover } = post;
if (cover && cover.childImageSharp && cover.childImageSharp.original) {
return cover.childImageSharp.original.src;
}
return "";
};
// const getCover = post => {
// const { cover } = post;
// if (cover && cover.childImageSharp && cover.childImageSharp.original) {
// return cover.childImageSharp.original.src;
// }
// return "";
// };

class PostShare extends React.Component {
render() {
Expand Down
6 changes: 3 additions & 3 deletions src/templates/author.jsx
Expand Up @@ -92,10 +92,10 @@ class AuthorTemplate extends React.Component {
{/* PostListing component renders all the posts */}
<PostListing postEdges={postEdges} postAuthors={authorsEdges} />

{/*Social information here*/}
{/* Social information here */}
<SocialMediaIcons urls={getAuthor().socialUrls} />

{/*The tiny footer at the very bottom*/}
{/* The tiny footer at the very bottom */}
<Footer
copyright={config.copyright}
promoteGatsby={config.promoteGatsby}
Expand All @@ -106,7 +106,7 @@ class AuthorTemplate extends React.Component {
}
}

/* eslint no-undef: "off"*/
/* eslint no-undef: "off" */
export const pageQuery = graphql`
query AuthorPage($author: String) {
allMarkdownRemark(
Expand Down
10 changes: 5 additions & 5 deletions src/templates/index.jsx
Expand Up @@ -67,7 +67,7 @@ class IndexTemplate extends React.Component {
<SiteWrapper>
{/* All the main content gets inserted here */}
<div className="home-template">
{/*The big featured header*/}
{/* The big featured header */}
<MainHeader cover={config.siteCover}>
<MainNav overlay={config.siteCover}>
<BlogLogo logo={config.siteLogo} title={config.siteTitle} />
Expand All @@ -90,8 +90,8 @@ class IndexTemplate extends React.Component {
className="scroll-down icon-arrow-left"
to="content"
data-offset="-45"
spy={true}
smooth={true}
spy
smooth
duration={500}
>
<span className="hidden">Scroll Down</span>
Expand All @@ -111,7 +111,7 @@ class IndexTemplate extends React.Component {
</PaginatedContent>
</div>

{/*The tiny footer at the very bottom*/}
{/* The tiny footer at the very bottom */}
<Footer
copyright={config.copyright}
promoteGatsby={config.promoteGatsby}
Expand All @@ -122,7 +122,7 @@ class IndexTemplate extends React.Component {
}
}

/* eslint no-undef: "off"*/
/* eslint no-undef: "off" */
export const pageQuery = graphql`
query IndexQuery {
allMarkdownRemark(
Expand Down
14 changes: 7 additions & 7 deletions src/templates/post.jsx
Expand Up @@ -69,11 +69,11 @@ class PostTemplate extends React.Component {
config.blogAuthorId
);

const formatReadNext = data => ({
path: data.fields.slug,
title: data.frontmatter.title,
cover: data.frontmatter.cover,
excerpt: data.excerpt
const formatReadNext = value => ({
path: value.fields.slug,
title: value.frontmatter.title,
cover: value.frontmatter.cover,
excerpt: value.excerpt
});
const getNextData = () => (next ? formatReadNext(data.next) : null);
const getPrevData = () => (prev ? formatReadNext(data.prev) : null);
Expand Down Expand Up @@ -126,7 +126,7 @@ class PostTemplate extends React.Component {
</MainContent>
<ReadNext next={getNextData()} prev={getPrevData()} />

{/*The tiny footer at the very bottom*/}
{/* The tiny footer at the very bottom */}
<Footer
copyright={config.copyright}
promoteGatsby={config.promoteGatsby}
Expand All @@ -137,7 +137,7 @@ class PostTemplate extends React.Component {
}
}

/* eslint no-undef: "off"*/
/* eslint no-undef: "off" */
export const pageQuery = graphql`
query BlogPostBySlug($slug: String!, $next: String, $prev: String) {
markdownRemark(fields: { slug: { eq: $slug } }) {
Expand Down

0 comments on commit c119bfe

Please sign in to comment.