Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
docs: detect and fix broken links (#16837)
* docs: detect and fix broken links * ci: build website before running lint:links * chore: update lint:links script * ci: refactor job * ci: increase memory * ci: fix * chore: use custom script * chore: fix script for windows * chore: fix script for windows * chore: update script * ci: remove unwanted changes * chore: fix script * chore: remove unwanted changes * docs: fix links
- Loading branch information
Showing
8 changed files
with
69 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
const path = require("path"); | ||
const TapRender = require("@munter/tap-render"); | ||
const spot = require("tap-spot"); | ||
const hyperlink = require("hyperlink"); | ||
|
||
const tapRenderInstance = new TapRender(); | ||
|
||
tapRenderInstance.pipe(spot()).pipe(process.stdout); | ||
|
||
const skipPatterns = [ | ||
"https://", | ||
"fragment-redirect", | ||
"migrating-to", | ||
"/blog", | ||
"/play", | ||
"/team", | ||
"/donate", | ||
"/docs/latest", | ||
`src="null"`, | ||
]; | ||
|
||
const skipFilter = (report) => | ||
Object.values(report).some((value) => | ||
skipPatterns.some((pattern) => String(value).includes(pattern)) | ||
); | ||
|
||
(async () => { | ||
try { | ||
await hyperlink( | ||
{ | ||
inputUrls: ["../_site/index.html"], | ||
root: path.resolve(__dirname, "../_site"), | ||
canonicalRoot: "https://eslint.org/docs/head/", | ||
recursive: true, | ||
internalOnly: true, | ||
pretty: true, | ||
concurrency: 25, | ||
skipFilter, | ||
}, | ||
tapRenderInstance | ||
); | ||
} catch (err) { | ||
console.log(err.stack); | ||
process.exit(1); | ||
} | ||
const results = tapRenderInstance.close(); | ||
|
||
process.exit(results.fail ? 1 : 0); | ||
})(); |