Error while running ESLint: Invalid regular expression flags
See original GitHub issueTell 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:
- Created 4 years ago
- Reactions:11
- Comments:23 (7 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.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 correctNode interpreters
, see screenshot below: