From e6c6a0c7291aadb3ac9142de6d4ead54dfd72084 Mon Sep 17 00:00:00 2001 From: Kevin Moore Date: Tue, 9 Apr 2024 14:00:17 -0700 Subject: [PATCH] Bump lints, require Dart 3.3 --- .github/workflows/test-package.yml | 2 +- CHANGELOG.md | 2 +- lib/parser.dart | 17 +++++++++-------- lib/src/source_map_span.dart | 5 ++--- pubspec.yaml | 4 ++-- test/parser_test.dart | 3 +++ 6 files changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml index 3e522b9..ed86d8f 100644 --- a/.github/workflows/test-package.yml +++ b/.github/workflows/test-package.yml @@ -47,7 +47,7 @@ jobs: matrix: # Add macos-latest and/or windows-latest if relevant for this package. os: [ubuntu-latest] - sdk: [3.0.0, dev] + sdk: [3.3.0, dev] steps: - uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 - uses: dart-lang/setup-dart@fedb1266e91cf51be2fdb382869461a434b920a3 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5afbb6c..9c8e7b3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## 0.10.13-wip -- Require Dart 3.0 +- Require Dart 3.3 ## 0.10.12 diff --git a/lib/parser.dart b/lib/parser.dart index 701a63f..b699ac7 100644 --- a/lib/parser.dart +++ b/lib/parser.dart @@ -66,7 +66,7 @@ Mapping parseJson(Map map, if (map.containsKey('mappings') || map.containsKey('sources') || map.containsKey('names')) { - throw FormatException('map containing "sections" ' + throw const FormatException('map containing "sections" ' 'cannot contain "mappings", "sources", or "names".'); } return MultiSectionMapping.fromJson(map['sections'] as List, otherMaps, @@ -110,13 +110,13 @@ class MultiSectionMapping extends Mapping { {/*String|Uri*/ Object? mapUrl}) { for (var section in sections.cast()) { var offset = section['offset'] as Map?; - if (offset == null) throw FormatException('section missing offset'); + if (offset == null) throw const FormatException('section missing offset'); var line = offset['line'] as int?; - if (line == null) throw FormatException('offset missing line'); + if (line == null) throw const FormatException('offset missing line'); var column = offset['column'] as int?; - if (column == null) throw FormatException('offset missing column'); + if (column == null) throw const FormatException('offset missing column'); _lineStart.add(line); _columnStart.add(column); @@ -125,7 +125,8 @@ class MultiSectionMapping extends Mapping { var map = section['map'] as Map?; if (url != null && map != null) { - throw FormatException("section can't use both url and map entries"); + throw const FormatException( + "section can't use both url and map entries"); } else if (url != null) { var other = otherMaps?[url]; if (otherMaps == null || other == null) { @@ -137,11 +138,11 @@ class MultiSectionMapping extends Mapping { } else if (map != null) { _maps.add(parseJson(map, otherMaps: otherMaps, mapUrl: mapUrl)); } else { - throw FormatException('section missing url or map'); + throw const FormatException('section missing url or map'); } } if (_lineStart.isEmpty) { - throw FormatException('expected at least one section'); + throw const FormatException('expected at least one section'); } } @@ -342,7 +343,7 @@ class SingleMapping extends Mapping { urls.keys.toList(), names.keys.toList(), lines); } - SingleMapping.fromJson(Map map, {mapUrl}) + SingleMapping.fromJson(Map map, {Object? mapUrl}) : targetUrl = map['file'] as String?, urls = List.from(map['sources'] as List), names = List.from((map['names'] as List?) ?? []), diff --git a/lib/src/source_map_span.dart b/lib/src/source_map_span.dart index 8ca12b9..aad8a32 100644 --- a/lib/src/source_map_span.dart +++ b/lib/src/source_map_span.dart @@ -14,9 +14,8 @@ class SourceMapSpan extends SourceSpanBase { /// If this is `true`, [text] is the value of the identifier. final bool isIdentifier; - SourceMapSpan(SourceLocation start, SourceLocation end, String text, - {this.isIdentifier = false}) - : super(start, end, text); + SourceMapSpan(super.start, super.end, super.text, + {this.isIdentifier = false}); /// Creates a [SourceMapSpan] for an identifier with value [text] starting at /// [start]. diff --git a/pubspec.yaml b/pubspec.yaml index 4180b8d..fcc9925 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -4,12 +4,12 @@ description: A library to programmatically manipulate source map files. repository: https://github.com/dart-lang/source_maps environment: - sdk: ^3.0.0 + sdk: ^3.3.0 dependencies: source_span: ^1.8.0 dev_dependencies: - dart_flutter_team_lints: ^1.0.0 + dart_flutter_team_lints: ^2.0.0 term_glyph: ^1.2.0 test: ^1.16.0 diff --git a/test/parser_test.dart b/test/parser_test.dart index cf320b6..6cfe928 100644 --- a/test/parser_test.dart +++ b/test/parser_test.dart @@ -2,6 +2,9 @@ // 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: inference_failure_on_collection_literal +// ignore_for_file: inference_failure_on_instance_creation + import 'dart:convert'; import 'package:source_maps/source_maps.dart';