Skip to content

Commit 24ec05b

Browse files
dependabot[bot]johnstcnmatifali
authored
chore: bump prettier from 2.8.1 to 3.0.0 in /site (coder#8477)
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Cian Johnston <cian@coder.com> Co-authored-by: Muhammad Atif Ali <atif@coder.com>
1 parent 3727e02 commit 24ec05b

File tree

13 files changed

+97
-85
lines changed

13 files changed

+97
-85
lines changed

site/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22

33
<!--
44
▄█▀ ▀█▄

site/jest.setup.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,19 @@ jest.mock("contexts/useProxyLatency", () => ({
2323
if (!proxies) {
2424
return {} as Record<string, ProxyLatencyReport>
2525
}
26-
return proxies.reduce((acc, proxy) => {
27-
acc[proxy.id] = {
28-
accurate: true,
29-
// Return a constant latency of 8ms.
30-
// If you make this random it could break stories.
31-
latencyMS: 8,
32-
at: new Date(),
33-
}
34-
return acc
35-
}, {} as Record<string, ProxyLatencyReport>)
26+
return proxies.reduce(
27+
(acc, proxy) => {
28+
acc[proxy.id] = {
29+
accurate: true,
30+
// Return a constant latency of 8ms.
31+
// If you make this random it could break stories.
32+
latencyMS: 8,
33+
at: new Date(),
34+
}
35+
return acc
36+
},
37+
{} as Record<string, ProxyLatencyReport>,
38+
)
3639
}, [proxies])
3740

3841
return { proxyLatencies, refetch: jest.fn() }

site/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@
149149
"jest-websocket-mock": "2.4.0",
150150
"jest_workaround": "0.1.14",
151151
"msw": "1.2.2",
152-
"prettier": "2.8.1",
152+
"prettier": "3.0.0",
153153
"resize-observer": "1.0.4",
154154
"storybook": "7.0.26",
155155
"storybook-addon-react-router-v6": "1.0.2",

site/src/api/api.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,8 +481,8 @@ export function waitForBuild(build: TypesGen.WorkspaceBuild) {
481481
let latestJobInfo: TypesGen.ProvisionerJob | undefined = undefined
482482

483483
while (
484-
!["succeeded", "canceled"].some((status) =>
485-
latestJobInfo?.status.includes(status),
484+
!["succeeded", "canceled"].some(
485+
(status) => latestJobInfo?.status.includes(status),
486486
)
487487
) {
488488
const { job } = await getWorkspaceBuildByNumber(

site/src/components/Filter/storyHelpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ export const getDefaultFilterProps = <TFilterProps>({
3131
values,
3232
},
3333
menus,
34-
} as TFilterProps)
34+
}) as TFilterProps

site/src/contexts/ProxyContext.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,13 @@ const selectByLatency = (
262262
return undefined
263263
}
264264

265-
const proxyMap = proxies.reduce((acc, proxy) => {
266-
acc[proxy.id] = proxy
267-
return acc
268-
}, {} as Record<string, Region>)
265+
const proxyMap = proxies.reduce(
266+
(acc, proxy) => {
267+
acc[proxy.id] = proxy
268+
return acc
269+
},
270+
{} as Record<string, Region>,
271+
)
269272

270273
const best = Object.keys(latencies)
271274
.map((proxyId) => {

site/src/contexts/useProxyLatency.ts

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -87,43 +87,46 @@ export const useProxyLatency = (
8787
// proxyMap is a map of the proxy path_app_url to the proxy object.
8888
// This is for the observer to know which requests are important to
8989
// record.
90-
const proxyChecks = proxies.reduce((acc, proxy) => {
91-
// Only run the latency check on healthy proxies.
92-
if (!proxy.healthy) {
93-
return acc
94-
}
95-
96-
// Do not run latency checks if a cached check exists below the latestFetchRequest Date.
97-
// This prevents fetching latencies too often.
98-
// 1. Fetch the latest stored latency for the given proxy.
99-
// 2. If the latest latency is after the latestFetchRequest, then skip the latency check.
100-
if (storedLatencies && storedLatencies[proxy.id]) {
101-
const fetchRequestDate = new Date(latestFetchRequest)
102-
const latest = storedLatencies[proxy.id].reduce((prev, next) =>
103-
prev.at > next.at ? prev : next,
104-
)
105-
106-
if (latest && latest.at > fetchRequestDate) {
107-
// dispatch the cached latency. This latency already went through the
108-
// guard logic below, so we can just dispatch it again directly.
109-
dispatchProxyLatencies({
110-
proxyID: proxy.id,
111-
cached: true,
112-
report: latest,
113-
})
90+
const proxyChecks = proxies.reduce(
91+
(acc, proxy) => {
92+
// Only run the latency check on healthy proxies.
93+
if (!proxy.healthy) {
11494
return acc
11595
}
116-
}
11796

118-
// Add a random query param to the url to make sure we don't get a cached response.
119-
// This is important in case there is some caching layer between us and the proxy.
120-
const url = new URL(
121-
`/latency-check?cache_bust=${generateRandomString(6)}`,
122-
proxy.path_app_url,
123-
)
124-
acc[url.toString()] = proxy
125-
return acc
126-
}, {} as Record<string, Region>)
97+
// Do not run latency checks if a cached check exists below the latestFetchRequest Date.
98+
// This prevents fetching latencies too often.
99+
// 1. Fetch the latest stored latency for the given proxy.
100+
// 2. If the latest latency is after the latestFetchRequest, then skip the latency check.
101+
if (storedLatencies && storedLatencies[proxy.id]) {
102+
const fetchRequestDate = new Date(latestFetchRequest)
103+
const latest = storedLatencies[proxy.id].reduce((prev, next) =>
104+
prev.at > next.at ? prev : next,
105+
)
106+
107+
if (latest && latest.at > fetchRequestDate) {
108+
// dispatch the cached latency. This latency already went through the
109+
// guard logic below, so we can just dispatch it again directly.
110+
dispatchProxyLatencies({
111+
proxyID: proxy.id,
112+
cached: true,
113+
report: latest,
114+
})
115+
return acc
116+
}
117+
}
118+
119+
// Add a random query param to the url to make sure we don't get a cached response.
120+
// This is important in case there is some caching layer between us and the proxy.
121+
const url = new URL(
122+
`/latency-check?cache_bust=${generateRandomString(6)}`,
123+
proxy.path_app_url,
124+
)
125+
acc[url.toString()] = proxy
126+
return acc
127+
},
128+
{} as Record<string, Region>,
129+
)
127130

128131
// dispatchProxyLatenciesGuarded will assign the latency to the proxy
129132
// via the reducer. But it will only do so if the performance entry is

site/src/pages/TemplateSettingsPage/TemplateSettingsLayout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const templatePermissions = (templateId: string) =>
2020
},
2121
action: "update",
2222
},
23-
} as const)
23+
}) as const
2424

2525
const fetchTemplateSettings = async (orgId: string, name: string) => {
2626
const template = await getTemplateByName(orgId, name)

site/src/testHelpers/entities.ts

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -149,31 +149,34 @@ export const MockWorkspaceProxies: TypesGen.WorkspaceProxy[] = [
149149
]
150150

151151
export const MockProxyLatencies: Record<string, ProxyLatencyReport> = {
152-
...MockWorkspaceProxies.reduce((acc, proxy) => {
153-
if (!proxy.healthy) {
152+
...MockWorkspaceProxies.reduce(
153+
(acc, proxy) => {
154+
if (!proxy.healthy) {
155+
return acc
156+
}
157+
acc[proxy.id] = {
158+
// Make one of them inaccurate.
159+
accurate: proxy.id !== "26e84c16-db24-4636-a62d-aa1a4232b858",
160+
// This is a deterministic way to generate a latency to for each proxy.
161+
// It will be the same for each run as long as the IDs don't change.
162+
latencyMS:
163+
(Number(
164+
Array.from(proxy.id).reduce(
165+
// Multiply each char code by some large prime number to increase the
166+
// size of the number and allow use to get some decimal points.
167+
(acc, char) => acc + char.charCodeAt(0) * 37,
168+
0,
169+
),
170+
) /
171+
// Cap at 250ms
172+
100) %
173+
250,
174+
at: new Date(),
175+
}
154176
return acc
155-
}
156-
acc[proxy.id] = {
157-
// Make one of them inaccurate.
158-
accurate: proxy.id !== "26e84c16-db24-4636-a62d-aa1a4232b858",
159-
// This is a deterministic way to generate a latency to for each proxy.
160-
// It will be the same for each run as long as the IDs don't change.
161-
latencyMS:
162-
(Number(
163-
Array.from(proxy.id).reduce(
164-
// Multiply each char code by some large prime number to increase the
165-
// size of the number and allow use to get some decimal points.
166-
(acc, char) => acc + char.charCodeAt(0) * 37,
167-
0,
168-
),
169-
) /
170-
// Cap at 250ms
171-
100) %
172-
250,
173-
at: new Date(),
174-
}
175-
return acc
176-
}, {} as Record<string, ProxyLatencyReport>),
177+
},
178+
{} as Record<string, ProxyLatencyReport>,
179+
),
177180
}
178181

179182
export const MockBuildInfo: TypesGen.BuildInfoResponse = {

site/src/xServices/workspace/workspaceXService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ const permissionsToCheck = (
138138
},
139139
action: "read",
140140
},
141-
} as const)
141+
}) as const
142142

