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

chore(lint): add trailing commas #10190

Merged
merged 1 commit into from
Mar 11, 2024
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
46 changes: 23 additions & 23 deletions packages/adapters/fastify/web/src/resolveOptions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ describe('resolveOptions', () => {
apiUrl: undefined,
apiProxyTarget: '/api',
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '/api']`
`[Error: If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '/api']`,
)
})

Expand All @@ -49,7 +49,7 @@ describe('resolveOptions', () => {
apiUrl: undefined,
apiProxyTarget: 'http://api.foo.com',
},
})
}),
).toMatchInlineSnapshot(`
{
"flags": {
Expand All @@ -72,9 +72,9 @@ describe('resolveOptions', () => {
apiUrl: '',
apiProxyTarget: undefined,
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: \`apiUrl\` cannot be an empty string]`
`[Error: \`apiUrl\` cannot be an empty string]`,
)
})

Expand All @@ -85,9 +85,9 @@ describe('resolveOptions', () => {
apiUrl: '',
apiProxyTarget: '',
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: \`apiUrl\` cannot be an empty string]`
`[Error: \`apiUrl\` cannot be an empty string]`,
)
})

Expand All @@ -98,9 +98,9 @@ describe('resolveOptions', () => {
apiUrl: '',
apiProxyTarget: '/api',
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: \`apiUrl\` cannot be an empty string]`
`[Error: \`apiUrl\` cannot be an empty string]`,
)
})

Expand All @@ -111,9 +111,9 @@ describe('resolveOptions', () => {
apiUrl: '',
apiProxyTarget: 'http://api.foo.com',
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: \`apiUrl\` cannot be an empty string]`
`[Error: \`apiUrl\` cannot be an empty string]`,
)
})
})
Expand All @@ -126,7 +126,7 @@ describe('resolveOptions', () => {
apiUrl: '/api',
apiProxyTarget: undefined,
},
})
}),
).toMatchInlineSnapshot(`
{
"flags": {
Expand All @@ -147,7 +147,7 @@ describe('resolveOptions', () => {
apiUrl: '/api',
apiProxyTarget: '',
},
})
}),
).toMatchInlineSnapshot(`
{
"flags": {
Expand All @@ -168,9 +168,9 @@ describe('resolveOptions', () => {
apiUrl: '/api',
apiProxyTarget: '/api',
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '/api']`
`[Error: If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '/api']`,
)
})

Expand All @@ -181,7 +181,7 @@ describe('resolveOptions', () => {
apiUrl: '/api',
apiProxyTarget: 'http://api.foo.com',
},
})
}),
).toMatchInlineSnapshot(`
{
"flags": {
Expand All @@ -204,7 +204,7 @@ describe('resolveOptions', () => {
apiUrl: 'http://api.foo.com',
apiProxyTarget: undefined,
},
})
}),
).toMatchInlineSnapshot(`
{
"flags": {
Expand All @@ -225,7 +225,7 @@ describe('resolveOptions', () => {
apiUrl: 'http://api.foo.com',
apiProxyTarget: '',
},
})
}),
).toMatchInlineSnapshot(`
{
"flags": {
Expand All @@ -246,9 +246,9 @@ describe('resolveOptions', () => {
apiUrl: 'http://api.foo.com',
apiProxyTarget: '/api',
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '/api']`
`[Error: If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '/api']`,
)
})

Expand All @@ -259,9 +259,9 @@ describe('resolveOptions', () => {
apiUrl: 'http://api.foo.com',
apiProxyTarget: 'http://api.foo.com',
},
})
}),
).toThrowErrorMatchingInlineSnapshot(
`[Error: If you provide \`apiProxyTarget\`, \`apiUrl\` cannot be a fully-qualified URL. \`apiUrl\` is 'http://api.foo.com']`
`[Error: If you provide \`apiProxyTarget\`, \`apiUrl\` cannot be a fully-qualified URL. \`apiUrl\` is 'http://api.foo.com']`,
)
})
})
Expand All @@ -273,7 +273,7 @@ describe('resolveOptions', () => {
redwood: {
apiHost: 'http://api.foo.com',
},
})
}),
).toMatchInlineSnapshot(`
{
"flags": {
Expand Down
6 changes: 3 additions & 3 deletions packages/adapters/fastify/web/src/resolveOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function resolveOptions(options: RedwoodFastifyWebOptions) {
!isFullyQualifiedUrl(redwoodOptions.apiProxyTarget)
) {
throw new Error(
`If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '${redwoodOptions.apiProxyTarget}'`
`If you provide \`apiProxyTarget\`, it has to be a fully-qualified URL. \`apiProxyTarget\` is '${redwoodOptions.apiProxyTarget}'`,
)
}

