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

Update no-unused-prop-types.md #2273

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@coryhouse
Copy link
Contributor

commented May 12, 2019

Using latest syntax, eliminated SFC since that's a dated term. Fixed grammar.

Update no-unused-prop-types.md
Using latest syntax, eliminated SFC since that's a dated term. Fixed grammar.
@@ -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.

This comment has been minimized.

Copy link
@ljharb

ljharb May 12, 2019

Collaborator

i prefer to keep the term SFC while it's still in common usage in the community. Please revert these.

This comment has been minimized.

Copy link
@coryhouse

coryhouse May 12, 2019

Author Contributor

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.

This comment has been minimized.

Copy link
@ljharb

ljharb May 12, 2019

Collaborator

React docs are irrelevant; it’s still a widely used term in the community. A component with a useState hook is still an SFC.

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`.

This comment has been minimized.

Copy link
@ljharb

ljharb May 12, 2019

Collaborator
Suggested change
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`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.