mirror of
https://github.com/hanzoai/babel.git
synced 2026-09-24 16:56:45 +00:00
* 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
47 lines
1.8 KiB
JavaScript
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" }],
|
|
},
|
|
],
|
|
});
|