Skip to content

Commit

Permalink
Apply prettier to all .js and .jsx files in the codebase.
Browse files Browse the repository at this point in the history
  • Loading branch information
levino committed Nov 2, 2018
1 parent 855745b commit b184e85
Show file tree
Hide file tree
Showing 5 changed files with 4,033 additions and 4,408 deletions.
76 changes: 38 additions & 38 deletions data/SiteConfig.js
@@ -1,53 +1,53 @@
module.exports = {
blogPostDir: "posts", // The name of directory that contains your posts.
lessonsDir: "lessons", // The name of the directory that contains lessons or docs.
siteTitle: "Gatsby Docs Starter", // Site title.
siteTitleAlt: "Gatsby Starter Template for Creating Docs", // Alternative site title for SEO.
siteLogo: "/logos/logo-1024.png", // Logo used for SEO and manifest.
siteUrl: "https://ericwindmill.com", // Domain of your website without pathPrefix.
pathPrefix: "/", // Prefixes all links. For cases when deployed to example.github.io/gatsby-advanced-starter/.
siteDescription: "A GatsbyJS stater for creating Documentation or Tutorials.", // Website description used for RSS feeds/meta description tag.
siteRss: "/rss.xml", // Path to the RSS file.
siteFBAppID: "1825356251115265", // FB Application ID for using app insights
googleAnalyticsID: "UA-82450300-1 ", // GA tracking ID.
disqusShortname: "https-ericwindmill-github-io-gatsby-advanced-starter", // Disqus shortname.
postDefaultCategoryID: "Tech", // Default category for posts.
userName: "User", // Username to display in the author segment.
userTwitter: "ericwindmill", // Optionally renders "Follow Me" in the UserInfo segment.
userLocation: "Portland, OR", // User location to display in the author segment.
userAvatar: "https://api.adorable.io/avatars/150/test.png", // User avatar to display in the author segment.
userDescription: "All about me!", // User description to display in the author segment.
blogPostDir: 'posts', // The name of directory that contains your posts.
lessonsDir: 'lessons', // The name of the directory that contains lessons or docs.
siteTitle: 'Gatsby Docs Starter', // Site title.
siteTitleAlt: 'Gatsby Starter Template for Creating Docs', // Alternative site title for SEO.
siteLogo: '/logos/logo-1024.png', // Logo used for SEO and manifest.
siteUrl: 'https://ericwindmill.com', // Domain of your website without pathPrefix.
pathPrefix: '/', // Prefixes all links. For cases when deployed to example.github.io/gatsby-advanced-starter/.
siteDescription: 'A GatsbyJS stater for creating Documentation or Tutorials.', // Website description used for RSS feeds/meta description tag.
siteRss: '/rss.xml', // Path to the RSS file.
siteFBAppID: '1825356251115265', // FB Application ID for using app insights
googleAnalyticsID: 'UA-82450300-1 ', // GA tracking ID.
disqusShortname: 'https-ericwindmill-github-io-gatsby-advanced-starter', // Disqus shortname.
postDefaultCategoryID: 'Tech', // Default category for posts.
userName: 'User', // Username to display in the author segment.
userTwitter: 'ericwindmill', // Optionally renders "Follow Me" in the UserInfo segment.
userLocation: 'Portland, OR', // User location to display in the author segment.
userAvatar: 'https://api.adorable.io/avatars/150/test.png', // User avatar to display in the author segment.
userDescription: 'All about me!', // User description to display in the author segment.
// Links to social profiles/projects you want to display in the author segment/navigation bar.
userLinks: [
{
label: "GitHub",
url: "https://github.com/ericwindmill",
iconClassName: "fa fa-github"
label: 'GitHub',
url: 'https://github.com/ericwindmill',
iconClassName: 'fa fa-github'
},
{
label: "Twitter",
url: "https://twitter.com/ericwindmill",
iconClassName: "fa fa-twitter"
label: 'Twitter',
url: 'https://twitter.com/ericwindmill',
iconClassName: 'fa fa-twitter'
},
{
label: "Messenger",
url: "https://www.messenger.com/t/eric.windmill",
iconClassName: "fa fa-message"
label: 'Messenger',
url: 'https://www.messenger.com/t/eric.windmill',
iconClassName: 'fa fa-message'
},
{
label: "Email",
url: "mailto:eric@ericwindmill.com",
iconClassName: "fa fa-envelope"
label: 'Email',
url: 'mailto:eric@ericwindmill.com',
iconClassName: 'fa fa-envelope'
},
{
label: "Instagram",
url: "https://instagram.com/ericwindmill",
iconClassName: "fa fa-envelope"
label: 'Instagram',
url: 'https://instagram.com/ericwindmill',
iconClassName: 'fa fa-envelope'
}
],
copyright: "Copyright © 2017. Advanced User", // Copyright string for the footer of the website and RSS feed.
themeColor: "#c62828", // Used for setting manifest and progress theme colors.
backgroundColor: "#e0e0e0", // Used for setting manifest background color.
copyright: 'Copyright © 2017. Advanced User', // Copyright string for the footer of the website and RSS feed.
themeColor: '#c62828', // Used for setting manifest and progress theme colors.
backgroundColor: '#e0e0e0', // Used for setting manifest background color.
// TODO: Move this literally anywhere better.
toCChapters: ["", "Chapter 1", "Chapter 2"] // Used to generate the Table Of Contents. Index 0 should be blank.
};
toCChapters: ['', 'Chapter 1', 'Chapter 2'] // Used to generate the Table Of Contents. Index 0 should be blank.
}
74 changes: 37 additions & 37 deletions gatsby-config.js
@@ -1,6 +1,6 @@
const config = require("./data/SiteConfig");
const config = require('./data/SiteConfig')

