RSPEC-3403 FP The "prop" in "for (prop in object)" is not considered a string

In this example

for (prop in object) {
  if (prop !== 'something') { // FP

The line marked with FP is where the false positive is shown, with the message:

Remove this “!==” check; it will always be true. Did you mean to use “!=”?

which corresponds to this rule: Rules explorer

BUT “prop” does hold a string.

As a side note, in 2021 nobody should suggest to use anything but “===” / “!==”.

  • Versions: SonarQube 8.9, Scanner 4.6.2