From 774ca2f19741c4e5956f9552b071c89b880f04d2 Mon Sep 17 00:00:00 2001 From: Alexandre Ardhuin Date: Tue, 11 Sep 2018 07:14:04 +0200 Subject: [PATCH] enable lint avoid_void_async (#21652) --- analysis_options.yaml | 2 +- .../bin/tasks/android_semantics_integration_test.dart | 2 +- dev/devicelab/bin/tasks/gradle_plugin_test.dart | 2 +- packages/flutter/test/widgets/async_lifecycle_test.dart | 4 ++-- .../test/test_config/flutter_test_config.dart | 2 +- .../test_config/nested_config/flutter_test_config.dart | 2 +- packages/flutter_tools/lib/src/compile.dart | 2 +- packages/flutter_tools/test/flutter_manifest_test.dart | 8 ++++---- 8 files changed, 12 insertions(+), 12 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 72bee0b77ad87..41a88b913787d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -74,7 +74,7 @@ linter: - avoid_types_as_parameter_names # - avoid_types_on_closure_parameters # conflicts with always_specify_types - avoid_unused_constructor_parameters - # - avoid_void_async # not yet tested + - avoid_void_async - await_only_futures - camel_case_types - cancel_subscriptions diff --git a/dev/devicelab/bin/tasks/android_semantics_integration_test.dart b/dev/devicelab/bin/tasks/android_semantics_integration_test.dart index fa9b10e3366dc..ffc8bd37bc6b2 100644 --- a/dev/devicelab/bin/tasks/android_semantics_integration_test.dart +++ b/dev/devicelab/bin/tasks/android_semantics_integration_test.dart @@ -6,7 +6,7 @@ import 'package:flutter_devicelab/framework/adb.dart'; import 'package:flutter_devicelab/framework/framework.dart'; import 'package:flutter_devicelab/tasks/integration_tests.dart'; -void main() async { +Future main() async { deviceOperatingSystem = DeviceOperatingSystem.android; await task(createAndroidSemanticsIntegrationTest()); } diff --git a/dev/devicelab/bin/tasks/gradle_plugin_test.dart b/dev/devicelab/bin/tasks/gradle_plugin_test.dart index 3cd61e3643ccc..b258a1f2448cb 100644 --- a/dev/devicelab/bin/tasks/gradle_plugin_test.dart +++ b/dev/devicelab/bin/tasks/gradle_plugin_test.dart @@ -36,7 +36,7 @@ Future runPluginProjectTest(Future testFunction(FlutterPluginProject } } -void main() async { +Future main() async { await task(() async { section('Find Java'); diff --git a/packages/flutter/test/widgets/async_lifecycle_test.dart b/packages/flutter/test/widgets/async_lifecycle_test.dart index 29ab93751966f..a8870809ac80d 100644 --- a/packages/flutter/test/widgets/async_lifecycle_test.dart +++ b/packages/flutter/test/widgets/async_lifecycle_test.dart @@ -10,7 +10,7 @@ class InvalidOnInitLifecycleWidget extends StatefulWidget { class InvalidOnInitLifecycleWidgetState extends State { @override - void initState() async { + Future initState() async { super.initState(); } @@ -31,7 +31,7 @@ class InvalidDidUpdateWidgetLifecycleWidget extends StatefulWidget { class InvalidDidUpdateWidgetLifecycleWidgetState extends State { @override - void didUpdateWidget(InvalidDidUpdateWidgetLifecycleWidget oldWidget) async { + Future didUpdateWidget(InvalidDidUpdateWidgetLifecycleWidget oldWidget) async { super.didUpdateWidget(oldWidget); } diff --git a/packages/flutter_test/test/test_config/flutter_test_config.dart b/packages/flutter_test/test/test_config/flutter_test_config.dart index 226d5bb261507..e5c8761bc4b1c 100644 --- a/packages/flutter_test/test/test_config/flutter_test_config.dart +++ b/packages/flutter_test/test/test_config/flutter_test_config.dart @@ -4,7 +4,7 @@ import 'dart:async'; -void main(FutureOr testMain()) async { +Future main(FutureOr testMain()) async { await runZoned(testMain, zoneValues: { String: '/test_config', }); diff --git a/packages/flutter_test/test/test_config/nested_config/flutter_test_config.dart b/packages/flutter_test/test/test_config/nested_config/flutter_test_config.dart index e52918ccfef7f..6a5c6e227eb09 100644 --- a/packages/flutter_test/test/test_config/nested_config/flutter_test_config.dart +++ b/packages/flutter_test/test/test_config/nested_config/flutter_test_config.dart @@ -4,7 +4,7 @@ import 'dart:async'; -void main(FutureOr testMain()) async { +Future main(FutureOr testMain()) async { await runZoned(testMain, zoneValues: { String: '/test_config/nested_config', int: 123, diff --git a/packages/flutter_tools/lib/src/compile.dart b/packages/flutter_tools/lib/src/compile.dart index fb8e251673c87..7f3728292225d 100644 --- a/packages/flutter_tools/lib/src/compile.dart +++ b/packages/flutter_tools/lib/src/compile.dart @@ -316,7 +316,7 @@ class ResidentCompiler { final List<_CompilationRequest> _compilationQueue = <_CompilationRequest>[]; - void _handleCompilationRequest(_CompilationRequest request) async { + Future _handleCompilationRequest(_CompilationRequest request) async { final bool isEmpty = _compilationQueue.isEmpty; _compilationQueue.add(request); // Only trigger processing if queue was empty - i.e. no other requests diff --git a/packages/flutter_tools/test/flutter_manifest_test.dart b/packages/flutter_tools/test/flutter_manifest_test.dart index 0733412248748..2c29651e88a15 100644 --- a/packages/flutter_tools/test/flutter_manifest_test.dart +++ b/packages/flutter_tools/test/flutter_manifest_test.dart @@ -503,7 +503,7 @@ flutter: }); group('FlutterManifest with MemoryFileSystem', () { - void assertSchemaIsReadable() async { + Future assertSchemaIsReadable() async { const String manifest = ''' name: test dependencies: @@ -529,18 +529,18 @@ flutter: ); } - testUsingContext('Validate manifest on original fs', () async { + testUsingContext('Validate manifest on original fs', () { assertSchemaIsReadable(); }); testUsingContextAndFs('Validate manifest on Posix FS', - new MemoryFileSystem(style: FileSystemStyle.posix), () async { + new MemoryFileSystem(style: FileSystemStyle.posix), () { assertSchemaIsReadable(); } ); testUsingContextAndFs('Validate manifest on Windows FS', - new MemoryFileSystem(style: FileSystemStyle.windows), () async { + new MemoryFileSystem(style: FileSystemStyle.windows), () { assertSchemaIsReadable(); } );