const pathPrefix = config.pathPrefix === "/" ? "" : config.pathPrefix;
const pathPrefix = config.pathPrefix === '/' ? '' : config.pathPrefix

module.exports = {
pathPrefix: config.pathPrefix,
Expand All @@ -17,90 +17,90 @@ module.exports = {
}
},
plugins: [
"gatsby-plugin-react-helmet",
"gatsby-plugin-styled-components",
'gatsby-plugin-react-helmet',
'gatsby-plugin-styled-components',
{
resolve: `gatsby-plugin-google-fonts`,
options: {
fonts: [`crimson text:400, 400i, 700, 700i`, `space mono:400,700`]
}
},
{
resolve: "gatsby-source-filesystem",
resolve: 'gatsby-source-filesystem',
options: {
name: "posts",
name: 'posts',
path: `${__dirname}/content/`
}
},
{
resolve: "gatsby-transformer-remark",
resolve: 'gatsby-transformer-remark',
options: {
plugins: [
{
resolve: "gatsby-remark-images",
resolve: 'gatsby-remark-images',
options: {
maxWidth: 690
}
},
{
resolve: "gatsby-remark-responsive-iframe"
resolve: 'gatsby-remark-responsive-iframe'
},
"gatsby-remark-prismjs",
"gatsby-remark-copy-linked-files",
"gatsby-remark-autolink-headers"
'gatsby-remark-prismjs',
'gatsby-remark-copy-linked-files',
'gatsby-remark-autolink-headers'
]
}
},
{
resolve: "gatsby-plugin-google-analytics",
resolve: 'gatsby-plugin-google-analytics',
options: {
trackingId: config.googleAnalyticsID
}
},
{
resolve: "gatsby-plugin-nprogress",
resolve: 'gatsby-plugin-nprogress',
options: {
color: config.themeColor
}
},
"gatsby-plugin-sharp",
"gatsby-plugin-catch-links",
"gatsby-plugin-twitter",
"gatsby-plugin-sitemap",
"gatsby-transformer-json",
'gatsby-plugin-sharp',
'gatsby-plugin-catch-links',
'gatsby-plugin-twitter',
'gatsby-plugin-sitemap',
'gatsby-transformer-json',
{
resolve: "gatsby-plugin-manifest",
resolve: 'gatsby-plugin-manifest',
options: {
name: config.siteTitle,
short_name: config.siteTitle,
description: config.siteDescription,
start_url: config.pathPrefix,
background_color: config.backgroundColor,
theme_color: config.themeColor,
display: "minimal-ui",
display: 'minimal-ui',
icons: [
{
src: "/logos/logo-192x192.png",
sizes: "192x192",
type: "image/png"
src: '/logos/logo-192x192.png',
sizes: '192x192',
type: 'image/png'
},
{
src: "/logos/logo-512x512.png",
sizes: "512x512",
type: "image/png"
src: '/logos/logo-512x512.png',
sizes: '512x512',
type: 'image/png'
}
]
}
},
"gatsby-plugin-offline",
'gatsby-plugin-offline',
{
resolve: "gatsby-plugin-feed",
resolve: 'gatsby-plugin-feed',
options: {
setup(ref) {
const ret = ref.query.site.siteMetadata.rssMetadata;
ret.allMarkdownRemark = ref.query.allMarkdownRemark;
ret.generator = "GatsbyJS Material Starter";
return ret;
const ret = ref.query.site.siteMetadata.rssMetadata
ret.allMarkdownRemark = ref.query.allMarkdownRemark
ret.generator = 'GatsbyJS Material Starter'
return ret
},
query: `
{
Expand All @@ -122,7 +122,7 @@ module.exports = {
feeds: [
{
serialize(ctx) {
const rssMetadata = ctx.query.site.siteMetadata.rssMetadata;
const rssMetadata = ctx.query.site.siteMetadata.rssMetadata
return ctx.query.allMarkdownRemark.edges.map(edge => ({
categories: edge.node.frontmatter.tags,
date: edge.node.frontmatter.date,
Expand All @@ -131,8 +131,8 @@ module.exports = {
author: rssMetadata.author,
url: rssMetadata.site_url + edge.node.fields.slug,
guid: rssMetadata.site_url + edge.node.fields.slug,
custom_elements: [{ "content:encoded": edge.node.html }]
}));
custom_elements: [{ 'content:encoded': edge.node.html }]
}))
},
query: `
{
Expand Down Expand Up @@ -164,4 +164,4 @@ module.exports = {
}
}
]
};
}
88 changes: 44 additions & 44 deletions gatsby-node.js
@@ -1,42 +1,42 @@
const path = require("path");
const _ = require("lodash");
const webpackLodashPlugin = require("lodash-webpack-plugin");
const path = require('path')
const _ = require('lodash')
const webpackLodashPlugin = require('lodash-webpack-plugin')

