Open
Description
tl;dr
LintNames.directives_ordering
(which I agree with) prefers code like this
import 'travis.dart';
import 'travis/lib.dart';
DartFixKind.ORGANIZE_IMPORTS
orders code like this:
import 'travis/lib.dart';
import 'travis.dart';
I hacked up the test which I would like to pass. 😄
diff --git a/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart b/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
index 868dbabae2f..a8d90b20c97 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/organize_imports_test.dart
@@ -4,6 +4,7 @@
import 'package:analysis_server/src/services/correction/fix.dart';
import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -40,4 +41,24 @@ import 'dart:io';
void main(Stream<String> args) { }
''');
}
+
+ Future<void> test_organizeImports2() async {
+ await resolveTestUnit('''
+import 'travis/lib.dart';
+
+import 'travis.dart';
+
+void main(Stream<String> args) { }
+''');
+ await assertHasFix(
+ '''
+import 'travis.dart';
+import 'travis/lib.dart';
+
+void main(Stream<String> args) { }
+''',
+ errorFilter: (input) =>
+ input.errorCode != CompileTimeErrorCode.URI_DOES_NOT_EXIST,
+ );
+ }
}
Metadata
Metadata
Assignees
Labels
A lower priority bug or feature requestFor issues related to the analysis server, IDE support, linter, `dart fix`, and diagnostic messages.Contributions welcome to help resolve this (the resolution is expected to be clear from the issue)Incorrect behavior (everything from a crash to more subtle misbehavior)