Files
Huáng JùnliàngandGitHub e2fd7d7bcf Bundle more packages (#17938)
* chore: bundle babel-cli and babel-node

* chore: bundle babel-helper-builder-react-jsx

* refactor: unify extra entrypoints handling

* chore: bundle babel-helper-transform-fixture-test-runner

* chore: bundle babel-helper-fixtures

* build: bundle babel-helpers

* build: bundle babel-build-external-helpers

* refactor: reuse pkgJSON in PackageInfo

* refactor: skip inputs path normalization

* build: bundle babel-eslint-parser

* fixup babel-helpers

* revert babel-cli bin changes

* update npm-ignore generators

* cleanup outdated comments

* test(eslint): avoid private sub imports

* chore: bundle babel-eslint-*

* chore: bundle babel-register

* chore: skip rollup for private packages
2026-04-22 19:47:42 -04:00

47 lines
1.8 KiB
JavaScript

import plugin from "../../lib/index.js";
import RuleTester from "../../../babel-eslint-shared-fixtures/utils/RuleTester.js";
const rule = plugin.rules["report-error-message-format"];
const ruleTester = new RuleTester();
ruleTester.run("report-error-message-format", rule, {
valid: [
"makeErrorTemplates({});",
'makeErrorTemplates({ ThisIsAnError: "This is an error." });',
`makeErrorTemplates({ ThisIsAnError: "'this' is an error." });`,
`makeErrorTemplates({ ThisIsAnError: "\`this\` is an error." });`,
`makeErrorTemplates({ ThisIsAnError: "This is an error?" });`,
`makeErrorTemplates({ ThisIsAnError: "'this' is an error?" });`,
`makeErrorTemplates({ ThisIsAnError: "\`this\` is an error?" });`,
'makeErrorTemplates({ ThisIsAnError: "This is\\nan error." });',
`makeErrorTemplates({ ThisIsAnError: "'this' is\\nan error." });`,
`makeErrorTemplates({ ThisIsAnError: "\`this\` is\\nan error." });`,
`makeErrorTemplates({ ThisIsAnError: "This is\\nan error?" });`,
`makeErrorTemplates({ ThisIsAnError: "'this' is\\nan error?" });`,
`makeErrorTemplates({ ThisIsAnError: "\`this\` is\\nan error?" });`,
],
invalid: [
{
code: "makeErrorTemplates({ ThisIsAnError: 'this is an error.' });",
errors: [{ messageId: "mustMatchPattern" }],
},
{
code: "makeErrorTemplates({ ThisIsAnError: 'This is an error' });",
errors: [{ messageId: "mustMatchPattern" }],
},
{
code: "makeErrorTemplates({ ThisIsAnError: 'this is an error?' });",
errors: [{ messageId: "mustMatchPattern" }],
},
{
code: "makeErrorTemplates({ ThisIsAnError: '`this` is an error' });",
errors: [{ messageId: "mustMatchPattern" }],
},
{
code: `makeErrorTemplates({ ThisIsAnError: "'this' is an error" });`,
errors: [{ messageId: "mustMatchPattern" }],
},
],
});