Skip to content

v2.1.0

Compare
Choose a tag to compare
@clementdessoude clementdessoude released this 11 Mar 11:35
· 119 commits to main since this release

Latest v2.1.0

Enhancements

  • Support for require-pragma option (Issue #573 closed with #574)
    Thanks to @yannick-paz for the contribution !
// Input
/**
 * @prettier
 */
public class Example { private int test=-1;}

// Output with require-pragma option activated
/**
 * @prettier
 */
public class Example {
  private int test = -1;
}

// Input
public class Example { private int test=-1;}

// Output with require-pragma option activated
public class Example { private int test=-1;}

Fixes

  • Break long assignments after equals (Issue #527 closed with #564)
    Thanks to @jtkiesel for the fix !
// Input
class Example {

  void example() {
    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes = new Object()
      .someMethod();

    Object[] aParticularlyLongAndObnoxiousNameForIllustrativePurposes2 = new Object[] {
      new Object(),
      new Object()
    };

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes3 = SomeClass.someStaticMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes = someMethod()
      .anotherMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes = anotherValue !=
      null
      ? anotherValue
      : new Object();
  }
}

// Output
class Example {

  void example() {
    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      new Object().someMethod();

    Object[] aParticularlyLongAndObnoxiousNameForIllustrativePurposes2 =
      new Object[] { new Object(), new Object() };

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes3 =
      SomeClass.someStaticMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      someMethod().anotherMethod();

    Object aParticularlyLongAndObnoxiousNameForIllustrativePurposes =
      anotherValue != null ? anotherValue : new Object();
  }
}