Skip to content

Commit dde4eac

Browse files
committed
Fix lint errors
1 parent 65697f9 commit dde4eac

File tree

9 files changed

+301
-247
lines changed

9 files changed

+301
-247
lines changed

packages/gatsby-plugin-cxs/src/__tests__/gatsby-node.js

+6-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import { pluginOptionsSchema } from "../gatsby-node"
55
it(`should provide meaningful errors when fields are invalid`, async () => {
66
const expectedErrors = [`"optionA" is not allowed`]
77

8-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
9-
optionA: `This options shouldn't exist`,
10-
})
8+
const { isValid, errors } = await testPluginOptionsSchema(
9+
pluginOptionsSchema,
10+
{
11+
optionA: `This options shouldn't exist`,
12+
}
13+
)
1114

1215
expect(isValid).toBe(false)
1316
expect(errors).toEqual(expectedErrors)

packages/gatsby-plugin-manifest/src/__tests__/gatsby-node.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -532,7 +532,10 @@ describe(`Test plugin manifest options`, () => {
532532

533533
describe(`pluginOptionsSchema`, () => {
534534
it(`validates options correctly`, async () => {
535-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, manifestOptions)
535+
const { isValid, errors } = await testPluginOptionsSchema(
536+
pluginOptionsSchema,
537+
manifestOptions
538+
)
536539

537540
expect(isValid).toBe(true)
538541
expect(errors).toEqual([])

packages/gatsby-plugin-mdx/__tests__/gatsby-node.js

+42-36
Original file line numberDiff line numberDiff line change
@@ -18,49 +18,55 @@ describe(`pluginOptionsSchema`, () => {
1818
`"shouldBlockNodeFromTransformation" must have an arity lesser or equal to 1`,
1919
]
2020

21-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
22-
extensions: [1, 2, 3],
23-
defaultLayouts: `this should be an object`,
24-
gatsbyRemarkPlugins: [1, { not: `existing prop` }, `valid one`],
25-
remarkPlugins: `this should be an array of object`,
26-
rehypePlugins: `this should be an array of object`,
27-
plugins: [2],
28-
mediaTypes: [1, 2],
29-
shouldBlockNodeFromTransformation: (wrong, number) => null,
30-
})
21+
const { isValid, errors } = await testPluginOptionsSchema(
22+
pluginOptionsSchema,
23+
{
24+
extensions: [1, 2, 3],
25+
defaultLayouts: `this should be an object`,
26+
gatsbyRemarkPlugins: [1, { not: `existing prop` }, `valid one`],
27+
remarkPlugins: `this should be an array of object`,
28+
rehypePlugins: `this should be an array of object`,
29+
plugins: [2],
30+
mediaTypes: [1, 2],
31+
shouldBlockNodeFromTransformation: (wrong, number) => null,
32+
}
33+
)
3134

3235
expect(isValid).toBe(false)
3336
expect(errors).toEqual(expectedErrors)
3437
})
3538

3639
it(`should validate the schema`, async () => {
37-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
38-
extensions: [`.mdx`, `.mdxx`],
39-
defaultLayouts: {
40-
posts: `../post-layout.js`,
41-
default: `../default-layout.js`,
42-
},
43-
gatsbyRemarkPlugins: [
44-
{
45-
resolve: `gatsby-remark-images`,
46-
options: {
47-
maxWidth: 590,
48-
},
40+
const { isValid, errors } = await testPluginOptionsSchema(
41+
pluginOptionsSchema,
42+
{
43+
extensions: [`.mdx`, `.mdxx`],
44+
defaultLayouts: {
45+
posts: `../post-layout.js`,
46+
default: `../default-layout.js`,
4947
},
50-
`gatsby-remark-other-plugin`,
51-
],
52-
remarkPlugins: [
53-
require(`../gatsby-node.js`),
54-
[require(`../gatsby-node.js`), { target: false }],
55-
],
56-
plugins: [{ resolve: `remark-autolink-plugin` }],
57-
rehypePlugins: [
58-
require(`../gatsby-node.js`),
59-
[require(`../gatsby-node.js`), { behavior: `wrap` }],
60-
],
61-
mediaTypes: [`text/markdown`, `text/x-markdown`, `custom-media/type`],
62-
shouldBlockNodeFromTransformation: node => Boolean(node),
63-
})
48+
gatsbyRemarkPlugins: [
49+
{
50+
resolve: `gatsby-remark-images`,
51+
options: {
52+
maxWidth: 590,
53+
},
54+
},
55+
`gatsby-remark-other-plugin`,
56+
],
57+
remarkPlugins: [
58+
require(`../gatsby-node.js`),
59+
[require(`../gatsby-node.js`), { target: false }],
60+
],
61+
plugins: [{ resolve: `remark-autolink-plugin` }],
62+
rehypePlugins: [
63+
require(`../gatsby-node.js`),
64+
[require(`../gatsby-node.js`), { behavior: `wrap` }],
65+
],
66+
mediaTypes: [`text/markdown`, `text/x-markdown`, `custom-media/type`],
67+
shouldBlockNodeFromTransformation: node => Boolean(node),
68+
}
69+
)
6470

6571
expect(isValid).toBe(true)
6672
expect(errors).toEqual([])

packages/gatsby-plugin-netlify/src/__tests__/gatsby-node.js

+27-21
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,39 @@ describe(`gatsby-node.js`, () => {
1313
`"generateMatchPathRewrites" must be a boolean`,
1414
]
1515

16-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
17-
headers: `this should be an object`,
18-
allPageHeaders: `this should be an array`,
19-
mergeSecurityHeaders: `this should be a boolean`,
20-
mergeLinkHeaders: `this should be a boolean`,
21-
mergeCachingHeaders: `this should be a boolean`,
22-
transformHeaders: (too, many, args) => ``,
23-
generateMatchPathRewrites: `this should be a boolean`,
24-
})
16+
const { isValid, errors } = await testPluginOptionsSchema(
17+
pluginOptionsSchema,
18+
{
19+
headers: `this should be an object`,
20+
allPageHeaders: `this should be an array`,
21+
mergeSecurityHeaders: `this should be a boolean`,
22+
mergeLinkHeaders: `this should be a boolean`,
23+
mergeCachingHeaders: `this should be a boolean`,
24+
transformHeaders: (too, many, args) => ``,
25+
generateMatchPathRewrites: `this should be a boolean`,
26+
}
27+
)
2528

2629
expect(isValid).toBe(false)
2730
expect(errors).toEqual(expectedErrors)
2831
})
2932

