diff --git a/package.json b/package.json index e970cf87cb0..cfc6b1b017a 100644 --- a/package.json +++ b/package.json @@ -66,7 +66,7 @@ "path-is-inside": "^1.0.2", "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^2.0.0", + "regexpp": "^2.0.1", "require-uncached": "^1.0.3", "semver": "^5.5.1", "strip-ansi": "^4.0.0", diff --git a/tests/lib/rules/no-invalid-regexp.js b/tests/lib/rules/no-invalid-regexp.js index 305f4e0d383..0062a5bbc5a 100644 --- a/tests/lib/rules/no-invalid-regexp.js +++ b/tests/lib/rules/no-invalid-regexp.js @@ -46,6 +46,12 @@ ruleTester.run("no-invalid-regexp", rule, { invalid: [ { code: "RegExp('[');", errors: [{ message: "Invalid regular expression: /[/: Unterminated character class.", type: "CallExpression" }] }, { code: "RegExp('.', 'z');", errors: [{ message: "Invalid flags supplied to RegExp constructor 'z'.", type: "CallExpression" }] }, - { code: "new RegExp(')');", errors: [{ message: "Invalid regular expression: /)/: Unmatched ')'.", type: "NewExpression" }] } + { code: "new RegExp(')');", errors: [{ message: "Invalid regular expression: /)/: Unmatched ')'.", type: "NewExpression" }] }, + + // https://github.com/eslint/eslint/issues/10861 + { + code: String.raw`new RegExp('\\');`, + errors: [{ message: "Invalid regular expression: /\\/: \\ at end of pattern.", type: "NewExpression" }] + } ] });