I will suggest that the rule RSPEC-3403 is useless, and should be removed, here is why.
First what you always should consider: SonarQube can’t analyze at runtime, only the source at design time. So if in your environment or case maybe always it will be a string, but SQ can’t know this, because it cant ‘debug’ or ‘run’ your code.
I write here, because we had a discussion about [RSPEC-3403].
This statement “it will always be true” is not correct. And because === does check type and value on both sides, the rule is senseless.
So the rule itself should be removed we believe in our team. Why?
Look at this example:
if ($currentClickedElement.data("switch") === "map") {
// do something
}
the compare operator ‘===’ means:
to be true, both sides must be from the same type and value
on the right side of the expression, the constant “map” is definitely of type ‘string’
on the left side you don’t know what type the value is at design time
3.1 but it CAN be of type ‘string’
3.1.1 so the statement “it will always be true” is not correct.
3.1.2 a statement like ‘it will sometimes be true’ is sensless, because this is why the ‘if’ clause exists