Make sure to read this post before raising a thread here:
Then tell us:
What language is this for?
React/TypeScript
Which rule?
typescript:S6754
Why do you believe it’s a false-positive/false-negative?
It is not taking into account title-capped state variable names when comparing the state and its setter. React requires title-capped variable names for components.
Are you using
SonarCloud
How can we reproduce the problem? Give us a self-contained snippet of code (formatted text, no screenshots)
In this case, the useState result is properly destructured, and the variable names are symmetrical. It looks like the code is looking at the setter name and trying to lower-case it to determine the state variable name, but that won’t work when the state variable is title-capped to allow it to be used as a component in JSX/TSX.
We haven’t had the opportunity to address this issue yet, but the use case you’re sharing will be taken into account as well during implementation. It is tracked with the same ticket created by my colleague @victor.diez