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 S6774 (prop-types): React components should validate prop types #4174

Merged
merged 1 commit into from
Sep 18, 2023

Conversation

yassin-kammoun-sonarsource
Copy link
Contributor

Fixes #4142

Comment on lines +25 to +27
"compatibleLanguages": [
"JAVASCRIPT"
]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that I only enabled the rule for JavaScript. I am not convinced it would make sense to enable for TypeScript in general. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not sure - the tests include TypeScript: https://github.com/jsx-eslint/eslint-plugin-react/blob/ecadb92609998520be80d64c0bd6bc5e05934aa9/tests/lib/rules/prop-types.js#L1286

On the other hand, it is indeed looks redundant for TypeScript

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should try to enable it and see how much noise it makes?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tried and noisy, too noisy. Let's keep the rule enabled for JavaScript only.

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.

I am undecided if this should be enabled for typescript or not, so up to you.

@sonarqube-next
Copy link

@yassin-kammoun-sonarsource yassin-kammoun-sonarsource merged commit 598b567 into master Sep 18, 2023
14 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/prop-types​: Disallow missing props validation in a React component definition
2 participants