From 2179743c1d2ba05ae13af87be3a68e409c0b9af8 Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Tue, 16 Nov 2021 12:45:38 -0500 Subject: [PATCH 1/3] test: add test for rule jsdoc type comment --- test/package.mjs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/package.mjs b/test/package.mjs index c03bf8941d..74a72a1df4 100644 --- a/test/package.mjs +++ b/test/package.mjs @@ -187,6 +187,16 @@ test('Every deprecated rules listed in docs/deprecated-rules.md', async t => { } }); +test('Every rule file has the appropriate contents', t => { + for (const ruleFile of ruleFiles) { + const ruleName = path.basename(ruleFile, '.js'); + const rulePath = path.join('rules', `${ruleName}.js`); + const ruleContents = fs.readFileSync(rulePath, 'utf8'); + + t.true(ruleContents.includes('/** @type {import(\'eslint\').Rule.RuleModule} */'), `${ruleName} includes jsdoc comment for rule type`); + } +}); + test('Every rule has a doc with the appropriate content', t => { for (const ruleFile of ruleFiles) { const ruleName = path.basename(ruleFile, '.js'); From 69b096047d664b3566c7306d30d6cf8414f4098d Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Tue, 16 Nov 2021 19:04:51 -0500 Subject: [PATCH 2/3] add return type to rule helper --- rules/utils/rule.js | 1 + 1 file changed, 1 insertion(+) diff --git a/rules/utils/rule.js b/rules/utils/rule.js index 5ab851bea2..146d4da92c 100644 --- a/rules/utils/rule.js +++ b/rules/utils/rule.js @@ -74,6 +74,7 @@ function checkVueTemplate(create, options) { return wrapped; } +/** @returns {import('eslint').Rule.RuleModule} */ function loadRule(ruleId) { const rule = require(`../${ruleId}`); From 564d73f963597d495da10c05c2b4d4626e1d126a Mon Sep 17 00:00:00 2001 From: Bryan Mishkin <698306+bmish@users.noreply.github.com> Date: Tue, 16 Nov 2021 19:22:05 -0500 Subject: [PATCH 3/3] Revert "add return type to rule helper" This reverts commit 69b096047d664b3566c7306d30d6cf8414f4098d. --- rules/utils/rule.js | 1 - 1 file changed, 1 deletion(-) diff --git a/rules/utils/rule.js b/rules/utils/rule.js index 146d4da92c..5ab851bea2 100644 --- a/rules/utils/rule.js +++ b/rules/utils/rule.js @@ -74,7 +74,6 @@ function checkVueTemplate(create, options) { return wrapped; } -/** @returns {import('eslint').Rule.RuleModule} */ function loadRule(ruleId) { const rule = require(`../${ruleId}`);