Disable prefer_collection_literals, because Dart 2.2 Set (dart-lang/pubspec_parse#40)
Enable and fix a few more
diff --git a/pkgs/pubspec_parse/analysis_options.yaml b/pkgs/pubspec_parse/analysis_options.yaml
index b959116..4f0a48b 100644
--- a/pkgs/pubspec_parse/analysis_options.yaml
+++ b/pkgs/pubspec_parse/analysis_options.yaml
@@ -12,6 +12,8 @@
rules:
- always_declare_return_types
- annotate_overrides
+ - avoid_bool_literals_in_conditional_expressions
+ - avoid_classes_with_only_static_members
- avoid_empty_else
- avoid_function_literals_in_foreach_calls
- avoid_init_to_null
@@ -21,12 +23,16 @@
- avoid_return_types_on_setters
- avoid_returning_null
- avoid_returning_null_for_future
+ - avoid_returning_null_for_void
+ - avoid_returning_this
- avoid_shadowing_type_parameters
+ - avoid_single_cascade_in_expression_statements
- avoid_types_as_parameter_names
- avoid_unused_constructor_parameters
- await_only_futures
- camel_case_types
- cancel_subscriptions
+ - cascade_invocations
- comment_references
- constant_identifier_names
- control_flow_in_finally
@@ -34,10 +40,12 @@
- empty_catches
- empty_constructor_bodies
- empty_statements
+ - file_names
- hash_and_equals
- implementation_imports
- invariant_booleans
- iterable_contains_unrelated_type
+ - join_return_with_assignment
- library_names
- library_prefixes
- list_remove_unrelated_type
@@ -53,7 +61,8 @@
- package_names
- package_prefixed_library_names
- prefer_adjacent_string_concatenation
- - prefer_collection_literals
+ # TODO: reenable this once we want to pin the SDK to >=2.2.0
+ # - prefer_collection_literals
- prefer_conditional_assignment
- prefer_const_constructors
- prefer_contains
@@ -64,11 +73,11 @@
- prefer_interpolation_to_compose_strings
- prefer_is_empty
- prefer_is_not_empty
+ - prefer_null_aware_operators
- prefer_single_quotes
- prefer_typing_uninitialized_variables
- recursive_getters
- slash_for_doc_comments
- - super_goes_last
- test_types_in_equals
- throw_in_finally
- type_init_formals
@@ -87,3 +96,4 @@
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- valid_regexps
+ - void_checks
diff --git a/pkgs/pubspec_parse/lib/src/pubspec.dart b/pkgs/pubspec_parse/lib/src/pubspec.dart
index 4052a70..c05e824 100644
--- a/pkgs/pubspec_parse/lib/src/pubspec.dart
+++ b/pkgs/pubspec_parse/lib/src/pubspec.dart
@@ -126,8 +126,7 @@
return _$PubspecFromJson(json);
} on CheckedFromJsonException catch (e) {
if (e.map == json && json.containsKey(e.key)) {
- json = Map.from(json);
- json.remove(e.key);
+ json = Map.from(json)..remove(e.key);
continue;
}
rethrow;