Skip to content

Commit

Permalink
docs: tweak rule notices
Browse files Browse the repository at this point in the history
  • Loading branch information
bmish committed Aug 18, 2022
1 parent a766255 commit db43d27
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions tests/index.js
Expand Up @@ -24,13 +24,11 @@ describe('all rule files should be exported by the plugin', () => {

describe('rule documentation files have the correct content', () => {
const MESSAGES = {
fixable:
'🔧 This rule is automatically fixable using the `--fix` flag on the command line.',
hasSuggestions:
'💡 This rule provides [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).',
fixable: '🔧 This rule is automatically fixable using the `--fix` [flag](https://eslint.org/docs/latest/user-guide/command-line-interface#--fix) on the command line.',
hasSuggestions: '💡 This rule provides editor [suggestions](https://eslint.org/docs/developer-guide/working-with-rules#providing-suggestions).',
};

for (const ruleFile of ruleFiles) {
ruleFiles.forEach((ruleFile) => {
const ruleName = path.basename(ruleFile, '.js');
const rule = plugin.rules[ruleName];
const documentPath = path.join('docs/rules', `${ruleName}.md`);
Expand All @@ -53,17 +51,17 @@ describe('rule documentation files have the correct content', () => {

// Ensure that expected notices are present in the correct order.
let currentLineNumber = 1;
for (const expectedNotice of expectedNotices) {
expectedNotices.forEach((expectedNotice) => {
assert.strictEqual(documentLines[currentLineNumber], '', `${ruleName} includes blank line ahead of ${expectedNotice} notice`);
assert.strictEqual(documentLines[currentLineNumber + 1], MESSAGES[expectedNotice], `${ruleName} includes ${expectedNotice} notice`);
currentLineNumber += 2;
}
});

// Ensure that unexpected notices are not present.
for (const unexpectedNotice of unexpectedNotices) {
unexpectedNotices.forEach((unexpectedNotice) => {
assert.ok(!documentContents.includes(MESSAGES[unexpectedNotice]), `${ruleName} does not include unexpected ${unexpectedNotice} notice`);
}
}
});
});
});

describe('deprecated rules', () => {
Expand Down

0 comments on commit db43d27

Please sign in to comment.