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

Standard removes my line breaks in jsx, makes it one big line #589

Closed
kasperpeulen opened this issue Aug 17, 2016 · 7 comments

Comments

@kasperpeulen
Copy link

commented Aug 17, 2016

I had this code:

            <FormControl
                componentClass='select'
                value={selectedAction}
                onChange={e => dispatch(new Actions.ChangeSelected(e.target.value))}>
              {actions.map(action => <option key={action} value={action}>{action}</option>)}
            </FormControl>

Now standard formatter (atom package) turns it into this:

            <FormControl componentClass='select' value={selectedAction} onChange={e => dispatch(new Actions.ChangeSelected(e.target.value))}>
              {actions.map(action => <option key={action} value={action}>
                                       {action}
                                     </option>)}

I normally try to make my lines not longer than 80. I think 120 is also fine. But this is 150 chars or something on one line. Way too long.

@Flet

This comment has been minimized.

Copy link
Member

commented Aug 17, 2016

For clarity, is this standard --fix or standard-format?

@kasperpeulen

This comment has been minimized.

Copy link
Author

commented Aug 17, 2016

I use atom standard-format so I think standard-atom.

@feross

This comment has been minimized.

Copy link
Member

commented Aug 18, 2016

@kasperpeulen Since this is an issue for standard-format, please open it on that repo. https://github.com/maxogden/standard-format But know that the maintainers of standard-format are currently very overwhelmed, so consider sending a PR if you want this fixed.

I recommend using standard --fix going forward (once standard v8 is released), or you can try it out today using npm install standard@beta.

@feross feross closed this Aug 18, 2016

@kasperpeulen

This comment has been minimized.

Copy link
Author

commented Aug 18, 2016

Ah, okay, do I understand correctly that standard --fix and standard-format are two different things doing the same thing, where the first one is a new official one?

@feross

This comment has been minimized.

Copy link
Member

commented Aug 18, 2016

The first one is integrated directly into standard and comes from the auto-fixing feature built into eslint, so it's 100% based on the eslint configuration file. It will never be out-of-date like standard-format (which is based on a separate tool esformatter) which required maintaining a separate config file.

If your code is ES5, standard-format is actually a more thorough tool.
If you need ES6 support, standard --fix works better, though it covers slightly fewer cases at the moment. But it's getting better with each eslint release.

See http://eslint.org/docs/rules/ and look at the rules with the wrench icon to see which rules standard --fix can automatically fix.

@kasperpeulen

This comment has been minimized.

Copy link
Author

commented Aug 18, 2016

Sounds good! Is there a way to get this working in atom as well?

@feross

This comment has been minimized.

Copy link
Member

commented Aug 18, 2016

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
3 participants
You can’t perform that action at this time.