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

+2-2
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

+4-4
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

+3-3
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

+4-6
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

+5-5
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

+2-2
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

+2-2
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

+2-2
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

+2-2
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

+3-3
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

docs/rules/function-component-definition.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This option enforces a specific function type for function components.
88

99
This rule is aimed to enforce consistent function types for function components. By default it prefers function declarations for named components and function expressions for unnamed components.
1010

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

1313
```jsx
1414
// function expression for named component
@@ -42,7 +42,7 @@ This rule takes an options object as a second parameter where the preferred func
4242
...
4343
```
4444

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

4747
```jsx
4848
// only function declarations for named components
@@ -93,7 +93,7 @@ function getComponent () {
9393

9494
```
9595

96-
The following patterns are **not** warnings:
96+
Examples of **correct** code for this rule:
9797

9898
```jsx
9999

docs/rules/jsx-boolean-value.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,30 @@ This rule takes two arguments. If the first argument is `"always"` then it warns
1010

1111
The second argument is optional: if provided, it must be an object with a `"never"` property (if the first argument is `"always"`), or an `"always"` property (if the first argument is `"never"`). This property’s value must be an array of strings representing prop names.
1212

13-
The following patterns are considered warnings when configured `"never"`, or with `"always", { "never": ["personal"] }`:
13+
Examples of **incorrect** code for this rule, when configured with `"never"`, or with `"always", { "never": ["personal"] }`:
1414

1515
```jsx
1616
var Hello = <Hello personal={true} />;
1717
```
1818

19-
The following patterns are **not** considered warnings when configured `"never"`, or with `"always", { "never": ["personal"] }`:
19+
Examples of **correct** code for this rule, when configured with `"never"`, or with `"always", { "never": ["personal"] }`:
2020

2121
```jsx
2222
var Hello = <Hello personal />;
2323
```
2424

25-
The following patterns are considered warnings when configured `"always"`, or with `"never", { "always": ["personal"] }`:
25+
Examples of **incorrect** code for this rule, when configured with `"always"`, or with `"never", { "always": ["personal"] }`:
2626

2727
```jsx
2828
var Hello = <Hello personal />;
2929
```
3030

31-
The following patterns are **not** considered warnings when configured `"always"`, or with `"never", { "always": ["personal"] }`:
31+
Examples of **correct** code for this rule, when configured with `"always"`, or with `"never", { "always": ["personal"] }`:
3232

3333
```jsx
3434
var Hello = <Hello personal={true} />;
3535
```
3636

3737
## When Not To Use It
3838

39-
If you do not want to enforce any style for boolean attributes, then you can disable this rule.
39+
If you do not want to enforce any style for boolean attributes, then you can disable this rule.

docs/rules/jsx-child-element-spacing.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Since React removes extraneous new lines between elements when possible,
66
it is possible to end up with inline elements that are not rendered with spaces between them and adjacent text.
77
This is often indicative of an error, so this rule attempts to detect
88

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

1111
```jsx
1212
<div>
@@ -22,7 +22,7 @@ The following patterns are considered warnings:
2222
</div>
2323
```
2424

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

2727
```jsx
2828
<div>

docs/rules/jsx-closing-bracket-location.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Enforce the closing bracket location for JSX multiline elements.
88

99
This rule checks all JSX multiline elements and verifies the location of the closing bracket. By default this one must be aligned with the opening tag.
1010

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

1313
```jsx
1414
<Hello
@@ -21,7 +21,7 @@ The following patterns are considered warnings:
2121
/>;
2222
```
2323

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

2626
```jsx
2727
<Hello firstName="John" lastName="Smith" />;
@@ -65,7 +65,7 @@ Defaults to `tag-aligned`.
6565

6666
For backward compatibility, you may pass an object `{ "location": <location> }` that is equivalent to the first string shortcut form.
6767

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

7070
```jsx
7171
// 'jsx-closing-bracket-location': 1
@@ -138,7 +138,7 @@ var x = function() {
138138
</Say>;
139139
```
140140

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

143143
```jsx
144144
// 'jsx-closing-bracket-location': 1

docs/rules/jsx-closing-tag-location.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Enforce the closing tag location for multiline JSX elements.
88

99
This rule checks all JSX multiline elements with children (non-self-closing) and verifies the location of the closing tag. The expectation is that the closing tag is aligned with the opening tag on its own line.
1010

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

1313
```jsx
1414
<Hello>
@@ -21,7 +21,7 @@ The following patterns are considered warnings:
2121
marklar</Hello>
2222
```
2323

24-
The following are **not** considered warnings:
24+
Examples of **correct** code for this rule:
2525

2626
```jsx
2727
<Hello>
@@ -35,4 +35,4 @@ The following are **not** considered warnings:
3535

3636
## When not to use
3737

38-
If you do not care about closing tag JSX alignment then you can disable this rule.
38+
If you do not care about closing tag JSX alignment then you can disable this rule.

0 commit comments

Comments
 (0)