Inconsistent Formatting (with Interface)
Prettier-Java 0.5.1
I'm not sure if this is the intended behavior of Prettier; Prettier adds a new line after class declarations but not after interface declarations.
overrides:
- files: ["*.java"]
options:
printWidth: 120
Input:
public interface ProjectOrBuilder extends com.google.protobuf.MessageOrBuilder {
String getModelVersion();
com.google.protobuf.ByteString getModelVersionBytes();
String getGroupId();
com.google.protobuf.ByteString getGroupIdBytes();
String getArtifactId();
com.google.protobuf.ByteString getArtifactIdBytes();
String getVersion();
}
Output:
public interface ProjectOrBuilder extends com.google.protobuf.MessageOrBuilder {
String getModelVersion();
com.google.protobuf.ByteString getModelVersionBytes();
String getGroupId();
com.google.protobuf.ByteString getGroupIdBytes();
String getArtifactId();
com.google.protobuf.ByteString getArtifactIdBytes();
String getVersion();
}
Expected behavior:
public interface ProjectOrBuilder extends com.google.protobuf.MessageOrBuilder {
String getModelVersion();
com.google.protobuf.ByteString getModelVersionBytes();
String getGroupId();
com.google.protobuf.ByteString getGroupIdBytes();
String getArtifactId();
com.google.protobuf.ByteString getArtifactIdBytes();
String getVersion();
}
I feel like if classes have new lines after their declaration, then interfaces and enums should follow the same pattern as well. An option to choose if newlines are added would be appreciated as well.
I'm not sure if this is a bug or an intended feature, however, I'm creating this issue to discuss this inconsistency in prettier.
I'm not sure if this helps, but the interface ProjectOrBuilder is present within a parent class. Maybe that's causing some issues with Prettier's formatting?