diff --git a/lib/eslint.js b/lib/eslint.js index 81483e1a261..e6bd43cdd47 100755 --- a/lib/eslint.js +++ b/lib/eslint.js @@ -974,7 +974,7 @@ module.exports = (function() { } if (opts) { - message = message.replace(/\{\{\s*(.+?)\s*\}\}/g, function(fullMatch, term) { + message = message.replace(/\{\{\s*([^{}]+?)\s*\}\}/g, function(fullMatch, term) { if (term in opts) { return opts[term]; } diff --git a/tests/lib/eslint.js b/tests/lib/eslint.js index 84226afe600..1ddfa1c9ce8 100644 --- a/tests/lib/eslint.js +++ b/tests/lib/eslint.js @@ -937,6 +937,25 @@ describe("eslint", function() { assert.equal(messages[0].message, "message yay!"); }); + it("should allow template parameter wrapped in braces", function() { + eslint.reset(); + eslint.defineRule("test-rule", function(context) { + return { + Literal(node) { + context.report(node, "message {{{param}}}", { + param: "yay!" + }); + } + }; + }); + + config.rules["test-rule"] = 1; + + const messages = eslint.verify("0", config); + + assert.equal(messages[0].message, "message {yay!}"); + }); + it("should ignore template parameter with no specified value", function() { eslint.reset(); eslint.defineRule("test-rule", function(context) {