-
Notifications
You must be signed in to change notification settings - Fork 170
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
Fix directives_ordering for a leading dot in path #4538
Conversation
It used to sort imports as follows: import './foo1.dart'; import '../../foo2.dart'; import '../foo3.dart'; import 'foo4.dart'; This change corrects it to the following: import '../../foo1.dart'; import '../foo2.dart'; import './foo3.dart'; import 'foo4.dart';
Does this cause the lint to diverge from the 'Sort Imports' operation? |
I am not fully sure this is a valid confirmation, but after I edit the lint in google3, the behavior of the bulk fix for the lint changes accordingly. So I think it means that that operation's behavior just uses the same code that is in this lint. |
I don't know how that would happen. The code in the organize imports implementation says /// Should keep these in sync! Copied from
/// https://github.com/dart-lang/linter/blob/658f497eef/lib/src/rules/directives_ordering.dart#L380-L387
/// Consider finding a way to share this code! |
I see. Yes, I realize my validation was not right. It's not that the fixer was doing the right thing now, it's just that it wasn't kicking in anymore. |
I can only think of two approaches (though there are probably others).
|
Let's just update sdk/ and rev linter at the same time. Was anyone planning a routine bump of the linter, so perhaps then we could advance it only 1 commit forward when applying this particular change? If there are some edge cases in their synchronization, I think it's not going to cause much damage, because it's very rare that |
OK, linter got bumped to latest! https://dart.googlesource.com/sdk/+/fab30a7a73cd6946fc0cc340a62c10b69740b02c I think we're in a great position to proceed with this change. Then I'll be able to make an SDK change that will also bump linter to this change. cc @pq |
That plan sounds good to me. Landing. |
Ah CL as well :) |
It sorts imports as follows:
This change corrects it to the following:
Fixes #2678
See #2678 (comment) for an explanation on how this edit relates to the behavior