Suggested fix for `no-div-regex` trips `no-useless-escape`
See original GitHub issueTell us about your environment
- ESLint Version: 5.13
- Node Version: 10.15.0
- npm Version: 6.4.1
What parser (default, Babel-ESLint, etc.) are you using? default
Please show your full configuration:
Configuration
{
"rules": {
"no-div-regex": "error",
"no-useless-escape": "error"
}
}
What did you do? Please include the actual source code causing the issue, as well as the command that you used to run ESLint.
console.log('test=='.replace(/=*$/, '')); // no-div-regex error
console.log('test=='.replace(/\=*$/, '')); // no-useless-escape error
console.log('test=='.replace(/[=]*$/, '')); // accepted by both rules
eslint script.js
What did you expect to happen?
no-div-regex
should suggest replacing /=foo/
with /[=]foo/
to avoid no-useless-escape
error. Alternatively no-useless-escape
could accept an ignoreDivRegex
boolean option to allow /\=foo/
.
Are you willing to submit a pull request to fix this bug?
I’m sure I can handle the documentation approach of suggesting /[=]foo/
. I’m not confident I can create the no-useless-escape
option to ignore div regex.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Disable Unnecessary escape character: \/ no-useless-escape
I have this regex of mine that will check the string if it contains link or url (i.e. https://eslint.org/docs/rules/no-useless-escape) .
Read more >no-useless-escape - 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 >regexp/no-useless-escape
This rule reports unnecessary escape characters in RegExp. You may be able to find another mistake by finding unnecessary escapes.
Read more >Strip HTML Tags in JavaScript - CSS-Tricks
I have developed same thing using javascript Regular Expression. It'll strip all the html tags excluding tag provided in exclude list by user....
Read more >Code Issues - Embold Help Center
StackAddressEscape, Check that addresses to stack memory do not escape the ... Unnecessary array allocation will occur even if no parameter is passed...
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
I can work on this one, Is it available?
@platinumazure thanks for responding. Unfortunately I don’t currently have time to work on this and since
xo
has removed theno-div-regex
this is no longer as issue for me.