forked from github/docs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request github#28437 from github/repo-sync
Repo sync
- Loading branch information
Showing
14 changed files
with
168 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import rules from '../../../../node_modules/markdownlint/lib/rules.js' | ||
import { gitHubDocsMarkdownlint } from '../linting-rules/index.js' | ||
import { baseConfig } from '../../style/base.js' | ||
import { githubDocsConfig } from '../../style/github-docs.js' | ||
import { githubDocsConfig, searchReplaceConfig } from '../../style/github-docs.js' | ||
|
||
export const customRules = gitHubDocsMarkdownlint.rules | ||
export const allRules = [...rules, ...gitHubDocsMarkdownlint.rules] | ||
export const allConfig = { ...baseConfig, ...githubDocsConfig } | ||
export const allConfig = { ...baseConfig, ...githubDocsConfig, ...searchReplaceConfig } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import searchReplace from 'markdownlint-rule-search-replace' | ||
|
||
import { runRule } from '../../lib/init-test.js' | ||
import { searchReplaceConfig } from '../../style/github-docs.js' | ||
|
||
describe(searchReplace.names.join(' - '), () => { | ||
test('TODOCS placeholder occurrences cause errors', async () => { | ||
const markdown = [ | ||
'## TODOCS', | ||
'- Todocs', | ||
'[ToDOCS](/todocs)', | ||
'![TODOCS](./ToDocs.png)', | ||
'HelloTODOCS', | ||
].join('\n') | ||
const result = await runRule(searchReplace, { | ||
strings: { markdown }, | ||
testConfig: searchReplaceConfig['search-replace'], | ||
}) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(7) | ||
}) | ||
|
||
test('docs domain occurrences cause error', async () => { | ||
const markdown = [ | ||
'These are not ok:', | ||
'docs.github.com', | ||
'- help.github.com', | ||
'[help.github.com](//developer.github.com)', | ||
'![developer.github.com](//preview.ghdocs.com)', | ||
' docs.github.com', | ||
'developer.github.com/enterprise', | ||
'developer.github.com/enterprise/', | ||
'', | ||
'These are ok:', | ||
'developer.github.com/changes', | ||
'developer.github.com/changes/', | ||
'developer.github.com/changes/changes', | ||
'developer.github.com/enterprise/1', | ||
].join('\n') | ||
const result = await runRule(searchReplace, { | ||
strings: { markdown }, | ||
testConfig: searchReplaceConfig['search-replace'], | ||
}) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(9) | ||
}) | ||
|
||
test('Deprecated Liquid syntax causes error', async () => { | ||
const markdown = [ | ||
'{{ site.data.thing1.thing2 }}', | ||
'{{site.data.thing1.thing2}}', | ||
'{{ octicon-plus An example label }}', | ||
'{{octicon-icon}}', | ||
].join('\n') | ||
const result = await runRule(searchReplace, { | ||
strings: { markdown }, | ||
testConfig: searchReplaceConfig['search-replace'], | ||
}) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(4) | ||
}) | ||
|
||
test('Using hardcoded personal access token string causes error', async () => { | ||
const markdown = [ | ||
'Hello personal access token for apps.', | ||
'A Personal access token for apps.', | ||
'Lots of PERSONAL ACCESS TOKENS for apps.', | ||
'access tokens for apps.', | ||
].join('\n') | ||
const result = await runRule(searchReplace, { | ||
strings: { markdown }, | ||
testConfig: searchReplaceConfig['search-replace'], | ||
}) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(3) | ||
}) | ||
|
||
test('Using hardcoded personal access token string causes error', async () => { | ||
const markdown = [ | ||
'Hello actions/checkout@v2 apps.', | ||
'A actions/delete-package-versions@v2 for apps.', | ||
'Hello actions/download-artifact@v2.', | ||
'actions/cache@432433423423', | ||
'actions/cache@', | ||
].join('\n') | ||
const result = await runRule(searchReplace, { | ||
strings: { markdown }, | ||
testConfig: searchReplaceConfig['search-replace'], | ||
}) | ||
const errors = result.markdown | ||
expect(errors.length).toBe(5) | ||
}) | ||
}) |