Version 2.12.0-234.0.dev
Merge commit '44cb6a17e941abef864f9c502e37b66675db29a4' into 'dev'
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index 1bc803f..6d94b51 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -26,6 +26,7 @@
import 'package:analysis_server/src/services/correction/dart/convert_to_list_literal.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_map_literal.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_null_aware.dart';
+import 'package:analysis_server/src/services/correction/dart/convert_to_package_import.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_relative_import.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_set_literal.dart';
import 'package:analysis_server/src/services/correction/dart/convert_to_where_type.dart';
@@ -114,6 +115,9 @@
LintNames.avoid_redundant_argument_values: [
RemoveArgument.newInstance,
],
+ LintNames.avoid_relative_lib_imports: [
+ ConvertToPackageImport.newInstance,
+ ],
LintNames.avoid_return_types_on_setters: [
RemoveTypeAnnotation.newInstance,
],
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_package_import_test.dart
new file mode 100644
index 0000000..3c8cf2b
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/convert_to_package_import_test.dart
@@ -0,0 +1,40 @@
+// Copyright (c) 2021, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../fix_processor.dart';
+import 'bulk_fix_processor.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ConvertToPackageImportTest);
+ });
+}
+
+@reflectiveTest
+class ConvertToPackageImportTest extends BulkFixProcessorTest {
+ @override
+ String get lintCode => LintNames.avoid_relative_lib_imports;
+
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44673')
+ Future<void> test_singleFile() async {
+ writeTestPackageConfig(config: PackageConfigFileBuilder());
+ addSource('/home/test/lib/bar.dart', 'class Bar {}');
+
+ testFile = convertPath('/home/test/tool/test.dart');
+
+ await resolveTestCode('''
+import '../lib/bar.dart';
+
+var bar = Bar();
+''');
+ await assertHasFix('''
+import 'package:test/foo/bar.dart';
+
+var bar = Bar();
+''');
+ }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
index 76e9f01..6a65f3b 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
@@ -25,6 +25,7 @@
import 'convert_to_list_literal_test.dart' as convert_to_list_literal;
import 'convert_to_map_literal_test.dart' as convert_to_map_literal;
import 'convert_to_null_aware_test.dart' as convert_to_null_aware;
+import 'convert_to_package_import_test.dart' as convert_to_package_import;
import 'convert_to_relative_import_test.dart' as convert_to_relative_import;
import 'convert_to_set_literal_test.dart' as convert_to_set_literal;
import 'convert_to_single_quoted_strings_test.dart'
@@ -90,6 +91,7 @@
convert_to_list_literal.main();
convert_to_map_literal.main();
convert_to_null_aware.main();
+ convert_to_package_import.main();
convert_to_relative_import.main();
convert_to_set_literal.main();
convert_to_single_quoted_strings.main();
diff --git a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
index 35b1de0..e991423 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/convert_to_package_import_test.dart
@@ -24,7 +24,7 @@
String get lintCode => LintNames.avoid_relative_lib_imports;
/// More coverage in the `convert_to_package_import_test.dart` assist test.
- @failingTest
+ @FailingTest(issue: 'https://github.com/dart-lang/sdk/issues/44673')
Future<void> test_relativeImport() async {
// This test fails because any attempt to specify a relative path that
// includes 'lib' (which the lint requires) results in a malformed URI when
diff --git a/tools/VERSION b/tools/VERSION
index 4c662f7..86f1ef8 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 12
PATCH 0
-PRERELEASE 233
+PRERELEASE 234
PRERELEASE_PATCH 0
\ No newline at end of file