xojs / eslint-config-xo

ESLint shareable config for XO

Home Page:https://github.com/xojs/xo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conflict between `no-div-regex` and `no-useless-escape`

coreyfarrell opened this issue · comments

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.

If you want I can open a bug with eslint

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

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.

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.