Skip to content

Commit

Permalink
test: add test for rule jsdoc type comment
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Nov 16, 2021
1 parent a3670e3 commit bdd6dde
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions test/package.mjs
Expand Up @@ -187,6 +187,17 @@ 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 rule = index.rules[ruleName];
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');
Expand Down

0 comments on commit bdd6dde

Please sign in to comment.