Repository: eslint/eslint
File: tools/check-rule-examples.js (JavaScript)

Code before:
                problems.push({
                    fatal: false,
                    severity: 2,
                    message,
                    line: codeBlockToken.map[0] + 1,
                    column: codeBlockToken.markup.length + 1
                });
            }

            const { ast, error } = tryParseForPlayground(code, parserOptions);

            if (ast && !isRuleRemoved) {
                const hasRuleConfigComment = ast.comments.some(
                    comment => {
                        if (comment.type !== "Block" || !/^\s*eslint(?!\S)/u.test(comment.value)) {
                            return false;
                        }
                        const { directiveValue } = commentParser.parseDirective(comment);
                        const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc);

                        return parseResult.success && Object.prototype.hasOwnProperty.call(parseResult.config, title);
                    }
                );

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

                    problems.push({
                        fatal: false,
                        severity: 2,
                        message,
                        line: codeBlockToken.map[0] + 2,
                        column: 1
                    });
                }
            }

            if (error) {
                const message = `Syntax error: ${error.message}`;
                const line = codeBlockToken.map[0] + 1 + error.lineNumber;
                const { column } = error;

                problems.push({
                    fatal: false,
                    severity: 2,
                    message,
                    line,
                    column
                });
            }
        }

Review comment (suggestion):
```suggestion
                    const message = `Example code should contain a configuration comment like /* eslint ${title}: "error" */`;
```

We're usually using `"error"` in rule examples.

Code after:
                problems.push({
                    fatal: false,
                    severity: 2,
                    message,
                    line: codeBlockToken.map[0] + 1,
                    column: codeBlockToken.markup.length + 1
                });
            }

            const { ast, error } = tryParseForPlayground(code, parserOptions);

            if (ast && !isRuleRemoved) {
                const hasRuleConfigComment = ast.comments.some(
                    comment => {
                        if (comment.type !== "Block" || !/^\s*eslint(?!\S)/u.test(comment.value)) {
                            return false;
                        }
                        const { directiveValue } = commentParser.parseDirective(comment);
                        const parseResult = commentParser.parseJsonConfig(directiveValue, comment.loc);

                        return parseResult.success && Object.prototype.hasOwnProperty.call(parseResult.config, title);
                    }
                );

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

                    problems.push({
                        fatal: false,
                        severity: 2,
                        message,
                        line: codeBlockToken.map[0] + 2,
                        column: 1
                    });
                }
            }

            if (error) {
                const message = `Syntax error: ${error.message}`;
                const line = codeBlockToken.map[0] + 1 + error.lineNumber;
                const { column } = error;

                problems.push({
                    fatal: false,
                    severity: 2,
                    message,
                    line,
                    column
                });
            }
        }