143143
export const workspaceMachine = createMachine(
144144
{

site/src/xServices/workspaceSchedule/workspaceScheduleXService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const permissionsToCheck = (workspace: TypesGen.Workspace) =>
3939
},
4040
action: "update",
4141
},
42-
} as const)
42+
}) as const
4343

4444
export type WorkspaceScheduleEvent =
4545
| {

site/static/error.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{{/* This template is used by application handlers to render friendly error
22
pages when there is a proxy error (for example, when the target app isn't
33
running). */}}
4-
<!DOCTYPE html>
4+
<!doctype html>
55
<html lang="en">
66
<head>
77
<meta charset="UTF-8" />

site/yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9435,10 +9435,10 @@ prelude-ls@^1.2.1:
94359435
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
94369436
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==
94379437

9438-
prettier@2.8.1:
9439-
version "2.8.1"
9440-
resolved "https://registry.yarnpkg.com/prettier/-/prettier-2.8.1.tgz#4e1fd11c34e2421bc1da9aea9bd8127cd0a35efc"
9441-
integrity sha512-lqGoSJBQNJidqCHE80vqZJHWHRFoNYsSpP9AjFhlhi9ODCJA541svILes/+/1GM3VaL/abZi7cpFzOpdR9UPKg==
9438+
prettier@3.0.0:
9439+
version "3.0.0"
9440+
resolved "https://registry.yarnpkg.com/prettier/-/prettier-3.0.0.tgz#e7b19f691245a21d618c68bc54dc06122f6105ae"
9441+
integrity sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==
94429442

94439443
prettier@^2.8.0, prettier@^2.8.7:
94449444
version "2.8.8"

0 commit comments

Comments
 (0)