Skip to content

Commit dcbb21f

Browse files
authored
Update minimum SDK, latest pkg:lints, update CI actions (dart-archive/string_scanner#48)
1 parent aa3ac44 commit dcbb21f

File tree

9 files changed

+33
-54
lines changed

9 files changed

+33
-54
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ jobs:
2222
matrix:
2323
sdk: [dev]
2424
steps:
25-
- uses: actions/checkout@v3
26-
- uses: dart-lang/setup-dart@v1
25+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
26+
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
2727
with:
2828
sdk: ${{ matrix.sdk }}
2929
- id: install
@@ -47,10 +47,10 @@ jobs:
4747
matrix:
4848
# Add macos-latest and/or windows-latest if relevant for this package.
4949
os: [ubuntu-latest]
50-
sdk: [2.12.0, dev]
50+
sdk: [2.18.0, dev]
5151
steps:
52-
- uses: actions/checkout@v3
53-
- uses: dart-lang/setup-dart@v1
52+
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
53+
- uses: dart-lang/setup-dart@6a218f2413a3e78e9087f638a238f6b40893203d
5454
with:
5555
sdk: ${{ matrix.sdk }}
5656
- id: install

pkgs/string_scanner/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
## 1.2.0
22

3+
* Require Dart 2.18.0
4+
35
* Add better support for reading code points in the Unicode supplementary plane:
46

57
* Added `StringScanner.readCodePoint()`, which consumes an entire Unicode code
Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,55 @@
1+
# https://dart.dev/guides/language/analysis-options
12
include: package:lints/recommended.yaml
23

34
analyzer:
4-
strong-mode:
5-
implicit-casts: false
5+
language:
6+
strict-casts: true
7+
strict-inference: true
8+
strict-raw-types: true
69

710
linter:
811
rules:
12+
- always_declare_return_types
913
- avoid_bool_literals_in_conditional_expressions
1014
- avoid_catching_errors
1115
- avoid_classes_with_only_static_members
12-
- avoid_function_literals_in_foreach_calls
16+
- avoid_dynamic_calls
1317
- avoid_private_typedef_functions
1418
- avoid_redundant_argument_values
15-
- avoid_renaming_method_parameters
1619
- avoid_returning_null_for_future
17-
- avoid_returning_null_for_void
1820
- avoid_returning_this
19-
- avoid_single_cascade_in_expression_statements
2021
- avoid_unused_constructor_parameters
2122
- avoid_void_async
22-
- await_only_futures
23-
- camel_case_types
2423
- cancel_subscriptions
2524
- comment_references
26-
- constant_identifier_names
27-
- control_flow_in_finally
2825
- directives_ordering
29-
- empty_statements
30-
- file_names
31-
- hash_and_equals
32-
- implementation_imports
33-
- iterable_contains_unrelated_type
3426
- join_return_with_assignment
3527
- lines_longer_than_80_chars
36-
- list_remove_unrelated_type
3728
- literal_only_boolean_expressions
3829
- missing_whitespace_between_adjacent_strings
3930
- no_adjacent_strings_in_list
4031
- no_runtimeType_toString
41-
- non_constant_identifier_names
32+
- omit_local_variable_types
4233
- only_throw_errors
43-
- overridden_fields
4434
- package_api_docs
45-
- package_names
46-
- package_prefixed_library_names
4735
- prefer_asserts_in_initializer_lists
4836
- prefer_const_constructors
4937
- prefer_const_declarations
5038
- prefer_expression_function_bodies
5139
- prefer_final_locals
52-
- prefer_function_declarations_over_variables
53-
- prefer_initializing_formals
54-
- prefer_inlined_adds
55-
- prefer_interpolation_to_compose_strings
56-
- prefer_is_not_operator
57-
- prefer_null_aware_operators
5840
- prefer_relative_imports
59-
- prefer_typing_uninitialized_variables
60-
- prefer_void_to_null
61-
- provide_deprecation_message
41+
- prefer_single_quotes
6242
- sort_pub_dependencies
6343
- test_types_in_equals
6444
- throw_in_finally
45+
- type_annotate_public_apis
46+
- unawaited_futures
6547
- unnecessary_await_in_return
66-
- unnecessary_brace_in_string_interps
67-
- unnecessary_getters_setters
6848
- unnecessary_lambdas
69-
- unnecessary_null_aware_assignments
70-
- unnecessary_overrides
7149
- unnecessary_parenthesis
50+
- unnecessary_raw_strings
7251
- unnecessary_statements
73-
- unnecessary_string_interpolations
52+
- use_if_null_to_convert_nulls_to_bools
53+
- use_raw_strings
7454
- use_string_buffers
75-
- void_checks
55+
- use_super_parameters

pkgs/string_scanner/lib/src/eager_span_scanner.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ class EagerSpanScanner extends SpanScanner {
6868
}
6969
}
7070