3033
it(`should validate the schema`, async () => {
31-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
32-
headers: {
33-
"/some-page": [`Bearer: Some-Magic-Token`],
34-
"/some-other-page": [`some`, `great`, `headers`],
35-
},
36-
allPageHeaders: [`First header`, `Second header`],
37-
mergeSecurityHeaders: true,
38-
mergeLinkHeaders: false,
39-
mergeCachingHeaders: true,
40-
transformHeaders: () => null,
41-
generateMatchPathRewrites: false,
42-
})
34+
const { isValid, errors } = await testPluginOptionsSchema(
35+
pluginOptionsSchema,
36+
{
37+
headers: {
38+
"/some-page": [`Bearer: Some-Magic-Token`],
39+
"/some-other-page": [`some`, `great`, `headers`],
40+
},
41+
allPageHeaders: [`First header`, `Second header`],
42+
mergeSecurityHeaders: true,
43+
mergeLinkHeaders: false,
44+
mergeCachingHeaders: true,
45+
transformHeaders: () => null,
46+
generateMatchPathRewrites: false,
47+
}
48+
)
4349

4450
expect(isValid).toBe(true)
4551
expect(errors).toEqual([])

packages/gatsby-plugin-offline/src/__tests__/gatsby-node.js

+64-58
Original file line numberDiff line numberDiff line change
@@ -133,72 +133,78 @@ describe(`pluginOptionsSchema`, () => {
133133
`"workboxConfig.clientsClaim" must be a boolean`,
134134
]
135135

136-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
137-
precachePages: [1, 2, 3],
138-
appendScript: 1223,
139-
debug: `This should be a boolean`,
140-
workboxConfig: {
141-
importWorkboxFrom: 123,
142-
globDirectory: 456,
143-
globPatterns: [1, 2, 3],
144-
modifyURLPrefix: {
145-
"/": 123,
146-
},
147-
cacheId: 123,
148-
dontCacheBustURLsMatching: `This should be a regexp`,
149-
runtimeCaching: [
150-
{
151-
urlPattern: /(\.js$|\.css$|static\/)/,
152-
handler: `Something Invalid`,
136+
const { isValid, errors } = await testPluginOptionsSchema(
137+
pluginOptionsSchema,
138+
{
139+
precachePages: [1, 2, 3],
140+
appendScript: 1223,
141+
debug: `This should be a boolean`,
142+
workboxConfig: {
143+
importWorkboxFrom: 123,
144+
globDirectory: 456,
145+
globPatterns: [1, 2, 3],
146+
modifyURLPrefix: {
147+
"/": 123,
153148
},
154-
2,
155-
3,
156-
],
157-
skipWaiting: `This should be a boolean`,
158-
clientsClaim: `This should be a boolean`,
159-
},
160-
})
149+
cacheId: 123,
150+
dontCacheBustURLsMatching: `This should be a regexp`,
151+
runtimeCaching: [
152+
{
153+
urlPattern: /(\.js$|\.css$|static\/)/,
154+
handler: `Something Invalid`,
155+
},
156+
2,
157+
3,
158+
],
159+
skipWaiting: `This should be a boolean`,
160+
clientsClaim: `This should be a boolean`,
161+
},
162+
}
163+
)
161164

