[linter] Account for new lints in 3.1.0 release

Bug: https://github.com/dart-lang/linter/pull/4678#issuecomment-1685125753
Change-Id: I8fe1bcea8cc0db26b1375cb95ebe6ec51b6b63ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322380
Auto-Submit: Parker Lougheed <parlough@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
This commit is contained in:
Parker Lougheed 2023-08-23 20:36:05 +00:00 committed by Commit Queue
parent 76e4e80ceb
commit 9e761d5a10
4 changed files with 16 additions and 5 deletions

View file

@ -174,6 +174,17 @@
calling `external void foo([int a, int b])` as `foo(0)` will now result in
`foo(0)`, and not `foo(0, null)`.
### Tools
#### Linter
- Added new static analysis lints you can [enable][enable-lints] in
your package's `analysis_options.yaml` file:
- [`no_self_assignments`](https://dart.dev/lints/no_self_assignments)
- [`no_wildcard_variable_uses`](https://dart.dev/lints/no_wildcard_variable_uses)
[enable-lints]: https://dart.dev/tools/analysis#enabling-linter-rules
## 3.0.7 - 2023-07-26
This is a patch release that:

View file

@ -1,4 +1,4 @@
# 3.1.0-wip
# 3.1.0
- new lint: `no_self_assignments`
- new lint: `no_wildcard_variable_uses`

View file

@ -365,7 +365,7 @@
"sets": [],
"fixStatus": "needsEvaluation",
"details": "**DON'T** assign a variable to itself. Usually this is a mistake.\n\n**BAD:**\n```dart\nclass C {\n int x;\n\n C(int x) {\n x = x;\n }\n}\n```\n\n**GOOD:**\n```dart\nclass C {\n int x;\n\n C(int x) : x = x;\n}\n```\n\n**GOOD:**\n```dart\nclass C {\n int x;\n\n C(int x) {\n this.x = x;\n }\n}\n```\n\n**BAD:**\n```dart\nclass C {\n int _x = 5;\n\n int get x => _x;\n\n set x(int x) {\n _x = x;\n _customUpdateLogic();\n }\n\n void _customUpdateLogic() {\n print('updated');\n }\n\n void example() {\n x = x;\n }\n}\n```\n\n**GOOD:**\n```dart\nclass C {\n int _x = 5;\n\n int get x => _x;\n\n set x(int x) {\n _x = x;\n _customUpdateLogic();\n }\n\n void _customUpdateLogic() {\n print('updated');\n }\n\n void example() {\n _customUpdateLogic();\n }\n}\n```\n\n**BAD:**\n```dart\nclass C {\n int x = 5;\n\n void update(C other) {\n this.x = this.x;\n }\n}\n```\n\n**GOOD:**\n```dart\nclass C {\n int x = 5;\n\n void update(C other) {\n this.x = other.x;\n }\n}\n```\n\n",
"sinceDartSdk": "3.1.0-wip"
"sinceDartSdk": "3.1.0"
},
{
"name": "no_wildcard_variable_uses",
@ -376,7 +376,7 @@
"sets": [],
"fixStatus": "needsEvaluation",
"details": "**DON'T** use wildcard parameters or variables.\n\nWildcard parameters and local variables\n(e.g. underscore-only names like `_`, `__`, `___`, etc.) will\nbecome non-binding in a future version of the Dart language.\nAny existing code that uses wildcard parameters or variables will\nbreak. In anticipation of this change, and to make adoption easier,\nthis lint disallows wildcard and variable parameter uses.\n\n\n**BAD:**\n```dart\nvar _ = 1;\nprint(_); // LINT\n```\n\n```dart\nvoid f(int __) {\n print(__); // LINT multiple underscores too\n}\n```\n\n**GOOD:**\n```dart\nfor (var _ in [1, 2, 3]) count++;\n```\n\n```dart\nvar [a, _, b, _] = [1, 2, 3, 4];\n```\n",
"sinceDartSdk": "3.1.0-wip"
"sinceDartSdk": "3.1.0"
},
{
"name": "prefer_relative_imports",

View file

@ -102,8 +102,8 @@ no_leading_underscores_for_local_identifiers: 2.16.0
no_literal_bool_comparisons: 3.0.0
no_logic_in_create_state: 2.8.1
no_runtimeType_toString: 2.8.1
no_self_assignments: 3.1.0-wip
no_wildcard_variable_uses: 3.1.0-wip
no_self_assignments: 3.1.0
no_wildcard_variable_uses: 3.1.0
non_constant_identifier_names: 2.0.0
noop_primitive_operations: 2.14.0
null_check_on_nullable_type_parameter: 2.12.0