Require Dart 3, update lints (dart-lang/pubspec_parse#106)
diff --git a/pkgs/pubspec_parse/.github/workflows/test-package.yml b/pkgs/pubspec_parse/.github/workflows/test-package.yml index 44a40de..eac88d5 100644 --- a/pkgs/pubspec_parse/.github/workflows/test-package.yml +++ b/pkgs/pubspec_parse/.github/workflows/test-package.yml
@@ -46,7 +46,7 @@ fail-fast: false matrix: os: [ubuntu-latest] - sdk: [2.18.0, dev] + sdk: [3.0.0, dev] steps: - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab - uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
diff --git a/pkgs/pubspec_parse/CHANGELOG.md b/pkgs/pubspec_parse/CHANGELOG.md index 9ed3837..7444f4f 100644 --- a/pkgs/pubspec_parse/CHANGELOG.md +++ b/pkgs/pubspec_parse/CHANGELOG.md
@@ -1,4 +1,9 @@ +## 1.2.4-wip + +- Require Dart 3.0 + ## 1.2.3 + - Added topics to `pubspec.yaml`. ## 1.2.2
diff --git a/pkgs/pubspec_parse/analysis_options.yaml b/pkgs/pubspec_parse/analysis_options.yaml index cf5c91f..af77edc 100644 --- a/pkgs/pubspec_parse/analysis_options.yaml +++ b/pkgs/pubspec_parse/analysis_options.yaml
@@ -1,4 +1,5 @@ -include: package:lints/recommended.yaml +# https://dart.dev/guides/language/analysis-options +include: package:dart_flutter_team_lints/analysis_options.yaml analyzer: language: @@ -8,9 +9,7 @@ linter: rules: - avoid_bool_literals_in_conditional_expressions - - avoid_catching_errors - avoid_classes_with_only_static_members - - avoid_dynamic_calls - avoid_private_typedef_functions - avoid_redundant_argument_values - avoid_returning_null @@ -21,27 +20,18 @@ - cancel_subscriptions - cascade_invocations - comment_references - - directives_ordering - join_return_with_assignment - - lines_longer_than_80_chars - literal_only_boolean_expressions - missing_whitespace_between_adjacent_strings - no_adjacent_strings_in_list - no_runtimeType_toString - - only_throw_errors - package_api_docs - - prefer_asserts_in_initializer_lists - prefer_const_constructors - prefer_const_declarations - prefer_expression_function_bodies - prefer_final_locals - prefer_relative_imports - require_trailing_commas - - sort_pub_dependencies - test_types_in_equals - - throw_in_finally - unnecessary_await_in_return - - unnecessary_lambdas - - unnecessary_parenthesis - - unnecessary_statements - use_string_buffers
diff --git a/pkgs/pubspec_parse/lib/pubspec_parse.dart b/pkgs/pubspec_parse/lib/pubspec_parse.dart index 7360d1a..b5c12e4 100644 --- a/pkgs/pubspec_parse/lib/pubspec_parse.dart +++ b/pkgs/pubspec_parse/lib/pubspec_parse.dart
@@ -5,10 +5,10 @@ export 'src/dependency.dart' show Dependency, + GitDependency, HostedDependency, HostedDetails, - GitDependency, - SdkDependency, - PathDependency; + PathDependency, + SdkDependency; export 'src/pubspec.dart' show Pubspec; export 'src/screenshot.dart' show Screenshot;
diff --git a/pkgs/pubspec_parse/lib/src/dependency.dart b/pkgs/pubspec_parse/lib/src/dependency.dart index e345dfd..95bbc8e 100644 --- a/pkgs/pubspec_parse/lib/src/dependency.dart +++ b/pkgs/pubspec_parse/lib/src/dependency.dart
@@ -74,19 +74,14 @@ final key = matchedKeys.single; - switch (key) { - case 'git': - return GitDependency.fromData(data[key]); - case 'path': - return PathDependency.fromData(data[key]); - case 'sdk': - return _$SdkDependencyFromJson(data); - case 'hosted': - final hosted = _$HostedDependencyFromJson(data); - hosted.hosted?._nameOfPackage = name; - return hosted; - } - throw StateError('There is a bug in pubspec_parse.'); + return switch (key) { + 'git' => GitDependency.fromData(data[key]), + 'path' => PathDependency.fromData(data[key]), + 'sdk' => _$SdkDependencyFromJson(data), + 'hosted' => _$HostedDependencyFromJson(data) + ..hosted?._nameOfPackage = name, + _ => throw StateError('There is a bug in pubspec_parse.'), + }; }); } }
diff --git a/pkgs/pubspec_parse/pubspec.yaml b/pkgs/pubspec_parse/pubspec.yaml index a2b189d..9c3b89a 100644 --- a/pkgs/pubspec_parse/pubspec.yaml +++ b/pkgs/pubspec_parse/pubspec.yaml
@@ -1,5 +1,5 @@ name: pubspec_parse -version: 1.2.3 +version: 1.2.4-wip description: >- Simple package for parsing pubspec.yaml files with a type-safe API and rich error reporting. @@ -8,7 +8,7 @@ - dart-pub environment: - sdk: '>=2.18.0 <3.0.0' + sdk: ^3.0.0 dependencies: checked_yaml: ^2.0.1 @@ -20,8 +20,8 @@ dev_dependencies: build_runner: ^2.0.3 build_verify: '>=2.0.0 <4.0.0' + dart_flutter_team_lints: ^1.0.0 json_serializable: ^6.6.0 - lints: ^2.0.0 path: ^1.5.1 # Needed because we are configuring `combining_builder` source_gen: ^1.0.0
diff --git a/pkgs/pubspec_parse/test/ensure_build_test.dart b/pkgs/pubspec_parse/test/ensure_build_test.dart index 612b837..689f6fe 100644 --- a/pkgs/pubspec_parse/test/ensure_build_test.dart +++ b/pkgs/pubspec_parse/test/ensure_build_test.dart
@@ -5,6 +5,8 @@ @Timeout.factor(2) @TestOn('vm') @Tags(['presubmit-only']) +library; + import 'package:build_verify/build_verify.dart'; import 'package:test/test.dart';
diff --git a/pkgs/pubspec_parse/test/parse_test.dart b/pkgs/pubspec_parse/test/parse_test.dart index e181ca6..f4d6476 100644 --- a/pkgs/pubspec_parse/test/parse_test.dart +++ b/pkgs/pubspec_parse/test/parse_test.dart
@@ -5,8 +5,6 @@ // ignore_for_file: deprecated_member_use_from_same_package // ignore_for_file: lines_longer_than_80_chars -library parse_test; - import 'package:pub_semver/pub_semver.dart'; import 'package:test/test.dart';