From ee8af5fb864b510ba6b50dcfb706b8b28fdfb74e Mon Sep 17 00:00:00 2001 From: Brandon Mills Date: Tue, 26 Oct 2021 15:10:52 -0400 Subject: [PATCH] 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. --- Makefile.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Makefile.js b/Makefile.js index 61f034ad6fb..0a0846b9270 100644 --- a/Makefile.js +++ b/Makefile.js @@ -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`; }