Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict between no-div-regex and no-useless-escape #54

Closed
coreyfarrell opened this issue Feb 4, 2019 · 3 comments
Closed

Conflict between no-div-regex and no-useless-escape #54

coreyfarrell opened this issue Feb 4, 2019 · 3 comments

Comments

@coreyfarrell
Copy link

I have a block of code which uses str.replace(/=*$/, '') to on a base64 string (round trip is not needed or wanted, I'm just generating random strings). First no-div-regex complained about this, then I updated the code to str.replace(/\=*$/, '') and no-useless-escape complained instead.

If you want I can open a bug with eslint, see if they'll add a ignore-div-regex boolean option to no-useless-escape. For now I'm just disabling no-div-regex on my own repo, leaving it to editors to disambiguate with regex syntax highlighting.

@sindresorhus
Copy link
Member

sindresorhus commented Feb 4, 2019

If you want I can open a bug with eslint

👍 Can you comment a link here to the issue when you do?

@coreyfarrell
Copy link
Author

I just did an additional test, it appears that str.replace(/[=]*$/, '') does not trip either rule and produces the desired result. I posted eslint/eslint#11355, we'll see if/how they want this handled.

@sindresorhus
Copy link
Member

While I still think the no-useless-escape rule should have an option to not conflict, I have decided to remove the no-div-regex rule. From looking closer at it, I don't really see the point of it. With syntax highlighting and proper formatting and spacing (which XO enforces), there's really no ambiguity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants