Skip to content

Conversation

ghost
Copy link

@ghost ghost commented Jan 23, 2017

Option style can be either "always" or "never". Default is "always", means wrap jsx in parentheses. Never disallows parentheses around jsx.

# Prevent missing parentheses around multiline JSX (jsx-wrap-multilines)

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"`, and `"return"` syntax is checked, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
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"`, and `"return"` syntax is checked, but these can be explicitly disabled. Any syntax type missing in the object will follow the default behavior (become enabled).
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a * here won't translate to a footnote below - I think perhaps leaving this paragraph alone, and adding a second paragraph that describes "never", would be better.

}]
```

The following patterns are considered warnings:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we'll need to add "considered warnings" and "not considered warnings" examples for the "never" option as well.


```js
"react/jsx-wrap-multilines": ["error", {
"style": "always|never", // default "always"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think adding an object property is the best schema here - I think we want to be able to do:

["error", "never", { … }] ["error", "always", { … }] ["error", { // implies "always" … }] 
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.. agree, I'll try to do it tomorrow, with the docs stuff.

@ghost ghost changed the title Add option style to jsx-wrap-multilines rule WIP: Add option style to jsx-wrap-multilines rule Jan 23, 2017
Copy link

@jorgelo jorgelo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🅰️

@chiawendt
Copy link
Contributor

Superseded by #1475

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants