Skip to content

Commit d10228d

Browse files
heiskrCopilot
andauthored
Remove unused exported symbols and one dead component (#62047)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c7e89e6 commit d10228d

10 files changed

Lines changed: 0 additions & 171 deletions

File tree

src/content-linter/lib/helpers/liquid-utils.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ export function getLiquidTokens(
3030

3131
export const OUTPUT_OPEN = '{%'
3232
export const OUTPUT_CLOSE = '%}'
33-
export const TAG_OPEN = '{{'
34-
export const TAG_CLOSE = '}}'
3533

3634
export const conditionalTags = ['if', 'elseif', 'unless', 'case', 'ifversion']
3735

src/content-linter/lib/helpers/utils.ts

Lines changed: 0 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -70,75 +70,6 @@ export function quotePrecedesLinkOpen(text: string | undefined): boolean {
7070
return text.endsWith('"') || text.endsWith("'")
7171
}
7272

73-
// Filters a list of tokens by token type only when they match
74-
// a specific token type order.
75-
// For example, if a list of tokens contains:
76-
//
77-
// [
78-
// { type: 'inline'},
79-
// { type: 'list_item_close'},
80-
// { type: 'list_item_open'},
81-
// { type: 'paragraph_open'},
82-
// { type: 'inline'},
83-
// { type: 'paragraph_close'},
84-
// ]
85-
//
86-
// And if the `tokenOrder` being looked for is:
87-
//
88-
// [
89-
// 'list_item_open',
90-
// 'paragraph_open',
91-
// 'inline'
92-
// ]
93-
//
94-
// Then the return value would be the items that match that sequence:
95-
// Index 2-4:
96-
// [
97-
// { type: 'inline'}, <-- Index 0 - NOT INCLUDED
98-
// { type: 'list_item_close'}, <-- Index 1 - NOT INCLUDED
99-
// { type: 'list_item_open'}, <-- Index 2 - INCLUDED
100-
// { type: 'paragraph_open'}, <-- Index 3 - INCLUDED
101-
// { type: 'inline'}, <-- Index 4 - INCLUDED
102-
// { type: 'paragraph_close'}, <-- Index 5 - NOT INCLUDED
103-
// ]
104-
//
105-
export function filterTokensByOrder(
106-
tokens: MarkdownToken[],
107-
tokenOrder: string[],
108-
): MarkdownToken[] {
109-
const matches: MarkdownToken[] = []
110-
111-
// Get a list of token indexes that match the
112-
// first token (root) in the tokenOrder array
113-
const tokenRootIndexes: number[] = []
114-
const firstTokenOrderType = tokenOrder[0]
115-
for (let index = 0; index < tokens.length; index++) {
116-
const token = tokens[index]
117-
if (token.type === firstTokenOrderType) {
118-
tokenRootIndexes.push(index)
119-
}
120-
}
121-
122-
// Loop through each root token index and check if
123-
// the order matches the tokenOrder array
124-
for (const tokenRootIndex of tokenRootIndexes) {
125-
for (let i = 1; i < tokenOrder.length; i++) {
126-
if (tokens[tokenRootIndex + i].type !== tokenOrder[i]) {
127-
// This tokenRootIndex was a possible start,
128-
// but doesn't match the tokenOrder perfectly, so break out
129-
// of the inner loop before it reaches the end.
130-
break
131-
}
132-
if (i === tokenOrder.length - 1) {
133-
matches.push(...tokens.slice(tokenRootIndex, tokenRootIndex + i + 1))
134-
}
135-
}
136-
}
137-
return matches
138-
}
139-
140-
export const docsDomains = ['docs.github.com', 'help.github.com', 'developer.github.com']
141-
14273
// Lines is an array of strings read from a
14374
// Markdown file a split around new lines.
14475
// This is the format we get from Markdownlint.
Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1 @@
1-
import { useMainContext } from '@/frame/components/context/MainContext'
2-
31
export type FeatureFlags = Record<string, string>
4-
5-
export const useFeatureFlags = (): FeatureFlags => {
6-
const { featureFlags } = useMainContext()
7-
return featureFlags
8-
}

src/landings/components/LandingSection.tsx

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/languages/components/useTranslation.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { UIStrings } from '@/frame/components/context/MainContext'
21
import { useMainContext } from '@/frame/components/context/MainContext'
32
import { createTranslationFunctions } from '@/languages/lib/translation-utils'
43

@@ -37,10 +36,3 @@ export const useTranslation = (namespaces: string | Array<string>) => {
3736

3837
return createTranslationFunctions(loadedData, namespaces)
3938
}
40-
41-
/**
42-
* Hook for App Router contexts that don't use MainContext
43-
*/
44-
export const useAppTranslation = (uiData: UIStrings, namespaces: string | Array<string>) => {
45-
return createTranslationFunctions(uiData, namespaces)
46-
}

src/links/lib/extract-links.ts

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -355,22 +355,6 @@ export async function renderAndExtractLinks(
355355
}
356356
}
357357

358-
/**
359-
* Read a file and extract links
360-
*/
361-
export async function extractLinksFromFile(
362-
filePath: string,
363-
context?: Context,
364-
): Promise<LinkExtractionResult> {
365-
const content = fs.readFileSync(filePath, 'utf-8')
366-
367-
if (context) {
368-
return extractLinksWithLiquid(content, context)
369-
}
370-
371-
return extractLinksFromMarkdown(content)
372-
}
373-
374358
/**
375359
* Get relative path from content root
376360
*/

src/search/components/helpers/execute-search-actions.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import { sanitizeSearchQuery } from '@/search/lib/sanitize-search-query'
99
// Search context values for identifying each search event
1010
export const GENERAL_SEARCH_CONTEXT = 'general-search'
1111
export const AI_SEARCH_CONTEXT = 'ai-search'
12-
export const COMBINED_SEARCH_CONTEXT = 'combined-search'
1312

1413
// The logic that redirects to the /search page with the proper query params
1514
// The query params will be consumed in the general search middleware

src/search/components/hooks/useQuery.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,3 @@
1-
import { useRouter } from 'next/router'
2-
3-
type QueryInfo = {
4-
query: string
5-
debug: boolean
6-
}
7-
export const useQuery = (): QueryInfo => {
8-
const router = useRouter()
9-
const query =
10-
router.query.query && Array.isArray(router.query.query)
11-
? router.query.query[0]
12-
: router.query.query || ''
13-
14-
const debug = parseDebug(router.query.debug)
15-
16-
return {
17-
query,
18-
debug,
19-
}
20-
}
21-
221
export function parseDebug(debug: string | Array<string> | undefined) {
232
if (debug === '') {
243
// E.g. `?query=foo&debug` should be treated as truthy

src/search/lib/helpers/cse-copilot-docs-versions.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,6 @@
22
import { versionToIndexVersionMap } from '../elasticsearch-versions'
33
const CSE_COPILOT_DOCS_VERSIONS = ['dotcom', 'ghec', 'ghes']
44

5-
// Languages supported by cse-copilot
6-
const DOCS_LANGUAGES = ['en']
7-
export function supportedCSECopilotLanguages() {
8-
return DOCS_LANGUAGES
9-
}
10-
115
export function getCSECopilotSource(version: (typeof CSE_COPILOT_DOCS_VERSIONS)[number]) {
126
if (!version) {
137
throw new Error(`Missing required key 'version' in request body`)

src/search/lib/helpers/external-search-analytics.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -124,20 +124,6 @@ function sanitizeUserAgent(userAgent: string | undefined): string {
124124
return 'other'
125125
}
126126

127-
/**
128-
* Determines if a host should bypass client_name requirement for analytics
129-
* Returns true if the host ends with github.net or githubapp.com
130-
* (for internal staging environments)
131-
* Note: docs.github.com is removed since normalizedHost will always be docs.github.com in production
132-
* Note: localhost is NOT included here as it should send analytics with auto-set client_name
133-
*/
134-
export function shouldBypassClientNameRequirement(host: string | undefined): boolean {
135-
if (!host) return false
136-
137-
const normalizedHost = stripPort(host)
138-
return normalizedHost.endsWith('.github.net') || normalizedHost.endsWith('.githubapp.com')
139-
}
140-
141127
/**
142128
* Strips port number from host string
143129
*/

0 commit comments

Comments
 (0)