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.

Error while running ESLint: Invalid regular expression flags

See original GitHub issue

Tell us about your environment

  • ESLint Version: 6.6.0
  • Node Version: 12.13.0
  • npm Version: 6.12.0

What parser (default, Babel-ESLint, etc.) are you using? default

Please show your full configuration:

Configuration
env:
  browser: true
  es6: true
  node: true
extends:
  - standard
globals:
  Atomics: readonly
  SharedArrayBuffer: readonly
parserOptions:
  ecmaFeatures:
    jsx: true
  ecmaVersion: 2018
  sourceType: module
plugins:
  - react
rules: {}

What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint. Creating any *.js file trigger the error. My linter in Atom report the following

What did you expect to happen? No linter error flag when a JS file is created

What actually happened? Please include the actual, raw output from ESLint.

Error while running ESLint: Invalid regular expression flags
Invalid regular expression flags
Referenced from: /Users/me/dev/.eslintrc.yml

/Users/me/dev/node_modules/eslint/lib/source-code/source-code.js:426
return /\s/u.test(text.replace(/\/\*.*?\*\//gus, ""));
                               ^

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:11
  • Comments:23 (7 by maintainers)

github_iconTop GitHub Comments

6reactions
damien-gitcommented, Dec 16, 2019

The related lint-eslint plugin issue is at https://github.com/AtomLinter/linter-eslint/issues/1306 . This led me to update Atom to version 1.42, which fixed the problem.

4reactions
anatoly314commented, Nov 17, 2019

I think that I know how to solve the issue, at least with WebStorm it works. It looks like Webstorm grabs on startup default Node/NPM version. If you manage multiple Node/NPM versions by nvm and the default one is v8.9.1 like in my scenario it won’t work.

To fix it you need to go to: Webstorm -> Preferences -> Languages and Frameworks -> Node.js and NPM and select correct Node interpreters, see screenshot below:

Screen Shot 2019-11-17 at 18 47 21
Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - eslint SyntaxError: Invalid regular expression flags
In my case (node react app), the cause of this error is the depreciated eslint-config-airbnb npm module. Running npx install-peerdeps --dev ...
Read more >
no-invalid-regexp - ESLint - Pluggable JavaScript Linter
Disallow invalid regular expression strings in RegExp constructors ... flags for any reason, you can specify them using the allowConstructorFlags option.
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 >
Always Show: (ESLint) Invalid regular expression flags
After Updating VS 2019, I create a new js file, and I dont key any codes in it. But the VS 2019 show...
Read more >
Error while running ESLint: Invalid regular expression flags ...
[Solved]-Error while running ESLint: Invalid regular expression flags-React Native. Search. score:7. /^(?:[^\\]|\\.)*?\\([0-3][0-7]{1,2}|[4-7][0-7]|[1-7])/u.
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