Skip to content

Commit 7cd719d

Browse files
heiskrCopilot
andauthored
Convert allowed-topics.js to TypeScript (#58011)
Co-authored-by: Copilot <[email protected]>
1 parent 3e3a82e commit 7cd719d

File tree

6 files changed

+13
-11
lines changed

6 files changed

+13
-11
lines changed

content/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ journeyTracks:
288288
- Optional.
289289

290290
### `topics`
291-
- Purpose: Indicate the topics covered by the article. Refer to the content models for more details about adding topics. A full list of existing topics is located in the [allowed topics file](/data/allowed-topics.js). If topics in article frontmatter and the allow-topics list become out of sync, the [topics CI test](/src/search/tests/topics.js) will fail.
291+
- Purpose: Indicate the topics covered by the article. Refer to the content models for more details about adding topics. A full list of existing topics is located in the [allowed topics file](/data/allowed-topics.ts). If topics in article frontmatter and the allow-topics list become out of sync, the [topics CI test](/src/search/tests/topics.ts) will fail.
292292
- Type: Array of `String`s
293293
- Optional: Topics are preferred for each article, but, there may be cases where existing articles don't yet have topics, or adding a topic to a new article may not add value.
294294

content/contributing/style-guide-and-content-model/about-topics.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ topics:
2020
---
2121
```
2222

23-
For more information on adding topics to an article see, [AUTOTITLE](/contributing/writing-for-github-docs/using-yaml-frontmatter#topics). For a list of all allowed topics, see [`allowed-topics`](https://github.com/github/docs/blob/main/data/allowed-topics.js).
23+
For more information on adding topics to an article see, [AUTOTITLE](/contributing/writing-for-github-docs/using-yaml-frontmatter#topics). For a list of all allowed topics, see [`allowed-topics`](https://github.com/github/docs/blob/main/data/allowed-topics.ts).
2424

2525
## Topics for all content types
2626

content/contributing/writing-for-github-docs/templates.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ intro: 'Article intro. See tips for a great intro below.'
7373
product: "{{ optional product callout }}"
7474
type: reference
7575
topics:
76-
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.js
76+
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.ts
7777
versions:
7878
- <version>
7979
---
@@ -125,7 +125,7 @@ intro: 'Article intro. See tips for a great intro below.'
125125
product: "{{ optional product callout }}"
126126
type: how_to
127127
topics:
128-
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.js
128+
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.ts
129129
versions:
130130
- <version>
131131
---
@@ -176,7 +176,7 @@ shortTitle: <subject> # Max 31 characters
176176
intro: 'Article intro. Highlight that the guide is quick and to the point.'
177177
type: quick_start
178178
topics:
179-
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.js
179+
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.ts
180180
versions:
181181
- <version>
182182
---
@@ -245,7 +245,7 @@ intro: 'Article intro. See tips for a great intro below'
245245
product: "{{ optional product callout }}"
246246
type: tutorial
247247
topics:
248-
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.js
248+
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.ts
249249
versions:
250250
- <version>
251251
---
@@ -320,7 +320,7 @@ intro: 'Article intro. See tips for a great intro below'
320320
product: "{{ optional product callout }}"
321321
type: tutorial
322322
topics:
323-
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.js
323+
- <topic> # One or more from list of allowed topics: https://github.com/github/docs/blob/main/data/allowed-topics.ts
324324
versions:
325325
- <version>
326326
---

content/contributing/writing-for-github-docs/using-yaml-frontmatter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ journeyTracks:
288288

289289
### `topics`
290290

291-
* Purpose: Indicate the topics covered by the article. Refer to the content models for more details about adding topics. A full list of existing topics is located in the [allowed topics file](https://github.com/github/docs/blob/main/data/allowed-topics.js). If topics in article frontmatter and the allow-topics list become out of sync, the [topics CI test](https://github.com/github/docs/blob/main/src/search/tests/topics.ts) will fail.
291+
* Purpose: Indicate the topics covered by the article. Refer to the content models for more details about adding topics. A full list of existing topics is located in the [allowed topics file](https://github.com/github/docs/blob/main/data/allowed-topics.ts). If topics in article frontmatter and the allow-topics list become out of sync, the [topics CI test](https://github.com/github/docs/blob/main/src/search/tests/topics.ts) will fail.
292292
* Type: Array of `String`s
293293
* Optional: Topics are preferred for each article, but, there may be cases where existing articles don't yet have topics, or adding a topic to a new article may not add value.
294294

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// content model, add the entry to this list, and ensure you loop in the
1111
// content and/or content strategy team for review.
1212

13-
export default [
13+
const allowedTopics = [
1414
'2FA',
1515
'Access management',
1616
'Accounts',
@@ -170,4 +170,6 @@ export default [
170170
'Xamarin.iOS',
171171
'Xamarin',
172172
'Xcode',
173-
]
173+
] as const
174+
175+
export default allowedTopics

src/search/tests/topics.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const topics: string[] = walk(contentDir, { includeBasePath: true })
2828
const allUsedTopics: string[] = Array.from(new Set(topics)).sort()
2929

3030
describe('Check for allowed frontmatter topics', () => {
31-
test('all used topics are allowed in /data/allowed-topics.js', () => {
31+
test('all used topics are allowed in /data/allowed-topics.ts', () => {
3232
expect(allUsedTopics.length).toBeGreaterThan(0)
3333

3434
const unusedTopics: string[] = difference(allUsedTopics, allowedTopics)

0 commit comments

Comments
 (0)