Skip to content

Commit e1f1a98

Browse files
lipispieh
authored andcommitted
chore: Format JS Files (gatsbyjs#8623)
After we merge gatsbyjs#8427
1 parent 9cc8f4d commit e1f1a98

File tree

84 files changed

+564
-491
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+564
-491
lines changed

benchmarks/markdown/gatsby-config.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
22
plugins: [`gatsby-transformer-remark`],
3-
};
3+
}

benchmarks/markdown/page-template.js

+14-7
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,30 @@
11
const faker = require(`faker`)
22
const matter = require(`gray-matter`)
33

4-
const NUM_ROWS = parseInt(process.env.NUM_ROWS || 25, 10);
4+
const NUM_ROWS = parseInt(process.env.NUM_ROWS || 25, 10)
55

66
module.exports = index => `
7-
${matter.stringify(``, {
8-
title: faker.lorem.sentence(),
9-
slug: `/${faker.helpers.slugify(faker.lorem.sentence())}`
10-
}).trim()}
7+
${matter
8+
.stringify(``, {
9+
title: faker.lorem.sentence(),
10+
slug: `/${faker.helpers.slugify(faker.lorem.sentence())}`,
11+
})
12+
.trim()}
1113
1214
## Page #${index}
1315
1416
### API
1517
1618
|Name|Description|Required|
1719
|:--:|-----------|--------|
18-
${new Array(faker.random.number(NUM_ROWS)).fill(undefined).map(() => `
20+
${new Array(faker.random.number(NUM_ROWS))
21+
.fill(undefined)
22+
.map(() =>
23+
`
1924
|${faker.lorem.word()}|${faker.lorem.sentence()}|${faker.random.boolean()}|
20-
`.trim()).join('\n')}
25+
`.trim()
26+
)
27+
.join(`\n`)}
2128
2229
### More Detail
2330

e2e-tests/gatsby-image/cypress/integration/fixed.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ describe(`fixed`, () => {
2525
// TODO: figure out why these tests are failing
2626
it(`applies 1x/2x/3x`, () => {
2727
cy.getTestElement(fixedTestId)
28-
.find('picture > source')
29-
.should('have.attr', 'srcset')
28+
.find(`picture > source`)
29+
.should(`have.attr`, `srcset`)
3030
.and(srcset => {
3131
;[`1x`, `2x`, `3x`].forEach(size => {
3232
expect(srcset).contains(size)

e2e-tests/gatsby-image/gatsby-config.js

+16-16
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
const path = require('path')
1+
const path = require(`path`)
22

33
module.exports = {
4-
pathPrefix: '/blog',
4+
pathPrefix: `/blog`,
55
siteMetadata: {
6-
title: 'Gatsby Image e2e',
6+
title: `Gatsby Image e2e`,
77
},
88
plugins: [
9-
'gatsby-plugin-react-helmet',
9+
`gatsby-plugin-react-helmet`,
1010
{
11-
resolve: 'gatsby-source-filesystem',
11+
resolve: `gatsby-source-filesystem`,
1212
options: {
13-
name: 'images',
14-
path: path.join(__dirname, 'content/images'),
13+
name: `images`,
14+
path: path.join(__dirname, `content/images`),
1515
},
1616
},
17-
'gatsby-transformer-sharp',
18-
'gatsby-plugin-sharp',
17+
`gatsby-transformer-sharp`,
18+
`gatsby-plugin-sharp`,
1919
{
2020
resolve: `gatsby-plugin-manifest`,
2121
options: {
22-
name: 'gatsby-starter-default',
23-
short_name: 'starter',
24-
start_url: '/',
25-
background_color: '#663399',
26-
theme_color: '#663399',
27-
display: 'minimal-ui',
28-
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
22+
name: `gatsby-starter-default`,
23+
short_name: `starter`,
24+
start_url: `/`,
25+
background_color: `#663399`,
26+
theme_color: `#663399`,
27+
display: `minimal-ui`,
28+
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
2929
},
3030
},
3131
],

e2e-tests/path-prefix/cypress/integration/navigate.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ const { pathPrefix } = require(`../../gatsby-config`)
33

44
const withTrailingSlash = url => `${url}/`
55

