Skip to content

Commit a9396b0

Browse files
authored
Update to latest lints, Require Dart 3.2 (dart-archive/package_config#145)
1 parent 2019cfa commit a9396b0

15 files changed

+42
-60
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
sdk: [3.0.0, dev]
50+
sdk: [3.2, dev]
5151
steps:
5252
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
5353
- uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d

pkgs/package_config/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## 2.1.1-wip
22

3-
- Require Dart 3.0
3+
- Require Dart 3.2
44

55
## 2.1.0
66

pkgs/package_config/lib/package_config.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Future<PackageConfig> loadPackageConfigUri(Uri file,
102102
/// then the parent directories are checked recursively,
103103
/// all the way to the root directory, to check if those contains
104104
/// a package configuration.
105-
/// If [recurse] is set to [false], this parent directory check is not
105+
/// If [recurse] is set to `false`, this parent directory check is not
106106
/// performed.
107107
///
108108
/// If [onError] is provided, the configuration file parsing will report errors
@@ -140,7 +140,7 @@ Future<PackageConfig?> findPackageConfig(Directory directory,
140140
/// then the parent directories are checked recursively,
141141
/// all the way to the root directory, to check if those contains
142142
/// a package configuration.
143-
/// If [recurse] is set to [false], this parent directory check is not
143+
/// If [recurse] is set to `false`, this parent directory check is not
144144
/// performed.
145145
///
146146
/// If [loader] is provided, URIs are loaded using that function.

pkgs/package_config/lib/src/errors.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,18 @@ abstract class PackageConfigError {
1212

1313
class PackageConfigArgumentError extends ArgumentError
1414
implements PackageConfigError {
15-
PackageConfigArgumentError(Object? value, String name, String message)
16-
: super.value(value, name, message);
15+
PackageConfigArgumentError(
16+
Object? super.value, String super.name, String super.message)
17+
: super.value();
1718

1819
PackageConfigArgumentError.from(ArgumentError error)
1920
: super.value(error.invalidValue, error.name, error.message);
2021
}
2122

2223
class PackageConfigFormatException extends FormatException
2324
implements PackageConfigError {
24-
PackageConfigFormatException(String message, Object? source, [int? offset])
25-
: super(message, source, offset);
25+
PackageConfigFormatException(super.message, Object? super.source,
26+
[super.offset]);
2627

2728
PackageConfigFormatException.from(FormatException exception)
2829
: super(exception.message, exception.source, exception.offset);

pkgs/package_config/lib/src/package_config.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ abstract class PackageConfig {
3232
/// absolute directory URIs, valid language version, if any),
3333
/// and there must not be two packages with the same name.
3434
///
35-
/// The package's root ([Package.rootUri]) and package-root
35+
/// The package's root ([Package.root]) and package-root
3636
/// ([Package.packageUriRoot]) paths must satisfy a number of constraints
3737
/// We say that one path (which we know ends with a `/` charater)
3838
/// is inside another path, if the latter path is a prefix of the former path,
@@ -95,7 +95,7 @@ abstract class PackageConfig {
9595

9696
/// Parses the JSON data of a package configuration file.
9797
///
98-
/// The [configuration] must be a JSON-like Dart data structure,
98+
/// The [jsonData] must be a JSON-like Dart data structure,
9999
/// like the one provided by parsing JSON text using `dart:convert`,
100100
/// containing a valid package configuration.
101101
///
@@ -167,7 +167,7 @@ abstract class PackageConfig {
167167
/// Provides the associated package for a specific [file] (or directory).
168168
///
169169
/// Returns a [Package] which contains the [file]'s path, if any.
170-
/// That is, the [Package.rootUri] directory is a parent directory
170+
/// That is, the [Package.root] directory is a parent directory
171171
/// of the [file]'s location.
172172
///
173173
/// Returns `null` if the file does not belong to any package.
@@ -247,7 +247,7 @@ abstract class Package {
247247
/// Is always an absolute URI with no query or fragment parts,
248248
/// and with a path ending in `/`.
249249
///
250-
/// All files in the [rootUri] directory are considered
250+
/// All files in the [root] directory are considered
251251
/// part of the package for purposes where that that matters.
252252
Uri get root;
253253

pkgs/package_config/lib/src/package_config_impl.dart

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,6 @@ class SimplePackageConfig implements PackageConfig {
141141
@override
142142
Package? operator [](String packageName) => _packages[packageName];
143143

144-
/// Provides the associated package for a specific [file] (or directory).
145-
///
146-
/// Returns a [Package] which contains the [file]'s path.
147-
/// That is, the [Package.rootUri] directory is a parent directory
148-
/// of the [file]'s location.
149-
/// Returns `null` if the file does not belong to any package.
150144
@override
151145
Package? packageOf(Uri file) => _packageTree.packageOf(file);
152146

@@ -270,7 +264,7 @@ class SimplePackage implements Package {
270264
}
271265
}
272266

273-
/// Checks whether [version] is a valid Dart language version string.
267+
/// Checks whether [source] is a valid Dart language version string.
274268
///
275269
/// The format is (as RegExp) `^(0|[1-9]\d+)\.(0|[1-9]\d+)$`.
276270
///
@@ -553,9 +547,8 @@ enum ConflictType { sameRoots, interleaving, insidePackageRoot }
553547
/// Conflict between packages added to the same configuration.
554548
///
555549
/// The [package] conflicts with [existingPackage] if it has
556-
/// the same root path ([isRootConflict]) or the package URI root path
557-
/// of [existingPackage] is inside the root path of [package]
558-
/// ([isPackageRootConflict]).
550+
/// the same root path or the package URI root path
551+
/// of [existingPackage] is inside the root path of [package].
559552
class ConflictException {
560553
/// The existing package that [package] conflicts with.
561554
final SimplePackage existingPackage;

pkgs/package_config/lib/src/package_config_io.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const packagesFileName = '.packages';
3838
/// If the [file] is a `.packages` file and [preferNewest] is true,
3939
/// first checks whether there is an adjacent `.dart_tool/package_config.json`
4040
/// file, and if so, reads that instead.
41-
/// If [preferNewset] is false, the specified file is loaded even if it is
41+
/// If [preferNewest] is false, the specified file is loaded even if it is
4242
/// a `.packages` file and there is an available `package_config.json` file.
4343
///
4444
/// The file must exist and be a normal file.

pkgs/package_config/lib/src/package_config_json.dart

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,8 @@ PackageConfig parsePackageConfigString(
7575
/// where the integer numeral cannot have a sign, and can only have a
7676
/// leading zero if the entire numeral is a single zero.
7777
///
78-
/// All other properties are stored in [extraData].
79-
///
8078
/// The [baseLocation] is used as base URI to resolve the "rootUri"
81-
/// URI referencestring.
79+
/// URI reference string.
8280
PackageConfig parsePackageConfigJson(
8381
Object? json, Uri baseLocation, void Function(Object error) onError) {
8482
if (!baseLocation.hasScheme || baseLocation.isScheme('package')) {
@@ -93,7 +91,7 @@ PackageConfig parsePackageConfigJson(
9391
String typeName<T>() {
9492
if (0 is T) return 'int';
9593
if ('' is T) return 'string';
96-
if (const [] is T) return 'array';
94+
if (const <Object?>[] is T) return 'array';
9795
return 'object';
9896
}
9997

@@ -239,7 +237,7 @@ void writePackageConfigJsonString(
239237
PackageConfig config, Uri? baseUri, StringSink output) {
240238
// Can be optimized.
241239
var data = packageConfigToJson(config, baseUri);
242-
output.write(JsonEncoder.withIndent(' ').convert(data));
240+
output.write(const JsonEncoder.withIndent(' ').convert(data));
243241
}
244242

245243
Map<String, Object?> packageConfigToJson(PackageConfig config, Uri? baseUri) =>

pkgs/package_config/lib/src/packages_file.dart

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,6 @@ PackageConfig parse(
148148
///
149149
/// If [baseUri] is provided, package locations will be made relative
150150
/// to the base URI, if possible, before writing.
151-
///
152-
/// If [allowDefaultPackage] is `true`, the [packageMapping] may contain an
153-
/// empty string mapping to the _default package name_.
154-
///
155-
/// All the keys of [packageMapping] must be valid package names,
156-
/// and the values must be URIs that do not have the `package:` scheme.
157151
void write(StringSink output, PackageConfig config,
158152
{Uri? baseUri, String? comment}) {
159153
if (baseUri != null && !baseUri.isAbsolute) {

pkgs/package_config/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ description: Support for reading and writing Dart Package Configuration files.
44
repository: https://github.com/dart-lang/package_config
55

66
environment:
7-
sdk: ^3.0.0
7+
sdk: ^3.2.0
88

99
dependencies:
1010
path: ^1.8.0
@@ -13,5 +13,5 @@ dev_dependencies:
1313
build_runner: ^2.0.0
1414
build_test: ^2.1.2
1515
build_web_compilers: ^4.0.0
16-
dart_flutter_team_lints: ^1.0.0
16+
dart_flutter_team_lints: ^2.0.0
1717
test: ^1.16.0

0 commit comments

Comments
 (0)