Skip to content

Commit

Permalink
Update to Prettier 1.6.0 + add .prettierrc (gatsbyjs#1948)
Browse files Browse the repository at this point in the history
* Update to Prettier 1.6.0 + add .prettierrc

* Update test
  • Loading branch information
KyleAMathews authored Aug 28, 2017
1 parent 7acc4e8 commit 0675e27
Show file tree
Hide file tree
Showing 76 changed files with 417 additions and 349 deletions.
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"trailingComma": "es5",
"semi": false
}
11 changes: 7 additions & 4 deletions examples/client-only-paths/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class AnimationExample extends React.Component {
return (
<div style={{ position: `relative`, minHeight: `80vh` }}>
<Route
render={({ location }) =>
render={({ location }) => (
<div style={styles.fill}>
<Route
exact
Expand Down Expand Up @@ -45,19 +45,21 @@ class AnimationExample extends React.Component {
/>
</ReactCSSTransitionGroup>
</div>
</div>}
</div>
)}
/>
</div>
)
}
}

const NavLink = props =>
const NavLink = props => (
<li style={styles.navItem}>
<Link {...props} style={{ color: `inherit` }} />
</li>
)

const HSL = ({ match: { params } }) =>
const HSL = ({ match: { params } }) => (
<div
style={{
...styles.fill,
Expand All @@ -67,6 +69,7 @@ const HSL = ({ match: { params } }) =>
>
hsl({params.h}, {params.s}%, {params.l}%)
</div>
)

const styles = {}

Expand Down
6 changes: 1 addition & 5 deletions examples/feed/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import React from "react"

export default class DefaultLayout extends React.Component {
render() {
return (
<div>
{this.props.children()}
</div>
)
return <div>{this.props.children()}</div>
}
}
3 changes: 2 additions & 1 deletion examples/feed/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import React from "react"

const IndexRoute = () =>
const IndexRoute = () => (
<div>
<p>
Welcome to the GatsbyJS RSS Demo.
<a href="/rss.xml">Click here</a>
to see the generated RSS Feed.
</p>
</div>
)

export default IndexRoute
6 changes: 4 additions & 2 deletions examples/gatsbygram/src/components/post-detail.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class PostDetail extends React.Component {

const { big } = bigImage.childImageSharp

const UserBar = () =>
const UserBar = () => (
<div
css={{
[presets.Tablet]: {
Expand Down Expand Up @@ -50,8 +50,9 @@ class PostDetail extends React.Component {
{username}
</h5>
</div>
)

const PostDetails = () =>
const PostDetails = () => (
<div
css={{
...scale(-2 / 5),
Expand Down Expand Up @@ -84,6 +85,7 @@ class PostDetail extends React.Component {
<strong>{username}</strong> {text}
</div>
</div>
)

return (
<div
Expand Down
5 changes: 3 additions & 2 deletions examples/gatsbygram/src/components/post.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class Post extends React.Component {
/>
</div>
{/* overlay */}
{this.state.hovering &&
{this.state.hovering && (
<div
css={{
position: `absolute`,
Expand All @@ -118,7 +118,8 @@ class Post extends React.Component {
/>
{` `}
{likes}
</div>}
</div>
)}
</Link>
)
}
Expand Down
19 changes: 11 additions & 8 deletions examples/gatsbygram/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,22 @@ class DefaultLayout extends React.Component {
}}
>
<div>
{isModal
? this.props.children({
...this.props,
location: { pathname: `/` },
})
: this.props.children()}
{isModal ? (
this.props.children({
...this.props,
location: { pathname: `/` },
})
) : (
this.props.children()
)}
</div>

<div>
{isModal &&
{isModal && (
<Modal isOpen={true} posts={this.posts} location={location}>
{this.props.children}
</Modal>}
</Modal>
)}
</div>
</div>
</div>
Expand Down
13 changes: 7 additions & 6 deletions examples/gatsbygram/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ class Index extends React.Component {
</div>
</div>
{/* posts */}
{chunk(posts.slice(0, this.state.postsToShow), 3).map((chunk, i) =>
{chunk(posts.slice(0, this.state.postsToShow), 3).map((chunk, i) => (
<div
key={`chunk-${i}`}
css={{
Expand All @@ -142,17 +142,17 @@ class Index extends React.Component {
},
}}
>
{chunk.map(node =>
{chunk.map(node => (
<Post
key={node.id}
post={node}
location={this.props.location}
onClick={post => this.setState({ activePost: post })}
/>
)}
))}
</div>
)}
{!this.state.showingMore &&
))}
{!this.state.showingMore && (
<a
css={{
...scale(-0.5),
Expand Down Expand Up @@ -188,7 +188,8 @@ class Index extends React.Component {
}}
>
Load More
</a>}
</a>
)}
</div>
)
}
Expand Down
8 changes: 2 additions & 6 deletions examples/hn/src/components/story-comment.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@ class StoryComment extends React.Component {
<td className="default">
<div style={{ marginTop: 2, marginBottom: -10 }}>
<span className="comhead">
<strong>
{comment.by}
</strong>
<strong>{comment.by}</strong>
{` `}
<span className="age">
{comment.timeISO}
</span>
<span className="age">{comment.timeISO}</span>
</span>
</div>
<br />
Expand Down
8 changes: 2 additions & 6 deletions examples/hn/src/components/story-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ class StoryItem extends React.Component {
}}
className="title"
>
<span className="rank">
{story.order}.
</span>
<span className="rank">{story.order}.</span>
</td>
<td className="title">
<a href={story.url} className="storylink">
Expand All @@ -46,9 +44,7 @@ class StoryItem extends React.Component {
</a>
{` `}
<span className="age">
<Link to={`/item/${story.id}/`}>
{story.timeISO}
</Link>
<Link to={`/item/${story.id}/`}>{story.timeISO}</Link>
</span>
{` `}
<span id={`unv_${story.id}`} />
Expand Down
4 changes: 1 addition & 3 deletions examples/hn/src/layouts/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,7 @@ class DefaultLayout extends React.Component {
</tr>
<tr style={{ height: `10px` }} />
<tr>
<td>
{this.props.children()}
</td>
<td>{this.props.children()}</td>
</tr>
<tr>
<td>
Expand Down
8 changes: 3 additions & 5 deletions examples/hn/src/templates/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,7 @@ class Story extends React.Component {
</a>
{` `}
<span className="age">
<Link to={`/item/${story.id}/`}>
{story.timeISO}
</Link>
<Link to={`/item/${story.id}/`}>{story.timeISO}</Link>
</span>
{` `}
|
Expand All @@ -84,9 +82,9 @@ class Story extends React.Component {
</table>
<table border="0" className="comment-tree">
<tr className="athing comtr " id="14174940">
{flatComemnts.map(comment =>
{flatComemnts.map(comment => (
<StoryComment comment={comment} width={width} />
)}
))}
</tr>
</table>
</div>
Expand Down
4 changes: 2 additions & 2 deletions examples/image-processing/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ class Index extends React.Component {
</h3>

<ul style={styles.ul}>
{images.map(image =>
{images.map(image => (
<li style={styles.thumbnail} key={image.node.resize.src}>
<img src={image.node.resize.src} />
</li>
)}
))}
</ul>

<p
Expand Down
7 changes: 3 additions & 4 deletions examples/redux/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ import PropTypes from "prop-types"
import Link from "gatsby-link"
import { connect } from "react-redux"

const Counter = ({ count, increment }) =>
const Counter = ({ count, increment }) => (
<div>
<p>
Count: {count}
</p>
<p>Count: {count}</p>
<button onClick={increment}>Increment</button>
</div>
)

Counter.propTypes = {
count: PropTypes.number.isRequired,
Expand Down
6 changes: 1 addition & 5 deletions examples/sitemap/src/layouts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import React from "react"

export default class DefaultLayout extends React.Component {
render() {
return (
<div>
{this.props.children()}
</div>
)
return <div>{this.props.children()}</div>
}
}
3 changes: 2 additions & 1 deletion examples/sitemap/src/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React from "react"

const IndexRoute = () =>
const IndexRoute = () => (
<div>
<p>
Welcome to the GatsbyJS Sitemap Demo. Visit{` `}
<a href="/sitemap.xml">to see the generated sitemap.</a>
</p>
</div>
)

export default IndexRoute
16 changes: 8 additions & 8 deletions examples/using-contentful/src/pages/image-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default props => {
options
</p>
<h2>Resize</h2>
{assets.map(({ node: { title, resize } }) =>
{assets.map(({ node: { title, resize } }) => (
<img
alt={title}
src={resize.src}
Expand All @@ -29,7 +29,7 @@ export default props => {
border: `1px solid tomato`,
}}
/>
)}
))}
<h4>GraphQL query</h4>
<pre style={{ background: `#efeded`, padding: rhythm(3 / 4) }}>
<code
Expand Down Expand Up @@ -67,7 +67,7 @@ export default props => {
<p>
You should prefer this operator over <code>resize</code>.
</p>
{assets.map(({ node: { title, responsiveResolution } }) =>
{assets.map(({ node: { title, responsiveResolution } }) => (
<img
alt={title}
src={responsiveResolution.src}
Expand All @@ -80,7 +80,7 @@ export default props => {
border: `1px solid tomato`,
}}
/>
)}
))}
<h4>GraphQL query</h4>
<pre style={{ background: `#efeded`, padding: rhythm(3 / 4) }}>
<code
Expand Down Expand Up @@ -122,7 +122,7 @@ export default props => {
resizing focus area
</a>
</p>
{assets.map(({ node: { title, resizing } }) =>
{assets.map(({ node: { title, resizing } }) => (
<img
alt={title}
src={resizing.src}
Expand All @@ -135,7 +135,7 @@ export default props => {
border: `1px solid tomato`,
}}
/>
)}
))}
<h4>GraphQL query</h4>
<pre style={{ background: `#efeded`, padding: rhythm(3 / 4) }}>
<code
Expand Down Expand Up @@ -171,7 +171,7 @@ export default props => {
specify a <code>maxWidth</code>, the max width the container of the
images reaches.
</p>
{assets.map(({ node: { title, responsiveSizes } }) =>
{assets.map(({ node: { title, responsiveSizes } }) => (
<img
alt={title}
src={responsiveSizes.src}
Expand All @@ -183,7 +183,7 @@ export default props => {
border: `1px solid tomato`,
}}
/>
)}
))}
<h4>GraphQL query</h4>
<pre style={{ background: `#efeded`, padding: rhythm(3 / 4) }}>
<code
Expand Down
Loading

0 comments on commit 0675e27

Please sign in to comment.