`no-regex-spaces`: Add RegExp object form
See original GitHub issueThe docs for this rule specifically call out that the following will not be considered a warning:
/*eslint no-regex-spaces: 2*/
var re = new RegExp("foo bar");
This seems to be a limitation, as it is not asserted in the tests, and intuitively it seems that the RegExp object format should be treated the same way as a literal, multiple spaces are equally hard to read in both.
<bountysource-plugin>
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource. </bountysource-plugin>
Issue Analytics
- State:
- Created 8 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
RegExp - JavaScript - MDN Web Docs - Mozilla
Chrome Edge
RegExp Full support. Chrome1. Toggle history Full support. Edge12. Toggle history
@@match Full support. Chrome50. Toggle history Full support. Edge13. Toggle history
@@matchAll Full...
Read more >Rules - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >Passing regex modifier options to RegExp object
You need to pass the second parameter: var r = new RegExp(keyword, "i");. You will also need to escape any special characters in...
Read more >Regular Expression (Regex) Tutorial
lookingAt(), which tries to match from the START of the input (^. ... There are two sets of methods, issue via a RegEx...
Read more >JavaScript RegExp Object - Regular Expressions - W3Schools
A regular expression is a sequence of characters that forms a search pattern. The search pattern can be used for text search and...
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
From the rule docs:
In most of the docs, the “not warnings” section is used to show how to “fix” the code so that the rule will no longer flag. So, what I’m proposing is:
Cool, I’d be all for that, and @nzakas has said
So I’d say go for it. 😃