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

Add support for conditional rendering to jsx-multiline-wrap #1285

Closed

Conversation

jseminck
Copy link
Contributor

@jseminck jseminck commented Jul 5, 2017

Main issue: #1282

I tried to make the fixer better so the output has the parens in the correct place. Probably, need to add a few more tests, but I think the current solution looks quite solid.

The rule is defaulted to false initially. If enabling it by default, a bigger version bump would be required?

See also some comments on another issue regarding jsx-multiline-wrap: #1207 (comment)

@jseminck
Copy link
Contributor Author

jseminck commented Jul 5, 2017

FYI broken build doesn't seem to be related to this branch. Currently when I try to build master I get the same error messages, even though the latest build on travis for master was successful (21hrs ago: https://travis-ci.org/yannickcr/eslint-plugin-react/builds/250125668)

</div>
```

The following patterns are not considered warnings when configured `{arrow: true}`.
Copy link
Contributor

Choose a reason for hiding this comment

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

do you mean {conditional: true}?

@deecewan
Copy link
Contributor

deecewan commented Jul 5, 2017

I know that it'd require a bigger version bump, but to me it'd make more sense to have all the rules enabled by default.

Also, while you're in there, feel like adding ternaries?

@ljharb
Copy link
Member

ljharb commented Jul 6, 2017

Enabling rules by default should wait for a separate semver-major PR, released after the non-major changes are released.

@jseminck jseminck force-pushed the conditional-wrap-nultilines branch from a223964 to f7ca45f Compare July 6, 2017 06:33
@marcdavi-es
Copy link

*** sits wriggling with excitement waiting for the merge ***

@ljharb
Copy link
Member

ljharb commented Jul 21, 2017

Sorry for the inconvenience; I've just merged a refactor to start using arrow functions. Would you mind rebasing?

@jseminck jseminck force-pushed the conditional-wrap-nultilines branch from f7ca45f to bbe67f9 Compare July 22, 2017 04:54
@jseminck
Copy link
Contributor Author

Are there some problems regarding for this PR to be moved forward?

I'd like to take a further look at this rule because I currently joined a project where we use a lot of conditional rendering and eslint-plugin-react doesn't always fix things as I expect it to. 😄

@jseminck
Copy link
Contributor Author

jseminck commented Nov 17, 2017

Seems like this was added in another PR, hence closing.

To achieve this functionality, use the option: {logical: 'parens'} or {logical: 'parens-new-line'}.

@jseminck jseminck closed this Nov 17, 2017
@jseminck jseminck deleted the conditional-wrap-nultilines branch November 17, 2017 19:55
@ljharb
Copy link
Member

ljharb commented Nov 18, 2017

@jseminck sorry about the conflict :-)

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

Successfully merging this pull request may close these issues.

None yet

4 participants