diff --git a/lib/rules/no-warning-comments.js b/lib/rules/no-warning-comments.js index 0dd0a26c1f9..1d1b55460bc 100644 --- a/lib/rules/no-warning-comments.js +++ b/lib/rules/no-warning-comments.js @@ -95,7 +95,7 @@ module.exports = { * ^\s*TERM\b. This checks the word boundary * at the beginning of the comment. */ - return new RegExp(prefix + escaped + suffix, "iu"); + return new RegExp(prefix + escaped + suffix, "i"); // eslint-disable-line require-unicode-regexp } /* @@ -103,7 +103,7 @@ module.exports = { * \bTERM\b|\bTERM\b, this checks the entire comment * for the term. */ - return new RegExp(prefix + escaped + suffix + eitherOrWordBoundary + term + wordBoundary, "iu"); + return new RegExp(prefix + escaped + suffix + eitherOrWordBoundary + term + wordBoundary, "i"); // eslint-disable-line require-unicode-regexp } const warningRegExps = warningTerms.map(convertToRegExp); diff --git a/tests/lib/rules/no-warning-comments.js b/tests/lib/rules/no-warning-comments.js index 3484d0a45f3..8a9b2c5e273 100644 --- a/tests/lib/rules/no-warning-comments.js +++ b/tests/lib/rules/no-warning-comments.js @@ -36,7 +36,8 @@ ruleTester.run("no-warning-comments", rule, { { code: "// comments containing terms as substrings like TodoMVC", options: [{ terms: ["todo"], location: "anywhere" }] }, { code: "// special regex characters don't cause problems", options: [{ terms: ["[aeiou]"], location: "anywhere" }] }, "/*eslint no-warning-comments: [2, { \"terms\": [\"todo\", \"fixme\", \"any other term\"], \"location\": \"anywhere\" }]*/\n\nvar x = 10;\n", - { code: "/*eslint no-warning-comments: [2, { \"terms\": [\"todo\", \"fixme\", \"any other term\"], \"location\": \"anywhere\" }]*/\n\nvar x = 10;\n", options: [{ location: "anywhere" }] } + { code: "/*eslint no-warning-comments: [2, { \"terms\": [\"todo\", \"fixme\", \"any other term\"], \"location\": \"anywhere\" }]*/\n\nvar x = 10;\n", options: [{ location: "anywhere" }] }, + { code: "foo", options: [{ terms: ["foo-bar"] }] } ], invalid: [ { code: "// fixme", errors: [{ message: "Unexpected 'fixme' comment." }] },