71-
EagerSpanScanner(String string, {sourceUrl, int? position})
72-
: super(string, sourceUrl: sourceUrl, position: position);
71+
EagerSpanScanner(super.string, {super.sourceUrl, super.position});
7372

7473
@override
7574
bool scanChar(int character) {

pkgs/string_scanner/lib/src/exception.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ class StringScannerException extends SourceSpanFormatException {
1616
/// This may be `null`, indicating that the source URL is unknown.
1717
Uri? get sourceUrl => span?.sourceUrl;
1818

19-
StringScannerException(String message, SourceSpan span, String source)
20-
: super(message, span, source);
19+
StringScannerException(
20+
super.message, SourceSpan super.span, String super.source);
2121
}

pkgs/string_scanner/lib/src/line_scanner.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,7 @@ class LineScanner extends StringScanner {
7373
}
7474
}
7575

76-
LineScanner(String string, {sourceUrl, int? position})
77-
: super(string, sourceUrl: sourceUrl, position: position);
76+
LineScanner(super.string, {super.sourceUrl, super.position});
7877

7978
@override
8079
bool scanChar(int character) {

pkgs/string_scanner/lib/src/span_scanner.dart

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,13 +59,12 @@ class SpanScanner extends StringScanner implements LineScanner {
5959
/// [sourceUrl] is used as [SourceLocation.sourceUrl] for the returned
6060
/// [FileSpan]s as well as for error reporting. It can be a [String], a
6161
/// [Uri], or `null`.
62-
SpanScanner(String string, {sourceUrl, int? position})
63-
: _sourceFile = SourceFile.fromString(string, url: sourceUrl),
64-
super(string, sourceUrl: sourceUrl, position: position);
62+
SpanScanner(super.string, {super.sourceUrl, super.position})
63+
: _sourceFile = SourceFile.fromString(string, url: sourceUrl);
6564

6665
/// Creates a new [SpanScanner] that eagerly computes line and column numbers.
6766
///
68-
/// In general [new SpanScanner] will be more efficient, since it avoids extra
67+
/// In general [SpanScanner.new] will be more efficient, since it avoids extra
6968
/// computation on every scan. However, eager scanning can be useful for
7069
/// situations where the normal course of parsing frequently involves
7170
/// accessing the current line and column numbers.

pkgs/string_scanner/lib/src/string_scanner.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ class StringScanner {
5656
/// [position] defaults to 0, the beginning of the string. [sourceUrl] is the
5757
/// URL of the source of the string being scanned, if available. It can be
5858
/// a [String], a [Uri], or `null`.
59-
StringScanner(this.string, {sourceUrl, int? position})
59+
StringScanner(this.string, {Object? sourceUrl, int? position})
6060
: sourceUrl = sourceUrl == null
6161
? null
6262
: sourceUrl is String
@@ -205,7 +205,7 @@ class StringScanner {
205205
name = '/$source/';
206206
} else {
207207
name =
208-
pattern.toString().replaceAll('\\', '\\\\').replaceAll('"', '\\"');
208+
pattern.toString().replaceAll(r'\', r'\\').replaceAll('"', r'\"');
209209
name = '"$name"';
210210
}
211211
}

pkgs/string_scanner/pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ description: A class for parsing strings using a sequence of patterns.
44
repository: https://github.com/dart-lang/string_scanner
55

66
environment:
7-
sdk: ">=2.12.0 <3.0.0"
7+
sdk: ">=2.18.0 <3.0.0"
88

99
dependencies:
1010
source_span: ^1.8.0
1111

1212
dev_dependencies:
13-
lints: ^1.0.0
13+
lints: ^2.0.0
1414
test: ^1.16.0

0 commit comments

Comments
 (0)