`prefer-regex-literals` suggestions
See original GitHub issueWhat rule do you want to change?
prefer-regex-literals
Does this change cause the rule to produce more or fewer warnings?
No
How will the change be implemented? (New option, new default behavior, etc.)?
Adds fixer
Please provide some example code that this change will affect:
new RegExp('\\.')
What does the rule currently do for this code?
Reports error
What will the rule do after it’s changed?
Fix it to:
/\./
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:28 (24 by maintainers)
Top Results From Across the Web
prefer-regex-literals - 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 >JavaScript: RegExp constructor vs RegEx literal - Stack Overflow
The literal is the best to use with known regular expressions, while the constructor is better for dynamically constructed regular expressions ...
Read more >Prefer the usage of regular expression literals ... - DeepSource
When a regular expression is known in advance, it is considered a best practice to avoid the string literal notation on top of...
Read more >Regular expressions - JavaScript - MDN Web Docs
Regular expression literals provide compilation of the regular expression when the script is loaded. If the regular expression remains constant, ...
Read more >[Returned for Revision] SE-0354: Regex Literals - Swift Forums
Hi everyone, The review of SE-0354: Regex Literals ran from April 28 to ... implies agreement to the idea that terse syntax ==...
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
No, if it isn’t reported then it shouldn’t be fixed. We could discuss in a separate issue whether or not this should be reported.
There’s an open PR: #15077