With eslint-plugin-sonarjs, this expression triggers sonarjs/new-cap
Intl.DateTimeFormat().resolvedOptions().timeZone
Presumably it dislikes DateTimeFormat not being a constructor, but the name is beyond my control as it’s part of the EcmaScript standard Intl.DateTimeFormat - JavaScript | MDN
Sorry, can you please further explain what snippet is raising the issue?
If it’s only this
Intl.DateTimeFormat().resolvedOptions().timeZone
then I would not say is a false positive, as DateTimeFormat is a constructor, and the samples in the MDN linked page show that.
This Sonar rule modifies the behaviour of the ESLint rule new-cap, which also covers calling an uppercase function without new. I think our rule description should be completed to also explain that use case. I created a ticket to complete it.
I think I just didn’t realize Intl.DateTimeFormat is a constructor and the code that triggered sonarjs/no-cap on our side is indeed missing a new keyword as the rule would suggest.