Skip to content

Commit

Permalink
[Docs] default-props-match-prop-types, require-default-props, `so…
Browse files Browse the repository at this point in the history
…rt-prop-types`: fix typos
  • Loading branch information
nix6839 authored and ljharb committed Apr 29, 2022
1 parent 24621e4 commit b7a9c2a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
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'
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

0 comments on commit b7a9c2a

Please sign in to comment.