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

Doesn't break long React props #15

Closed
erbridge opened this issue Jan 10, 2017 · 6 comments
Closed

Doesn't break long React props #15

erbridge opened this issue Jan 10, 2017 · 6 comments
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something

Comments

@erbridge
Copy link

e.g.

<BaseForm url="/auth/google" method="GET" colour="blue" size="large" submitLabel="Sign in with Google" />

should probably be converted into

<BaseForm 
  url="/auth/google"
  method="GET"
  colour="blue"
  size="large"
  submitLabel="Sign in with Google"
/>
@wmertens
Copy link

And don't forget about this form:

const FooForm = ({colour}) => {
   const method = 'GET'
   return (
      <BaseForm {...{
        url: '/auth/google',
        method, colour
      }}/>
   )
}

@ericclemmons
Copy link
Contributor

Similarly, I tested:

const render = ({ styles }) => (
  <div style={styles} key="something">
    Keep the wrapping params. Put each key on it's own line.
  </div>
);

which results in:

const render = ({ styles }) => <div style={
  styles
} key="something">
  Keep the wrapping params. Put each key on it's own line.
</div>;

@gaearon
Copy link

gaearon commented Jan 10, 2017

Here, IMO the best style would be the one that optimizes for diff readability on changes.
Like the one in the OP post.
Probably worth doing for any elements that don't fit within a single line completely.

@rattrayalex
Copy link
Collaborator

I'm going to try to tackle this now.

@vramana vramana added the type:enhancement A potential new feature to be added, or an improvement to how we print something label Jan 11, 2017
@rattrayalex
Copy link
Collaborator

rattrayalex commented Jan 11, 2017

The example by @ericclemmons now compiles to:

const render = ({ styles }) => <div style={styles} key="something">
  Keep the wrapping params. Put each key on it's own line.
</div>;

which is an improvement, but I agree the parens should be maintained. I'll open a separate issue for that if one doesn't already exist, and try to tackle soon.

(note that improvement is probably unrelated to my modification, I didn't check)

@vramana
Copy link

vramana commented Jan 11, 2017

I am closing this in favour of #73. Please continue the discussion in that thread.

@vramana vramana closed this as completed Jan 11, 2017
@lock lock bot added the locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. label Jul 8, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jul 8, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked-due-to-inactivity Please open a new issue and fill out the template instead of commenting. type:enhancement A potential new feature to be added, or an improvement to how we print something
Projects
None yet
Development

No branches or pull requests

6 participants