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] default-props-match-prop-types, require-default-props, sort-prop-types: fix typos #3279

Merged
merged 1 commit into from Apr 30, 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 @@ -29,7 +29,9 @@ This change log adheres to standards from [Keep a CHANGELOG](https://keepachange
* [Refactor] [`no-did-mount-set-state`], [`no-did-update-set-state`], [`no-will-update-set-state`]: improve performance ([#3272][] @golopot)
* [Refactor] improve performance by avoiding unnecessary `Components.detect` ([#3273][] @golopot)
* [Refactor] add `isParenthesized` AST util ([#3203][] @Belco90)
* [Docs] `default-props-match-prop-types`, `require-default-props`, `sort-prop-types`: fix typos ([#3279][] @nix6839)

[#3279]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3279
[#3273]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3273
[#3272]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3272
[#3271]: https://github.com/jsx-eslint/eslint-plugin-react/pull/3271
Expand Down
3 changes: 2 additions & 1 deletion docs/rules/default-props-match-prop-types.md
Expand Up @@ -127,7 +127,7 @@ MyStatelessComponent.propTypes = {
};

MyStatelessComponent.defaultProps = {
bar: 'some default'
bar: 'some default'
};
```

Expand Down Expand Up @@ -193,6 +193,7 @@ If you don't care about stray `defaultsProps` in your components, you can disabl
- [require-default-props](./require-default-props.md)

# Resources

- [Official React documentation on defaultProps](https://facebook.github.io/react/docs/typechecking-with-proptypes.html#default-prop-values)

[PropTypes]: https://reactjs.org/docs/typechecking-with-proptypes.html
Expand Down
4 changes: 2 additions & 2 deletions docs/rules/require-default-props.md
Expand Up @@ -165,7 +165,7 @@ MyStatelessComponent.propTypes = {
};

MyStatelessComponent.defaultProps = {
bar: 'some default'
ljharb marked this conversation as resolved.
Show resolved Hide resolved
bar: 'some default'
};
```

Expand Down Expand Up @@ -199,7 +199,7 @@ NotAComponent.propTypes = {
...
"react/require-default-props": [<enabled>, {
"forbidDefaultForRequired": <boolean>,
"classes": "defaultProps | "ignore",
"classes": "defaultProps" | "ignore",
"functions": "defaultProps" | "defaultArguments" | "ignore"
// @deprecated Use `functions` option instead.
"ignoreFunctionalComponents": <boolean>,
Expand Down
5 changes: 5 additions & 0 deletions docs/rules/sort-prop-types.md
Expand Up @@ -18,6 +18,7 @@ var Component = createReactClass({
...
});
```

```jsx
type Props = {
z: number,
Expand All @@ -28,6 +29,7 @@ class Component extends React.Component<Props> {
...
}
```

```jsx
class Component extends React.Component {
static propTypes = {
Expand All @@ -53,6 +55,7 @@ var Component = createReactClass({
...
});
```

```jsx
type Props = {
a: string,
Expand All @@ -63,6 +66,7 @@ class Component extends React.Component<Props> {
...
}
```

```jsx
class Component extends React.Component {
static propTypes = {
Expand Down Expand Up @@ -144,6 +148,7 @@ var Component = createReactClass({
...
});
```

### `noSortAlphabetically`

When `true`, alphabetical order is not enforced:
Expand Down