Skip to content

Commit

Permalink
Fix docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jackyho112 committed Aug 16, 2017
1 parent c66def5 commit 0554b49
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions docs/rules/jsx-curly-brace-presence.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,9 @@ or alternatively

### Valid options for <string>

They are `always`, `always,single`, `always,double`, `always,orignal`, `never` and `ignore` for checking on JSX props and children.
They are `always`, `never` and `ignore` for checking on JSX props and children.

* `always`: always enforce curly braces inside JSX props or/and children and fix with double quotes inside the generated JSX expressions
* `always,single`: always enforce curly braces and fix with single quotes
* `always,double`: always enforce curly braces and fix with double quotes
* `always,original`: always enforce curly braces and fix with original quotes(default to double quotes for JSX children)
* `always`: always enforce curly braces inside JSX props or/and children and fix with double quotes for JSX children inside the generated JSX expressions
* `never`: never allow unnecessary curly braces inside JSX props or/and children
* `ignore`: ignore the rule for JSX props or/and children

Expand All @@ -55,8 +52,6 @@ They can be fixed to:
<App prop={"Hello world"}>{"Hello world"}</App>;
```

They will be fixed with single, double or original quotes based on the option you passed in. The default is double.

When `{ props: "never", children: "never" }` is set, the following patterns will be given warnings.

```jsx
Expand All @@ -73,7 +68,7 @@ They can be fixed to:

### Alternative syntax

The options are also `always`, `always,single`, `always,double`, `always,orignal`, `never` and `ignore` for the same meanings.
The options are also `always`, `never` and `ignore` for the same meanings.

In this syntax, only a string is provided and the default will be set to that option for checking on both JSX props and children.

Expand All @@ -92,13 +87,6 @@ They can be fixed to:
<App prop={"Hello world"}>{"Hello world"}</App>;
```

If `'always,single'` is passed, they can be fixed to:

```jsx
<App>{'Hello world'}</App>;
<App prop={'Hello world'}>{'Hello world'}</App>;
```

When `'never'` is set, the following pattern will be given warnings.

```jsx
Expand All @@ -118,7 +106,7 @@ The fix also deals with template literals, strings with quotes and strings with
* If the rule is set to get rid of unnecessary curly braces and the template literal inside a JSX expression has no expression, it will throw a warning and be fixed with double quotes. For example:

```jsx
<App prop={`Hello world`}>Hello world</App>;
<App prop={`Hello world`}>{`Hello world`}</App>;
```

will be warned and fixed to:
Expand All @@ -127,7 +115,9 @@ will be warned and fixed to:
<App prop="Hello world">Hello world</App>;
```

* If the rule is set to enforce curly braces and the strings have quotes, it will be fixed with original quotes for JSX attributes and double for JSX children. For example:
* If the rule is set to enforce curly braces and the strings have quotes, it will be fixed with double quotes for JSX children and the normal way for JSX attributes.

For example:


```jsx
Expand Down

0 comments on commit 0554b49

Please sign in to comment.