Skip to content

Commit 502b774

Browse files
committed
chore(deps): lint issues
1 parent ddd5462 commit 502b774

3 files changed

Lines changed: 53 additions & 18 deletions

File tree

src/linear/build-snapshot.ts

Lines changed: 48 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import { linear } from './client.js'
2-
import type { RoadmapSnapshot, RoadmapTeam, RoadmapProject } from '../types/roadmap.js'
2+
import type {
3+
RoadmapSnapshot,
4+
RoadmapTeam,
5+
RoadmapProject
6+
} from '../types/roadmap.js'
37

48
const DEFAULT_VIEW_ID = '27df73bc-50ec-4fc1-bbb2-d906236a5bbc'
59

@@ -91,9 +95,21 @@ type ViewProjectNode = {
9195
progress: number
9296
url: string | null
9397
sortOrder: number
94-
teams: { nodes: Array<{ id: string; name: string; key: string; color: string | null }> }
98+
teams: {
99+
nodes: Array<{
100+
id: string
101+
name: string
102+
key: string
103+
color: string | null
104+
}>
105+
}
95106
projectMilestones: {
96-
nodes: Array<{ id: string; name: string; targetDate: string | null; sortOrder: number }>
107+
nodes: Array<{
108+
id: string
109+
name: string
110+
targetDate: string | null
111+
sortOrder: number
112+
}>
97113
}
98114
}
99115

@@ -118,7 +134,11 @@ function isTransientError(err: unknown): boolean {
118134
return false
119135
}
120136

121-
async function withRetry<T>(fn: () => Promise<T>, retries = 3, delayMs = 2000): Promise<T> {
137+
async function withRetry<T>(
138+
fn: () => Promise<T>,
139+
retries = 3,
140+
delayMs = 2000
141+
): Promise<T> {
122142
let lastErr: unknown
123143
for (let attempt = 0; attempt <= retries; attempt++) {
124144
try {
@@ -127,7 +147,9 @@ async function withRetry<T>(fn: () => Promise<T>, retries = 3, delayMs = 2000):
127147
if (!isTransientError(err) || attempt === retries) throw err
128148
lastErr = err
129149
const wait = delayMs * 2 ** attempt
130-
console.warn(`[linear] Transient error (attempt ${attempt + 1}/${retries}), retrying in ${wait}ms...`)
150+
console.warn(
151+
`[linear] Transient error (attempt ${attempt + 1}/${retries}), retrying in ${wait}ms...`
152+
)
131153
await new Promise((r) => setTimeout(r, wait))
132154
}
133155
}
@@ -148,8 +170,8 @@ async function fetchTeams(): Promise<TeamsQueryResult['teams']['nodes']> {
148170
const result = await withRetry(() =>
149171
linear.client.request<TeamsQueryResult>(TEAMS_QUERY, {
150172
first: 50,
151-
after: endCursor,
152-
}),
173+
after: endCursor
174+
})
153175
)
154176
all.push(...result.teams.nodes)
155177
hasNextPage = result.teams.pageInfo.hasNextPage
@@ -170,12 +192,14 @@ async function fetchViewProjects(viewId: string): Promise<ViewProjectNode[]> {
170192
const result = await withRetry(() =>
171193
linear.client.request<CustomViewQueryResult>(CUSTOM_VIEW_QUERY, {
172194
id: viewId,
173-
after: endCursor,
174-
}),
195+
after: endCursor
196+
})
175197
)
176198

177199
if (!result.customView) {
178-
throw new Error(`Custom view ${viewId} not found in Linear. Check LINEAR_CUSTOM_VIEW_ID.`)
200+
throw new Error(
201+
`Custom view ${viewId} not found in Linear. Check LINEAR_CUSTOM_VIEW_ID.`
202+
)
179203
}
180204

181205
all.push(...result.customView.projects.nodes)
@@ -196,7 +220,7 @@ export async function buildSnapshot(): Promise<RoadmapSnapshot> {
196220

197221
const [teamNodes, viewProjects] = await Promise.all([
198222
fetchTeams(),
199-
fetchViewProjects(viewId),
223+
fetchViewProjects(viewId)
200224
])
201225

202226
const projects: RoadmapProject[] = viewProjects
@@ -218,12 +242,21 @@ export async function buildSnapshot(): Promise<RoadmapSnapshot> {
218242
completedAt: p.completedAt ?? null,
219243
url: p.url,
220244
team: firstTeam
221-
? { id: firstTeam.id, name: firstTeam.name, key: firstTeam.key, color: firstTeam.color }
245+
? {
246+
id: firstTeam.id,
247+
name: firstTeam.name,
248+
key: firstTeam.key,
249+
color: firstTeam.color
250+
}
222251
: null,
223252
milestones: p.projectMilestones.nodes
224253
.slice()
225254
.sort((a, b) => a.sortOrder - b.sortOrder)
226-
.map((m) => ({ id: m.id, name: m.name, targetDate: m.targetDate ?? null })),
255+
.map((m) => ({
256+
id: m.id,
257+
name: m.name,
258+
targetDate: m.targetDate ?? null
259+
}))
227260
}
228261
})
229262

@@ -236,13 +269,13 @@ export async function buildSnapshot(): Promise<RoadmapSnapshot> {
236269
key: t.key,
237270
color: t.color,
238271
childrenIds: t.children.map((c) => c.id),
239-
projectCount: projects.filter((p) => p.team?.id === t.id).length,
272+
projectCount: projects.filter((p) => p.team?.id === t.id).length
240273
}))
241274

242275
return {
243276
generatedAt: new Date().toISOString(),
244277
lastSyncAt: new Date().toISOString(),
245278
teams,
246-
projects,
279+
projects
247280
}
248281
}

src/linear/client.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ if (!process.env.LINEAR_API_KEY) {
55
}
66

77
export const linear = new LinearClient({
8-
apiKey: process.env.LINEAR_API_KEY,
8+
apiKey: process.env.LINEAR_API_KEY
99
})

src/pages/roadmap.astro

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ let fetchError = false
1212
1313
try {
1414
const store = getStore('roadmap')
15-
const snapshot: RoadmapSnapshot | null = await store.get('roadmap-snapshot', { type: 'json' })
15+
const snapshot: RoadmapSnapshot | null = await store.get('roadmap-snapshot', {
16+
type: 'json'
17+
})
1618
if (!snapshot) throw new Error('Roadmap snapshot not yet available')
1719
projects = (snapshot.projects ?? []) as ApiProject[]
1820
teams = snapshot.teams ?? []
@@ -22,7 +24,7 @@ try {
2224
2325
Astro.response.headers.set(
2426
'Netlify-CDN-Cache-Control',
25-
'public, max-age=43200, stale-while-revalidate=86400',
27+
'public, max-age=43200, stale-while-revalidate=86400'
2628
)
2729
---
2830

0 commit comments

Comments
 (0)