Skip to content

Commit fd94b95

Browse files
committed
[Docs] make example descriptions consistent
1 parent 8867490 commit fd94b95

File tree

87 files changed

+367
-379
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+367
-379
lines changed

docs/rules/boolean-prop-naming.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ regardless of how you define them.
88

99
## Rule Details
1010

11-
The following patterns are considered warnings:
11+
Examples of **incorrect** code for this rule:
1212

1313
```jsx
1414
var Hello = createReactClass({
@@ -26,7 +26,7 @@ type Props = {
2626
const Hello = (props: Props) => <div />;
2727
```
2828

29-
The following patterns are **not** considered warnings:
29+
Examples of **correct** code for this rule:
3030

3131
```jsx
3232
var Hello = createReactClass({

docs/rules/button-has-type.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This rules enforces an explicit `type` attribute for all the `button` elements a
55

66
## Rule Details
77

8-
The following patterns are considered errors:
8+
Examples of **incorrect** code for this rule:
99

1010
```jsx
1111
var Hello = <button>Hello</button>
@@ -16,7 +16,7 @@ var Hello = React.createElement('button', {}, 'Hello')
1616
var Hello = React.createElement('button', {type: 'foo'}, 'Hello')
1717
```
1818

19-
The following patterns are **not** considered errors:
19+
Examples of **correct** code for this rule:
2020

2121
```jsx
2222
var Hello = <span>Hello</span>
@@ -48,7 +48,7 @@ var Hello = React.createElement('button', {type: condition ? 'button' : 'submit'
4848

4949
You can forbid particular type attribute values by passing `false` as corresponding option (by default all of them are `true`).
5050

51-
The following patterns are considered errors when using `"react/button-has-type": ["error", {reset: false}]`:
51+
Examples of **incorrect** code for this rule, when configured with `{ "reset": false }`:
5252

5353
```jsx
5454
var Hello = <button type="reset">Hello</button>
@@ -60,4 +60,4 @@ var Hello = React.createElement('button', {type: condition ? "button" : "reset"}
6060

6161
## When Not To Use It
6262

63-
If you use only `"submit"` buttons, you can disable this rule
63+
If you use only `"submit"` buttons, you can disable this rule

docs/rules/default-props-match-prop-types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ required property similarly indicates a possible refactoring problem.
1313

1414
## Rule Details
1515

16-
The following patterns are considered warnings:
16+
Examples of **incorrect** code for this rule:
1717

1818
```jsx
1919
function MyStatelessComponent({ foo, bar }) {
@@ -103,7 +103,7 @@ MyStatelessComponent.defaultProps = {
103103
}
104104
```
105105

106-
The following patterns are **not** considered warnings:
106+
Examples of **correct** code for this rule:
107107

108108
```jsx
109109
function MyStatelessComponent({ foo, bar }) {
@@ -167,7 +167,7 @@ NotAComponent.propTypes = {
167167

168168
When `true` the rule will ignore `defaultProps` for required prop types.
169169

170-
The following patterns are considered okay and do not cause warnings:
170+
Examples of **correct** code for this rule, when configured with `{ "allowRequiredDefaults": true }`:
171171

172172
```jsx
173173
function MyStatelessComponent({ foo, bar }) {

docs/rules/destructuring-assignment.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Rule can be set to either of `always` or `never`;
77

88
## Rule Details
99

10-
By default rule is set to `always` enforce destructuring assignment. The following patterns are considered warnings:
10+
By default rule is set to `always` enforce destructuring assignment. Examples of **incorrect** code for this rule:
1111

1212
```js
1313
const MyComponent = (props) => {
@@ -47,7 +47,7 @@ const Foo = class extends React.PureComponent {
4747
};
4848
```
4949

50-
If rule is set to `never`, the following patterns are considered warning:
50+
Examples of **incorrect** code for this rule, when configured with `"never"`:
5151

5252
```js
5353
const MyComponent = ({id}) => {
@@ -97,12 +97,10 @@ const Foo = class extends React.PureComponent {
9797

9898
### `ignoreClassFields`
9999

100-
When `true` the rule will ignore class field declarations.
101-
102-
The following patterns are then considered okay and do not cause warnings:
100+
When configured with `true`, the rule will ignore class field declarations. Examples of **correct** code for this rule:
103101

104102
```jsx
105103
class Foo extends React.PureComponent {
106104
bar = this.props.bar
107105
}
108-
```
106+
```

docs/rules/display-name.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ DisplayName allows you to name your component. This name is used by React in deb
44

55
## Rule Details
66

7-
The following patterns are considered warnings:
7+
Examples of **incorrect** code for this rule:
88

99
```jsx
1010
var Hello = createReactClass({
@@ -14,7 +14,7 @@ var Hello = createReactClass({
1414
});
1515
```
1616

17-
The following patterns are **not** considered warnings:
17+
Examples of **correct** code for this rule:
1818

1919
```jsx
2020
var Hello = createReactClass({
@@ -37,7 +37,7 @@ var Hello = createReactClass({
3737

3838
When `true` the rule will ignore the name set by the transpiler and require a `displayName` property in this case.
3939

40-
The following patterns are considered okay and do **not** cause warnings:
40+
Examples of **correct** code for this rule:
4141

4242
```jsx
4343
var Hello = createReactClass({
@@ -66,7 +66,7 @@ export default function Hello({ name }) {
6666
Hello.displayName = 'Hello';
6767
```
6868

69-
The following patterns will cause warnings:
69+
Examples of **incorrect** code for this rule:
7070

7171
```jsx
7272
var Hello = createReactClass({
@@ -120,4 +120,4 @@ For now we should detect components created with:
120120

121121
* `createReactClass()`
122122
* an ES6 class that inherit from `React.Component` or `Component`
123-
* a stateless function that return JSX or the result of a `React.createElement` call.
123+
* a stateless function that return JSX or the result of a `React.createElement` call.

docs/rules/forbid-component-props.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ By default this rule prevents passing of [props that add lots of complexity](htt
77
This rule checks all JSX elements and verifies that no forbidden props are used
88
on Components. This rule is off by default.
99

10-
The following patterns are considered warnings:
10+
Examples of **incorrect** code for this rule:
1111

1212
```jsx
1313
<Hello className='foo' />
@@ -17,7 +17,7 @@ The following patterns are considered warnings:
1717
<Hello style={{color: 'red'}} />
1818
```
1919

20-
The following patterns are **not** considered warnings:
20+
Examples of **correct** code for this rule:
2121

2222
```jsx
2323
<Hello name='Joe' />

docs/rules/forbid-dom-props.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ The list of forbidden props can be customized with the `forbid` option.
88
This rule checks all JSX elements and verifies that no forbidden props are used
99
on DOM Nodes. This rule is off by default.
1010

11-
The following patterns are considered warnings:
11+
Examples of **incorrect** code for this rule:
1212

1313
```jsx
1414
// [1, { "forbid": ["id"] }]
@@ -20,7 +20,7 @@ The following patterns are considered warnings:
2020
<div style={{color: 'red'}} />
2121
```
2222

23-
The following patterns are **not** considered warnings:
23+
Examples of **correct** code for this rule:
2424

2525
```jsx
2626
// [1, { "forbid": ["id"] }]

docs/rules/forbid-elements.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ An array of strings and/or objects. An object in this array may have the followi
2323

2424
A string item in the array is a shorthand for `{ element: string }`.
2525

26-
The following patterns are **not** considered warnings:
26+
Examples of **correct** code for this rule:
2727

2828
```jsx
2929
// [1, { "forbid": ["button"] }]
@@ -33,7 +33,7 @@ The following patterns are **not** considered warnings:
3333
<Button />
3434
```
3535

36-
The following patterns are considered warnings:
36+
Examples of **incorrect** code for this rule:
3737

3838
```jsx
3939
// [1, { "forbid": ["button"] }]

docs/rules/forbid-foreign-prop-types.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ In order to ensure that imports are explicitly exported it is recommended to use
88

99
This rule checks all objects and ensures that the `propTypes` property is not used.
1010

11-
The following patterns are considered warnings:
11+
Examples of **incorrect** code for this rule:
1212

1313
```js
1414
import SomeComponent from './SomeComponent';
@@ -19,7 +19,7 @@ var { propTypes } = SomeComponent;
1919
SomeComponent['propTypes'];
2020
```
2121

22-
The following patterns are **not** considered warnings:
22+
Examples of **correct** code for this rule:
2323

2424
```js
2525
import SomeComponent, {propTypes as someComponentPropTypes} from './SomeComponent';

docs/rules/forbid-prop-types.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ By default this rule prevents vague prop types with more specific alternatives a
77
This rule checks all JSX components and verifies that no forbidden propsTypes are used.
88
This rule is off by default.
99

10-
The following patterns are considered warnings:
10+
Examples of **incorrect** code for this rule:
1111

1212
```jsx
1313
var Component = createReactClass({
@@ -54,11 +54,11 @@ An array of strings, with the names of `PropTypes` keys that are forbidden. The
5454

5555
### `checkContextTypes`
5656

57-
Whether or not to check `contextTypes` for forbidden prop types. The default value is false.
57+
Whether or not to check `contextTypes` for forbidden prop types. The default value is `false`.
5858

5959
### `checkChildContextTypes`
6060

61-
Whether or not to check `childContextTypes` for forbidden prop types. The default value is false.
61+
Whether or not to check `childContextTypes` for forbidden prop types. The default value is `false`.
6262

6363
## When not to use
6464

0 commit comments

Comments
 (0)