Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1552 from Vydia/jsx-one-expression-per-line-docs
[Docs] jsx-one-expression-per-line
- Loading branch information
Showing
4 changed files
with
108 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
# One JSX Element Per Line (react/jsx-indent) | ||
|
||
This option limits every line in JSX to one expression each. | ||
|
||
**Fixable:** This rule is automatically fixable using the `--fix` flag on the command line. | ||
Fixer will insert line breaks between any expression that are on the same line. | ||
|
||
## Rule Details | ||
|
||
The following patterns are considered warnings: | ||
|
||
```jsx | ||
<App><Hello /></App> | ||
|
||
<App><Hello /> | ||
</App> | ||
|
||
<App> | ||
<Hello> | ||
</Hello></App> | ||
|
||
<App> | ||
</Hello> World | ||
</App> | ||
|
||
<App> | ||
</Hello> { 'World' } | ||
</App> | ||
|
||
<App> | ||
</Hello> { this.world() } | ||
</App> | ||
|
||
<App> | ||
{ 'Hello' }{ ' ' }{ 'World' } | ||
</App> | ||
|
||
<App | ||
foo | ||
><Hello /> | ||
</App> | ||
|
||
<App><Hello | ||
foo | ||
/> | ||
</App> | ||
|
||
<App><Hello1 /> | ||
<Hello2 /> | ||
<Hello3 /> | ||
</App> | ||
``` | ||
|
||
The following patterns are **not** warnings: | ||
|
||
```jsx | ||
<App> | ||
<Hello /> | ||
</App> | ||
|
||
<App> | ||
<Hello> | ||
</Hello> | ||
</App> | ||
|
||
<App> | ||
</Hello> | ||
World | ||
</App> | ||
|
||
<App> | ||
</Hello> | ||
{ 'World' } | ||
</App> | ||
|
||
<App> | ||
</Hello> | ||
{ this.world() } | ||
</App> | ||
|
||
<App> | ||
{ 'Hello' } | ||
{ ' ' } | ||
{ 'World' } | ||
</App> | ||
|
||
<App | ||
foo | ||
> | ||
<Hello /> | ||
</App> | ||
|
||
<App> | ||
<Hello | ||
foo | ||
/> | ||
</App> | ||
|
||
<App> | ||
<Hello1 /> | ||
<Hello2 /> | ||
<Hello3 /> | ||
</App> | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters