`no-useless-assertions` false negative around `$`
RunDevelopment opened this issue · comments
Michael Schmidt commented
#478 included the regex: /Java(?=Script)$/
. This regex will always reject because the 2 assertions conflict each other. no-useless-assertions
is supposed to report this but doesn't. The rule does find the problem in /Java$(?=Script)/
though.
Yosuke Ota commented
I've found other false negatives for no-useless-assertions.
( I thought I'd open a new issue, but commenting on this issue because I thought it was similar to this issue. Let me know if you think it should be a separate issue.)
The following patterns contain assertions that are always accepted, but none are reported.
console.log(/^^a$$/u.test('a'));
// ^ ^ second edge assertions will always accept
console.log(/\b^a\b$/u.test('a'));
// ^^ ^^ \b will always accept
console.log(/^\ba$\b/u.test('a'));
// ^^ ^^ \b will always accept
console.log(/\b\ba\b\b/u.test('a'));
// ^^ ^^ second \b will always accept