From ba15a54bf8c5f5527c406932a9d96418afa66f0e Mon Sep 17 00:00:00 2001 From: Brandon Mills Date: Mon, 25 Oct 2021 00:52:59 -0400 Subject: [PATCH] Docs: Link to unit tests from rule documentation 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`; }