-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Update no-unused-prop-types.md #2273
Conversation
docs/rules/no-unused-prop-types.md
Outdated
@@ -86,12 +90,12 @@ AComponent.propTypes = { | |||
bProp: PropTypes.string // bProp is defined but never used | |||
}; | |||
``` | |||
A suggested fix is to assign a bProp to a variable outside of the SFC. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i prefer to keep the term SFC while it's still in common usage in the community. Please revert these.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no mention of SFC in the react docs anymore. Or stateless function. https://www.dropbox.com/s/u51xabyw7wfuqqy/Screenshot%202019-05-12%2008.12.19.png?dl=0. And even if one does know the history and what SFC means, the warnings apply to function components with state (via Hooks) too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
React docs are irrelevant; it’s still a widely used term in the community. A component with a useState hook is still an SFC.
docs/rules/no-unused-prop-types.md
Outdated
Using Intermediate variables might be desired and unavoidable for more complex props structure. | ||
Like for shape prop types. To avoid false positive in this case make sure `skipShapeProps` is set to `true`. | ||
Using intermediate variables might be desired and unavoidable for more complex props structure. | ||
Like for shape propTypes. To avoid false positive in this case make sure `skipShapeProps` is set to `true`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like for shape propTypes. To avoid false positive in this case make sure `skipShapeProps` is set to `true`. | |
For example, for shape propTypes, to avoid a false positive, make sure `skipShapeProps` is set to `true`. |
I've addressed the feedback and rebased against the latest changes in this PR. #2450 Closing this. |
@EvHaus rather than opening another PR, collaborators can force push directly to PR branches. |
My bad @ljharb. Good to know for next time. Is this good to merge after CI? |
Using latest syntax, eliminated SFC since that's a dated term. Fixed grammar.