eslint: no-invalid-regexp rule doesn't error with example from its documentation
Tell us about your environment
- ESLint Version: 5.6.0
- Node Version: 8.12.0
- npm Version: 6.3.0
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
{
"env": {
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2017
},
"rules": {
"no-invalid-regexp": "error"
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
// like in the no-invalid-regexp documentation:
// https://github.com/eslint/eslint/blob/master/docs/rules/no-invalid-regexp.md#rule-details
new RegExp('\\');
eslint file.js
What did you expect to happen?
eslint failing with an error from the no-invalid-regexp
rule.
What actually happened? Please include the actual, raw output from ESLint.
eslint passed with no output.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (12 by maintainers)
Commits related to this issue
- Fix: follow tc39/ecma262#910 (refs eslint/eslint#10861) — committed to mysticatea/regexpp by mysticatea 6 years ago
- Fix: no-invalid-regexp disallows \ at end of pattern (fixes #10861) — committed to eslint/eslint by mysticatea 6 years ago
- Fix: no-invalid-regexp disallows \ at end of pattern (fixes #10861) (#10920) — committed to eslint/eslint by mysticatea 6 years ago
- Revert "Fix: no-invalid-regexp disallows \ at end of pattern (fixes #10861) (#10920)" This reverts commit 5fe0e1a9fccaaf5c7c883ca2c9cea12fae0fcd1f. — committed to eslint/eslint by btmills 6 years ago
@sstern6 It looks like the fix has already been published as a new version of
regexpp
. https://github.com/eslint/eslint/pull/10920 has the effect of upgradingregexpp
and adding a test, as you suggested.Iām sorry, I misread it as
//
šWhen I run that code, I get an error: