SonarCloud is raising an issue which I believe to be a false positive. When using the class attribute in JSX but without React, it is flagged as an unknown attribute by Sonar.
Basic info
CI: Jenkins
Language: TSX
Quality profile: Sonar way (built in)
The issue
We use the StencilJS framework. Our code is written as TSX. The React package is installed, but not used in this part of the code.
Stencil uses the normal class attribute, as opposed to className in React. Since a few days, however, our TSX code using class attributes is getting flagged by SonarCloud with the typescript:S6747 rule: Unknown property âclassâ found, use âclassNameâ instead.
In fact, using class here is correct, while using className would be incorrect and give a TypeScript error.
weâll try to prioritize this ticket for our next hardening. In the meantime, feel free to mark the issues as âwonât fixâ or disable the rule in your quality profile.
This looks like a much larger issue than just the stencilJS. using @react-three/fiber and after the updates to Sonar Way quality gate on 2023/10/05 it has flagged a large amount of âinvalidâ jsx property usage. We have the types installed and they werenât flagged as issues prior.
thanks for the feedback, weâll have this into account.
In the meantime, there is a workaround you all can use @dgonzalezr@matsgottenbos@Scott_Beck by whitelisting specific JSX attributes in the rule parameters:
PS: The rule is: JSX elements should not use unknown properties and attributes (typescript:S6747). I would love to have more granularity, but this is a good sanity fix for now.