Skip to content
Permalink
Browse files
docs: Link to unit tests from rule documentation (#15207)
In the Resources section at the bottom of each rule's documentation, we
already link to the rule's implementation and the documentation's
Markdown source. This adds a link to the rule's unit tests.
  • Loading branch information
btmills committed Oct 26, 2021
1 parent 1c0ca3c commit ee8af5fb864b510ba6b50dcfb706b8b28fdfb74e
Showing 1 changed file with 2 additions and 0 deletions.
@@ -648,6 +648,7 @@ target.gensite = function(prereleaseVersion) {
if (test("-f", filename) && path.extname(filename) === ".md") {

const rulesUrl = "https://github.com/eslint/eslint/tree/HEAD/lib/rules/",
testsUrl = "https://github.com/eslint/eslint/tree/HEAD/tests/lib/rules/",
docsUrl = "https://github.com/eslint/eslint/tree/HEAD/docs/rules/",
baseName = path.basename(filename),
sourceBaseName = `${path.basename(filename, ".md")}.js`,
@@ -731,6 +732,7 @@ target.gensite = function(prereleaseVersion) {
text += "\n## Resources\n\n";
if (!removed) {
text += `* [Rule source](${rulesUrl}${sourceBaseName})\n`;
text += `* [Test source](${testsUrl}${sourceBaseName})\n`;
}
text += `* [Documentation source](${docsUrl}${baseName})\n`;
}

0 comments on commit ee8af5f

Please sign in to comment.