jhipster / prettier-java

Prettier Java Plugin
http://www.jhipster.tech/prettier-java/
Apache License 2.0
1.06k stars 103 forks source link

prettier doesn't correct EmptyLineSeparator for checkstyle with comments #647

Open xenoterracide opened 4 months ago

xenoterracide commented 4 months ago
        "@prettier/plugin-xml": "^3.2.2",
        "prettier": "^3.1.1",
        "prettier-plugin-java": "^2.5.0",
        "prettier-plugin-properties": "^0.3.0",
        "prettier-plugin-sh": "^0.14.0",
        "prettier-plugin-toml": "^2.0.1"

Input:

// SPDX-License-Identifier: Apache-2.0
// Copyright © 2018-2024 Caleb Cushing.
package com.xenoterracide.gradle.semver;

Output:

// SPDX-License-Identifier: Apache-2.0
// Copyright © 2018-2024 Caleb Cushing.
package com.xenoterracide.gradle.semver;

Expected behavior:

// SPDX-License-Identifier: Apache-2.0
// Copyright © 2018-2024 Caleb Cushing.

package com.xenoterracide.gradle.semver;

expected behavior is simply derived from the checkstyle config which contains, I'm indifferent to correcting prettier, or correcting checkstyle. For now I've worked around this by simply changing my spotless config to output \n\n instead of just \n

    <module name="EmptyLineSeparator">
      <property
        name="tokens"
        value="PACKAGE_DEF, IMPORT, STATIC_IMPORT, CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
                    STATIC_INIT, INSTANCE_INIT, CTOR_DEF, VARIABLE_DEF, RECORD_DEF,
                    COMPACT_CTOR_DEF"
      />
      <property name="allowNoEmptyLineBetweenFields" value="true" />
    </module>