Expand All @@ -43,7 +43,7 @@ export function resolveOptions(options: RedwoodFastifyWebOptions) {
// This is pretty unlikely because we default `apiUrl` to '/.redwood/functions'
if (!redwoodOptions.apiUrl && redwoodOptions.apiProxyTarget) {
throw new Error(
`If you provide \`apiProxyTarget\`, \`apiUrl\` has to be a relative URL. \`apiUrl\` is '${redwoodOptions.apiUrl}'`
`If you provide \`apiProxyTarget\`, \`apiUrl\` has to be a relative URL. \`apiUrl\` is '${redwoodOptions.apiUrl}'`,
)
}

Expand All @@ -58,7 +58,7 @@ export function resolveOptions(options: RedwoodFastifyWebOptions) {
// ```
if (apiUrlIsFullyQualifiedUrl && redwoodOptions.apiProxyTarget) {
throw new Error(
`If you provide \`apiProxyTarget\`, \`apiUrl\` cannot be a fully-qualified URL. \`apiUrl\` is '${redwoodOptions.apiUrl}'`
`If you provide \`apiProxyTarget\`, \`apiUrl\` cannot be a fully-qualified URL. \`apiUrl\` is '${redwoodOptions.apiUrl}'`,
)
}

Expand Down
42 changes: 21 additions & 21 deletions packages/adapters/fastify/web/src/web.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ describe('redwoodFastifyWeb', () => {
expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8')
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8'),
)
})

Expand All @@ -68,7 +68,7 @@ describe('redwoodFastifyWeb', () => {
expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8')
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8'),
)
})

Expand All @@ -85,7 +85,7 @@ describe('redwoodFastifyWeb', () => {
expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8')
fs.readFileSync(path.join(getPaths().web.dist, `${url}.html`), 'utf-8'),
)
})

Expand Down Expand Up @@ -124,7 +124,7 @@ describe('redwoodFastifyWeb', () => {
expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, url), 'utf-8')
fs.readFileSync(path.join(getPaths().web.dist, url), 'utf-8'),
)
})

Expand All @@ -137,7 +137,7 @@ describe('redwoodFastifyWeb', () => {
expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, '200.html'), 'utf-8')
fs.readFileSync(path.join(getPaths().web.dist, '200.html'), 'utf-8'),
)
})
})
Expand All @@ -153,13 +153,13 @@ describe('redwoodFastifyWeb', () => {

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe(
'application/javascript; charset=UTF-8'
'application/javascript; charset=UTF-8',
)
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
'utf-8'
)
'utf-8',
),
)
})

Expand All @@ -176,8 +176,8 @@ describe('redwoodFastifyWeb', () => {
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
'utf-8'
)
'utf-8',
),
)
})

Expand All @@ -191,13 +191,13 @@ describe('redwoodFastifyWeb', () => {

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe(
'application/json; charset=UTF-8'
'application/json; charset=UTF-8',
)
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
'utf-8'
)
'utf-8',
),
)
})

Expand All @@ -224,8 +224,8 @@ describe('redwoodFastifyWeb', () => {
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
'utf-8'
)
'utf-8',
),
)
})

Expand All @@ -242,8 +242,8 @@ describe('redwoodFastifyWeb', () => {
expect(res.body).toBe(
fs.readFileSync(
path.join(getPaths().web.dist, relativeFilePath),
'utf-8'
)
'utf-8',
),
)
})
})
Expand Down Expand Up @@ -319,10 +319,10 @@ describe('redwoodFastifyWeb', () => {

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe(
'application/json; charset=utf-8'
'application/json; charset=utf-8',
)
expect(res.body).toMatchInlineSnapshot(
`"{"data":null,"errors":[{"message":"Bad Gateway: you may have misconfigured apiUrl and apiProxyTarget. If apiUrl is a relative URL, you must provide apiProxyTarget.","extensions":{"code":"BAD_GATEWAY","httpStatus":502}}]}"`
`"{"data":null,"errors":[{"message":"Bad Gateway: you may have misconfigured apiUrl and apiProxyTarget. If apiUrl is a relative URL, you must provide apiProxyTarget.","extensions":{"code":"BAD_GATEWAY","httpStatus":502}}]}"`,
)
})

Expand All @@ -336,10 +336,10 @@ describe('redwoodFastifyWeb', () => {

expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe(
'application/json; charset=utf-8'
'application/json; charset=utf-8',
)
expect(res.body).toMatchInlineSnapshot(
`"{"data":null,"errors":[{"message":"Bad Gateway: you may have misconfigured apiUrl and apiProxyTarget. If apiUrl is a relative URL, you must provide apiProxyTarget.","extensions":{"code":"BAD_GATEWAY","httpStatus":502}}]}"`
`"{"data":null,"errors":[{"message":"Bad Gateway: you may have misconfigured apiUrl and apiProxyTarget. If apiUrl is a relative URL, you must provide apiProxyTarget.","extensions":{"code":"BAD_GATEWAY","httpStatus":502}}]}"`,
)
})
})
Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/fastify/web/src/web.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export { coerceRootPath, RedwoodFastifyWebOptions }

export async function redwoodFastifyWeb(
fastify: FastifyInstance,
opts: RedwoodFastifyWebOptions
opts: RedwoodFastifyWebOptions,
) {
const { redwoodOptions, flags } = resolveOptions(opts)

Expand Down
2 changes: 1 addition & 1 deletion packages/adapters/fastify/web/src/webFallback.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('webFallback', () => {
expect(res.statusCode).toBe(200)
expect(res.headers['content-type']).toBe('text/html; charset=UTF-8')
expect(res.body).toBe(
fs.readFileSync(path.join(getPaths().web.dist, url), 'utf-8')
fs.readFileSync(path.join(getPaths().web.dist, url), 'utf-8'),
)

await fastify.close()
Expand Down
2 changes: 1 addition & 1 deletion packages/api-server/src/__tests__/api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ describe('redwoodFastifyAPI', () => {

expect(res.statusCode).toEqual(404)
expect(res.body).toEqual(
'Function "deeplyNested" was not found.'
'Function "deeplyNested" was not found.',
)
})
})
Expand Down
Loading
Loading