question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggested fix for `no-div-regex` trips `no-useless-escape`

See original GitHub issue

Tell 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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
SalsabeelQandeelcommented, Apr 18, 2019

I can work on this one, Is it available?

1reaction
coreyfarrellcommented, Mar 24, 2019

@platinumazure thanks for responding. Unfortunately I don’t currently have time to work on this and since xo has removed the no-div-regex this is no longer as issue for me.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found