Skip to content
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

Closed
wants to merge 1 commit into from
Closed

WIP: Add option style to jsx-wrap-multilines rule #1039

wants to merge 1 commit into from

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.

@@ -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).
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.

"return": bool, // default true
}]
```

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.

🅰️

@golopot
Copy link
Contributor

golopot commented May 19, 2019

Superseded by #1475

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

Successfully merging this pull request may close these issues.

3 participants