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.

no-useless-escape false negative

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.12.2
  • Node Version: 7.2.1
  • npm Version: 3.10.10

What parser (default, Babel-ESLint, etc.) are you using?

default

Please show your full configuration: n/a, no configuration file





What did you do? Please include the actual source code causing the issue.

Running eslint --no-eslintrc --rule 'no-useless-escape: 2' test.js with the contents of `test.js being:

/\{/

Also same results with this more complete example:

console.log(/\{/.test('{')); // true

console.log(/{/.test('{')); // also true

What did you expect to happen?

I expected to be told that { was being uselessly escaped on line 1.

What actually happened? Please include the actual, raw output from ESLint.

No error reported. This issue also applies to /\}/.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Dec 19, 2016

Actually, after looking at the spec I’m not sure this is a bug – see this comment for more explanation. /{/ is only a legal regex for engines that implement Annex B, a part of the spec which is only normative for engines in web browsers. So /\{/ is only a useless escape on engines that implement Annex B, which might not apply to all engines.

1reaction
not-an-aardvarkcommented, Dec 24, 2016

Closing this issue – as described above, /\{/ is only a useless escape for engines that implement Annex B, but it’s not useless for JS engines in general.

Read more comments on GitHub >

github_iconTop Results From Across the Web

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 >
eslint: false positive no-useless-escape : r/reactjs - Reddit
But eslint saying that I do not need backslash, but without backslash it will be not "non-space" but S. React version is 16.12.0....
Read more >
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) . Using ...
Read more >
regexp/no-useless-escape
regexp/no-useless-escape #. disallow unnecessary escape characters in RegExp. ⚙️ This rule is included in "plugin:regexp/recommended" .
Read more >
Practices of Science: False Positives and False Negatives
This is a false positive. This can lead to unnecessary medical treatment. On the other hand a false negative is when the test...
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