switch to using package:dart_flutter_team_lints (#247)
* switch to using package:dart_flutter_team_lints
* address example lints
* require dart 2.19
* update action config
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index e8b2448..65703b1 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -47,7 +47,7 @@
# Add macos-latest and/or windows-latest if relevant for this package
os: [ubuntu-latest]
# Add stable if the package should also be tested on stable
- sdk: [2.18.0, dev]
+ sdk: [2.19.0, dev]
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
- uses: dart-lang/setup-dart@d6a63dab3335f427404425de0fbfed4686d93c4f
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 16515ba..f8374ed 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,6 +3,7 @@
* Change the validation of `mandatory` options; they now perform validation when
the value is retrieved (from the `ArgResults` object), instead of when the
args are parsed.
+* Require Dart 2.19.
## 2.4.1
diff --git a/analysis_options.yaml b/analysis_options.yaml
index a9dbdb5..424f0d3 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,27 +1,18 @@
# https://dart.dev/guides/language/analysis-options
-include: package:lints/recommended.yaml
+
+include: package:dart_flutter_team_lints/analysis_options.yaml
linter:
rules:
- - always_declare_return_types
- - avoid_dynamic_calls
- avoid_unused_constructor_parameters
- cancel_subscriptions
- comment_references
- - directives_ordering
- - lines_longer_than_80_chars
- literal_only_boolean_expressions
- missing_whitespace_between_adjacent_strings
- no_adjacent_strings_in_list
- no_runtimeType_toString
- - omit_local_variable_types
- package_api_docs
- prefer_relative_imports
- - prefer_single_quotes
- test_types_in_equals
- - throw_in_finally
- - type_annotate_public_apis
- - unawaited_futures
- unnecessary_await_in_return
- - unnecessary_lambdas
- use_super_parameters
diff --git a/example/command_runner/draw.dart b/example/command_runner/draw.dart
index 3f0baec..35a3601 100644
--- a/example/command_runner/draw.dart
+++ b/example/command_runner/draw.dart
@@ -33,7 +33,7 @@
@override
FutureOr<String>? run() {
- final size = int.parse(argResults?['size'] ?? '20');
+ final size = int.parse(argResults?['size'] as String? ?? '20');
final char = (globalResults?['char'] as String?)?[0] ?? '#';
return draw(size, size, char, (x, y) => true);
}
@@ -55,7 +55,7 @@
@override
FutureOr<String>? run() {
- final size = 2 * int.parse(argResults?['radius'] ?? '10');
+ final size = 2 * int.parse(argResults?['radius'] as String? ?? '10');
final char = (globalResults?['char'] as String?)?[0] ?? '#';
return draw(size, size, char, (x, y) => x * x + y * y < 1);
}
@@ -93,7 +93,7 @@
@override
FutureOr<String>? run() {
- final size = int.parse(argResults?['size'] ?? '20');
+ final size = int.parse(argResults?['size'] as String? ?? '20');
final char = (globalResults?['char'] as String?)?[0] ?? '#';
return drawTriangle(size, size * sqrt(3) ~/ 2, char);
}
@@ -116,8 +116,8 @@
@override
FutureOr<String>? run() {
- final width = int.parse(argResults?['width'] ?? '50');
- final height = int.parse(argResults?['height'] ?? '10');
+ final width = int.parse(argResults?['width'] as String? ?? '50');
+ final height = int.parse(argResults?['height'] as String? ?? '10');
final char = (globalResults?['char'] as String?)?[0] ?? '#';
return drawTriangle(width, height, char);
}
diff --git a/lib/command_runner.dart b/lib/command_runner.dart
index 183264d..1845160 100644
--- a/lib/command_runner.dart
+++ b/lib/command_runner.dart
@@ -192,13 +192,13 @@
commands = command._subcommands as Map<String, Command<T>>;
commandString += ' ${argResults.name}';
- if (argResults.options.contains('help') && argResults['help']) {
+ if (argResults.options.contains('help') && (argResults['help'] as bool)) {
command.printUsage();
return null;
}
}
- if (topLevelResults['help']) {
+ if (topLevelResults['help'] as bool) {
command!.printUsage();
return null;
}
diff --git a/pubspec.yaml b/pubspec.yaml
index dec55a9..3166e1d 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -9,8 +9,8 @@
- cli
environment:
- sdk: '>=2.18.0 <3.0.0'
+ sdk: '>=2.19.0 <4.0.0'
dev_dependencies:
- lints: ^2.0.0
+ dart_flutter_team_lints: ^1.0.0
test: ^1.16.0
diff --git a/test/command_runner_test.dart b/test/command_runner_test.dart
index 9031dd1..cc80c6b 100644
--- a/test/command_runner_test.dart
+++ b/test/command_runner_test.dart
@@ -755,5 +755,5 @@
String get name => 'mandatory-option-command';
@override
- String run() => argResults!['mandatory-option'];
+ String run() => argResults!['mandatory-option'] as String;
}