Skip to content

Commit dd94f2c

Browse files
authored
add several rules to core and recommended (dart-archive/lints#150)
* add several rules to core and recommended * remove `deprecated_consistency`
1 parent e8ce542 commit dd94f2c

File tree

5 files changed

+28
-9
lines changed

5 files changed

+28
-9
lines changed

pkgs/lints/CHANGELOG.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
## 3.0.0-wip
22

3-
- Added to `core.yaml`:
4-
- `collection_methods_unrelated_type`
5-
- `implicit_call_tearoffs`
6-
- `use_string_in_part_of_directives`
7-
- Removed from `core.yaml`:
8-
- `iterable_contains_unrelated_type`
9-
- `list_remove_unrelated_type`
3+
- `core`:
4+
- added `collection_methods_unrelated_type`
5+
- added `implicit_call_tearoffs`
6+
- added `no_wildcard_variable_uses`
7+
- added `secure_pubspec_urls`
8+
- added `type_literal_in_constant_pattern`
9+
- added `use_string_in_part_of_directives`
10+
- removed `iterable_contains_unrelated_type`
11+
- removed `list_remove_unrelated_type`
12+
- `recommended`:
13+
- added `unnecessary_to_list_in_spreads`
14+
- added `use_super_parameters`
15+
- removed `prefer_equal_for_default_values`
1016
- Add info about which lints have quick fixes to the package's readme.
1117
- Move the list of lint rules from the readme to a separate
1218
[rules.md](https://github.com/dart-lang/lints/blob/main/rules.md) file.

pkgs/lints/lib/core.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ linter:
2121
- hash_and_equals
2222
- implicit_call_tearoffs
2323
- no_duplicate_case_values
24+
- no_wildcard_variable_uses
2425
- non_constant_identifier_names
2526
- null_check_on_nullable_type_parameter
2627
- package_prefixed_library_names
@@ -30,6 +31,8 @@ linter:
3031
- prefer_iterable_whereType
3132
- prefer_typing_uninitialized_variables
3233
- provide_deprecation_message
34+
- secure_pubspec_urls
35+
- type_literal_in_constant_pattern
3336
- unnecessary_overrides
3437
- unrelated_type_equality_checks
3538
- use_string_in_part_of_directives

pkgs/lints/lib/recommended.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ linter:
3737
- prefer_collection_literals
3838
- prefer_conditional_assignment
3939
- prefer_contains
40-
- prefer_equal_for_default_values
4140
- prefer_final_fields
4241
- prefer_for_elements_to_map_fromIterable
4342
- prefer_function_declarations_over_variables
@@ -64,5 +63,7 @@ linter:
6463
- unnecessary_string_escapes
6564
- unnecessary_string_interpolations
6665
- unnecessary_this
66+
- unnecessary_to_list_in_spreads
6767
- use_function_type_syntax_for_parameters
6868
- use_rethrow_when_possible
69+
- use_super_parameters

pkgs/lints/rules.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
| [`hash_and_equals`](https://dart.dev/lints/hash_and_equals) | Always override `hashCode` if overriding `==`. ||
2121
| [`implicit_call_tearoffs`](https://dart.dev/lints/implicit_call_tearoffs) | Explicitly tear-off `call` methods when using an object as a Function. ||
2222
| [`no_duplicate_case_values`](https://dart.dev/lints/no_duplicate_case_values) | Don't use more than one case with same value. ||
23+
| [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses) | Don't use wildcard parameters or variables. | |
2324
| [`non_constant_identifier_names`](https://dart.dev/lints/non_constant_identifier_names) | Name non-constant identifiers using lowerCamelCase. ||
2425
| [`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. ||
2526
| [`package_prefixed_library_names`](https://dart.dev/lints/package_prefixed_library_names) | Prefix library names with the package name and a dot-separated path. | |
@@ -29,6 +30,8 @@
2930
| [`prefer_iterable_whereType`](https://dart.dev/lints/prefer_iterable_whereType) | Prefer to use whereType on iterable. ||
3031
| [`prefer_typing_uninitialized_variables`](https://dart.dev/lints/prefer_typing_uninitialized_variables) | Prefer typing uninitialized variables and fields. ||
3132
| [`provide_deprecation_message`](https://dart.dev/lints/provide_deprecation_message) | Provide a deprecation message, via @Deprecated("message"). | |
33+
| [`secure_pubspec_urls`](https://dart.dev/lints/secure_pubspec_urls) | Use secure urls in `pubspec.yaml`. | |
34+
| [`type_literal_in_constant_pattern`](https://dart.dev/lints/type_literal_in_constant_pattern) | Don't use constant patterns with type literals. ||
3235
| [`unnecessary_overrides`](https://dart.dev/lints/unnecessary_overrides) | Don't override a method to do a super method invocation with the same parameters. ||
3336
| [`unrelated_type_equality_checks`](https://dart.dev/lints/unrelated_type_equality_checks) | Equality operator `==` invocation with references of unrelated types. | |
3437
| [`use_string_in_part_of_directives`](https://dart.dev/lints/use_string_in_part_of_directives) | Use string in part of directives. ||
@@ -67,7 +70,6 @@
6770
| [`prefer_collection_literals`](https://dart.dev/lints/prefer_collection_literals) | Use collection literals when possible. ||
6871
| [`prefer_conditional_assignment`](https://dart.dev/lints/prefer_conditional_assignment) | Prefer using `??=` over testing for null. ||
6972
| [`prefer_contains`](https://dart.dev/lints/prefer_contains) | Use contains for `List` and `String` instances. ||
70-
| [`prefer_equal_for_default_values`](https://dart.dev/lints/prefer_equal_for_default_values) | Use `=` to separate a named parameter from its default value. | |
7173
| [`prefer_final_fields`](https://dart.dev/lints/prefer_final_fields) | Private field could be final. ||
7274
| [`prefer_for_elements_to_map_fromIterable`](https://dart.dev/lints/prefer_for_elements_to_map_fromIterable) | Prefer 'for' elements when building maps from iterables. ||
7375
| [`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. ||
@@ -94,8 +96,10 @@
9496
| [`unnecessary_string_escapes`](https://dart.dev/lints/unnecessary_string_escapes) | Remove unnecessary backslashes in strings. ||
9597
| [`unnecessary_string_interpolations`](https://dart.dev/lints/unnecessary_string_interpolations) | Unnecessary string interpolation. ||
9698
| [`unnecessary_this`](https://dart.dev/lints/unnecessary_this) | Don't access members with `this` unless avoiding shadowing. ||
99+
| [`unnecessary_to_list_in_spreads`](https://dart.dev/lints/unnecessary_to_list_in_spreads) | Unnecessary toList() in spreads. ||
97100
| [`use_function_type_syntax_for_parameters`](https://dart.dev/lints/use_function_type_syntax_for_parameters) | Use generic function type syntax for parameters. ||
98101
| [`use_rethrow_when_possible`](https://dart.dev/lints/use_rethrow_when_possible) | Use rethrow to rethrow a caught exception. ||
102+
| [`use_super_parameters`](https://dart.dev/lints/use_super_parameters) | Use super-initializer parameters where possible. ||
99103
<!-- recommended -->
100104

101105
[Fix]: https://dart.dev/tools/dart-fix

pkgs/lints/tool/rules.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,11 @@
254254
"description": "Annotate overridden members.",
255255
"fixStatus": "hasFix"
256256
},
257+
{
258+
"name": "annotate_redeclares",
259+
"description": "Annotate redeclared members.",
260+
"fixStatus": "hasFix"
261+
},
257262
{
258263
"name": "avoid_annotating_with_dynamic",
259264
"description": "Avoid annotating with dynamic when not required.",

0 commit comments

Comments
 (0)