-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Add option style to jsx-wrap-multilines rule #1039
Conversation
@@ -1,11 +1,24 @@ | |||
# 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). |
There was a problem hiding this comment.
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.
"return": bool, // default true | ||
}] | ||
``` | ||
|
||
The following patterns are considered warnings: |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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"
…
}]
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superseded by #1475 |
Option style can be either "always" or "never". Default is "always", means wrap jsx in parentheses. Never disallows parentheses around jsx.