Invalid regular expression flags catch on no-octal-escape rule
See original GitHub issueTell us about your environment
- ESLint Version: 6.7.1
- Node Version: 10.16.3
- npm Version: 6.12.1
What parser (default, Babel-ESLint, etc.) are you using? babel-eslint
Please show your full configuration:
Configuration
{
"extends": ["airbnb", "prettier"],
"parser": "babel-eslint",
"env": {
"jest": true,
"browser": true
},
"rules": {
"no-restricted-syntax": ["error", "LabeledStatement", "WithStatement"],
"no-console": "off",
"react/prop-types": "off",
"react/destructuring-assignment": "off",
"react/jsx-filename-extension": "off",
"no-param-reassign": "off",
"spaced-comment": "off",
"no-nested-ternary": "off",
"no-return-assign": "off",
"no-else-return": "off"
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
Linter is catching an invalid regular expressions error in the no-octal-escape rule file.
Changing the regular expression flags to /u
seems to fix the issue.
What did you expect to happen?
ESLint to operate as usual
What actually happened? Please include the actual, raw output from ESLint.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:9 (3 by maintainers)
Top Results From Across the Web
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 >Error while running ESLint: Invalid regular expression flags
I went to node_modules/eslint/lib/rules/no-octal-escape.js and replaced the line in the screen shot with: /^(?:[^\\]|\\.)*?
Read more >disallow invalid regular expression strings in RegExp ...
This rule disallows invalid regular expression strings in RegExp constructors. ... ECMAScript 6 adds the following flag arguments to the RegExp constructor:.
Read more >SyntaxError: invalid regular expression flag "x"
They can also be defined in the constructor function of the RegExp object (second parameter). Regular expression flags can be used separately or ......
Read more >在使用vue-cli脚手架工具进行项目搭建时,按照官方教程完成 ...
[89])|[1-7])/su ^ SyntaxError: Invalid regular expression flags at ... F:\test\node_modules\eslint\lib\rules\no-octal-escape.js:41 /$(?
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 Free
Top 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
Howdy - know this has been closed - but if anyone is experiencing this error in prettier-atom a simple update to atom fixed it. I was running 1.3.something
I am also seeing this exact error in VSCode when using the extension - https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint
Changing the regular expression flags to /u seems to fix the issue for me as well