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

Fix: html-indent about binary expressions (fixes #264) #281

Merged
merged 2 commits into from
Dec 17, 2017

Conversation

mysticatea
Copy link
Member

@mysticatea mysticatea commented Dec 4, 2017

Fixes #264.

This PR fixes vue/html-indent rule about the indentation of binary expressions.

Before, the second line of binary expressions always has 1 indent from the first line.
After this PR, the second line of binary expressions has the same indentation as the first line in except the following cases:

  • The first token of the binary expression is on the same line as the previous token.
    {
      foo: a
        + b
    }
  • The first token of the binary expression is the first token of the statement.
    a
        + b

EDIT: additionally:

  • The first token of the binary expression is the first token of an argument of CallExpression/NewExpression.
    foo(
        a
            + b,
        c
            + d
    )
  • The first token of the binary expression is the first token of an element of ArrayExpression.
    [
        a
            + b,
        c
            + d
    ]
  • The first token of the binary expression is the first token of an expression of SequenceExpression.
    (
        a
            + b,
        c
            + d
    )

@mysticatea
Copy link
Member Author

Mm, I'm considering that the following case (the first token of the binary expression is the first token of a parameter/array element) should have one indent:

foo(
    a +
        b,
    c +
        d
);

[
    a +
        b,
    c +
        d,
];

@mysticatea
Copy link
Member Author

I updated this PR.

Copy link
Member

@michalsnik michalsnik left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@michalsnik michalsnik merged commit 345aaac into master Dec 17, 2017
@michalsnik michalsnik deleted the html-indent/issue264 branch December 17, 2017 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vue/html-indent not allowing conditions with aligned indentation
2 participants