question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

no-invalid-regexp rule doesn't error with example from its documentation

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Oct 5, 2018

@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 upgrading regexpp and adding a test, as you suggested.

1reaction
mysticateacommented, Oct 5, 2018

I’m sorry, I misread it as // 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

no-invalid-regexp - ESLint - Pluggable JavaScript Linter
This rule disallows invalid regular expression strings in RegExp constructors. Examples of incorrect code for this rule: /*eslint no-invalid-regexp: "error"*/ ...
Read more >
Regex for rules in CI/CD jobs does not work - GitLab
Summary Regex in the rule block of a CI job does not work. ... literal: '[' or a Gitlab CI error rules:rule if...
Read more >
What flavor of Regex does Visual Studio Code use?
It'll complain with the error Invalid group . Apart from solving this specific issue, I'm looking for information about the flavor of Regexes...
Read more >
SyntaxError: invalid regular expression flag "x" - MDN Web Docs
The JavaScript exception "invalid regular expression flag" occurs when the flags in a regular expression contain any flag that is not one ...
Read more >
Regular Expression—ArcGIS Pro | Documentation
When a string is found that does not match the format or values specified, the table row is returned as an error. For...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found