-
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 inconsistent with other orderings #2678
Comments
@davidmorgan: are we good on this one now? |
IIRC, yes :) |
Super! I'll ride your enthusiasm and close this one; we can re-open if we hit any snags. Thanks! /fyi @jefflim-google |
I found another edge case. What import './foo1.dart';
import '../../foo2.dart';
import '../foo3.dart';
import 'foo4.dart'; What I expect & what import '../../foo1.dart';
import '../foo2.dart';
import './foo3.dart';
import 'foo4.dart'; Or alternatively the exact opposite of the latter also might make sense, but not the mixed order. I think the culprit is the fact that this function is invoked on the uri whether or not it is actually from a package, and so the part before the first slash is sorted separately: linter/lib/src/rules/directives_ordering.dart Lines 118 to 125 in cf4fbcd
I.e. it sorts the items as if they are such tuples: ('.', 'foo1.dart')
('..', '../foo2.dart')
('..', 'foo3.dart') I can't think of any other scenario where this "tuple-ness" causes wrong orderings to happen, although at first it might seem like a wide class of errors. The ASCII table ordering goes like [ And also I guess one big reason that this error has gone unnoticed is that you're just not supposed to write |
Has this been fixed now? |
I reopened because it was only mostly fixed. With that, the status is: @oprypin oprypin linked a pull request Jul 6, 2023 that will close this issue |
The sort order does not seem to be consistent with analyzer/tidy_dart when there are packages with
.
in the name; it looks like we need to split the package name out, sort by then, then sort by name within package.Other suggestions to check:
The text was updated successfully, but these errors were encountered: