analyzer: Deprecate the avoid_null_checks_in_equality_operators lint rule
Work towards https://github.com/dart-lang/sdk/issues/59514 We introduced a new Warning called NON_NULLABLE_EQUALS_PARAMETER a few releases ago. It warns when the parameter of an `operator ==` override has a nullable type: > The parameter type of '==' operators should be non-nullable. I didn't realize it at the time, but that new warning, plus null safety, basically replace the `avoid_null_checks_in_equality_operators` lint rule. This rule reports doing any null-check work on a nullable parameter of an `operator ==` override. Change-Id: Ibd8139cd5804a9ccb6cc07d2187c9305a336c7cd Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/467922 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Queue
parent
6c0ae6015d
commit
04753f6565
@@ -50,6 +50,9 @@
|
||||
- Fixes to the 'Extract Widget' refactoring.
|
||||
- (Thanks [@FMorschel](https://github.com/FMorschel) and
|
||||
[@DanTup](https://github.com/DanTup) for many of the above enhancements!)
|
||||
- The `avoid_null_checks_in_equality_operators` lint rule is now deprecated.
|
||||
- The `prefer_final_parameters` lint rule is now deprecated.
|
||||
- The `use_if_null_to_convert_nulls_to_bools` lint rule is now deprecated.
|
||||
|
||||
#### Pub
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@ linter:
|
||||
- avoid_init_to_null
|
||||
- avoid_js_rounded_ints
|
||||
- avoid_multiple_declarations_per_line
|
||||
- avoid_null_checks_in_equality_operators
|
||||
- avoid_positional_boolean_parameters
|
||||
- avoid_print
|
||||
- avoid_private_typedef_functions
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import 'package:analyzer/analysis_rule/analysis_rule.dart';
|
||||
import 'package:analyzer/analysis_rule/rule_context.dart';
|
||||
import 'package:analyzer/analysis_rule/rule_state.dart';
|
||||
import 'package:analyzer/analysis_rule/rule_visitor_registry.dart';
|
||||
import 'package:analyzer/dart/ast/ast.dart';
|
||||
import 'package:analyzer/dart/ast/token.dart';
|
||||
@@ -11,6 +12,7 @@ import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/dart/element/element.dart';
|
||||
import 'package:analyzer/dart/element/nullability_suffix.dart';
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:pub_semver/pub_semver.dart';
|
||||
|
||||
import '../analyzer.dart';
|
||||
import '../diagnostic.dart' as diag;
|
||||
@@ -43,6 +45,7 @@ class AvoidNullChecksInEqualityOperators extends AnalysisRule {
|
||||
: super(
|
||||
name: LintNames.avoid_null_checks_in_equality_operators,
|
||||
description: _desc,
|
||||
state: RuleState.deprecated(since: Version(3, 11, 0)),
|
||||
);
|
||||
|
||||
@override
|
||||
|
||||
@@ -1728,6 +1728,7 @@ LinterLintCode:
|
||||
correctionMessage: "Try removing the comparison."
|
||||
state:
|
||||
stable: "2.0"
|
||||
deprecated: "3.11"
|
||||
categories: [style]
|
||||
hasPublishedDocs: false
|
||||
deprecatedDetails: |-
|
||||
|
||||
Reference in New Issue
Block a user