Skip to content

Commit

Permalink
add several rules to core and recommended
Browse files Browse the repository at this point in the history
  • Loading branch information
devoncarew committed Sep 19, 2023
1 parent 81100a2 commit 3ab275c
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 9 deletions.
21 changes: 14 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
## 3.0.0-wip

- Added to `core.yaml`:
- `collection_methods_unrelated_type`
- `implicit_call_tearoffs`
- `use_string_in_part_of_directives`
- Removed from `core.yaml`:
- `iterable_contains_unrelated_type`
- `list_remove_unrelated_type`
- `core`:
- added `collection_methods_unrelated_type`
- added `implicit_call_tearoffs`
- added `no_wildcard_variable_uses`
- added `secure_pubspec_urls`
- added `type_literal_in_constant_pattern`
- added `use_string_in_part_of_directives`
- removed `iterable_contains_unrelated_type`
- removed `list_remove_unrelated_type`
- `recommended`:
- added `deprecated_consistency`
- added `unnecessary_to_list_in_spreads`
- added `use_super_parameters`
- removed `prefer_equal_for_default_values`
- Add info about which lints have quick fixes to the package's readme.
- Move the list of lint rules from the readme to a separate
[rules.md](https://github.com/dart-lang/lints/blob/main/rules.md) file.
Expand Down
3 changes: 3 additions & 0 deletions lib/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ linter:
- hash_and_equals
- implicit_call_tearoffs
- no_duplicate_case_values
- no_wildcard_variable_uses
- non_constant_identifier_names
- null_check_on_nullable_type_parameter
- package_prefixed_library_names
Expand All @@ -30,6 +31,8 @@ linter:
- prefer_iterable_whereType
- prefer_typing_uninitialized_variables
- provide_deprecation_message
- secure_pubspec_urls
- type_literal_in_constant_pattern
- unnecessary_overrides
- unrelated_type_equality_checks
- use_string_in_part_of_directives
Expand Down
4 changes: 3 additions & 1 deletion lib/recommended.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ linter:
- avoid_single_cascade_in_expression_statements
- constant_identifier_names
- control_flow_in_finally
- deprecated_consistency
- empty_constructor_bodies
- empty_statements
- exhaustive_cases
Expand All @@ -37,7 +38,6 @@ linter:
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_contains
- prefer_equal_for_default_values
- prefer_final_fields
- prefer_for_elements_to_map_fromIterable
- prefer_function_declarations_over_variables
Expand All @@ -64,5 +64,7 @@ linter:
- unnecessary_string_escapes
- unnecessary_string_interpolations
- unnecessary_this
- unnecessary_to_list_in_spreads
- use_function_type_syntax_for_parameters
- use_rethrow_when_possible
- use_super_parameters
7 changes: 6 additions & 1 deletion rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
| [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. ||
| [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. ||
| [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. ||
| [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses) | Don't use wildcard parameters or variables. | |
| [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. ||
| [`null_check_on_nullable_type_parameter`](https://dart.dev/lints/null_check_on_nullable_type_parameter) | Don't use null check on a potentially nullable type parameter. ||
| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | |
Expand All @@ -29,6 +30,8 @@
| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. ||
| [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. ||
| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | |
| [`secure_pubspec_urls`](https://dart.dev/lints/secure_pubspec_urls) | Use secure urls in `pubspec.yaml`. | |
| [`type_literal_in_constant_pattern`](https://dart.dev/lints/type_literal_in_constant_pattern) | Don't use constant patterns with type literals. ||
| [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. ||
| [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | |
| [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. ||
Expand All @@ -51,6 +54,7 @@
| [`avoid_single_cascade_in_expression_statements`](https://dart.dev/lints/avoid_single_cascade_in_expression_statements) | Avoid single cascade in expression statements. ||
| [`constant_identifier_names`](https://dart.dev/lints/constant_identifier_names) | Prefer using lowerCamelCase for constant names. ||
| [`control_flow_in_finally`](https://dart.dev/lints/control_flow_in_finally) | Avoid control flow in finally blocks. | |
| [`deprecated_consistency`](https://dart.dev/lints/deprecated_consistency) | Missing deprecated annotation. | |
| [`empty_constructor_bodies`](https://dart.dev/lints/empty_constructor_bodies) | Use `;` instead of `{}` for empty constructor bodies. ||
| [`empty_statements`](https://dart.dev/lints/empty_statements) | Avoid empty statements. ||
| [`exhaustive_cases`](https://dart.dev/lints/exhaustive_cases) | Define case clauses for all constants in enum-like classes. ||
Expand All @@ -67,7 +71,6 @@
| [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. ||
| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. ||
| [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. ||
| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | |
| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. ||
| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. ||
| [`prefer_function_declarations_over_variables`](https://dart.dev/lints/prefer_function_declarations_over_variables) | Use a function declaration to bind a function to a name. ||
Expand All @@ -94,8 +97,10 @@
| [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. ||
| [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. ||
| [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. ||
| [`unnecessary_to_list_in_spreads`](https://dart.dev/lints/unnecessary_to_list_in_spreads) | Unnecessary toList() in spreads. ||
| [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. ||
| [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. ||
| [`use_super_parameters`](https://dart.dev/lints/use_super_parameters) | Use super-initializer parameters where possible. ||
<!-- recommended -->

[Fix]: https://dart.dev/tools/dart-fix
5 changes: 5 additions & 0 deletions tool/rules.json
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@
"description": "Annotate overridden members.",
"fixStatus": "hasFix"
},
{
"name": "annotate_redeclares",
"description": "Annotate redeclared members.",
"fixStatus": "hasFix"
},
{
"name": "avoid_annotating_with_dynamic",
"description": "Avoid annotating with dynamic when not required.",
Expand Down

0 comments on commit 3ab275c

Please sign in to comment.