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

[Docs] no-unused-prop-types: fix syntax errors #3259

Merged
merged 1 commit into from Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -17,9 +17,11 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
### Changed
* [readme] remove global usage and eslint version from readme ([#3254][] @aladdin-add)
* [Refactor] fix linter errors ([#3261][] @golopot)
* [Docs] [`no-unused-prop-types`]: fix syntax errors ([#3259][] @mrdulin)

[#3261]: https://github.com/yannickcr/eslint-plugin-react/pull/3261
[#3260]: https://github.com/yannickcr/eslint-plugin-react/pull/3260
[#3259]: https://github.com/yannickcr/eslint-plugin-react/pull/3259
[#3254]: https://github.com/yannickcr/eslint-plugin-react/pull/3254
[#3251]: https://github.com/yannickcr/eslint-plugin-react/pull/3251
[#3244]: https://github.com/yannickcr/eslint-plugin-react/pull/3244
Expand Down
16 changes: 8 additions & 8 deletions docs/rules/no-unused-prop-types.md
Expand Up @@ -15,18 +15,18 @@ class Hello extends React.Component {
render() {
return <div>Hello Bob</div>;
}
});
}

Hello.propTypes = {
name: PropTypes.string
},
};
```

```jsx
type Props = {
firstname: string,
middlename: string, // middlename is never used by the Hello component
lastname: string
firstname: string;
middlename: string; // middlename is never used by the Hello component
lastname: string;
Comment on lines +27 to +29
Copy link
Member

Choose a reason for hiding this comment

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

technically these aren't syntax errors, but this is the more common TS style.

}

class Hello extends React.Component<Props> {
Expand Down Expand Up @@ -62,11 +62,11 @@ class Hello extends React.Component {
render() {
return <div>Hello {this.props.name}</div>;
}
};
}

Hello.propTypes: {
Hello.propTypes = {
name: PropTypes.string
},
};
```

## Rule Options
Expand Down