diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000000..cc4e915353841 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,4 @@ +{ + "trailingComma": "es5", + "semi": false +} diff --git a/examples/client-only-paths/src/pages/index.js b/examples/client-only-paths/src/pages/index.js index 1a363e91e89a8..9c052a21ce7e1 100644 --- a/examples/client-only-paths/src/pages/index.js +++ b/examples/client-only-paths/src/pages/index.js @@ -10,7 +10,7 @@ class AnimationExample extends React.Component { return (
Welcome to the GatsbyJS RSS Demo. @@ -8,5 +8,6 @@ const IndexRoute = () => to see the generated RSS Feed.
+const Counter = ({ count, increment }) => (
- Count: {count} -
+Count: {count}
Welcome to the GatsbyJS Sitemap Demo. Visit{` `} to see the generated sitemap.
{
You should prefer this operator over resize
.
- {assets.map(({ node: { title, responsiveResolution } }) =>
+ {assets.map(({ node: { title, responsiveResolution } }) => (
{
border: `1px solid tomato`,
}}
/>
- )}
+ ))}
GraphQL query
{
resizing focus area
- {assets.map(({ node: { title, resizing } }) =>
+ {assets.map(({ node: { title, resizing } }) => (
{
border: `1px solid tomato`,
}}
/>
- )}
+ ))}
GraphQL query
{
specify a maxWidth
, the max width the container of the
images reaches.
- {assets.map(({ node: { title, responsiveSizes } }) =>
+ {assets.map(({ node: { title, responsiveSizes } }) => (
{
border: `1px solid tomato`,
}}
/>
- )}
+ ))}
GraphQL query
+const Product = ({ node }) => (
}}
>
- {node.image[0].responsiveResolution.src &&
+ {node.image[0].responsiveResolution.src && (
}
-
-
- {node.productName.productName}
+ />
+ )}
+ {node.productName.productName}
+)
class IndexPage extends React.Component {
render() {
diff --git a/examples/using-contentful/src/templates/category.js b/examples/using-contentful/src/templates/category.js
index 3ceb355654bc8..3357ccff4d660 100644
--- a/examples/using-contentful/src/templates/category.js
+++ b/examples/using-contentful/src/templates/category.js
@@ -31,24 +31,20 @@ class CategoryTemplate extends React.Component {
src={iconImg.src}
srcSet={iconImg.srcSet}
/>
-
- {title}
-
+ {title}
-
- {title}
-
+ {title}
Products
{product &&
- product.map((p, i) =>
+ product.map((p, i) => (
-
{p.productName.productName}
- )}
+ ))}
diff --git a/examples/using-contentful/src/templates/product.js b/examples/using-contentful/src/templates/product.js
index 1f4e711da4a22..1bb894f54a632 100644
--- a/examples/using-contentful/src/templates/product.js
+++ b/examples/using-contentful/src/templates/product.js
@@ -35,20 +35,12 @@ class ProductTemplate extends React.Component {
src={image[0].responsiveResolution.src}
srcSet={image[0].responsiveResolution.srcSet}
/>
-
- {productName}
-
+ {productName}
-
- {productName}
-
-
- Made by {brand.companyName.companyName}
-
+ {productName}
+ Made by {brand.companyName.companyName}
-
- Price: ${price}
-
+ Price: ${price}
See other:
- {categories.map((category, i) =>
+ {categories.map((category, i) => (
-
{category.title.title}
- )}
+ ))}
diff --git a/examples/using-glamor/src/pages/other-page.js b/examples/using-glamor/src/pages/other-page.js
index 434d89dc3f330..584b9fa1e8dcc 100644
--- a/examples/using-glamor/src/pages/other-page.js
+++ b/examples/using-glamor/src/pages/other-page.js
@@ -1,6 +1,6 @@
import React from "react"
-export default () =>
+export default () => (
Weeee...
+)
diff --git a/examples/using-mongodb/src/pages/index.js b/examples/using-mongodb/src/pages/index.js
index 33c3ae491d23b..656cd53eeb9a2 100644
--- a/examples/using-mongodb/src/pages/index.js
+++ b/examples/using-mongodb/src/pages/index.js
@@ -11,9 +11,9 @@ class Index extends React.Component {
Website information stored in MongoDB
- {allMongodbCloudDocuments.edges.map(({ node }) =>
+ {allMongodbCloudDocuments.edges.map(({ node }) => (
- )}
+ ))}
)
diff --git a/examples/using-remark/src/pages/index.js b/examples/using-remark/src/pages/index.js
index 9eed3960439f2..680065c2168c4 100644
--- a/examples/using-remark/src/pages/index.js
+++ b/examples/using-remark/src/pages/index.js
@@ -42,7 +42,7 @@ class Index extends React.Component {
listStyle: `none`,
}}
>
- {posts.map(post =>
+ {posts.map(post => (
- )}
+ ))}
diff --git a/examples/using-remark/src/pages/tags.js b/examples/using-remark/src/pages/tags.js
index db92da0e51b6f..e5b5f437252c9 100644
--- a/examples/using-remark/src/pages/tags.js
+++ b/examples/using-remark/src/pages/tags.js
@@ -10,7 +10,7 @@ class TagsPageRoute extends React.Component {
Tags
- {allTags.map(tag =>
+ {allTags.map(tag => (
-
- )}
+ ))}
)
diff --git a/examples/using-remark/src/templates/template-blog-post.js b/examples/using-remark/src/templates/template-blog-post.js
index c12a219eebdd0..d8326911cca9b 100644
--- a/examples/using-remark/src/templates/template-blog-post.js
+++ b/examples/using-remark/src/templates/template-blog-post.js
@@ -18,9 +18,7 @@ class BlogPostRoute extends React.Component {
const divider = i < tagsArray.length - 1 && {`, `}
return (
-
- {post.frontmatter.tags[i]}
-
+ {post.frontmatter.tags[i]}
{divider}
)
diff --git a/examples/using-remark/src/templates/template-tag-page.js b/examples/using-remark/src/templates/template-tag-page.js
index 9c9f9deb015c3..6c762e0b07586 100644
--- a/examples/using-remark/src/templates/template-tag-page.js
+++ b/examples/using-remark/src/templates/template-tag-page.js
@@ -4,13 +4,11 @@ import Link from "gatsby-link"
class TagRoute extends React.Component {
render() {
const posts = this.props.data.allMarkdownRemark.edges
- const postLinks = posts.map(post =>
+ const postLinks = posts.map(post => (
-
- {post.node.frontmatter.title}
-
+ {post.node.frontmatter.title}
- )
+ ))
return (
@@ -18,9 +16,7 @@ class TagRoute extends React.Component {
{this.props.data.allMarkdownRemark.totalCount}
{` `}posts tagged with “{this.props.pathContext.tag}”
-
- {postLinks}
-
+ {postLinks}
Browse all tags
diff --git a/examples/using-wordpress/src/components/Footer.js b/examples/using-wordpress/src/components/Footer.js
index 4aae11cbcbfaf..7638a10e74f53 100644
--- a/examples/using-wordpress/src/components/Footer.js
+++ b/examples/using-wordpress/src/components/Footer.js
@@ -1,11 +1,12 @@
import React from "react"
import { Page, Row } from "./styled"
-const Footer = props =>
+const Footer = props => (
+)
export default Footer
diff --git a/examples/using-wordpress/src/components/Header.js b/examples/using-wordpress/src/components/Header.js
index 1bec15fae7df7..7e4be961df45f 100644
--- a/examples/using-wordpress/src/components/Header.js
+++ b/examples/using-wordpress/src/components/Header.js
@@ -4,18 +4,14 @@ import Link from "gatsby-link"
import { H1, H2, H3, H4 } from "../components/styled"
import { Row, Page, Column } from "./styled"
-const Header = ({ title, subtitle, pages }) =>
+const Header = ({ title, subtitle, pages }) => (
// TODO : Sort order of menu based on field menu_order
-
- {title}
-
+ {title}
-
- {subtitle}
-
+ {subtitle}
@@ -28,9 +24,7 @@ const Header = ({ title, subtitle, pages }) =>
return (
{i !== 0 ? ` - ` : ``}
-
- {unescape(p.node.title)}
-
+ {unescape(p.node.title)}
)
})}
@@ -38,6 +32,7 @@ const Header = ({ title, subtitle, pages }) =>
+)
Header.propTypes = {
title: PropTypes.string,
diff --git a/examples/using-wordpress/src/components/PostsListSearchable.js b/examples/using-wordpress/src/components/PostsListSearchable.js
index f25f569e7851d..92f5612c3308c 100644
--- a/examples/using-wordpress/src/components/PostsListSearchable.js
+++ b/examples/using-wordpress/src/components/PostsListSearchable.js
@@ -31,7 +31,7 @@ class PostsListSearchable extends Component {
Filter by category:
this.resetFilter()}>All -
- {this.props.propsData.allWordpressCategory.edges.map((cat, i) =>
+ {this.props.propsData.allWordpressCategory.edges.map((cat, i) => (
this.handleFilter(cat.node.id)}
@@ -39,18 +39,18 @@ class PostsListSearchable extends Component {
{i !== 0 ? ` - ` : ``}
{cat.node.name}
- )}
+ ))}
this.resetFilter()}> - Reset filter
- {this.state.data.map(article =>
+ {this.state.data.map(article => (
- )}
+ ))}
diff --git a/examples/using-wordpress/src/components/styled/index.js b/examples/using-wordpress/src/components/styled/index.js
index d8d1375e3da93..044c0cde9ea5a 100644
--- a/examples/using-wordpress/src/components/styled/index.js
+++ b/examples/using-wordpress/src/components/styled/index.js
@@ -107,15 +107,14 @@ export const DefaultLink = styled(
...rest
}) =>
)`
- ${props => PR.ftzProps(props)}
- ${props => PR.colorProps(props, color.link)}
- text-decoration: ${props => (props.underline ? `underline` : `none`)};
+ ${props => PR.ftzProps(props)} ${props =>
+ PR.colorProps(props, color.link)} text-decoration: ${props =>
+ props.underline ? `underline` : `none`};
&:hover {
- ${props => PR.colorHoverProps(props, `blue`)}
- ${props =>
- props.block &&
- typeof props.block === `boolean` &&
- `background-color: ${color.white}`}
+ ${props => PR.colorHoverProps(props, `blue`)} ${props =>
+ props.block &&
+ typeof props.block === `boolean` &&
+ `background-color: ${color.white}`};
}
`
diff --git a/examples/using-wordpress/src/components/styled/layout.js b/examples/using-wordpress/src/components/styled/layout.js
index 6cb5ae34c5012..f3a5393b58123 100644
--- a/examples/using-wordpress/src/components/styled/layout.js
+++ b/examples/using-wordpress/src/components/styled/layout.js
@@ -29,10 +29,10 @@ const { sizes, color } = theme
// Iterate through the sizes and create a media template
export const media = Object.keys(sizes).reduce((acc, label) => {
acc[label] = (...args) => css`
- @media (max-width: ${sizes[label] / 16}em) {
- ${css(...args)}
- }
- `
+ @media (max-width: ${sizes[label] / 16}em) {
+ ${css(...args)};
+ }
+ `
return acc
}, {})
@@ -47,18 +47,20 @@ export const Page = styled(HedronPage)`
margin: 0 auto;
max-width: 100%;
${props.width ? `width: ${props.width};` : `width: ${sizes.max};`}
- `}
+ `};
`
export const RowHedron = styled(HedronRow)`
display: flex;
flex-direction: row;
flex-wrap: wrap;
- ${ifDefined(`alignContent`, `align-content`)}
- ${ifDefined(`alignItems`, `align-items`)}
- ${ifDefined(`alignSelf`, `align-self`)}
- ${ifDefined(`justifyContent`, `justify-content`)}
- ${ifDefined(`order`)}
+ ${ifDefined(`alignContent`, `align-content`)} ${ifDefined(
+ `alignItems`,
+ `align-items`
+ )} ${ifDefined(`alignSelf`, `align-self`)} ${ifDefined(
+ `justifyContent`,
+ `justify-content`
+ )} ${ifDefined(`order`)};
`
export const gutter = props => css`
@@ -67,7 +69,7 @@ export const gutter = props => css`
${media.sm`
padding-right: 15px;
padding-left: 15px;
- `}
+ `};
`
export const Row = styled(
@@ -83,32 +85,28 @@ export const Row = styled(
...rest
}) =>
)`
-
${props => props.gutter && gutter};
${props =>
- css` background-color: ${props.gutterWhite
- ? color.white
- : color.lightGray}`};
+ css`
+ background-color: ${props.gutterWhite ? color.white : color.lightGray};
+ `};
${PR.heightProps};
${PR.borderProps};
${PR.outlineProps};
`
-export const Column = styled(({ outline, ...rest }) =>
+export const Column = styled(({ outline, ...rest }) => (
-)`
+))`
display: block;
${props =>
props.debug
? `background-color: rgba(50, 50, 255, .1);
outline: 1px solid #fff;`
- : ``}
- box-sizing: border-box;
+ : ``} box-sizing: border-box;
padding: 0;
width: 100%;
- ${compute(`xs`)}
- ${compute(`sm`)}
- ${compute(`md`)}
- ${compute(`lg`)}
- ${PR.outlineProps}
+ ${compute(`xs`)} ${compute(`sm`)} ${compute(`md`)} ${compute(
+ `lg`
+ )} ${PR.outlineProps};
`
diff --git a/examples/using-wordpress/src/components/styled/propReceivers.js b/examples/using-wordpress/src/components/styled/propReceivers.js
index 41b12408678d5..2335b44e31c47 100644
--- a/examples/using-wordpress/src/components/styled/propReceivers.js
+++ b/examples/using-wordpress/src/components/styled/propReceivers.js
@@ -5,40 +5,64 @@ const { ftz, color, goldenRatio } = theme
// FONT SIZES
const ftzMap = p => {
if (p.h1) {
- return css`font-size: ${ftz.h1};`
+ return css`
+ font-size: ${ftz.h1};
+ `
}
if (p.h2) {
- return css`font-size: ${ftz.h2};`
+ return css`
+ font-size: ${ftz.h2};
+ `
}
if (p.h3) {
- return css`font-size: ${ftz.h3};`
+ return css`
+ font-size: ${ftz.h3};
+ `
}
if (p.h4) {
- return css`font-size: ${ftz.h4};`
+ return css`
+ font-size: ${ftz.h4};
+ `
}
if (p.h5) {
- return css`font-size: ${ftz.h5};`
+ return css`
+ font-size: ${ftz.h5};
+ `
}
if (p.h6) {
- return css`font-size: ${ftz.h6};`
+ return css`
+ font-size: ${ftz.h6};
+ `
}
if (p.h7) {
- return css`font-size: ${ftz.h7};`
+ return css`
+ font-size: ${ftz.h7};
+ `
}
if (p.p1) {
- return css`font-size: ${ftz.p1};`
+ return css`
+ font-size: ${ftz.p1};
+ `
}
if (p.p2) {
- return css`font-size: ${ftz.p2};`
+ return css`
+ font-size: ${ftz.p2};
+ `
}
if (p.p3) {
- return css`font-size: ${ftz.p3};`
+ return css`
+ font-size: ${ftz.p3};
+ `
}
if (p.p4) {
- return css`font-size: ${ftz.p4};`
+ return css`
+ font-size: ${ftz.p4};
+ `
}
if (p.p5) {
- return css`font-size: ${ftz.p5};`
+ return css`
+ font-size: ${ftz.p5};
+ `
}
}
export const ftzPropsVar = {
@@ -73,9 +97,13 @@ export const ftzProps = (props, def = `inherit`) => {
) {
return ftzMap(props)
} else if (props.ftz) {
- return css`font-size: ${props.ftz};`
+ return css`
+ font-size: ${props.ftz};
+ `
} else {
- return css`font-size: ${def};`
+ return css`
+ font-size: ${def};
+ `
}
}
@@ -219,11 +247,11 @@ export const backgroundProps = props => css`
export const heightProps = props => css`
${props.height &&
typeof props.height === `number` &&
- `height: ${goldenRatio * props.height}px;`}
+ `height: ${goldenRatio * props.height}px;`};
`
export const outlineProps = props => css`
${props.outline &&
typeof props.outline === `boolean` &&
- `outline: 1px solid white`}
+ `outline: 1px solid white`};
`
diff --git a/examples/using-wordpress/src/layouts/index.js b/examples/using-wordpress/src/layouts/index.js
index b40299b425d8c..da5e9e04f5676 100644
--- a/examples/using-wordpress/src/layouts/index.js
+++ b/examples/using-wordpress/src/layouts/index.js
@@ -3,11 +3,7 @@ import PropTypes from "prop-types"
class DefaultLayout extends React.Component {
render() {
- return (
-
- {this.props.children()}
-
- )
+ return {this.props.children()}
}
}
diff --git a/package.json b/package.json
index 515b48303d63a..c2dd9426a33d8 100644
--- a/package.json
+++ b/package.json
@@ -36,8 +36,8 @@
"jest-cli": "^20.0.4",
"lerna": "^2.1.0",
"plop": "^1.7.4",
- "prettier": "^1.5.3",
- "prettier-eslint-cli": "^4.2.0",
+ "prettier": "^1.6.0",
+ "prettier-eslint-cli": "^4.2.1",
"prop-types": "^15.5.8",
"purdy": "^2.2.1",
"remotedev-server": "^0.2.3",
diff --git a/packages/gatsby-link/src/index.js b/packages/gatsby-link/src/index.js
index 887993fddbabd..2c58f5c435024 100644
--- a/packages/gatsby-link/src/index.js
+++ b/packages/gatsby-link/src/index.js
@@ -72,10 +72,16 @@ class GatsbyLink extends React.Component {
// just scroll there.
let pathname = this.state.to
if (pathname.split(`#`).length > 1) {
- pathname = pathname.split(`#`).slice(0, -1).join(``)
+ pathname = pathname
+ .split(`#`)
+ .slice(0, -1)
+ .join(``)
}
if (pathname === window.location.pathname) {
- const hashFragment = this.state.to.split(`#`).slice(1).join(`#`)
+ const hashFragment = this.state.to
+ .split(`#`)
+ .slice(1)
+ .join(`#`)
const element = document.getElementById(hashFragment)
if (element !== null) {
element.scrollIntoView()
diff --git a/packages/gatsby-plugin-jss/src/gatsby-ssr.js b/packages/gatsby-plugin-jss/src/gatsby-ssr.js
index 2813dff472d57..8f31cf8126247 100644
--- a/packages/gatsby-plugin-jss/src/gatsby-ssr.js
+++ b/packages/gatsby-plugin-jss/src/gatsby-ssr.js
@@ -10,9 +10,7 @@ exports.replaceRenderer = ({
const sheets = new SheetsRegistry()
const bodyHTML = renderToString(
-
- {bodyComponent}
-
+ {bodyComponent}
)
replaceBodyHTMLString(bodyHTML)
diff --git a/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js b/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js
index e4c9e1c31bf81..7b196fe0e63dc 100644
--- a/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js
+++ b/packages/gatsby-remark-copy-linked-files/src/__tests__/index.js
@@ -36,7 +36,10 @@ describe(`gatsby-remark-copy-linked-files`, () => {
{
absolutePath: path.normalize(filePath),
internal: {},
- extension: filePath.split(`.`).pop().trim(),
+ extension: filePath
+ .split(`.`)
+ .pop()
+ .trim(),
},
]
diff --git a/packages/gatsby-remark-images/src/__tests__/__snapshots__/index.js.snap b/packages/gatsby-remark-images/src/__tests__/__snapshots__/index.js.snap
index fea1d4ad77b31..fba6d3f757054 100644
--- a/packages/gatsby-remark-images/src/__tests__/__snapshots__/index.js.snap
+++ b/packages/gatsby-remark-images/src/__tests__/__snapshots__/index.js.snap
@@ -4,7 +4,7 @@ exports[`it transforms HTML img tags 1`] = `
"
-
+
@@ -26,7 +26,7 @@ exports[`it transforms images in markdown 1`] = `
height: 100%;
`
)
- $(`iframe, object`).attr(`width`, null).attr(`height`, null)
+ $(`iframe, object`)
+ .attr(`width`, null)
+ .attr(`height`, null)
const newIframe = $.html()
// TODO add youtube preview image as background-image.
diff --git a/packages/gatsby-remark-smartypants/src/index.js b/packages/gatsby-remark-smartypants/src/index.js
index 595a679384c0b..3c17de3402d08 100644
--- a/packages/gatsby-remark-smartypants/src/index.js
+++ b/packages/gatsby-remark-smartypants/src/index.js
@@ -6,7 +6,9 @@ const _ = require(`lodash`)
module.exports = ({ markdownAST }, pluginOptions = {}) => {
visit(markdownAST, `text`, node => {
const processedText = String(
- retext().use(smartypants, pluginOptions).process(node.value)
+ retext()
+ .use(smartypants, pluginOptions)
+ .process(node.value)
)
node.value = processedText
})
diff --git a/packages/gatsby-source-contentful/src/fetch.js b/packages/gatsby-source-contentful/src/fetch.js
index 7d1fbd5236715..05d46be279b55 100644
--- a/packages/gatsby-source-contentful/src/fetch.js
+++ b/packages/gatsby-source-contentful/src/fetch.js
@@ -101,24 +101,20 @@ function pagedGet(
pageLimit = 1000,
aggregatedResponse = null
) {
- return client
- [method]({
- ...query,
- skip: skip,
- limit: pageLimit,
- order: `sys.createdAt`,
- })
- .then(response => {
- if (!aggregatedResponse) {
- aggregatedResponse = response
- } else {
- aggregatedResponse.items = aggregatedResponse.items.concat(
- response.items
- )
- }
- if (skip + pageLimit <= response.total) {
- return pagedGet(client, method, skip + pageLimit, aggregatedResponse)
- }
- return aggregatedResponse
- })
+ return client[method]({
+ ...query,
+ skip: skip,
+ limit: pageLimit,
+ order: `sys.createdAt`,
+ }).then(response => {
+ if (!aggregatedResponse) {
+ aggregatedResponse = response
+ } else {
+ aggregatedResponse.items = aggregatedResponse.items.concat(response.items)
+ }
+ if (skip + pageLimit <= response.total) {
+ return pagedGet(client, method, skip + pageLimit, aggregatedResponse)
+ }
+ return aggregatedResponse
+ })
}
diff --git a/packages/gatsby-source-contentful/src/normalize.js b/packages/gatsby-source-contentful/src/normalize.js
index 4eb7b4ee91846..5bf857653c89f 100644
--- a/packages/gatsby-source-contentful/src/normalize.js
+++ b/packages/gatsby-source-contentful/src/normalize.js
@@ -3,7 +3,11 @@ const crypto = require(`crypto`)
const stringify = require(`json-stringify-safe`)
const deepMap = require(`deep-map`)
-const digest = str => crypto.createHash(`md5`).update(str).digest(`hex`)
+const digest = str =>
+ crypto
+ .createHash(`md5`)
+ .update(str)
+ .digest(`hex`)
const typePrefix = `Contentful`
const makeTypeName = type => _.upperFirst(_.camelCase(`${typePrefix} ${type}`))
diff --git a/packages/gatsby-source-wordpress/src/gatsby-node.js b/packages/gatsby-source-wordpress/src/gatsby-node.js
index 19909ffa64dee..6fab2186d2bf5 100644
--- a/packages/gatsby-source-wordpress/src/gatsby-node.js
+++ b/packages/gatsby-source-wordpress/src/gatsby-node.js
@@ -498,7 +498,11 @@ async function fetchData(route, createNode, parentNodeId) {
*
* @param {any} str
*/
-const digest = str => crypto.createHash(`md5`).update(str).digest(`hex`)
+const digest = str =>
+ crypto
+ .createHash(`md5`)
+ .update(str)
+ .digest(`hex`)
/**
* Create the Graph QL Node
diff --git a/packages/gatsby-transformer-csv/src/gatsby-node.js b/packages/gatsby-transformer-csv/src/gatsby-node.js
index 0c21db54f40d1..a732f18a3ce9e 100644
--- a/packages/gatsby-transformer-csv/src/gatsby-node.js
+++ b/packages/gatsby-transformer-csv/src/gatsby-node.js
@@ -5,12 +5,14 @@ const crypto = require(`crypto`)
const convertToJson = (data, options) =>
new Promise((res, rej) => {
- csv(options).fromString(data).on(`end_parsed`, jsonData => {
- if (!jsonData) {
- rej(`CSV to JSON conversion failed!`)
- }
- res(jsonData)
- })
+ csv(options)
+ .fromString(data)
+ .on(`end_parsed`, jsonData => {
+ if (!jsonData) {
+ rej(`CSV to JSON conversion failed!`)
+ }
+ res(jsonData)
+ })
})
async function onCreateNode(
diff --git a/packages/gatsby-transformer-documentationjs/src/gatsby-node.js b/packages/gatsby-transformer-documentationjs/src/gatsby-node.js
index 9198f88fd002a..6f169e649128c 100644
--- a/packages/gatsby-transformer-documentationjs/src/gatsby-node.js
+++ b/packages/gatsby-transformer-documentationjs/src/gatsby-node.js
@@ -1,6 +1,10 @@
const documentation = require(`documentation`)
const crypto = require(`crypto`)
-const digest = str => crypto.createHash(`md5`).update(str).digest(`hex`)
+const digest = str =>
+ crypto
+ .createHash(`md5`)
+ .update(str)
+ .digest(`hex`)
const remark = require(`remark`)
const _ = require(`lodash`)
const Prism = require(`prismjs`)
@@ -109,7 +113,10 @@ exports.onCreateNode = async ({
// When documenting destructured parameters, the name
// is parent.child where we just want the child.
if (param.name.split(`.`).length > 1) {
- param.name = param.name.split(`.`).slice(-1).join(`.`)
+ param.name = param.name
+ .split(`.`)
+ .slice(-1)
+ .join(`.`)
}
if (param.properties) {
diff --git a/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js b/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js
index 39ef03628c872..afadd23b42bf5 100644
--- a/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js
+++ b/packages/gatsby-transformer-javascript-static-exports/src/gatsby-node.js
@@ -110,7 +110,10 @@ async function onCreateNode({
}
} finally {
const objStr = JSON.stringify(node)
- const contentDigest = crypto.createHash(`md5`).update(objStr).digest(`hex`)
+ const contentDigest = crypto
+ .createHash(`md5`)
+ .update(objStr)
+ .digest(`hex`)
const nodeData = {
id: `${node.id} >>> JSFrontmatter`,
diff --git a/packages/gatsby-transformer-react-docgen/src/Doclets.js b/packages/gatsby-transformer-react-docgen/src/Doclets.js
index d97489c9afb17..28fdd7ceaf90e 100644
--- a/packages/gatsby-transformer-react-docgen/src/Doclets.js
+++ b/packages/gatsby-transformer-react-docgen/src/Doclets.js
@@ -1,6 +1,10 @@
const metadata = require(`react-docgen`)
-let cleanDocletValue = str => str.trim().replace(/^\{/, ``).replace(/\}$/, ``)
+let cleanDocletValue = str =>
+ str
+ .trim()
+ .replace(/^\{/, ``)
+ .replace(/\}$/, ``)
let isLiteral = str => /^('|")/.test(str.trim())
diff --git a/packages/gatsby-transformer-react-docgen/src/on-node-create.js b/packages/gatsby-transformer-react-docgen/src/on-node-create.js
index 6d761b515e3ef..3e4512d275859 100644
--- a/packages/gatsby-transformer-react-docgen/src/on-node-create.js
+++ b/packages/gatsby-transformer-react-docgen/src/on-node-create.js
@@ -1,7 +1,11 @@
import crypto from "crypto"
import parseMetadata from "./parse"
-const digest = str => crypto.createHash(`md5`).update(str).digest(`hex`)
+const digest = str =>
+ crypto
+ .createHash(`md5`)
+ .update(str)
+ .digest(`hex`)
const propsId = (parentId, name) => `${parentId}--ComponentProp-${name}`
const descId = parentId => `${parentId}--ComponentDescription`
diff --git a/packages/gatsby-transformer-xml/src/gatsby-node.js b/packages/gatsby-transformer-xml/src/gatsby-node.js
index f567ebd26132e..729fa40516493 100644
--- a/packages/gatsby-transformer-xml/src/gatsby-node.js
+++ b/packages/gatsby-transformer-xml/src/gatsby-node.js
@@ -13,7 +13,10 @@ async function onCreateNode({ node, boundActionCreators, loadNodeContent }) {
const parsedXml = parseXml(rawXml)
const nodeArray = parsedXml.root.children.map((obj, i) => {
const objStr = JSON.stringify(obj)
- const contentDigest = crypto.createHash(`md5`).update(objStr).digest(`hex`)
+ const contentDigest = crypto
+ .createHash(`md5`)
+ .update(objStr)
+ .digest(`hex`)
return {
...obj,
id: obj.attributes.id ? obj.attributes.id : `${node.id} [${i}] >>> XML`,
diff --git a/www/src/components/blog-post-preview-item.js b/www/src/components/blog-post-preview-item.js
index 5c84ffc60dc07..312415ccbe898 100644
--- a/www/src/components/blog-post-preview-item.js
+++ b/www/src/components/blog-post-preview-item.js
@@ -52,12 +52,8 @@ class BlogPostPreviewItem extends React.Component {
},
}}
>
-
- {post.frontmatter.author.id}
-
-
- {post.frontmatter.date}
-
+ {post.frontmatter.author.id}
+ {post.frontmatter.date}
diff --git a/www/src/components/card-headline.js b/www/src/components/card-headline.js
index 5ee1dbea2a1a6..b81d3491f2777 100644
--- a/www/src/components/card-headline.js
+++ b/www/src/components/card-headline.js
@@ -1,7 +1,7 @@
import presets from "../utils/presets"
import { rhythm, scale, options } from "../utils/typography"
-const CardHeadline = ({ children }) =>
+const CardHeadline = ({ children }) => (
>
{children}
+)
export default CardHeadline
diff --git a/www/src/components/card.js b/www/src/components/card.js
index 68831ee752475..9cb9aa98f3fbf 100644
--- a/www/src/components/card.js
+++ b/www/src/components/card.js
@@ -2,7 +2,7 @@ import presets from "../utils/presets"
import { rhythm, scale, options } from "../utils/typography"
import { vP, vPHd, vPVHd, vPVVHd } from "../components/gutters"
-const Card = ({ children }) =>
+const Card = ({ children }) => (
{children}
+)
export default Card
diff --git a/www/src/components/cards.js b/www/src/components/cards.js
index 0634fe70189ea..c8c65a8370892 100644
--- a/www/src/components/cards.js
+++ b/www/src/components/cards.js
@@ -2,7 +2,7 @@ import presets from "../utils/presets"
import { rhythm, scale, options } from "../utils/typography"
import { vP, vPHd, vPVHd, vPVVHd } from "../components/gutters"
-const Cards = ({ children }) =>
+const Cards = ({ children }) => (
>
{children}
+)
export default Cards
diff --git a/www/src/components/container.js b/www/src/components/container.js
index 1ee600f5d7c36..023d38e764118 100644
--- a/www/src/components/container.js
+++ b/www/src/components/container.js
@@ -3,7 +3,7 @@ import presets from "../utils/presets"
import { rhythm, scale } from "../utils/typography"
-export default ({ children, className, hasSideBar = true }) =>
+export default ({ children, className, hasSideBar = true }) => (
>
{children}
+)
diff --git a/www/src/components/cta-button.js b/www/src/components/cta-button.js
index 364b4c52fcc61..9a3a8c3bd2737 100644
--- a/www/src/components/cta-button.js
+++ b/www/src/components/cta-button.js
@@ -9,7 +9,7 @@ let stripeAnimation = css.keyframes({
"100%": { backgroundPosition: `30px 60px` },
})
-const CtaButton = ({ to, overrideCSS, children }) =>
+const CtaButton = ({ to, overrideCSS, children }) => (
>
{children}
+)
export default CtaButton
diff --git a/www/src/components/diagram.js b/www/src/components/diagram.js
index 7d1ed689511c1..3198ea2962421 100644
--- a/www/src/components/diagram.js
+++ b/www/src/components/diagram.js
@@ -29,7 +29,7 @@ const lineAnimation = css.keyframes({
},
})
-const Segment = ({ className, children }) =>
+const Segment = ({ className, children }) => (
>
{children}
+)
-const SegmentTitle = ({ children }) =>
+const SegmentTitle = ({ children }) => (
>
{children}
+)
-const VerticalLine = () =>
+const VerticalLine = () => (
+)
const box = {
border: `1px solid #f4ecfe`,
@@ -99,7 +102,7 @@ const borderAndBoxShadow = {
borderRadius: presets.radius,
}
-const SourceItems = ({ children }) =>
+const SourceItems = ({ children }) => (
>
{children}
+)
const boxPadding = { padding: `${rhythm(1 / 3)} ${rhythm(2 / 4)}` }
-const SourceItem = ({ children }) =>
+const SourceItem = ({ children }) => (
{children}
+)
-const ItemTitle = ({ children }) =>
+const ItemTitle = ({ children }) => (
>
{children}
+)
-const ItemDescription = ({ children }) =>
+const ItemDescription = ({ children }) => (
>
{children}
+)
-const Gatsby = ({ children }) =>
+const Gatsby = ({ children }) => (
+)
-const Diagram = ({ containerCSS }) =>
+const Diagram = ({ containerCSS }) => (
+)
export default Diagram
diff --git a/www/src/components/discord.js b/www/src/components/discord.js
index 906fc79429ea0..7da27ab938495 100644
--- a/www/src/components/discord.js
+++ b/www/src/components/discord.js
@@ -1,4 +1,4 @@
-const DiscordIcon = ({ overrideCSS }) =>
+const DiscordIcon = ({ overrideCSS }) => (
+)
export default DiscordIcon
diff --git a/www/src/components/function-list.js b/www/src/components/function-list.js
index 2d57e3e5d95c0..ed382b516f778 100644
--- a/www/src/components/function-list.js
+++ b/www/src/components/function-list.js
@@ -27,27 +27,30 @@ const Param = (param, depth = 0) => {
{param.name === `$0` ? `destructured object` : param.name}
{` `}
{param.type &&
- param.name !== `$0` &&
- {`{${param.type.name}}`}}
+ param.name !== `$0` && (
+ {`{${param.type.name}}`}
+ )}
- {param.description &&
+ {param.description && (
}
- {param.properties &&
+ />
+ )}
+ {param.properties && (
{param.properties.map(param => Param(param, depth + 1))}
- }
+
+ )}
)
}
-export default ({ functions }) =>
+export default ({ functions }) => (
- {functions.map(({ node }, i) =>
+ {functions.map(({ node }, i) => (
{i !== 0 &&
}
-
- {node.name}
-
+ {node.name}
__html: node.description.childMarkdownRemark.html,
}}
/>
- {(node.params && node.params.length) > 0 &&
+ {(node.params && node.params.length) > 0 && (
Parameters
{node.params.map(param => Param(param, 0))}
- }
+
+ )}
{node.examples &&
- node.examples.length > 0 &&
+ node.examples.length > 0 && (
Example
{` `}
- {node.examples.map((example, i) =>
+ {node.examples.map((example, i) => (
}}
/>
- )}
- }
+ ))}
+
+ )}
- )}
+ ))}
+)
export const pageQuery = graphql`
fragment FunctionList on DocumentationJs {
diff --git a/www/src/components/futura-paragraph.js b/www/src/components/futura-paragraph.js
index 188b7ee87f4eb..d7006f4901599 100644
--- a/www/src/components/futura-paragraph.js
+++ b/www/src/components/futura-paragraph.js
@@ -1,7 +1,7 @@
import { rhythm, scale, options } from "../utils/typography"
import presets from "../utils/presets"
-const FuturaParagraph = ({ children }) =>
+const FuturaParagraph = ({ children }) => (
>
{children}
+)
export default FuturaParagraph
diff --git a/www/src/components/masthead-bg.js b/www/src/components/masthead-bg.js
index 3bee074950cc5..58283c0022332 100644
--- a/www/src/components/masthead-bg.js
+++ b/www/src/components/masthead-bg.js
@@ -14,7 +14,7 @@ const cover = {
bottom: 0,
}
-const MastheadBg = () =>
+const MastheadBg = () => (
+)
export default MastheadBg
diff --git a/www/src/components/masthead.js b/www/src/components/masthead.js
index 2803d37a6e06e..31a9e93da49fc 100644
--- a/www/src/components/masthead.js
+++ b/www/src/components/masthead.js
@@ -8,7 +8,7 @@ import MastheadBg from "./masthead-bg"
import FuturaParagraph from "./futura-paragraph"
import { vP, vPHd, vPVHd, vPVVHd } from "../components/gutters"
-const MastheadContent = () =>
+const MastheadContent = () => (
+)
const Masthead = () =>
diff --git a/www/src/components/sidebar-body.js b/www/src/components/sidebar-body.js
index 6d4393a458593..7477d0d9e34b0 100644
--- a/www/src/components/sidebar-body.js
+++ b/www/src/components/sidebar-body.js
@@ -25,7 +25,7 @@ class SidebarBody extends React.Component {
padding: this.props.inline ? 0 : rhythm(3 / 4),
}}
>
- {menu.map((section, index) =>
+ {menu.map((section, index) => (
- )}
+ ))}
)
}
diff --git a/www/src/components/used-by.js b/www/src/components/used-by.js
index 265fc516e8c67..07c2a7f9bf740 100644
--- a/www/src/components/used-by.js
+++ b/www/src/components/used-by.js
@@ -3,7 +3,7 @@ import presets from "../utils/presets"
import { vP, vPHd, vPVHd, vPVVHd } from "../components/gutters"
import { FormidableIcon, FabricIcon, SegmentIcon } from "../assets/logos"
-const Icon = ({ icon }) =>
+const Icon = ({ icon }) => (
}}
/>
+)
-const UsedBy = () =>
+const UsedBy = () => (
+)
export default UsedBy
diff --git a/www/src/layouts/index.js b/www/src/layouts/index.js
index 36484f60d34a7..993a5850097f0 100644
--- a/www/src/layouts/index.js
+++ b/www/src/layouts/index.js
@@ -94,7 +94,7 @@ module.exports = React.createClass({
opacity: 0.8,
},
}
- const NavItem = ({ linkTo, children }) =>
+ const NavItem = ({ linkTo, children }) => (
- const MobileNavItem = ({ linkTo, title, children }) =>
+ )
+ const MobileNavItem = ({ linkTo, title, children }) => (
{children}
-
- {title}
-
+ {title}
+ )
const socialIconsStyles = {
color: presets.brandLight,
[presets.Phablet]: {
@@ -134,10 +134,7 @@ module.exports = React.createClass({
return (
-
+
diff --git a/www/src/pages/blog/index.js b/www/src/pages/blog/index.js
index 3bcf2e3afdc05..7e79a5844cd76 100644
--- a/www/src/pages/blog/index.js
+++ b/www/src/pages/blog/index.js
@@ -9,9 +9,9 @@ class BlogPostsIndex extends React.Component {
return (
Blog
- {allMarkdownRemark.edges.map(({ node }) =>
+ {allMarkdownRemark.edges.map(({ node }) => (
- )}
+ ))}
)
}
diff --git a/www/src/pages/colors.js b/www/src/pages/colors.js
index c18b6c4be1a98..fddb4aae83d48 100644
--- a/www/src/pages/colors.js
+++ b/www/src/pages/colors.js
@@ -4,7 +4,7 @@ import { rhythm, options } from "../utils/typography"
import Container from "../components/container"
import range from "lodash/range"
-export default () =>
+export default () => (
Colors
@@ -13,7 +13,7 @@ export default () =>
- {range(0, 16).map(a =>
+ {range(0, 16).map(a => (
>
{a}
- )}
+ ))}
a
- {colors.a.map(a =>
+ {colors.a.map(a => (
- )}
+ ))}
b
- {colors.b.map(a =>
+ {colors.b.map(a => (
- )}
+ ))}
c
- {colors.c.map(a =>
+ {colors.c.map(a => (
- )}
+ ))}
+)
diff --git a/www/src/pages/docs/bound-action-creators.js b/www/src/pages/docs/bound-action-creators.js
index b5e7ff1fb49fc..76cc3401d1db6 100644
--- a/www/src/pages/docs/bound-action-creators.js
+++ b/www/src/pages/docs/bound-action-creators.js
@@ -21,13 +21,11 @@ class ActionCreatorsDocs extends React.Component {
Functions
- {this.props.data.allDocumentationJs.edges.map(({ node }, i) =>
+ {this.props.data.allDocumentationJs.edges.map(({ node }, i) => (
-
-
- {node.name}
-
+ {node.name}
- )}
+ ))}
Reference
diff --git a/www/src/pages/docs/browser-apis.js b/www/src/pages/docs/browser-apis.js
index 6e2cc4d184903..91601cc4661b4 100644
--- a/www/src/pages/docs/browser-apis.js
+++ b/www/src/pages/docs/browser-apis.js
@@ -11,13 +11,11 @@ class BrowserAPIDocs extends React.Component {
Gatsby Browser APIs
APIs
- {this.props.data.allDocumentationJs.edges.map(({ node }, i) =>
+ {this.props.data.allDocumentationJs.edges.map(({ node }, i) => (
-
-
- {node.name}
-
+ {node.name}
- )}
+ ))}
diff --git a/www/src/pages/docs/node-apis.js b/www/src/pages/docs/node-apis.js
index df448317e9795..769c0582acb76 100644
--- a/www/src/pages/docs/node-apis.js
+++ b/www/src/pages/docs/node-apis.js
@@ -45,13 +45,11 @@ exports.createPages = (_, pluginOptions, cb) => {
APIs
- {this.props.data.allDocumentationJs.edges.map(({ node }, i) =>
+ {this.props.data.allDocumentationJs.edges.map(({ node }, i) => (
-
-
- {node.name}
-
+ {node.name}
- )}
+ ))}
diff --git a/www/src/pages/docs/ssr-apis.js b/www/src/pages/docs/ssr-apis.js
index eecf8eb7bb12d..2edc00c1691d9 100644
--- a/www/src/pages/docs/ssr-apis.js
+++ b/www/src/pages/docs/ssr-apis.js
@@ -11,13 +11,11 @@ class SSRAPIs extends React.Component {
Gatsby Server Rendering APIs
APIs
- {this.props.data.allDocumentationJs.edges.map(({ node }, i) =>
+ {this.props.data.allDocumentationJs.edges.map(({ node }, i) => (
-
-
- {node.name}
-
+ {node.name}
- )}
+ ))}
diff --git a/www/src/pages/index.js b/www/src/pages/index.js
index af06cffaa178e..a443bda961bd9 100644
--- a/www/src/pages/index.js
+++ b/www/src/pages/index.js
@@ -183,9 +183,9 @@ const IndexRoute = React.createClass({
>
Latest from the Gatsby blog
- {blogPosts.edges.map(({ node }) =>
+ {blogPosts.edges.map(({ node }) => (
- )}
+ ))}
diff --git a/www/src/pages/tutorial.js b/www/src/pages/tutorial.js
index 8bd4507f63bbd..6afb1d33ab285 100644
--- a/www/src/pages/tutorial.js
+++ b/www/src/pages/tutorial.js
@@ -2,7 +2,7 @@ import React from "react"
import Link from "gatsby-link"
import Container from "../components/container"
-export default () =>
+export default () => (
Gatsby.js Tutorial
@@ -48,3 +48,4 @@ export default () =>
+)
diff --git a/www/src/templates/template-blog-post.js b/www/src/templates/template-blog-post.js
index 2c551993acc23..dbcf9dd502057 100644
--- a/www/src/templates/template-blog-post.js
+++ b/www/src/templates/template-blog-post.js
@@ -8,7 +8,7 @@ import Container from "../components/container"
const BlogPostTemplate = React.createClass({
render() {
const post = this.props.data.markdownRemark
- const BioLine = ({ children }) =>
+ const BioLine = ({ children }) => (
{children}
+ )
return (
{/* Add long list of social meta tags */}
{post.frontmatter.title}
-
-
+
+
-
-
+
+
-
+
-
+
{post.frontmatter.author.id}
-
- {post.frontmatter.author.bio}
-
+ {post.frontmatter.author.bio}
{post.frontmatter.date} · {post.timeToRead} min read
diff --git a/www/src/templates/template-docs-markdown.js b/www/src/templates/template-docs-markdown.js
index 42369f50d9a35..23371442faf09 100644
--- a/www/src/templates/template-docs-markdown.js
+++ b/www/src/templates/template-docs-markdown.js
@@ -19,9 +19,7 @@ const DocsTemplate = React.createClass({
-
- {page.frontmatter.title}
-
+ {page.frontmatter.title}
{
- if (c === ``) return
- colors[pointer].push(c)
- switch (pointer) {
- case `a`:
- pointer = `b`
- break
- case `b`:
- pointer = `c`
- break
- case `c`:
- pointer = `a`
- break
- }
-})
+colorStr
+ .split(`\n`)
+ .reverse()
+ .forEach(c => {
+ if (c === ``) return
+ colors[pointer].push(c)
+ switch (pointer) {
+ case `a`:
+ pointer = `b`
+ break
+ case `b`:
+ pointer = `c`
+ break
+ case `c`:
+ pointer = `a`
+ break
+ }
+ })
module.exports = colors
diff --git a/yarn.lock b/yarn.lock
index 874de3c367283..0285d549f2293 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4494,9 +4494,9 @@ preserve@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/preserve/-/preserve-0.2.0.tgz#815ed1f6ebc65926f865b310c0713bcb3315ce4b"
-prettier-eslint-cli@^4.2.0:
- version "4.2.0"
- resolved "https://registry.yarnpkg.com/prettier-eslint-cli/-/prettier-eslint-cli-4.2.0.tgz#733e19efac70432c2ef989665c0e458985c62fd3"
+prettier-eslint-cli@^4.2.1:
+ version "4.2.1"
+ resolved "https://registry.yarnpkg.com/prettier-eslint-cli/-/prettier-eslint-cli-4.2.1.tgz#7a36dd4c8e2243f077f30c266ea6c90c616a09e8"
dependencies:
arrify "^1.0.1"
babel-runtime "^6.23.0"
@@ -4531,10 +4531,14 @@ prettier-eslint@^6.0.0:
pretty-format "^20.0.3"
require-relative "^0.8.7"
-prettier@^1.5.0, prettier@^1.5.3:
+prettier@^1.5.0:
version "1.5.3"
resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.5.3.tgz#59dadc683345ec6b88f88b94ed4ae7e1da394bfe"
+prettier@^1.6.0:
+ version "1.6.0"
+ resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.6.0.tgz#23e9c68251f440feb847f558821bead21765919a"
+
pretty-format@^20.0.3:
version "20.0.3"
resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-20.0.3.tgz#020e350a560a1fe1a98dc3beb6ccffb386de8b14"