exports.onCreateNode = ({ node, boundActionCreators, getNode }) => {
const { createNodeField } = boundActionCreators;
let slug;
if (node.internal.type === "MarkdownRemark") {
const fileNode = getNode(node.parent);
const parsedFilePath = path.parse(fileNode.relativePath);
const { createNodeField } = boundActionCreators
let slug
if (node.internal.type === 'MarkdownRemark') {
const fileNode = getNode(node.parent)
const parsedFilePath = path.parse(fileNode.relativePath)
if (
Object.prototype.hasOwnProperty.call(node, "frontmatter") &&
Object.prototype.hasOwnProperty.call(node.frontmatter, "slug")
Object.prototype.hasOwnProperty.call(node, 'frontmatter') &&
Object.prototype.hasOwnProperty.call(node.frontmatter, 'slug')
) {
slug = `/${_.kebabCase(node.frontmatter.slug)}`;
slug = `/${_.kebabCase(node.frontmatter.slug)}`
}
if (
Object.prototype.hasOwnProperty.call(node, "frontmatter") &&
Object.prototype.hasOwnProperty.call(node.frontmatter, "title")
Object.prototype.hasOwnProperty.call(node, 'frontmatter') &&
Object.prototype.hasOwnProperty.call(node.frontmatter, 'title')
) {
slug = `/${_.kebabCase(node.frontmatter.title)}`;
} else if (parsedFilePath.name !== "index" && parsedFilePath.dir !== "") {
slug = `/${parsedFilePath.dir}/${parsedFilePath.name}/`;
} else if (parsedFilePath.dir === "") {
slug = `/${parsedFilePath.name}/`;
slug = `/${_.kebabCase(node.frontmatter.title)}`
} else if (parsedFilePath.name !== 'index' && parsedFilePath.dir !== '') {
slug = `/${parsedFilePath.dir}/${parsedFilePath.name}/`
} else if (parsedFilePath.dir === '') {
slug = `/${parsedFilePath.name}/`
} else {
slug = `/${parsedFilePath.dir}/`;
slug = `/${parsedFilePath.dir}/`
}
createNodeField({ node, name: "slug", value: slug });
createNodeField({ node, name: 'slug', value: slug })
}
};
}

exports.createPages = ({ graphql, boundActionCreators }) => {
const { createPage } = boundActionCreators;
const { createPage } = boundActionCreators

return new Promise((resolve, reject) => {
const postPage = path.resolve("src/templates/post.jsx");
const lessonPage = path.resolve("src/templates/lesson.jsx");
const categoryPage = path.resolve("src/templates/category.jsx");
const postPage = path.resolve('src/templates/post.jsx')
const lessonPage = path.resolve('src/templates/lesson.jsx')
const categoryPage = path.resolve('src/templates/category.jsx')
resolve(
graphql(
`
Expand All @@ -60,59 +60,59 @@ exports.createPages = ({ graphql, boundActionCreators }) => {
`
).then(result => {
if (result.errors) {
reject(result.errors);
reject(result.errors)
}

const tagSet = new Set();
const categorySet = new Set();
const tagSet = new Set()
const categorySet = new Set()

result.data.allMarkdownRemark.edges.forEach(edge => {
if (edge.node.frontmatter.tags) {
edge.node.frontmatter.tags.forEach(tag => {
tagSet.add(tag);
});
tagSet.add(tag)
})
}

if (edge.node.frontmatter.category) {
categorySet.add(edge.node.frontmatter.category);
categorySet.add(edge.node.frontmatter.category)
}

if (edge.node.frontmatter.type === "post") {
if (edge.node.frontmatter.type === 'post') {
createPage({
path: edge.node.fields.slug,
component: postPage,
context: {
slug: edge.node.fields.slug
}
});
})
} else {
createPage({
path: edge.node.fields.slug,
component: lessonPage,
context: {
slug: edge.node.fields.slug
}
});
})
}
});
})

const categoryList = Array.from(categorySet);
const categoryList = Array.from(categorySet)
categoryList.forEach(category => {
createPage({
path: `/categories/${_.kebabCase(category)}/`,
component: categoryPage,
context: {
category
}
});
});
})
})
})
);
});
};
)
})
}

exports.modifyWebpackConfig = ({ config, stage }) => {
if (stage === "build-javascript") {
config.plugin("Lodash", webpackLodashPlugin, null);
if (stage === 'build-javascript') {
config.plugin('Lodash', webpackLodashPlugin, null)
}
};
}

0 comments on commit b184e85

Please sign in to comment.