Skip to content

Commit e1f97ec

Browse files
authored
Merge pull request #41667 from github/repo-sync
Repo sync
2 parents 0a67afd + 03945b8 commit e1f97ec

File tree

20 files changed

+185
-91
lines changed

20 files changed

+185
-91
lines changed

eslint.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ export default [
109109
'rest-api-description/',
110110
'docs-internal-data/',
111111
'src/code-scanning/scripts/generate-code-scanning-query-list.ts',
112+
'next-env.d.ts',
112113
],
113114
},
114115

src/app/lib/app-router-context.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { getUIDataMerged } from '@/data-directory/lib/get-data'
22
import { type LanguageCode } from '@/languages/lib/languages'
33
import { translate } from '@/languages/lib/translation-utils'
44
import { extractLanguageFromPath } from '@/app/lib/language-utils'
5+
import { type UIStrings } from '@/frame/components/context/MainContext'
56

67
export interface AppRouterContext {
78
currentLanguage: LanguageCode
89
currentVersion: string
910
sitename: string
1011
site: {
1112
data: {
12-
ui: any
13+
ui: UIStrings
1314
}
1415
}
1516
}

src/article-api/middleware/article-pageinfo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export async function getPageInfoFromCache(page: Page, pathname: string) {
100100
cacheInfo = 'initial-load'
101101
} catch (error) {
102102
cacheInfo = 'initial-fail'
103-
if (error instanceof Error && (error as any).code !== 'ENOENT') {
103+
if (error instanceof Error && (error as NodeJS.ErrnoException).code !== 'ENOENT') {
104104
throw error
105105
}
106106
_cache = {}

src/assets/tests/static-assets.ts

Lines changed: 46 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@ import path from 'path'
33

44
import { afterAll, beforeAll, describe, expect, test, vi } from 'vitest'
55
import nock from 'nock'
6+
import type { Response } from 'express'
67

78
import { get } from '@/tests/helpers/e2etest'
89
import { checkCachingHeaders } from '@/tests/helpers/caching-headers'
910
import { setDefaultFastlySurrogateKey } from '@/frame/middleware/set-fastly-surrogate-key'
1011
import archivedEnterpriseVersionsAssets from '@/archives/middleware/archived-enterprise-versions-assets'
12+
import type { ExtendedRequest } from '@/types'
1113

1214
function getNextStaticAsset(directory: string) {
1315
const root = path.join('.next', 'static', directory)
@@ -34,10 +36,10 @@ function mockRequest(requestPath: string, { headers }: { headers?: Record<string
3436
}
3537

3638
type MockResponse = {
37-
status: number
38-
statusCode: number
39-
json?: (payload: any) => void
40-
send?: (body: any) => void
39+
status: number | undefined
40+
statusCode: number | undefined
41+
json?: (payload: unknown) => void
42+
send?: (body: unknown) => void
4143
sendStatus?: (statusCode: number) => void
4244
end?: () => void
4345
_json?: string
@@ -50,17 +52,17 @@ type MockResponse = {
5052

5153
const mockResponse = () => {
5254
const res: MockResponse = {
53-
status: undefined as any,
54-
statusCode: undefined as any,
55+
status: undefined,
56+
statusCode: undefined,
5557
headers: {},
5658
}
5759
res.json = (payload) => {
58-
res._json = payload
60+
res._json = payload as string
5961
}
6062
res.send = (body) => {
6163
res.status = 200
6264
res.statusCode = 200
63-
res._send = body
65+
res._send = body as string
6466
}
6567
res.end = () => {
6668
// Mock end method
@@ -86,7 +88,7 @@ const mockResponse = () => {
8688
return key in res.headers
8789
}
8890
// Add Express-style status method that supports chaining
89-
;(res as any).status = (code: number) => {
91+
;(res as unknown as { status: (code: number) => MockResponse }).status = (code: number) => {
9092
res.status = code
9193
res.statusCode = code
9294
return res
@@ -222,7 +224,11 @@ describe('archived enterprise static assets', () => {
222224
throw new Error('did not expect this to ever happen')
223225
}
224226
setDefaultFastlySurrogateKey(req, res, () => {})
225-
await archivedEnterpriseVersionsAssets(req as any, res as any, next)
227+
await archivedEnterpriseVersionsAssets(
228+
req as unknown as ExtendedRequest,
229+
res as unknown as Response,
230+
next,
231+
)
226232
expect(res.statusCode).toBe(200)
227233
checkCachingHeaders(res, false, 60)
228234
})
@@ -238,7 +244,11 @@ describe('archived enterprise static assets', () => {
238244
throw new Error('did not expect this to ever happen')
239245
}
240246
setDefaultFastlySurrogateKey(req, res, () => {})
241-
await archivedEnterpriseVersionsAssets(req as any, res as any, next)
247+
await archivedEnterpriseVersionsAssets(
248+
req as unknown as ExtendedRequest,
249+
res as unknown as Response,
250+
next,
251+
)
242252
expect(res.statusCode).toBe(200)
243253
checkCachingHeaders(res, false, 60)
244254
})
@@ -254,7 +264,11 @@ describe('archived enterprise static assets', () => {
254264
throw new Error('did not expect this to ever happen')
255265
}
256266
setDefaultFastlySurrogateKey(req, res, () => {})
257-
await archivedEnterpriseVersionsAssets(req as any, res as any, next)
267+
await archivedEnterpriseVersionsAssets(
268+
req as unknown as ExtendedRequest,
269+
res as unknown as Response,
270+
next,
271+
)
258272
expect(res.statusCode).toBe(200)
259273
checkCachingHeaders(res, false, 60)
260274
})
@@ -271,7 +285,11 @@ describe('archived enterprise static assets', () => {
271285
nexted = true
272286
}
273287
setDefaultFastlySurrogateKey(req, res, next)
274-
await archivedEnterpriseVersionsAssets(req as any, res as any, next)
288+
await archivedEnterpriseVersionsAssets(
289+
req as unknown as ExtendedRequest,
290+
res as unknown as Response,
291+
next,
292+
)
275293
// It didn't exit in that middleware but called next() to move on
276294
// with any other middlewares.
277295
expect(nexted).toBe(true)
@@ -289,7 +307,11 @@ describe('archived enterprise static assets', () => {
289307
nexted = true
290308
}
291309
setDefaultFastlySurrogateKey(req, res, () => {})
292-
await archivedEnterpriseVersionsAssets(req as any, res as any, next)
310+
await archivedEnterpriseVersionsAssets(
311+
req as unknown as ExtendedRequest,
312+
res as unknown as Response,
313+
next,
314+
)
293315
// It tried to go via the proxy, but it wasn't there, but then it
294316
// tried "our disk" and it's eventually there.
295317
expect(nexted).toBe(true)
@@ -335,7 +357,11 @@ describe('archived enterprise static assets', () => {
335357
nexted = true
336358
}
337359
setDefaultFastlySurrogateKey(req, res, () => {})
338-
await archivedEnterpriseVersionsAssets(req as any, res as any, next)
360+
await archivedEnterpriseVersionsAssets(
361+
req as unknown as ExtendedRequest,
362+
res as unknown as Response,
363+
next,
364+
)
339365
expect(res.statusCode).toBe(expectStatus)
340366
if (shouldCallNext) {
341367
expect(nexted).toBe(true)
@@ -374,7 +400,11 @@ describe('archived enterprise static assets', () => {
374400
nexted = true
375401
}
376402
setDefaultFastlySurrogateKey(req, res, () => {})
377-
await archivedEnterpriseVersionsAssets(req as any, res as any, next)
403+
await archivedEnterpriseVersionsAssets(
404+
req as unknown as ExtendedRequest,
405+
res as unknown as Response,
406+
next,
407+
)
378408
expect(nexted).toBe(shouldCallNext)
379409
expect(res.statusCode).toBe(expectStatus)
380410
})

src/audit-logs/lib/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import path from 'path'
33
import { readCompressedJsonFileFallback } from '@/frame/lib/read-json-file'
44
import { getOpenApiVersion } from '@/versions/lib/all-versions'
55
import findPage from '@/frame/lib/find-page'
6+
import type { Context, Page } from '@/types'
67
import type {
78
AuditLogEventT,
89
CategorizedEvents,
@@ -30,8 +31,8 @@ export function getCategoryNotes(): CategoryNotes {
3031
return auditLogConfig.categoryNotes || {}
3132
}
3233

33-
type TitleResolutionContext = {
34-
pages: Record<string, any>
34+
type TitleResolutionContext = Context & {
35+
pages: Record<string, Page>
3536
redirects: Record<string, string>
3637
}
3738

@@ -61,7 +62,7 @@ async function resolveReferenceLinksToTitles(
6162
currentVersion: 'free-pro-team@latest',
6263
pages: context.pages,
6364
redirects: context.redirects,
64-
}
65+
} as unknown as Context
6566
const title = await page.renderProp('title', renderContext, { textOnly: true })
6667
titles.push(title)
6768
} else {

src/automated-pipelines/lib/update-markdown.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import type { MarkdownFrontmatter } from '@/types'
1414
// Type definitions - extending existing type to add missing fields and make most fields optional
1515
type FrontmatterData = Partial<MarkdownFrontmatter> & {
1616
autogenerated?: string
17-
[key: string]: any
17+
[key: string]: unknown
1818
}
1919

2020
type SourceContentItem = {
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { gitHubDocsMarkdownlint } from '@/content-linter/lib/linting-rules/index'
22
import { baseConfig } from '@/content-linter/style/base'
33
import { customConfig } from '@/content-linter/style/github-docs'
4-
import type { Rule } from '@/content-linter/types'
4+
import type { Rule, RuleConfig } from '@/content-linter/types'
55

66
// Import markdownlint rules - external library without TypeScript declarations
77
import markdownlintRules from '../../../../node_modules/markdownlint/lib/rules'
88

99
export const customRules: Rule[] = gitHubDocsMarkdownlint.rules
10-
export const allRules: any[] = [...markdownlintRules, ...gitHubDocsMarkdownlint.rules]
11-
export const allConfig: Record<string, any> = { ...baseConfig, ...customConfig }
10+
export const allRules: Rule[] = [...markdownlintRules, ...gitHubDocsMarkdownlint.rules]
11+
export const allConfig = { ...baseConfig, ...customConfig } as unknown as RuleConfig

src/content-linter/lib/linting-rules/early-access-references.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { RuleParams, RuleErrorCallback, Rule } from '@/content-linter/types
77
interface Frontmatter {
88
redirect_from?: string | string[]
99
children?: string[]
10-
[key: string]: any
10+
[key: string]: unknown
1111
}
1212

1313
const ERROR_MESSAGE =

src/content-linter/lib/linting-rules/frontmatter-hero-image.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import type { RuleParams, RuleErrorCallback, Rule } from '@/content-linter/types
77

88
interface Frontmatter {
99
heroImage?: string
10-
[key: string]: any
10+
[key: string]: unknown
1111
}
1212

1313
// Get the list of valid hero images (without extensions)

src/content-linter/lib/linting-rules/frontmatter-intro-links.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import type { RuleParams, RuleErrorCallback, Rule } from '@/content-linter/types
66

77
interface Frontmatter {
88
introLinks?: Record<string, string>
9-
[key: string]: any
9+
[key: string]: unknown
1010
}
1111

1212
// Get the valid introLinks keys from ui.yml

0 commit comments

Comments
 (0)