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

Add rule S6747 (no-unknown-property): JSX elements should not use unknown properties and attributes #4146

Merged
merged 1 commit into from Sep 6, 2023

Conversation

yassin-kammoun-sonarsource
Copy link
Contributor

Fixes #4144

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource changed the title Add rule S6747 (no-unknown-property): Disallow usage of unknown DOM property Add rule S6747 (no-unknown-property): JSX elements should not use unknown properties and attributes Sep 6, 2023
@@ -17,11 +17,11 @@
* along with this program; if not, write to the Free Software Foundation,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes on this file were required to also consider .jsx files triggering quick fixes.

@Rule(key = "S6747")
public class NoUnknownPropertyCheck implements EslintBasedCheck {

@RuleProperty(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In general, I would avoid as much as possible to include properties to a rule. However, if we don't provide this feature, I am afraid too many users will complain about false positives.

Please let me know if that makes sense to you, or if we should drop that property :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree that it is necessary - that was my first thought when I was reading the rule source.

@sonarqube-next
Copy link

sonarqube-next bot commented Sep 6, 2023

Copy link
Contributor

@alex-sonar alex-sonar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource merged commit 1bf25e7 into master Sep 6, 2023
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create rule for react/no-unknown-property​: Disallow usage of unknown DOM property
2 participants