-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Fix correction of sorted_imports rule for leading comments case
#6318
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
Conversation
|
I'm still getting some unexpected diffs with this change: //
// Copyright © Foo
//
+import AAA // a comment
import DDD
import FFF
-
-// some comment
-import AAA // a comment
import NNN
import RRR
import SSSand //
// Copyright © Foo
//
import DDD
-import SSS
// some comment
import FFF // a comment
+import SSS |
Generated by 🚫 Danger |
81395bb to
e448552
Compare
They should all be fine with the latest update. Are they, @jszumski? |
|
So close! just this one edge case left: +import BBB
//
// Copyright © Foo
//
import class CCC
-import BBB
import LLLI guess if the trivia of the old first item ends with a newline then a replacement into the first position should append to that old trivia? |
e448552 to
df404bb
Compare
Yeah, sort of that. 😅 The condition was too vague. The case of an empty line between the comment and the first imports wasn't decently handled. Could you give it another try? That really helps getting this properly sorted (pun indented). |
|
Also close, but if any replacement is made in a position >1 it chomps the first position's trivia: //
// Copyright © Foo
//
-
import AAA
-import class CCC2.View
import CCC1
+import class CCC2.View |
df404bb to
0b802f8
Compare
|
Next try ... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect!
Fixes #6317.