Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix FP S6747: Support StencilJS class TSX attribute #4250

Closed
victor-diez-sonarsource opened this issue Oct 6, 2023 · 7 comments
Closed

Fix FP S6747: Support StencilJS class TSX attribute #4250

victor-diez-sonarsource opened this issue Oct 6, 2023 · 7 comments
Labels
jira-import_24-04-2024 The issue have been imported in jira on 24-04-2024

Comments

@victor-diez-sonarsource
Copy link
Contributor

Seems the StencilJS framework uses class as a valid TSX attribute.

Reported in community.

Probably this should depend on detecting package.json dependencies. But even if React is detected (as it's the user's case), make sure it's actually used in the current analyzed file.

@gabriel-vivas-sonarsource

Another user in the same thread commented they also saw FP with @react-three/fiber.

@ilia-kebets-sonarsource ilia-kebets-sonarsource modified the milestone: 10.9 Oct 19, 2023
@saurabh-sp-tripathi
Copy link

We are having the same issue. My error is as following Unknown property 'analyticsvalue' found

<div hidden
                key={purchase?.giftCode}
				analyticsid={`Product_${purchase?.offer?.offerCode}`}
				analyticsvalue="123456789101112"
</div>

@appurist
Copy link

appurist commented Nov 2, 2023

I have, what I believe is the same problem, with my web apps that use Solid.js rather than React.
I believe Sonarlint should have a specific rule the S6747 case of class (specifically). I want other unrecognized properties to be reported, but class is part of HTML so creating an error by default is way too intrusive behavior (assumes React).

Can we get the className suggestion added as a separate rule so that we can just turn this specific case off when using additional frameworks and tools?

Edit: Sorry, I thought I matched on a Google search for S6747 sonarlint and thought this was a Sonarlint issue.

@vdiez
Copy link
Contributor

vdiez commented Nov 2, 2023

You all can use this workaround in the meantime to whitelist specific attributes: https://community.sonarsource.com/t/unknown-property-jsx-found-with-styled-jsx-ts-s6747/102300/3

@vdiez
Copy link
Contributor

vdiez commented Nov 2, 2023

@appurist sonarlint issues for js/ts come from this analyzer, so you you are posting in the right place

@appurist
Copy link

appurist commented Nov 2, 2023

I wasn't connected, so I was looking for an update for the VSCode settings.json file. I think I found it. You can whitelist class under the rule? This in my settings.json seems to allow class for both JS and TS:

  "sonarlint.rules": {
    "javascript:S6747": {
      "level": "on",
      "parameters": {
        "whitelist": "class"
      }
    },
    "typescript:S6747": {
      "level": "on",
      "parameters": {
        "whitelist": "class"
      }
    },

Maybe that is the general pattern for disconnected use.
@vdiez Thank you very much, I never would have found that without your link telling me there was a whitelist option.
💯 🙇‍♂️

@Wohops Wohops added the jira-import_24-04-2024 The issue have been imported in jira on 24-04-2024 label Apr 24, 2024
@Wohops Wohops closed this as completed Apr 24, 2024
@Wohops
Copy link
Contributor

Wohops commented Apr 24, 2024

Migrated to Jira. New ticket number: JS-74

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
jira-import_24-04-2024 The issue have been imported in jira on 24-04-2024
Projects
None yet
Development

No branches or pull requests

7 participants