Skip to content

Commit 2d17b7f

Browse files
authored
Merge pull request #1199 from preco21/docs-improvement
Small document improvements
2 parents ecc327a + 859d12a commit 2d17b7f

File tree

2 files changed

+81
-11
lines changed

2 files changed

+81
-11
lines changed

docs/rules/jsx-first-prop-new-line.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@ Ensure correct position of the first property.
66

77
## Rule Details
88

9-
This rule checks whether the first property of all JSX elements is correctly placed. There are three possible configurations:
9+
This rule checks whether the first property of all JSX elements is correctly placed. There are the possible configurations:
10+
1011
* `always`: The first property should always be placed on a new line.
1112
* `never` : The first property should never be placed on a new line, e.g. should always be on the same line as the Component opening tag.
1213
* `multiline`: The first property should always be placed on a new line when the JSX tag takes up multiple lines.
13-
* `multiline-multiprop`: The first property should always be placed on a new line if the JSX tag takes up multiple lines and there are multiple properties. `default`
14+
* `multiline-multiprop`: The first property should always be placed on a new line if the JSX tag takes up multiple lines and there are multiple properties. This is the `default` value.
1415

1516
The following patterns are considered warnings when configured `"always"`:
1617

docs/rules/jsx-wrap-multilines.md

Lines changed: 78 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,20 @@
11
# Prevent missing parentheses around multiline JSX (react/jsx-wrap-multilines)
22

3-
Wrapping multiline JSX in parentheses can improve readability and/or convenience. It optionally takes a second parameter in the form of an object, containing places to apply the rule. By default, `"declaration"`, `"assignment"`, `"return"`, and `"arrow"` syntax is checked, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
3+
Wrapping multiline JSX in parentheses can improve readability and/or convenience.
44

55
**Fixable:** This rule is automatically fixable using the `--fix` flag on the command line.
66

77
## Rule Details
88

9+
This rule optionally takes a second parameter in the form of an object, containing places to apply the rule. By default, all the syntax listed below will be checked, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
10+
11+
There are the possible syntax available:
12+
13+
* `declaration`
14+
* `assignment`
15+
* `return`
16+
* `arrow`
17+
918
The following patterns are considered warnings:
1019

1120
```jsx
@@ -32,20 +41,80 @@ var Hello = createReactClass({
3241
);
3342
}
3443
});
44+
```
45+
46+
The following patterns are considered warnings when configured `{declaration: true}`.
47+
48+
```jsx
49+
var hello = <div>
50+
<p>Hello</p>
51+
</div>;
52+
```
3553

36-
// When [1, {declaration: false}]
54+
The following patterns are not considered warnings when configured `{declaration: true}`.
55+
56+
```jsx
57+
var hello = (
58+
<div>
59+
<p>Hello</p>
60+
</div>
61+
);
62+
```
63+
64+
The following patterns are considered warnings when configured `{assignment: true}`.
65+
66+
```jsx
3767
var hello;
3868
hello = <div>
3969
<p>Hello</p>
40-
</div>
70+
</div>;
71+
```
4172

42-
// When [1, {declaration: true, assignment: false, return: true}]
43-
var world = <div>
44-
<p>World</p>
45-
</div>
73+
The following patterns are not considered warnings when configured `{assignment: true}`.
4674

47-
// When [1, {arrow: false}]
75+
```jsx
76+
var hello;
77+
hello = (
78+
<div>
79+
<p>Hello</p>
80+
</div>
81+
);
82+
```
83+
The following patterns are considered warnings when configured `{return: true}`.
84+
85+
```jsx
86+
function hello() {
87+
return <div>
88+
<p>Hello</p>
89+
</div>;
90+
}
91+
```
92+
93+
The following patterns are not considered warnings when configured `{return: true}`.
94+
95+
```jsx
96+
function hello() {
97+
return (
98+
<div>
99+
<p>Hello</p>
100+
</div>
101+
);
102+
}
103+
```
104+
The following patterns are considered warnings when configured `{arrow: true}`.
105+
106+
```jsx
48107
var hello = () => <div>
49108
<p>World</p>
50-
</div>
109+
</div>;
110+
```
111+
112+
The following patterns are not considered warnings when configured `{arrow: true}`.
113+
114+
```jsx
115+
var hello = () => (
116+
<div>
117+
<p>World</p>
118+
</div>
119+
);
51120
```

0 commit comments

Comments
 (0)