Skip to content

Commit

Permalink
docs: Link to unit tests from rule documentation (#15207)
Browse files Browse the repository at this point in the history
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 ee8af5f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile.js
Expand Up @@ -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`,
Expand Down Expand Up @@ -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`;
}
Expand Down

0 comments on commit ee8af5f

Please sign in to comment.