Skip to content

Commit ce15656

Browse files
authored
Require Dart 3, update lints (dart-archive/pubspec_parse#106)
1 parent 544b07a commit ce15656

File tree

8 files changed

+24
-34
lines changed

8 files changed

+24
-34
lines changed

pkgs/pubspec_parse/.github/workflows/test-package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
fail-fast: false
4747
matrix:
4848
os: [ubuntu-latest]
49-
sdk: [2.18.0, dev]
49+
sdk: [3.0.0, dev]
5050
steps:
5151
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
5252
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f

pkgs/pubspec_parse/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1+
## 1.2.4-wip
2+
3+
- Require Dart 3.0
4+
15
## 1.2.3
6+
27
- Added topics to `pubspec.yaml`.
38

49
## 1.2.2
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
include: package:lints/recommended.yaml
1+
# https://dart.dev/guides/language/analysis-options
2+
include: package:dart_flutter_team_lints/analysis_options.yaml
23

34
analyzer:
45
language:
@@ -8,9 +9,7 @@ analyzer:
89
linter:
910
rules:
1011
- avoid_bool_literals_in_conditional_expressions
11-
- avoid_catching_errors
1212
- avoid_classes_with_only_static_members
13-
- avoid_dynamic_calls
1413
- avoid_private_typedef_functions
1514
- avoid_redundant_argument_values
1615
- avoid_returning_null
@@ -21,27 +20,18 @@ linter:
2120
- cancel_subscriptions
2221
- cascade_invocations
2322
- comment_references
24-
- directives_ordering
2523
- join_return_with_assignment
26-
- lines_longer_than_80_chars
2724
- literal_only_boolean_expressions
2825
- missing_whitespace_between_adjacent_strings
2926
- no_adjacent_strings_in_list
3027
- no_runtimeType_toString
31-
- only_throw_errors
3228
- package_api_docs
33-
- prefer_asserts_in_initializer_lists
3429
- prefer_const_constructors
3530
- prefer_const_declarations
3631
- prefer_expression_function_bodies
3732
- prefer_final_locals
3833
- prefer_relative_imports
3934
- require_trailing_commas
40-
- sort_pub_dependencies
4135
- test_types_in_equals
42-
- throw_in_finally
4336
- unnecessary_await_in_return
44-
- unnecessary_lambdas
45-
- unnecessary_parenthesis
46-
- unnecessary_statements
4737
- use_string_buffers

pkgs/pubspec_parse/lib/pubspec_parse.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
export 'src/dependency.dart'
66
show
77
Dependency,
8+
GitDependency,
89
HostedDependency,
910
HostedDetails,
10-
GitDependency,
11-
SdkDependency,
12-
PathDependency;
11+
PathDependency,
12+
SdkDependency;
1313
export 'src/pubspec.dart' show Pubspec;
1414
export 'src/screenshot.dart' show Screenshot;

pkgs/pubspec_parse/lib/src/dependency.dart

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,19 +74,14 @@ Dependency? _fromJson(Object? data, String name) {
7474

7575
final key = matchedKeys.single;
7676

77-
switch (key) {
78-
case 'git':
79-
return GitDependency.fromData(data[key]);
80-
case 'path':
81-
return PathDependency.fromData(data[key]);
82-
case 'sdk':
83-
return _$SdkDependencyFromJson(data);
84-
case 'hosted':
85-
final hosted = _$HostedDependencyFromJson(data);
86-
hosted.hosted?._nameOfPackage = name;
87-
return hosted;
88-
}
89-
throw StateError('There is a bug in pubspec_parse.');
77+
return switch (key) {
78+
'git' => GitDependency.fromData(data[key]),
79+
'path' => PathDependency.fromData(data[key]),
80+
'sdk' => _$SdkDependencyFromJson(data),
81+
'hosted' => _$HostedDependencyFromJson(data)
82+
..hosted?._nameOfPackage = name,
83+
_ => throw StateError('There is a bug in pubspec_parse.'),
84+
};
9085
});
9186
}
9287
}

pkgs/pubspec_parse/pubspec.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: pubspec_parse
2-
version: 1.2.3
2+
version: 1.2.4-wip
33
description: >-
44
Simple package for parsing pubspec.yaml files with a type-safe API and rich
55
error reporting.
@@ -8,7 +8,7 @@ topics:
88
- dart-pub
99

1010
environment:
11-
sdk: '>=2.18.0 <3.0.0'
11+
sdk: ^3.0.0
1212

1313
dependencies:
1414
checked_yaml: ^2.0.1
@@ -20,8 +20,8 @@ dependencies:
2020
dev_dependencies:
2121
build_runner: ^2.0.3
2222
build_verify: '>=2.0.0 <4.0.0'
23+
dart_flutter_team_lints: ^1.0.0
2324
json_serializable: ^6.6.0
24-
lints: ^2.0.0
2525
path: ^1.5.1
2626
# Needed because we are configuring `combining_builder`
2727
source_gen: ^1.0.0

pkgs/pubspec_parse/test/ensure_build_test.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
@Timeout.factor(2)
66
@TestOn('vm')
77
@Tags(['presubmit-only'])
8+
library;
9+
810
import 'package:build_verify/build_verify.dart';
911
import 'package:test/test.dart';
1012

pkgs/pubspec_parse/test/parse_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
// ignore_for_file: deprecated_member_use_from_same_package
66
// ignore_for_file: lines_longer_than_80_chars
77

8-
library parse_test;
9-
108
import 'package:pub_semver/pub_semver.dart';
119
import 'package:test/test.dart';
1210

0 commit comments

Comments
 (0)