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

Change operator-linebreak to before instead of after. #24

Merged
merged 1 commit into from
Sep 22, 2017

Conversation

sambev
Copy link
Contributor

@sambev sambev commented Sep 6, 2017

I am proposing that we change our operator line break to either before or just turning it off completely.

Current (after):

var fullHeight = borderTop +
                 innerHeight +
                 borderBottom;

This PR (before):

var fullHeight = borderTop
               + innerHeight
               + borderBottom;

I particularly like before much better with conditionals and terns:

if (someCondition
    || otherCondition) {
}

answer = everything
  ? 42
  : foo;


answer = everything ? 42
                    : 0

As I said before, I would also be okay with removing any before or after rule entirely. I mostly just hate being forced to use after, especially when conditionals and terns are longer and I am using split pane views with more "real life" code examples:

😢 (Sam with after)

const transactions = this.props.displayChildAsParent ?
  TransactionUtils.filterOutParentsOfSplits(this.props.transactions) :
  TransactionUtils.filterOutChildrenOfSplits(this.props.transactions);

In this paritcular case, the ? : || && characters can get cut off in the current pane, forcing me to horizontally scroll to see what is going on

😄 (Sam with before)

const transactions = this.props.displayChildAsParent
  ? TransactionUtils.filterOutParentsOfSplits(this.props.transactions)
  : TransactionUtils.filterOutChildrenOfSplits(this.props.transactions);

With before, the operators are always visible and aligned with each other.

@lukeschunk
Copy link
Collaborator

i think i prefer after still, but not extremely opposed

@lukeschunk
Copy link
Collaborator

also thanks for the good write up 🏀

@paniclater
Copy link
Collaborator

I don't have a preference here.

@paniclater
Copy link
Collaborator

As in, I'm good either way.

@cerinman
Copy link
Contributor

cerinman commented Sep 6, 2017

Hmm, I lean toward before but I'm good either way

@jtanner
Copy link
Contributor

jtanner commented Sep 6, 2017

I'm leaning toward before as well.

@redperk
Copy link
Collaborator

redperk commented Sep 6, 2017

I think I'm leaning to before as well, but I'm fine either way

@phantomxc
Copy link
Collaborator

before

Copy link
Contributor

@jtanner jtanner left a comment

Choose a reason for hiding this comment

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

:shipit:

@paniclater paniclater merged commit 5ce8f6c into master Sep 22, 2017
@paniclater paniclater deleted the sb/operator-linebreak-before branch September 22, 2017 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants