Comment section moved between two import declarations
See original GitHub issuePrettier-Java 0.7.0
Launched through prettier-maven-plugin 0.7.0 without any option. In the following case, the comment section is moved between two import lines. This bugs depends on import declaration order. If “com.me.Util” is declared first, the generated file is OK.
Input:
package org.mypackage;
/*-
*/
import java.lang.Util;
import java.util.Map;
import com.me.Util;
public class Prettier {}
Output:
package org.mypackage;
import com.me.Util;
/*-
*/
import java.lang.Util;
import java.util.Map;
public class Prettier {}
Expected behavior:
package org.mypackage;
/*-
*/
import java.lang.Util;
import java.util.Map;
import com.me.Util;
public class Prettier {}
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
Component is part of the declaration of 2 modules
Here is what I did to fix sharing a directive. create a new shared module. shared.module.ts import { NgModule, Directive,OnInit ...
Read more >Instructions For CBP Form 3299 - Declaration for Free Entry of ...
PART V - Carrier's Certificate and Release Order - If the importer has hired a moving and/or freight company to transport the imported...
Read more >Auto import | PyCharm Documentation - JetBrains
The import statement is added to the imports section, but the caret does not move from the current position, and your current editing...
Read more >International Trade Definitions - Census Bureau
Card Count - The number of individual export or import line items. ... company under which freight is to be moved between points...
Read more >PEP 8 – Style Guide for Python Code
Surround top-level function and class definitions with two blank lines. ... You should put a blank line between each group of imports.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My $0.02 is that sorting imports feels within scope for prettier-java, and we really like having it
I agree with @murdos on sorting imports. Further more, in my opinion, prettier’s goal is to standardize code across an organization by sharing a common set of rules so that code made by each contributor looks the same (or at least aims at looking the same)., and imports too are a part of a codebase (maybe not as important as the rest, but still…).
The example is a bit weird too, and may not happen very often (I may not fully understand the motivation behind putting a comment in such a place though). IMO, I wouldn’t say this issue has a “high priority”. I’m sure there must be a more important task to do.