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: consistent break after equals #641

Merged

Conversation

jtkiesel
Copy link
Contributor

What changed with this PR:

Long assignment operations are now consistently broken after equals between variable declarations and binary expressions. Assignment operations now avoid breaking after the equals, the way variable declarations do. This also aligns the formatting of these lines more closely to the way Prettier JavaScript does.

Example

Input

class Example {

  void example() {
    foo = new Foo("aaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbb", "cccccccccccccccccccc", "dddddddddddddddddddd", "eeeeeeeeeeeeeeeeeeee", "ffffffffffffffffffff");

    final Foo bar = new Foo("aaaaaaaaaaaaaaaaaaaa", "bbbbbbbbbbbbbbbbbbbb", "cccccccccccccccccccc", "dddddddddddddddddddd", "eeeeeeeeeeeeeeeeeeee", "ffffffffffffffffffff");
  }
}

Output

class Example {

  void example() {
    foo = new Foo(
      "aaaaaaaaaaaaaaaaaaaa",
      "bbbbbbbbbbbbbbbbbbbb",
      "cccccccccccccccccccc",
      "dddddddddddddddddddd",
      "eeeeeeeeeeeeeeeeeeee",
      "ffffffffffffffffffff"
    );

    final Foo bar = new Foo(
      "aaaaaaaaaaaaaaaaaaaa",
      "bbbbbbbbbbbbbbbbbbbb",
      "cccccccccccccccccccc",
      "dddddddddddddddddddd",
      "eeeeeeeeeeeeeeeeeeee",
      "ffffffffffffffffffff"
    );
  }
}

Relative issues or prs:

Closes #638

@clementdessoude
Copy link
Contributor

Hello @jtkiesel, once again, I took too much time to review, and it caused a small conflict: I can resolve it and push it to main if you want, or I can let you fix it, as you want

@jtkiesel jtkiesel force-pushed the fix/consistent-break-after-equals branch from 8e3cbe1 to 8986c8b Compare February 13, 2024 21:48
@jtkiesel
Copy link
Contributor Author

@clementdessoude No problem, thank you for reviewing and merging so many of these PRs! I've resolved the conflict here (and in other open PRs).

@clementdessoude clementdessoude merged commit 0111610 into jhipster:main Feb 15, 2024
6 checks passed
@jtkiesel jtkiesel deleted the fix/consistent-break-after-equals branch April 11, 2024 06:03
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.

Unexpected new line when assigning to a class member
2 participants