-
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
directives_ordering unexpectedly changed #4869
Comments
CC @oprypin |
Basically the code change just falls back to the behavior prior to commit aed089e45c35221ce2b82f3757132031f0344b8b when a leading slash is encountered. Fixes dart-lang/linter#4869 Change-Id: I61fc7915f44f043f591ea439d40d4016fc8b3d27 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/350861 Commit-Queue: Oleh Prypin <[email protected]> Reviewed-by: Samuel Rawlins <[email protected]>
Should we use some kind of logical ordering instead of accidental lexicographical ordering? The example import './foo1.dart';
import '../../foo2.dart';
import '../foo3.dart';
import 'foo4.dart'; shows If there are no leading or embedded Generally, it should sort by ordering by path segment, rather than treating |
We are currently enforcing the guidelines in the style guide (https://dart.dev/effective-dart/style#ordering). If we want to update the style guide then we'll update the lint (and sort command) to correspond. Assuming that it has the right definition of "alphabetical", I believe that this is currently working as intended (modulo the bug that was introduced). @munificent For visibility. @srawlins Did you recently review a CL with a fix for this bug? |
Yes, "Fixes XYZ" does not work cross-repos, so every linter bug must be closed manually. Fixed by dart-lang/sdk@9fdb0ca |
|
Never mind, silly me. I thought the issue was closed as "WAI", but it is in fact fixed. Please ignore my previous comment. Thanks for the fix. |
Eh, probably not worth the effort. Lexicographical is close enough to logical order except in the case where users are pointlessly doing |
Describe the issue
The linter for the following seems to have broken by #4538
is being flagged, and changed to
To Reproduce
Create a dart file with the above import. Run
dart lint <file>
.Expected behavior
Expected
/foo1.dart
to be at the top as it is an absolute path. '../' and './' are all relative paths. This was the behavior before the PR was merged.Additional context
#4538 was fixing #2678 which is unrelated to the issue above. The example given in #4538 had only relative paths. The proposed fix should not have affected absolute path ordering.
The text was updated successfully, but these errors were encountered: