Update minimum SDK, latest pkg:lints, update CI actions (#48)
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 9bf6845..bc43599 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -22,8 +22,8 @@
matrix:
sdk: [dev]
steps:
- - uses: actions/checkout@v3
- - uses: dart-lang/setup-dart@v1
+ - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: ${{ matrix.sdk }}
- id: install
@@ -47,10 +47,10 @@
matrix:
# Add macos-latest and/or windows-latest if relevant for this package.
os: [ubuntu-latest]
- sdk: [2.12.0, dev]
+ sdk: [2.18.0, dev]
steps:
- - uses: actions/checkout@v3
- - uses: dart-lang/setup-dart@v1
+ - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
+ - uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
with:
sdk: ${{ matrix.sdk }}
- id: install
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5963ce8..b5346b0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,7 @@
## 1.2.0
+* Require Dart 2.18.0
+
* Add better support for reading code points in the Unicode supplementary plane:
* Added `StringScanner.readCodePoint()`, which consumes an entire Unicode code
diff --git a/analysis_options.yaml b/analysis_options.yaml
index a4495f2..b507c06 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,75 +1,55 @@
+# https://dart.dev/guides/language/analysis-options
include: package:lints/recommended.yaml
analyzer:
- strong-mode:
- implicit-casts: false
+ language:
+ strict-casts: true
+ strict-inference: true
+ strict-raw-types: true
linter:
rules:
+ - always_declare_return_types
- avoid_bool_literals_in_conditional_expressions
- avoid_catching_errors
- avoid_classes_with_only_static_members
- - avoid_function_literals_in_foreach_calls
+ - avoid_dynamic_calls
- avoid_private_typedef_functions
- avoid_redundant_argument_values
- - avoid_renaming_method_parameters
- avoid_returning_null_for_future
- - avoid_returning_null_for_void
- avoid_returning_this
- - avoid_single_cascade_in_expression_statements
- avoid_unused_constructor_parameters
- avoid_void_async
- - await_only_futures
- - camel_case_types
- cancel_subscriptions
- comment_references
- - constant_identifier_names
- - control_flow_in_finally
- directives_ordering
- - empty_statements
- - file_names
- - hash_and_equals
- - implementation_imports
- - iterable_contains_unrelated_type
- join_return_with_assignment
- lines_longer_than_80_chars
- - list_remove_unrelated_type
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- - non_constant_identifier_names
+ - omit_local_variable_types
- only_throw_errors
- - overridden_fields
- package_api_docs
- - package_names
- - package_prefixed_library_names
- prefer_asserts_in_initializer_lists
- prefer_const_constructors
- prefer_const_declarations
- prefer_expression_function_bodies
- prefer_final_locals
- - prefer_function_declarations_over_variables
- - prefer_initializing_formals
- - prefer_inlined_adds
- - prefer_interpolation_to_compose_strings
- - prefer_is_not_operator
- - prefer_null_aware_operators
- prefer_relative_imports
- - prefer_typing_uninitialized_variables
- - prefer_void_to_null
- - provide_deprecation_message
+ - prefer_single_quotes
- sort_pub_dependencies
- test_types_in_equals
- throw_in_finally
+ - type_annotate_public_apis
+ - unawaited_futures
- unnecessary_await_in_return
- - unnecessary_brace_in_string_interps
- - unnecessary_getters_setters
- unnecessary_lambdas
- - unnecessary_null_aware_assignments
- - unnecessary_overrides
- unnecessary_parenthesis
+ - unnecessary_raw_strings
- unnecessary_statements
- - unnecessary_string_interpolations
+ - use_if_null_to_convert_nulls_to_bools
+ - use_raw_strings
- use_string_buffers
- - void_checks
+ - use_super_parameters
diff --git a/lib/src/eager_span_scanner.dart b/lib/src/eager_span_scanner.dart
index 3bf5416..db06127 100644
--- a/lib/src/eager_span_scanner.dart
+++ b/lib/src/eager_span_scanner.dart
@@ -68,8 +68,7 @@
}
}
- EagerSpanScanner(String string, {sourceUrl, int? position})
- : super(string, sourceUrl: sourceUrl, position: position);
+ EagerSpanScanner(super.string, {super.sourceUrl, super.position});
@override
bool scanChar(int character) {
diff --git a/lib/src/exception.dart b/lib/src/exception.dart
index 8aa7aab..57af541 100644
--- a/lib/src/exception.dart
+++ b/lib/src/exception.dart
@@ -16,6 +16,6 @@
/// This may be `null`, indicating that the source URL is unknown.
Uri? get sourceUrl => span?.sourceUrl;
- StringScannerException(String message, SourceSpan span, String source)
- : super(message, span, source);
+ StringScannerException(
+ super.message, SourceSpan super.span, String super.source);
}
diff --git a/lib/src/line_scanner.dart b/lib/src/line_scanner.dart
index 4f0673c..5bf701c 100644
--- a/lib/src/line_scanner.dart
+++ b/lib/src/line_scanner.dart
@@ -73,8 +73,7 @@
}
}
- LineScanner(String string, {sourceUrl, int? position})
- : super(string, sourceUrl: sourceUrl, position: position);
+ LineScanner(super.string, {super.sourceUrl, super.position});
@override
bool scanChar(int character) {
diff --git a/lib/src/span_scanner.dart b/lib/src/span_scanner.dart
index 806a8f8..413a433 100644
--- a/lib/src/span_scanner.dart
+++ b/lib/src/span_scanner.dart
@@ -59,13 +59,12 @@
/// [sourceUrl] is used as [SourceLocation.sourceUrl] for the returned
/// [FileSpan]s as well as for error reporting. It can be a [String], a
/// [Uri], or `null`.
- SpanScanner(String string, {sourceUrl, int? position})
- : _sourceFile = SourceFile.fromString(string, url: sourceUrl),
- super(string, sourceUrl: sourceUrl, position: position);
+ SpanScanner(super.string, {super.sourceUrl, super.position})
+ : _sourceFile = SourceFile.fromString(string, url: sourceUrl);
/// Creates a new [SpanScanner] that eagerly computes line and column numbers.
///
- /// In general [new SpanScanner] will be more efficient, since it avoids extra
+ /// In general [SpanScanner.new] will be more efficient, since it avoids extra
/// computation on every scan. However, eager scanning can be useful for
/// situations where the normal course of parsing frequently involves
/// accessing the current line and column numbers.
diff --git a/lib/src/string_scanner.dart b/lib/src/string_scanner.dart
index de566a5..1466944 100644
--- a/lib/src/string_scanner.dart
+++ b/lib/src/string_scanner.dart
@@ -56,7 +56,7 @@
/// [position] defaults to 0, the beginning of the string. [sourceUrl] is the
/// URL of the source of the string being scanned, if available. It can be
/// a [String], a [Uri], or `null`.
- StringScanner(this.string, {sourceUrl, int? position})
+ StringScanner(this.string, {Object? sourceUrl, int? position})
: sourceUrl = sourceUrl == null
? null
: sourceUrl is String
@@ -205,7 +205,7 @@
name = '/$source/';
} else {
name =
- pattern.toString().replaceAll('\\', '\\\\').replaceAll('"', '\\"');
+ pattern.toString().replaceAll(r'\', r'\\').replaceAll('"', r'\"');
name = '"$name"';
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index c38f3bf..6f14e81 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -4,11 +4,11 @@
repository: https://github.com/dart-lang/string_scanner
environment:
- sdk: ">=2.12.0 <3.0.0"
+ sdk: ">=2.18.0 <3.0.0"
dependencies:
source_span: ^1.8.0
dev_dependencies:
- lints: ^1.0.0
+ lints: ^2.0.0
test: ^1.16.0