Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0] housekeeping: run format + update snapshots #1006

Merged
merged 1 commit into from
May 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 17 additions & 15 deletions examples/client-only-paths/src/utils/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@ const options = {
baseLineHeight: 1.45,
blockMarginBottom: 0.75,
scaleRatio: 2.15,
overrideStyles: ({ rhythm, scale }, options) => ({
"h1,h2,h3,h4": {
lineHeight: 1.2,
},
[TABLET_MEDIA_QUERY]: {
// Make baseFontSize on mobile 17px.
html: {
fontSize: `${17 / 16 * 100}%`,
overrideStyles: ({ rhythm, scale }, options) => {
return {
"h1,h2,h3,h4": {
lineHeight: 1.2,
},
},
[MOBILE_MEDIA_QUERY]: {
// Make baseFontSize on mobile 16px.
html: {
fontSize: `${16 / 16 * 100}%`,
[TABLET_MEDIA_QUERY]: {
// Make baseFontSize on mobile 17px.
html: {
fontSize: `${17 / 16 * 100}%`,
},
},
},
}),
[MOBILE_MEDIA_QUERY]: {
// Make baseFontSize on mobile 16px.
html: {
fontSize: `${16 / 16 * 100}%`,
},
},
}
},
}

const typography = new Typography(options)
Expand Down
7 changes: 4 additions & 3 deletions examples/gatsbygram/src/components/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ class GatsbyGramModal extends React.Component {

findCurrentIndex() {
let index
index = findIndex(this.props.posts, post => {
return post.id === this.props.location.pathname.split(`/`)[1]
})
index = findIndex(
this.props.posts,
post => post.id === this.props.location.pathname.split(`/`)[1]
)

return index
}
Expand Down
50 changes: 24 additions & 26 deletions examples/gatsbygram/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,32 +128,30 @@ class Index extends React.Component {
</div>
</div>
{/* posts */}
{chunk(posts.slice(0, this.state.postsToShow), 3).map((chunk, i) => {
return (
<div
key={`chunk-${i}`}
css={{
display: `flex`,
alignItems: `stretch`,
flexShrink: 0,
flexDirection: `row`,
marginBottom: rhythm(1 / 8),
[presets.Tablet]: {
marginBottom: rhythm(1),
},
}}
>
{chunk.map(node => (
<Post
key={node.id}
post={node}
location={this.props.location}
onClick={post => this.setState({ activePost: post })}
/>
))}
</div>
)
})}
{chunk(posts.slice(0, this.state.postsToShow), 3).map((chunk, i) => (
<div
key={`chunk-${i}`}
css={{
display: `flex`,
alignItems: `stretch`,
flexShrink: 0,
flexDirection: `row`,
marginBottom: rhythm(1 / 8),
[presets.Tablet]: {
marginBottom: rhythm(1),
},
}}
>
{chunk.map(node => (
<Post
key={node.id}
post={node}
location={this.props.location}
onClick={post => this.setState({ activePost: post })}
/>
))}
</div>
))}
{!this.state.showingMore &&
<a
css={{
Expand Down
24 changes: 13 additions & 11 deletions examples/gatsbygram/src/utils/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,19 @@ const options = {
blockMarginBottom: 0.75,
headerFontFamily: [`Space Mono`, `sans-serif`],
bodyFontFamily: [`Space Mono`, `sans-serif`],
overrideStyles: () => ({
html: {
overflowY: `scroll`,
},
h1: {
lineHeight: 1.1,
},
a: {
color: `#3897f0`,
},
}),
overrideStyles: () => {
return {
html: {
overflowY: `scroll`,
},
h1: {
lineHeight: 1.1,
},
a: {
color: `#3897f0`,
},
}
},
}

const typography = new Typography(options)
Expand Down
4 changes: 1 addition & 3 deletions examples/hn/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ class Index extends React.Component {
console.log(this.props)
return (
<table border="0" className="itemlist" cellPadding={0} cellSpacing={0}>
{allHnStory.edges.map(({ node }) => {
return <StoryItem story={node} />
})}
{allHnStory.edges.map(({ node }) => <StoryItem story={node} />)}
<tr className="morespace" style={{ height: `10px` }} />
<tr>
<td style={{ paddingLeft: 36 }} className="title">
Expand Down
6 changes: 3 additions & 3 deletions examples/hn/src/templates/story.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ class Story extends React.Component {
</table>
<table border="0" className="comment-tree">
<tr className="athing comtr " id="14174940">
{flatComemnts.map(comment => {
return <StoryComment comment={comment} width={width} />
})}
{flatComemnts.map(comment => (
<StoryComment comment={comment} width={width} />
))}
</tr>
</table>
</div>
Expand Down
4 changes: 1 addition & 3 deletions examples/using-drupal/src/templates/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ class ArticleTemplate extends React.Component {
// Split text on new lnes and put into paragraph elements.
paragraphedBody = body
.split(`\n`)
.map(split => {
return `<p>${split}</p>`
})
.map(split => `<p>${split}</p>`)
.join(``)
}
return (
Expand Down
32 changes: 17 additions & 15 deletions examples/using-drupal/src/utils/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,25 @@ const options = {
baseLineHeight: 1.45,
blockMarginBottom: 0.75,
scaleRatio: 2.15,
overrideStyles: ({ rhythm, scale }, options) => ({
"h1,h2,h3,h4": {
lineHeight: 1.2,
},
[TABLET_MEDIA_QUERY]: {
// Make baseFontSize on mobile 17px.
html: {
fontSize: `${17 / 16 * 100}%`,
overrideStyles: ({ rhythm, scale }, options) => {
return {
"h1,h2,h3,h4": {
lineHeight: 1.2,
},
},
[MOBILE_MEDIA_QUERY]: {
// Make baseFontSize on mobile 16px.
html: {
fontSize: `${16 / 16 * 100}%`,
[TABLET_MEDIA_QUERY]: {
// Make baseFontSize on mobile 17px.
html: {
fontSize: `${17 / 16 * 100}%`,
},
},
},
}),
[MOBILE_MEDIA_QUERY]: {
// Make baseFontSize on mobile 16px.
html: {
fontSize: `${16 / 16 * 100}%`,
},
},
}
},
}

const typography = new Typography(options)
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@
"eslint-plugin-flow-vars": "^0.5.0",
"eslint-plugin-flowtype": "^2.32.1",
"eslint-plugin-import": "^2.2.0",
"eslint-plugin-jsx-a11y": "^5.0.1",
"eslint-plugin-prettier": "^2.0.1",
"eslint-plugin-jsx-a11y": "^5.0.3",
"eslint-plugin-prettier": "^2.1.1",
"eslint-plugin-react": "^7.0.0",
"flow-bin": "^0.42.0",
"glob": "^7.1.1",
"iflow-debug": "^1.0.15",
"iflow-lodash": "^1.1.24",
"iflow-react-router": "^1.2.1",
"jest": "^20.0.0",
"jest": "^20.0.3",
"lerna": "^2.0.0-rc.4",
"prettier-eslint-cli": "^3.4.2",
"prettier-eslint-cli": "^3.6.0",
"prop-types": "^15.5.8",
"purdy": "^2.2.1",
"remotedev-server": "^0.2.2",
Expand Down
6 changes: 1 addition & 5 deletions packages/gatsby-dev-cli/src/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ function watch(root, packages, { scanOnce, quiet }) {

chokidar
.watch(prefix, {
ignored: [
(path, stats) => {
return _.some(ignoreRegs, reg => reg.test(path))
},
],
ignored: [(path, stats) => _.some(ignoreRegs, reg => reg.test(path))],
})
.on(`all`, (event, path) => {
if (event === `change` || event === `add`) {
Expand Down
5 changes: 2 additions & 3 deletions packages/gatsby-plugin-glamor/src/gatsby-node.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
const webpack = require(`webpack`)

// Add Glamor support
exports.modifyWebpackConfig = ({ config }) => {
return config.plugin(`Glamor`, webpack.ProvidePlugin, [
exports.modifyWebpackConfig = ({ config }) =>
config.plugin(`Glamor`, webpack.ProvidePlugin, [
{
Glamor: `glamor-react`,
},
])
}

// Add Glamor support
exports.modifyBabelrc = ({ babelrc }) => {
Expand Down
94 changes: 46 additions & 48 deletions packages/gatsby-source-drupal/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@ const axios = require(`axios`)
const crypto = require(`crypto`)
const _ = require(`lodash`)

const makeTypeName = type => {
return `drupal__${type.replace(/-/g, `_`)}`
}
const makeTypeName = type => `drupal__${type.replace(/-/g, `_`)}`

const processEntities = ents => {
return ents.map(ent => {
const processEntities = ents =>
ents.map(ent => {
const newEnt = {
id: ent.id,
internal: {
Expand All @@ -25,7 +23,6 @@ const processEntities = ents => {

return newEnt
})
}

exports.sourceNodes = async (
{ boundActionCreators, getNode, hasNodeChanged, store },
Expand Down Expand Up @@ -116,48 +113,49 @@ exports.sourceNodes = async (
const userResult = await axios.get(userUrl)
const users = processEntities(userResult.data.data)
const blue = await Promise.all(
users.map((user, i) => {
return new Promise(resolve => {
const userStr = JSON.stringify(user)

const gatsbyUser = {
...user,
children: [],
parent: `__SOURCE__`,
internal: {
type: makeTypeName(user.internal.type),
content: userStr,
mediaType: `application/json`,
},
}

if (gatsbyUser.uid === 1) {
return resolve()
}

axios
.get(
userResult.data.data[i].relationships.user_picture.links.related,
{ timeout: 20000 }
)
.catch(() => console.log(`fail fetch`, gatsbyUser))
.then(pictureResult => {
gatsbyUser.picture = `http://dev-gatsbyjs-d8.pantheonsite.io${pictureResult.data.data.attributes.url}`

// Get content digest of node.
const contentDigest = crypto
.createHash(`md5`)
.update(JSON.stringify(gatsbyUser))
.digest(`hex`)

gatsbyUser.internal.contentDigest = contentDigest

createNode(gatsbyUser)

resolve()
})
})
})
users.map(
(user, i) =>
new Promise(resolve => {
const userStr = JSON.stringify(user)

const gatsbyUser = {
...user,
children: [],
parent: `__SOURCE__`,
internal: {
type: makeTypeName(user.internal.type),
content: userStr,
mediaType: `application/json`,
},
}

if (gatsbyUser.uid === 1) {
return resolve()
}

axios
.get(
userResult.data.data[i].relationships.user_picture.links.related,
{ timeout: 20000 }
)
.catch(() => console.log(`fail fetch`, gatsbyUser))
.then(pictureResult => {
gatsbyUser.picture = `http://dev-gatsbyjs-d8.pantheonsite.io${pictureResult.data.data.attributes.url}`

// Get content digest of node.
const contentDigest = crypto
.createHash(`md5`)
.update(JSON.stringify(gatsbyUser))
.digest(`hex`)

gatsbyUser.internal.contentDigest = contentDigest

createNode(gatsbyUser)

resolve()
})
})
)
)

updateSourcePluginStatus({
Expand Down
5 changes: 2 additions & 3 deletions packages/gatsby-source-hacker-news/src/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@ const crypto = require(`crypto`)
const url = require(`url`)
const _ = require(`lodash`)

const get = query => {
return axios.get(
const get = query =>
axios.get(
`https://www.graphqlhub.com/graphql?query=${encodeURIComponent(query)}`
)
}

exports.sourceNodes = async ({
boundActionCreators,
Expand Down
Loading