6-
describe('navigate', () => {
6+
describe(`navigate`, () => {
77
beforeEach(() => {
88
cy.visit(`/`).waitForAPI(`onRouteUpdate`)
99
})
1010

1111
it(`uses pathPrefix`, () => {
12-
cy.getTestElement('page-2-button-link')
12+
cy.getTestElement(`page-2-button-link`)
1313
.click()
1414
.location(`pathname`)
1515
.should(`eq`, withTrailingSlash(`${pathPrefix}/page-2`))
1616
})
1717

1818
it(`can navigate back after using`, () => {
19-
cy.getTestElement('page-2-button-link')
19+
cy.getTestElement(`page-2-button-link`)
2020
.click()
21-
.getTestElement('index-link')
21+
.getTestElement(`index-link`)
2222
.click()
2323
.location(`pathname`)
2424
.should(`eq`, withTrailingSlash(pathPrefix))

e2e-tests/path-prefix/gatsby-config.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
module.exports = {
2-
pathPrefix: '/blog',
2+
pathPrefix: `/blog`,
33
siteMetadata: {
4-
title: 'Gatsby Default Starter',
4+
title: `Gatsby Default Starter`,
55
},
66
plugins: [
7-
'gatsby-plugin-react-helmet',
7+
`gatsby-plugin-react-helmet`,
88
{
99
resolve: `gatsby-plugin-manifest`,
1010
options: {
11-
name: 'gatsby-starter-default',
12-
short_name: 'starter',
13-
start_url: '/',
14-
background_color: '#663399',
15-
theme_color: '#663399',
16-
display: 'minimal-ui',
17-
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
11+
name: `gatsby-starter-default`,
12+
short_name: `starter`,
13+
start_url: `/`,
14+
background_color: `#663399`,
15+
theme_color: `#663399`,
16+
display: `minimal-ui`,
17+
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
1818
},
1919
},
2020
],

e2e-tests/production-runtime/gatsby-config.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
module.exports = {
22
siteMetadata: {
3-
title: 'Gatsby Default Starter',
3+
title: `Gatsby Default Starter`,
44
},
55
plugins: [
6-
'gatsby-plugin-react-helmet',
6+
`gatsby-plugin-react-helmet`,
77
{
88
resolve: `gatsby-plugin-manifest`,
99
options: {
10-
name: 'gatsby-starter-default',
11-
short_name: 'starter',
12-
start_url: '/',
13-
background_color: '#663399',
14-
theme_color: '#663399',
15-
display: 'minimal-ui',
16-
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
10+
name: `gatsby-starter-default`,
11+
short_name: `starter`,
12+
start_url: `/`,
13+
background_color: `#663399`,
14+
theme_color: `#663399`,
15+
display: `minimal-ui`,
16+
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
1717
},
1818
},
1919
],

examples/gatsbygram/scrape.js

+11-7
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const bar = new ProgressBar(
3535
mkdirp.sync(`./data/images`)
3636

3737
let posts = []
38-
let userId
38+
let userId
3939

4040
// Write json
4141
const saveJSON = _ =>
@@ -45,16 +45,17 @@ const getPosts = maxId => {
4545
let url = `https://www.instagram.com/${username}/?__a=1`
4646
let url2 = `https://www.instagram.com/graphql/query/?query_hash=472f257a40c653c64c666ce877d59d2b`
4747

48-
if (maxId) url = url2 + `&variables={"id":"${userId}","first":12,"after":"${maxId}"}`
48+
if (maxId)
49+
url = url2 + `&variables={"id":"${userId}","first":12,"after":"${maxId}"}`
4950

5051
request(url, { encoding: `utf8` }, (err, res, body) => {
5152
if (err) console.log(`error: ${err}`)
5253
if (maxId) {
53-
body = JSON.parse(body).data
54+
body = JSON.parse(body).data
5455
} else {
55-
//This is the first request, lets get the userId
56-
body = JSON.parse(body).graphql
57-
userId = body.user.id
56+
//This is the first request, lets get the userId
57+
body = JSON.parse(body).graphql
58+
userId = body.user.id
5859
}
5960
body.user.edge_owner_to_timeline_media.edges
6061
.filter(({ node: item }) => item[`__typename`] === `GraphImage`)
@@ -85,7 +86,10 @@ const getPosts = maxId => {
8586
posts.push(item)
8687
})
8788

88-
const lastId = get(body, `user.edge_owner_to_timeline_media.page_info.end_cursor`)
89+
const lastId = get(
90+
body,
91+
`user.edge_owner_to_timeline_media.page_info.end_cursor`
92+
)
8993
if (posts.length < 100 && lastId) getPosts(lastId)
9094
else saveJSON()
9195
})

examples/gatsbygram/utils/download-file.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
1-
var fs = require("fs")
2-
var request = require("request")
1+
var fs = require(`fs`)
2+
var request = require(`request`)
33

44
module.exports = function(url, dest, cb) {
55
var file = fs.createWriteStream(dest)
66
var sendReq = request.get(url)
77

88
// verify response code
9-
sendReq.on("response", function(response) {
9+
sendReq.on(`response`, function(response) {
1010
if (response.statusCode !== 200) {
11-
return cb("Response status was " + response.statusCode)
11+
return cb(`Response status was ` + response.statusCode)
1212
}
1313
})
1414

1515
// check for request errors
16-
sendReq.on("error", function(err) {
16+
sendReq.on(`error`, function(err) {
1717
fs.unlink(dest)
1818

1919
if (cb) {
@@ -23,11 +23,11 @@ module.exports = function(url, dest, cb) {
2323

2424
sendReq.pipe(file)
2525

26-
file.on("finish", function() {
26+
file.on(`finish`, function() {
2727
file.close(cb) // close() is async, call cb after close completes.
2828
})
2929

30-
file.on("error", function(err) {
30+
file.on(`error`, function(err) {
3131
// Handle errors
3232
fs.unlink(dest)
3333

examples/using-emotion/src/pages/index.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,8 @@ const IndexPage = () => (
6666
</Helmet>
6767
<Wrapper>
6868
<h1 className={title}>
69-
Hello World, this is my first component styled with{" "}
69+
Hello World, this is my first component styled with
70+
{` `}
7071
<a href="https://emotion.sh/">emotion</a>!
7172
</h1>
7273
<p className={subtitle}>

examples/using-gatsby-source-graphql/components/BlogPost.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export default ({ data }) => {
77
return (
88
<div>
99
<h1>{blogPost.title}</h1>
10-
<div>Posted at: {dateformat(blogPost.createdAt, "fullDate")}</div>
10+
<div>Posted at: {dateformat(blogPost.createdAt, `fullDate`)}</div>
1111
<ReactMarkdown source={blogPost.post} />
1212
</div>
1313
)

examples/using-gatsby-source-graphql/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default ({ data }) => (
88
{data.cms.blogPosts.map((blog, i) => (
99
<a key={i} href={makeBlogPath(blog)}>
1010
<h2>
11-
{dateformat(blog.createdAt, "fullDate")} - {blog.title}
11+
{dateformat(blog.createdAt, `fullDate`)} - {blog.title}
1212
</h2>
1313
</a>
1414
))}

examples/using-gatsby-source-graphql/pages/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export default ({ data }) => (
88
{data.cms.blogPosts.map((blog, i) => (
99
<a key={i} href={makeBlogPath(blog)}>
1010
<h2>
11-
{dateformat(blog.createdAt, "fullDate")} - {blog.title}
11+
{dateformat(blog.createdAt, `fullDate`)} - {blog.title}
1212
</h2>
1313
</a>
1414
))}
+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
module.exports = 'test-file-stub'
1+
module.exports = `test-file-stub`

examples/using-jest/__mocks__/gatsby.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
const React = require('react')
2-
const gatsby = jest.requireActual('gatsby')
1+
const React = require(`react`)
2+
const gatsby = jest.requireActual(`gatsby`)
33

44
module.exports = {
55
...gatsby,
66
graphql: jest.fn(),
77
Link: jest.fn().mockImplementation(({ to, ...rest }) =>
8-
React.createElement('a', {
8+
React.createElement(`a`, {
99
...rest,
1010
href: to,
1111
})

examples/using-jest/gatsby-config.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,30 @@
11
module.exports = {
22
siteMetadata: {
3-
title: 'Gatsby Default Starter',
3+
title: `Gatsby Default Starter`,
44
},
55
plugins: [
6-
'gatsby-plugin-react-helmet',
6+
`gatsby-plugin-react-helmet`,
77
{
88
resolve: `gatsby-source-filesystem`,
99
options: {
1010
name: `images`,
1111
path: `${__dirname}/src/images`,
1212
},
1313
},
14-
'gatsby-transformer-sharp',
15-
'gatsby-plugin-sharp',
14+
`gatsby-transformer-sharp`,
15+
`gatsby-plugin-sharp`,
1616
{
1717
resolve: `gatsby-plugin-manifest`,
1818
options: {
19-
name: 'gatsby-starter-default',
20-
short_name: 'starter',
21-
start_url: '/',
22-
background_color: '#663399',
23-
theme_color: '#663399',
24-
display: 'minimal-ui',
25-
icon: 'src/images/gatsby-icon.png', // This path is relative to the root of the site.
19+
name: `gatsby-starter-default`,
20+
short_name: `starter`,
21+
start_url: `/`,
22+
background_color: `#663399`,
23+
theme_color: `#663399`,
24+
display: `minimal-ui`,
25+
icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
2626
},
2727
},
28-
'gatsby-plugin-offline',
28+
`gatsby-plugin-offline`,
2929
],
3030
}
+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
const babelOptions = {
2-
presets: ['babel-preset-gatsby'],
2+
presets: [`babel-preset-gatsby`],
33
}
44

5-
module.exports = require('babel-jest').createTransformer(babelOptions)
5+
module.exports = require(`babel-jest`).createTransformer(babelOptions)

0 commit comments

Comments
 (0)