From fa2856ae5888e0b7bedda303f1372b3ee600816f Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 10 Jul 2024 14:21:28 +0200 Subject: [PATCH 1/4] Switch to `package:dart_flutter_team_lints` --- analysis_options.yaml | 10 +++++++++- lib/expect.dart | 9 ++++----- lib/src/expect/expect.dart | 5 ++++- lib/src/expect/throws_matcher.dart | 2 +- pubspec.yaml | 1 + test/core_matchers_test.dart | 2 +- test/having_test.dart | 2 +- test/iterable_matchers_test.dart | 2 +- test/map_matchers_test.dart | 2 +- test/mirror_matchers_test.dart | 4 +++- test/operator_matchers_test.dart | 2 +- test/pretty_print_test.dart | 2 +- test/string_matchers_test.dart | 2 +- test/type_matcher_test.dart | 2 +- 14 files changed, 30 insertions(+), 17 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index f0f137f..0ea8e3f 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -1,5 +1,13 @@ -include: package:lints/recommended.yaml +include: package:dart_flutter_team_lints/analysis_options.yaml +analyzer: + errors: + avoid_dynamic_calls: ignore + inference_failure_on_collection_literal: ignore + inference_failure_on_function_return_type: ignore + inference_failure_on_instance_creation: ignore + strict-casts: false + linter: rules: - always_declare_return_types diff --git a/lib/expect.dart b/lib/expect.dart index c842d30..e3865eb 100644 --- a/lib/expect.dart +++ b/lib/expect.dart @@ -5,7 +5,6 @@ // ignore_for_file: deprecated_member_use_from_same_package export 'matcher.dart'; - export 'src/expect/expect.dart' show ErrorFormatter, expect, expectLater, fail; export 'src/expect/expect_async.dart' show @@ -38,14 +37,14 @@ export 'src/expect/prints_matcher.dart' show prints; export 'src/expect/stream_matcher.dart' show StreamMatcher; export 'src/expect/stream_matchers.dart' show - emitsDone, emits, - emitsError, - mayEmit, emitsAnyOf, - emitsInOrder, + emitsDone, + emitsError, emitsInAnyOrder, + emitsInOrder, emitsThrough, + mayEmit, mayEmitMultiple, neverEmits; export 'src/expect/throws_matcher.dart' show Throws, throws, throwsA; diff --git a/lib/src/expect/expect.dart b/lib/src/expect/expect.dart index 8dd8cae..81e57f5 100644 --- a/lib/src/expect/expect.dart +++ b/lib/src/expect/expect.dart @@ -74,7 +74,10 @@ Future expectLater(dynamic actual, dynamic matcher, /// The implementation of [expect] and [expectLater]. Future _expect(Object? actual, Object? matcher, - {String? reason, skip, bool verbose = false, ErrorFormatter? formatter}) { + {String? reason, + Object? skip, + bool verbose = false, + ErrorFormatter? formatter}) { final test = TestHandle.current; formatter ??= (actual, matcher, reason, matchState, verbose) { var mismatchDescription = StringDescription(); diff --git a/lib/src/expect/throws_matcher.dart b/lib/src/expect/throws_matcher.dart index 0ee3144..89fc852 100644 --- a/lib/src/expect/throws_matcher.dart +++ b/lib/src/expect/throws_matcher.dart @@ -117,7 +117,7 @@ class Throws extends AsyncMatcher { /// Verifies that [error] matches [_matcher] and returns a [String] /// description of the failure if it doesn't. - String? _check(error, StackTrace? trace) { + String? _check(dynamic error, StackTrace? trace) { if (_matcher == null) return null; var matchState = {}; diff --git a/pubspec.yaml b/pubspec.yaml index 8b6df88..9fb4c67 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -16,6 +16,7 @@ dependencies: test_api: ">=0.5.0 <0.8.0" dev_dependencies: + dart_flutter_team_lints: ^2.1.1 fake_async: ^1.3.0 lints: ^3.0.0 test: ^1.23.0 diff --git a/test/core_matchers_test.dart b/test/core_matchers_test.dart index 04fc8b3..62e7d75 100644 --- a/test/core_matchers_test.dart +++ b/test/core_matchers_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:matcher/matcher.dart'; -import 'package:test/test.dart' show test, group; +import 'package:test/test.dart' show group, test; import 'test_utils.dart'; diff --git a/test/having_test.dart b/test/having_test.dart index ddada77..26592cd 100644 --- a/test/having_test.dart +++ b/test/having_test.dart @@ -5,7 +5,7 @@ // ignore_for_file: lines_longer_than_80_chars import 'package:matcher/matcher.dart'; -import 'package:test/test.dart' show test, expect, throwsA, group; +import 'package:test/test.dart' show expect, group, test, throwsA; import 'test_utils.dart'; diff --git a/test/iterable_matchers_test.dart b/test/iterable_matchers_test.dart index 7607d18..2d55fd8 100644 --- a/test/iterable_matchers_test.dart +++ b/test/iterable_matchers_test.dart @@ -196,7 +196,7 @@ void main() { equals(2), // 2 allOf([lessThan(3), isNot(0)]), // 1 equals(0), // 0 - predicate((int v) => v % 2 == 1), // 3 + predicate((int v) => v.isOdd), // 3 equals(5), // 5 ])); shouldFail( diff --git a/test/map_matchers_test.dart b/test/map_matchers_test.dart index 4c699ab..f7dbafe 100644 --- a/test/map_matchers_test.dart +++ b/test/map_matchers_test.dart @@ -1,5 +1,5 @@ import 'package:matcher/matcher.dart' - show contains, containsValue, containsPair; + show contains, containsPair, containsValue; import 'package:test/test.dart' show test; import 'test_utils.dart'; diff --git a/test/mirror_matchers_test.dart b/test/mirror_matchers_test.dart index b19fe3e..cc4e757 100644 --- a/test/mirror_matchers_test.dart +++ b/test/mirror_matchers_test.dart @@ -2,10 +2,12 @@ // 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. -// ignore_for_file: deprecated_member_use_from_same_package +// ignore_for_file: unreachable_from_main @TestOn('vm') +library; +// ignore: deprecated_member_use_from_same_package import 'package:matcher/mirror_matchers.dart'; import 'package:test/test.dart'; diff --git a/test/operator_matchers_test.dart b/test/operator_matchers_test.dart index f4b6d3a..46151e0 100644 --- a/test/operator_matchers_test.dart +++ b/test/operator_matchers_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:matcher/matcher.dart'; -import 'package:test/test.dart' show test, expect, throwsArgumentError; +import 'package:test/test.dart' show expect, test, throwsArgumentError; import 'test_utils.dart'; diff --git a/test/pretty_print_test.dart b/test/pretty_print_test.dart index 184704b..62f3ab1 100644 --- a/test/pretty_print_test.dart +++ b/test/pretty_print_test.dart @@ -6,7 +6,7 @@ import 'dart:collection'; import 'package:matcher/matcher.dart'; import 'package:matcher/src/pretty_print.dart'; -import 'package:test/test.dart' show group, test, expect; +import 'package:test/test.dart' show expect, group, test; class DefaultToString {} diff --git a/test/string_matchers_test.dart b/test/string_matchers_test.dart index be9e768..0820015 100644 --- a/test/string_matchers_test.dart +++ b/test/string_matchers_test.dart @@ -3,7 +3,7 @@ // BSD-style license that can be found in the LICENSE file. import 'package:matcher/matcher.dart'; -import 'package:test/test.dart' show test, expect; +import 'package:test/test.dart' show expect, test; import 'test_utils.dart'; diff --git a/test/type_matcher_test.dart b/test/type_matcher_test.dart index 99d4459..15fc247 100644 --- a/test/type_matcher_test.dart +++ b/test/type_matcher_test.dart @@ -4,7 +4,7 @@ // ignore_for_file: deprecated_member_use_from_same_package import 'package:matcher/matcher.dart'; -import 'package:test/test.dart' show test, group; +import 'package:test/test.dart' show group, test; import 'test_utils.dart'; From d1d7d064e88cdcdb4b8a96c4a086b7ddb0460eb3 Mon Sep 17 00:00:00 2001 From: Moritz Date: Wed, 10 Jul 2024 14:27:59 +0200 Subject: [PATCH 2/4] Fix --- analysis_options.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/analysis_options.yaml b/analysis_options.yaml index 0ea8e3f..79971ca 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -6,6 +6,7 @@ analyzer: inference_failure_on_collection_literal: ignore inference_failure_on_function_return_type: ignore inference_failure_on_instance_creation: ignore + language: strict-casts: false linter: From af8d38dff58328829e898ccfe9df3c29ed329509 Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 11 Jul 2024 09:09:34 +0200 Subject: [PATCH 3/4] Rev to `wip` --- CHANGELOG.md | 4 ++++ pubspec.yaml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 30d9ef6..c253eb0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## 0.12.17-wip + +* Switch to `package:dart_flutter_team_lints`. + ## 0.12.16+1 * Require Dart 3.0 diff --git a/pubspec.yaml b/pubspec.yaml index 9fb4c67..5b4f2fe 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,5 +1,5 @@ name: matcher -version: 0.12.16+1 +version: 0.12.17-wip description: >- Support for specifying test expectations via an extensible Matcher class. Also includes a number of built-in Matcher implementations for common cases. From ba926cae9e0e1abe6d2d03c013ea26ef29472efb Mon Sep 17 00:00:00 2001 From: Moritz Date: Thu, 11 Jul 2024 09:12:35 +0200 Subject: [PATCH 4/4] Add issues --- analysis_options.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/analysis_options.yaml b/analysis_options.yaml index 79971ca..fb7654e 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -2,12 +2,12 @@ include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: errors: - avoid_dynamic_calls: ignore + avoid_dynamic_calls: ignore #TODO(mosum): https://github.com/dart-lang/matcher/issues/252 inference_failure_on_collection_literal: ignore inference_failure_on_function_return_type: ignore inference_failure_on_instance_creation: ignore language: - strict-casts: false + strict-casts: false #TODO(mosum): Fix https://github.com/dart-lang/matcher/issues/253 linter: rules: