Skip to content

JS-72 S6767: Update rspec with FP explanation #4971

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

Merged
merged 1 commit into from
Apr 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions rules/S6767/javascript/rule.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ Leaving unused props in a React component can make the code harder to understand

To avoid these issues, you should remove any unused props from React components. This helps keep the codebase clean, improves performance, and enhances code readability.

=== Known Issues/Limitations

False Positives SFC
Stateless Function Components (SFCs) accept props as an argument and return a JSX expression. Even if the function gets called from a component, the props that are only used inside the component are not be considered used by a component. See references for more details.

== How to fix it in PropTypes

=== Code examples
Expand Down Expand Up @@ -92,3 +97,4 @@ class Hello extends React.Component<Props> {
* React Documentation - https://react.dev/learn/passing-props-to-a-component[Passing Props to a Component]
* React Documentation - https://react.dev/reference/react/Component#static-proptypes[static propTypes]
* React Documentation - https://react.dev/learn/typescript#typescript-with-react-components[TypeScript with React Components]
* ESLint React Plugin Known Limitations - https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/no-unused-prop-types.md#known-issueslimitations
Loading