Skip to content

Commit

Permalink
apply suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
fasttime committed Dec 7, 2023
1 parent b14bf59 commit 47a1495
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/tools/check-rule-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe("check-rule-examples", () => {
"\x1B[0m \x1B[2m12:1\x1B[22m \x1B[31merror\x1B[39m Syntax error: 'import' and 'export' may appear only with 'sourceType: module'\x1B[0m\n" +
"\x1B[0m \x1B[2m20:5\x1B[22m \x1B[31merror\x1B[39m Nonstandard language tag 'ts': use one of 'javascript', 'js' or 'jsx'\x1B[0m\n" +
"\x1B[0m \x1B[2m23:7\x1B[22m \x1B[31merror\x1B[39m Syntax error: Identifier 'foo' has already been declared\x1B[0m\n" +
"\x1B[0m \x1B[2m31:1\x1B[22m \x1B[31merror\x1B[39m Example code should contain a configuration comment like /* eslint no-restricted-syntax: error */\x1B[0m\n" +
"\x1B[0m \x1B[2m31:1\x1B[22m \x1B[31merror\x1B[39m Example code should contain a configuration comment like /* eslint no-restricted-syntax: \"error\" */\x1B[0m\n" +
"\x1B[0m\x1B[0m\n" +
"\x1B[0m\x1B[31m\x1B[1m✖ 5 problems (5 errors, 0 warnings)\x1B[22m\x1B[39m\x1B[0m\n" +
"\x1B[0m\x1B[31m\x1B[1m\x1B[22m\x1B[39m\x1B[0m\n"
Expand Down
6 changes: 3 additions & 3 deletions tools/check-rule-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ const matter = require("gray-matter");
const markdownIt = require("markdown-it");
const markdownItContainer = require("markdown-it-container");
const { promisify } = require("util");
const meta = require("../docs/src/_data/rules_meta.json");
const markdownItRuleExample = require("../docs/tools/markdown-it-rule-example");
const ConfigCommentParser = require("../lib/linter/config-comment-parser");
const rules = require("../lib/rules");

//------------------------------------------------------------------------------
// Typedefs
Expand Down Expand Up @@ -55,7 +55,7 @@ function tryParseForPlayground(code, parserOptions) {
async function findProblems(filename) {
const text = await readFile(filename, "UTF-8");
const { title } = matter(text).data;
const isRuleRemoved = !Object.prototype.hasOwnProperty.call(meta, title);
const isRuleRemoved = !rules.has(title);
const problems = [];
const ruleExampleOptions = markdownItRuleExample({
open({ code, parserOptions, codeBlockToken }) {
Expand Down Expand Up @@ -96,7 +96,7 @@ async function findProblems(filename) {
);

if (!hasRuleConfigComment) {
const message = `Example code should contain a configuration comment like /* eslint ${title}: error */`;
const message = `Example code should contain a configuration comment like /* eslint ${title}: "error" */`;

problems.push({
fatal: false,
Expand Down

0 comments on commit 47a1495

Please sign in to comment.