Fix broken lints, update to pkg:lints, Bump SDK constraint (dart-lang/source_span#77)
Also cleaned out changelog
diff --git a/pkgs/source_span/CHANGELOG.md b/pkgs/source_span/CHANGELOG.md
index fa4b193..90aba0b 100644
--- a/pkgs/source_span/CHANGELOG.md
+++ b/pkgs/source_span/CHANGELOG.md
@@ -1,5 +1,7 @@
# 1.8.2-dev
+- Require Dart >= 2.14.
+
# 1.8.1
* Fix a bug where the URL header for the highlights with multiple files would
@@ -9,32 +11,6 @@
* Stable release for null safety.
-# 1.8.0-nullsafety.4
-
-* Update SDK constraints to `>=2.12.0-0 <3.0.0` based on beta release
- guidelines.
-
-# 1.8.0-nullsafety.3
-
-* Remove workaround for https://github.com/dart-lang/sdk/issues/43136, which is
- now fixed.
-* Allow prerelease versions of the 2.12 sdk.
-
-# 1.8.0-nullsafety.2
-
-* Revert unnecessary null check fix (sdk fix wont land in 2.10 stable).
-* Allow 2.10 stable and 2.11 dev sdks.
-
-# 1.8.0-nullsafety.1
-
-* Fixes a newly recognized unnecessary null check to remove warnings.
-
-# 1.8.0-nullsafety
-
-* Migrate to null safety.
- * Apis have been migrated to reflect the existing assumptions in the code
- and are not expected to be breaking.
-
# 1.7.0
* Add a `SourceSpan.subspan()` extension method which returns a slice of an
diff --git a/pkgs/source_span/analysis_options.yaml b/pkgs/source_span/analysis_options.yaml
index ab5a4f2..002297f 100644
--- a/pkgs/source_span/analysis_options.yaml
+++ b/pkgs/source_span/analysis_options.yaml
@@ -1,7 +1,9 @@
-include: package:pedantic/analysis_options.yaml
+include: package:lints/recommended.yaml
+
analyzer:
strong-mode:
implicit-casts: false
+
linter:
rules:
- always_declare_return_types
diff --git a/pkgs/source_span/lib/src/file.dart b/pkgs/source_span/lib/src/file.dart
index 6fbcd41..473b8c1 100644
--- a/pkgs/source_span/lib/src/file.dart
+++ b/pkgs/source_span/lib/src/file.dart
@@ -398,9 +398,8 @@
sourceUrl == other.sourceUrl;
}
- // Eliminates dart2js warning about overriding `==`, but not `hashCode`
@override
- int get hashCode => super.hashCode;
+ int get hashCode => Object.hash(_start, _end, sourceUrl);
/// Returns a new span that covers both `this` and [other].
///
@@ -409,7 +408,7 @@
@override
FileSpan expand(FileSpan other) {
if (sourceUrl != other.sourceUrl) {
- throw ArgumentError('Source URLs \"$sourceUrl\" and '
+ throw ArgumentError('Source URLs "$sourceUrl" and '
" \"${other.sourceUrl}\" don't match.");
}
diff --git a/pkgs/source_span/lib/src/location.dart b/pkgs/source_span/lib/src/location.dart
index 0979618..634863b 100644
--- a/pkgs/source_span/lib/src/location.dart
+++ b/pkgs/source_span/lib/src/location.dart
@@ -61,7 +61,7 @@
/// This always returns a non-negative value.
int distance(SourceLocation other) {
if (sourceUrl != other.sourceUrl) {
- throw ArgumentError('Source URLs \"$sourceUrl\" and '
+ throw ArgumentError('Source URLs "$sourceUrl" and '
"\"${other.sourceUrl}\" don't match.");
}
return (offset - other.offset).abs();
@@ -76,7 +76,7 @@
@override
int compareTo(SourceLocation other) {
if (sourceUrl != other.sourceUrl) {
- throw ArgumentError('Source URLs \"$sourceUrl\" and '
+ throw ArgumentError('Source URLs "$sourceUrl" and '
"\"${other.sourceUrl}\" don't match.");
}
return offset - other.offset;
diff --git a/pkgs/source_span/lib/src/location_mixin.dart b/pkgs/source_span/lib/src/location_mixin.dart
index 9a1f930..bae38be 100644
--- a/pkgs/source_span/lib/src/location_mixin.dart
+++ b/pkgs/source_span/lib/src/location_mixin.dart
@@ -23,7 +23,7 @@
@override
int distance(SourceLocation other) {
if (sourceUrl != other.sourceUrl) {
- throw ArgumentError('Source URLs \"$sourceUrl\" and '
+ throw ArgumentError('Source URLs "$sourceUrl" and '
"\"${other.sourceUrl}\" don't match.");
}
return (offset - other.offset).abs();
@@ -35,7 +35,7 @@
@override
int compareTo(SourceLocation other) {
if (sourceUrl != other.sourceUrl) {
- throw ArgumentError('Source URLs \"$sourceUrl\" and '
+ throw ArgumentError('Source URLs "$sourceUrl" and '
"\"${other.sourceUrl}\" don't match.");
}
return offset - other.offset;
diff --git a/pkgs/source_span/lib/src/span.dart b/pkgs/source_span/lib/src/span.dart
index ba8bec7..30590ea 100644
--- a/pkgs/source_span/lib/src/span.dart
+++ b/pkgs/source_span/lib/src/span.dart
@@ -102,7 +102,7 @@
SourceSpanBase(this.start, this.end, this.text) {
if (end.sourceUrl != start.sourceUrl) {
- throw ArgumentError('Source URLs \"${start.sourceUrl}\" and '
+ throw ArgumentError('Source URLs "${start.sourceUrl}" and '
" \"${end.sourceUrl}\" don't match.");
} else if (end.offset < start.offset) {
throw ArgumentError('End $end must come after start $start.');
diff --git a/pkgs/source_span/lib/src/span_mixin.dart b/pkgs/source_span/lib/src/span_mixin.dart
index 0f751ea..4d7bab4 100644
--- a/pkgs/source_span/lib/src/span_mixin.dart
+++ b/pkgs/source_span/lib/src/span_mixin.dart
@@ -31,7 +31,7 @@
@override
SourceSpan union(SourceSpan other) {
if (sourceUrl != other.sourceUrl) {
- throw ArgumentError('Source URLs \"$sourceUrl\" and '
+ throw ArgumentError('Source URLs "$sourceUrl" and '
" \"${other.sourceUrl}\" don't match.");
}
@@ -77,7 +77,7 @@
other is SourceSpan && start == other.start && end == other.end;
@override
- int get hashCode => start.hashCode + (31 * end.hashCode);
+ int get hashCode => Object.hash(start, end);
@override
String toString() => '<$runtimeType: from $start to $end "$text">';
diff --git a/pkgs/source_span/pubspec.yaml b/pkgs/source_span/pubspec.yaml
index 3343428..08bf64b 100644
--- a/pkgs/source_span/pubspec.yaml
+++ b/pkgs/source_span/pubspec.yaml
@@ -5,7 +5,7 @@
homepage: https://github.com/dart-lang/source_span
environment:
- sdk: ">=2.12.0 <3.0.0"
+ sdk: ">=2.14.0 <3.0.0"
dependencies:
collection: ^1.15.0
@@ -13,4 +13,5 @@
term_glyph: ^1.2.0
dev_dependencies:
+ lints: ^1.0.0
test: ^1.16.0