Debian Codegraph @

eslint/babel-eslint-plugin-development-internal/test/rules/report-error-message-formtat.js

raw symbols SCIP
1 import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
2 import rule from "../../lib/rules/report-error-message-format.cjs";
3
4 const ruleTester = new RuleTester();
5
6 ruleTester.run("report-error-message-format", rule, {
7 valid: [
8 "makeErrorTemplates({});",
9 'makeErrorTemplates({ ThisIsAnError: "This is an error." });',
10 `makeErrorTemplates({ ThisIsAnError: "'this' is an error." });`,
11 `makeErrorTemplates({ ThisIsAnError: "\`this\` is an error." });`,
12 `makeErrorTemplates({ ThisIsAnError: "This is an error?" });`,
13 `makeErrorTemplates({ ThisIsAnError: "'this' is an error?" });`,
14 `makeErrorTemplates({ ThisIsAnError: "\`this\` is an error?" });`,
15 'makeErrorTemplates({ ThisIsAnError: "This is\\nan error." });',
16 `makeErrorTemplates({ ThisIsAnError: "'this' is\\nan error." });`,
17 `makeErrorTemplates({ ThisIsAnError: "\`this\` is\\nan error." });`,
18 `makeErrorTemplates({ ThisIsAnError: "This is\\nan error?" });`,
19 `makeErrorTemplates({ ThisIsAnError: "'this' is\\nan error?" });`,
20 `makeErrorTemplates({ ThisIsAnError: "\`this\` is\\nan error?" });`,
21 ],
22 invalid: [
23 {
24 code: "makeErrorTemplates({ ThisIsAnError: 'this is an error.' });",
25 errors: [{ messageId: "mustMatchPattern" }],
26 },
27 {
28 code: "makeErrorTemplates({ ThisIsAnError: 'This is an error' });",
29 errors: [{ messageId: "mustMatchPattern" }],
30 },
31 {
32 code: "makeErrorTemplates({ ThisIsAnError: 'this is an error?' });",
33 errors: [{ messageId: "mustMatchPattern" }],
34 },
35 {
36 code: "makeErrorTemplates({ ThisIsAnError: '`this` is an error' });",
37 errors: [{ messageId: "mustMatchPattern" }],
38 },
39 {
40 code: `makeErrorTemplates({ ThisIsAnError: "'this' is an error" });`,
41 errors: [{ messageId: "mustMatchPattern" }],
42 },
43 ],
44 });