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

Merged
merged 1 commit into from
Oct 6, 2019
Merged

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

merged 1 commit into from
Oct 6, 2019

Conversation

coryhouse
Copy link
Contributor

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.
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Member

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.

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`.
Copy link
Member

Choose a reason for hiding this comment

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

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

@EvHaus EvHaus self-assigned this Jul 25, 2019
@EvHaus
Copy link
Collaborator

EvHaus commented Oct 6, 2019

I've addressed the feedback and rebased against the latest changes in this PR. #2450

Closing this.

@EvHaus EvHaus closed this Oct 6, 2019
@ljharb ljharb reopened this Oct 6, 2019
@ljharb
Copy link
Member

ljharb commented Oct 6, 2019

@EvHaus rather than opening another PR, collaborators can force push directly to PR branches.

@EvHaus
Copy link
Collaborator

EvHaus commented Oct 6, 2019

My bad @ljharb. Good to know for next time. Is this good to merge after CI?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants