bulk fix for `sort_child_properties_last`

Change-Id: If340bb29892eded3801801bf5e97794b45eae321
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161624
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
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 8ca0596..27e4114 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
@@ -44,6 +44,7 @@
 import 'package:analysis_server/src/services/correction/dart/replace_with_is_empty.dart';
 import 'package:analysis_server/src/services/correction/dart/replace_with_tear_off.dart';
 import 'package:analysis_server/src/services/correction/dart/replace_with_var.dart';
+import 'package:analysis_server/src/services/correction/dart/sort_child_property_last.dart';
 import 'package:analysis_server/src/services/correction/dart/use_curly_braces.dart';
 import 'package:analysis_server/src/services/correction/dart/use_is_not_empty.dart';
 import 'package:analysis_server/src/services/correction/dart/use_rethrow.dart';
@@ -103,6 +104,7 @@
     LintNames.prefer_single_quotes: ConvertToSingleQuotes.newInstance,
     LintNames.prefer_spread_collections: ConvertAddAllToSpread.newInstance,
     LintNames.slash_for_doc_comments: ConvertDocumentationIntoLine.newInstance,
+    LintNames.sort_child_properties_last: SortChildPropertyLast.newInstance,
     LintNames.type_init_formals: RemoveTypeAnnotation.newInstance,
     LintNames.unawaited_futures: AddAwait.newInstance,
     LintNames.unnecessary_brace_in_string_interps:
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/sort_child_properties_last.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/sort_child_properties_last.dart
new file mode 100644
index 0000000..80c02dd
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/sort_child_properties_last.dart
@@ -0,0 +1,64 @@
+// Copyright (c) 2020, 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 'bulk_fix_processor.dart';
+
+void main() {
+  defineReflectiveSuite(() {
+    defineReflectiveTests(SortChildPropertyLastTest);
+  });
+}
+
+@reflectiveTest
+class SortChildPropertyLastTest extends BulkFixProcessorTest {
+  @override
+  String get lintCode => LintNames.sort_child_properties_last;
+
+  Future<void> test_singleFile() async {
+    addFlutterPackage();
+    await resolveTestUnit('''
+import 'package:flutter/material.dart';
+main() {
+  Column(
+    children: [
+      Column(
+        children: [
+          Text('a'),
+        ],
+        crossAxisAlignment: CrossAxisAlignment.center,
+      ),
+      Text('b'),
+      Text('c'),
+      Text('d'),
+    ],
+    crossAxisAlignment: CrossAxisAlignment.center,
+  );
+}
+''');
+    // todo (pq): two diagnostics are produced but only the first is fixed.
+    // see: linter/test/rules/sort_child_properties_last.dart:nestedChildren()
+    await assertHasFix('''
+import 'package:flutter/material.dart';
+main() {
+  Column(
+    crossAxisAlignment: CrossAxisAlignment.center,
+    children: [
+      Column(
+        children: [
+          Text('a'),
+        ],
+        crossAxisAlignment: CrossAxisAlignment.center,
+      ),
+      Text('b'),
+      Text('c'),
+      Text('d'),
+    ],
+  );
+}
+''');
+  }
+}
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 009ee47..36033cf 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
@@ -46,6 +46,7 @@
 import 'replace_with_is_empty_test.dart' as replace_with_is_empty;
 import 'replace_with_tear_off_test.dart' as replace_with_tear_off;
 import 'replace_with_var_test.dart' as replace_with_var;
+import 'sort_child_properties_last.dart' as sort_child_properties_last;
 import 'use_curly_braces_test.dart' as use_curly_braces;
 import 'use_is_not_empty_test.dart' as use_is_not_empty;
 import 'use_rethrow_test.dart' as use_rethrow;
@@ -88,6 +89,7 @@
     replace_with_is_empty.main();
     replace_with_tear_off.main();
     replace_with_var.main();
+    sort_child_properties_last.main();
     use_curly_braces.main();
     use_is_not_empty.main();
     use_rethrow.main();