Skip to content

Commit

Permalink
Update prettier (#22520)
Browse files Browse the repository at this point in the history
* Update prettier to latest version

* Run 'yarn format' from root of project

* Remove prettier-ignore for nested markdown

* Fix starters

* Fix benchmarks

* Fix examples

* Fix integration-tests

* Update eslint-config-prettier & eslint-plugin-prettier

* Fix linting

* Update all .prettierrc

* Run Prettier on full codebase

* Remove unnecessary .prettierrc & .prettierignore files

* Update Prettier script

* Update snapshots

* Revert snapshot

* Revert "Update Prettier script"

This reverts commit 008eb99

* Update snapshot

* Update docs/blog/2018-08-09-swag-store/index.md

Co-Authored-By: Dima An <dmitriym44@gmail.com>

Co-authored-by: Dima An <dmitriym44@gmail.com>
  • Loading branch information
MichaelDeBoey and tbntdima committed Apr 15, 2020
1 parent 936fa40 commit ff911e2
Show file tree
Hide file tree
Showing 481 changed files with 138,269 additions and 138,471 deletions.
4 changes: 1 addition & 3 deletions .github/actions/high-priority-prs/src/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ const filter = (queues, team) => {
.map(node => {
if (node.requestedReviewer) {
tools.log.info(
`Review request for team ${node.requestedReviewer.name} on PR: ${
pr.title
}`
`Review request for team ${node.requestedReviewer.name} on PR: ${pr.title}`
)
return node.requestedReviewer.id
}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/high-priority-prs/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const teams = [
},
]

const start = async function() {
const start = async function () {
const data = await fetch()
if (data) {
const queues = processData(data)
Expand Down
13 changes: 5 additions & 8 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
module.exports = {
endOfLine: "lf",
arrowParens: "avoid",
semi: false,
singleQuote: false,
tabWidth: 2,
trailingComma: "es5",
overrides: [
{
// This file uses semicolons. It's needed here because `documentation`
Expand All @@ -16,10 +13,10 @@ module.exports = {
},
},
{
"files": "docs/**/*.md",
"options": {
"parser": "mdx"
}
files: "docs/**/*.md",
options: {
parser: "mdx",
},
},
],
}
4 changes: 1 addition & 3 deletions benchmarks/create-pages/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ module.exports = {
description: `The createPages benchmark`,
author: `@gatsbyjs`,
},
plugins: [
`gatsby-plugin-benchmark-reporting`,
],
plugins: [`gatsby-plugin-benchmark-reporting`],
}
272,414 changes: 136,207 additions & 136,207 deletions benchmarks/image-processing/plugins/gatsby-source-remote-images/urls.json

Large diffs are not rendered by default.

5 changes: 1 addition & 4 deletions benchmarks/markdown_id/md.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ module.exports = index => `${matter
title: faker.lorem.sentence(),
description: faker.lorem.sentence(),
path: `/${faker.helpers.slugify(faker.lorem.sentence())}`,
date: faker.date
.recent(1000)
.toISOString()
.slice(0, 10),
date: faker.date.recent(1000).toISOString().slice(0, 10),
tags: `[${faker.random
.words(3)
.split(` `)
Expand Down
5 changes: 1 addition & 4 deletions benchmarks/markdown_slug/md.tpl.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ module.exports = index => `${matter
title: faker.lorem.sentence(),
description: faker.lorem.sentence(),
path: `/${faker.helpers.slugify(faker.lorem.sentence())}`,
date: faker.date
.recent(1000)
.toISOString()
.slice(0, 10),
date: faker.date.recent(1000).toISOString().slice(0, 10),
tags: `[${faker.random
.words(3)
.split(` `)
Expand Down
4 changes: 0 additions & 4 deletions benchmarks/mdx/.prettierignore

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/mdx/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./styles.css"
import "./styles.css"
2 changes: 1 addition & 1 deletion benchmarks/mdx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"devDependencies": {
"cross-env": "^7.0.0",
"gatsby-plugin-benchmark-reporting": "*",
"prettier": "^1.19.1",
"prettier": "2.0.4",
"willit": "*"
},
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/mdx/src/pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const Index = ({ data }) => {
<Layout>
{data.site.siteMetadata.siteTitle}
<ul>
{data?.articles?.nodes.map(article => (
{data?.articles?.nodes.map((article) => (
<li>
<Link to={article.fields.path}>{article.frontmatter.title}</Link>
</li>
Expand Down
7 changes: 4 additions & 3 deletions benchmarks/plugin-manifest/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ async function runTest() {
)

console.info(
`\nRange execution time (hr): ${(Math.max(...results.nanoseconds) -
Math.min(...results.nanoseconds)) /
1000000}ms`
`\nRange execution time (hr): ${
(Math.max(...results.nanoseconds) - Math.min(...results.nanoseconds)) /
1000000
}ms`
)
}

Expand Down
4 changes: 0 additions & 4 deletions benchmarks/source-contentful/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions benchmarks/source-contentful/.prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/source-contentful/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"chalk": "^2.4.2",
"cross-env": "^7.0.0",
"gatsby-plugin-benchmark-reporting": "*",
"prettier": "^1.19.1",
"prettier": "2.0.4",
"yargs": "^15.3.1"
},
"repository": {
Expand Down
4 changes: 0 additions & 4 deletions benchmarks/source-datocms/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions benchmarks/source-datocms/.prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/source-datocms/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"cross-env": "^7.0.0",
"gatsby-plugin-benchmark-reporting": "*",
"prettier": "^1.19.1"
"prettier": "2.0.4"
},
"repository": {
"type": "git",
Expand Down
4 changes: 2 additions & 2 deletions benchmarks/source-datocms/src/templates/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const Article = ({ data }) => {
export default Article

export const query = graphql`
query($id: String!){
article: datoCmsArticle(id: {eq: $id }) {
query($id: String!) {
article: datoCmsArticle(id: { eq: $id }) {
title
body
image {
Expand Down
4 changes: 0 additions & 4 deletions benchmarks/source-drupal/.prettierignore

This file was deleted.

7 changes: 0 additions & 7 deletions benchmarks/source-drupal/.prettierrc

This file was deleted.

2 changes: 1 addition & 1 deletion benchmarks/source-drupal/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./styles.css"
import "./styles.css"
6 changes: 3 additions & 3 deletions benchmarks/source-drupal/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const kebabCase = require(`lodash.kebabcase`)
exports.onCreateNode = ({ actions, node }) => {
const { createNodeField } = actions

if (node.internal.type === 'node__article') {
if (node.internal.type === "node__article") {
createNodeField({ node, name: "slug", value: kebabCase(node.title) })
}
}
Expand Down Expand Up @@ -33,7 +33,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
component: require.resolve(`./src/templates/article.js`),
context: {
slug: article.fields.slug,
}
},
})
})
}
}
2 changes: 1 addition & 1 deletion benchmarks/source-drupal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"devDependencies": {
"cross-env": "^7.0.0",
"gatsby-plugin-benchmark-reporting": "*",
"prettier": "^1.19.1"
"prettier": "2.0.4"
},
"repository": {
"type": "git",
Expand Down
17 changes: 12 additions & 5 deletions benchmarks/source-drupal/src/templates/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ const Article = ({ data }) => {
<div>
<h2>{data.article.title}</h2>
{data.article.relationships.field_image.localFile.childImageSharp ? (
<Img fluid={data.article.relationships.field_image.localFile.childImageSharp.fluid} />
<Img
fluid={
data.article.relationships.field_image.localFile.childImageSharp
.fluid
}
/>
) : (
<div>Image can't be displayed</div>
)}
<div dangerouslySetInnerHTML={{ __html: data.article.body.processed }} />
<div
dangerouslySetInnerHTML={{ __html: data.article.body.processed }}
/>
</div>
</Layout>
)
Expand All @@ -23,8 +30,8 @@ const Article = ({ data }) => {
export default Article

export const query = graphql`
query($slug: String!){
article: nodeArticle(fields: {slug: {eq: $slug }}) {
query($slug: String!) {
article: nodeArticle(fields: { slug: { eq: $slug } }) {
title
body {
processed
Expand All @@ -42,4 +49,4 @@ export const query = graphql`
}
}
}
`
`
2 changes: 1 addition & 1 deletion benchmarks/source-wordpress/gatsby-browser.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
import "./styles.css"
import "./styles.css"
4 changes: 2 additions & 2 deletions benchmarks/source-wordpress/gatsby-node.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ exports.createPages = async ({ actions, graphql, reporter }) => {
component: require.resolve(`./src/templates/article.js`),
context: {
id: article.id,
}
},
})
})
}
}
2 changes: 1 addition & 1 deletion benchmarks/source-wordpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"devDependencies": {
"cross-env": "^7.0.0",
"gatsby-plugin-benchmark-reporting": "*",
"prettier": "^1.19.1"
"prettier": "2.0.4"
},
"repository": {
"type": "git",
Expand Down
18 changes: 9 additions & 9 deletions benchmarks/source-wordpress/src/templates/article.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@ export default Article

export const query = graphql`
query($id: String!) {
article: wpPost(id: { eq: $id } ) {
article: wpPost(id: { eq: $id }) {
title
content
featuredImage {
content
featuredImage {
remoteFile {
childImageSharp {
fluid(maxWidth: 960, quality: 90) {
...GatsbyImageSharpFluid_withWebp_tracedSVG
}
childImageSharp {
fluid(maxWidth: 960, quality: 90) {
...GatsbyImageSharpFluid_withWebp_tracedSVG
}
}
}
}
}
}
}
`
`
16 changes: 6 additions & 10 deletions docs/blog/2018-08-09-swag-store/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ We’ve spent the last couple weeks working the kinks out, and we couldn’t be
src="./images/gatsby-swag-twitter.jpg"
/>
<figcaption>
{/* prettier-ignore */}
Tweets from <a href="https://twitter.com/DeaNHtiD99/status/1023204484183416832">
Dean
</a>, <a href="https://twitter.com/ARebelBelle/status/1020044426712735744">
Elle
</a>, <a href="https://twitter.com/chaseadamsio/status/1021896138503245824">
Chase
</a>, and <a href="https://twitter.com/kato_katherine/status/1021967765400211456">
Katherine
</a> showing off their new Gatsby swag.
Tweets from
[Dean](https://twitter.com/DeaNHtiD99/status/1023204484183416832),
[Elle](https://twitter.com/ARebelBelle/status/1020044426712735744),
[Chase](https://twitter.com/chaseadamsio/status/1021896138503245824), and
[Katherine](https://twitter.com/kato_katherine/status/1021967765400211456)
showing off their new Gatsby swag.
</figcaption>
</figure>

Expand Down
5 changes: 3 additions & 2 deletions docs/blog/2018-12-17-turning-the-static-dynamic/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,9 @@ export default () => {
const content = { message: "", login: true }
const user = getUser()
if (isLoggedIn()) {
content.message = `Hello, ${user.user_metadata &&
user.user_metadata.full_name}`
content.message = `Hello, ${
user.user_metadata && user.user_metadata.full_name
}`
} else {
content.message = "You are not logged in"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,7 @@ export default function Contact() {
initialValues={{ email: ``, name: ``, message: `` }}
onSubmit={handleSubmit}
validationSchema={yup.object().shape({
email: yup
.string()
.email()
.required(),
email: yup.string().email().required(),
name: yup.string().required(),
message: yup.string().required(),
})}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ These files will be present in all Gatsby starters you use, so it's worth your t
"react-helmet": "^5.2.0"
},
"devDependencies": {
"prettier": "^1.16.4"
"prettier": "2.0.4"
},
"keywords": ["gatsby"],
"license": "MIT",
Expand Down Expand Up @@ -196,7 +196,7 @@ module.exports = {
"**/users",
],
excludedRoutes: [],
normalizer: function({ entities }) {
normalizer: function ({ entities }) {
return entities
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ module.exports = {
"**/*/*/menu-locations", // <== Menu api endpoint
],
excludedRoutes: [],
normalizer: function({ entities }) {
normalizer: function ({ entities }) {
return entities
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ Here's my new array of objects with the properties matching the first row.
Next, I'd like for my comma-separated strings of tags (column I) to be arrays of tags (so I can `.map` over them in my React UI). This code allows me to do that:

```javascript
let itemsArrayWithTagsArray = rows.map(function(item) {
let itemsArrayWithTagsArray = rows.map(function (item) {
item.tags = item.tags.split(",").map(item => item.trim())
item = { ...item }
return item
Expand Down
Loading

0 comments on commit ff911e2

Please sign in to comment.