162165
expect(isValid).toBe(false)
163166
expect(errors).toEqual(expectedErrors)
164167
})
165168

166169
it(`should validate the schema`, async () => {
167-
const { isValid, errors } = await testPluginOptionsSchema(pluginOptionsSchema, {
168-
precachePages: [`/about-us/`, `/projects/*`],
169-
appendScript: `src/custom-sw-code.js`,
170-
debug: true,
171-
workboxConfig: {
172-
importWorkboxFrom: `local`,
173-
globDirectory: `rootDir`,
174-
globPatterns: [`a`, `b`, `c`],
175-
modifyURLPrefix: {
176-
"/": `pathPrefix/`,
177-
},
178-
cacheId: `gatsby-plugin-offline`,
179-
dontCacheBustURLsMatching: /(\.js$|\.css$|static\/)/,
180-
runtimeCaching: [
181-
{
182-
urlPattern: /(\.js$|\.css$|static\/)/,
183-
handler: `CacheFirst`,
184-
},
185-
{
186-
urlPattern: /^https?:.*\/page-data\/.*\.json/,
187-
handler: `StaleWhileRevalidate`,
188-
},
189-
{
190-
urlPattern: /^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
191-
handler: `StaleWhileRevalidate`,
192-
},
193-
{
194-
urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
195-
handler: `StaleWhileRevalidate`,
170+
const { isValid, errors } = await testPluginOptionsSchema(
171+
pluginOptionsSchema,
172+
{
173+
precachePages: [`/about-us/`, `/projects/*`],
174+
appendScript: `src/custom-sw-code.js`,
175+
debug: true,
176+
workboxConfig: {
177+
importWorkboxFrom: `local`,
178+
globDirectory: `rootDir`,
179+
globPatterns: [`a`, `b`, `c`],
180+
modifyURLPrefix: {
181+
"/": `pathPrefix/`,
196182
},
197-
],
198-
skipWaiting: true,
199-
clientsClaim: true,
200-
},
201-
})
183+
cacheId: `gatsby-plugin-offline`,
184+
dontCacheBustURLsMatching: /(\.js$|\.css$|static\/)/,
185+
runtimeCaching: [
186+
{
187+
urlPattern: /(\.js$|\.css$|static\/)/,
188+
handler: `CacheFirst`,
189+
},
190+
{
191+
urlPattern: /^https?:.*\/page-data\/.*\.json/,
192+
handler: `StaleWhileRevalidate`,
193+
},
194+
{
195+
urlPattern: /^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/,
196+
handler: `StaleWhileRevalidate`,
197+
},
198+
{
199+
urlPattern: /^https?:\/\/fonts\.googleapis\.com\/css/,
200+
handler: `StaleWhileRevalidate`,
201+
},
202+
],
203+
skipWaiting: true,
204+
clientsClaim: true,
205+
},
206+
}
207+
)
202208

203209
expect(isValid).toBe(true)
204210
expect(errors).toEqual([])

0 commit comments

Comments
 (0)