mirror of
https://github.com/flutter/flutter
synced 2024-08-27 20:10:11 +00:00
update list of lints (#47661)
This commit is contained in:
parent
fcaf9c4070
commit
4adad2c652
|
@ -59,6 +59,7 @@ linter:
|
|||
- avoid_classes_with_only_static_members
|
||||
# - avoid_double_and_int_checks # only useful when targeting JS runtime
|
||||
- avoid_empty_else
|
||||
# - avoid_equals_and_hash_code_on_mutable_classes # not yet tested
|
||||
- avoid_field_initializers_in_const_classes
|
||||
- avoid_function_literals_in_foreach_calls
|
||||
# - avoid_implementing_value_types # not yet tested
|
||||
|
@ -66,6 +67,7 @@ linter:
|
|||
# - avoid_js_rounded_ints # only useful when targeting JS runtime
|
||||
- avoid_null_checks_in_equality_operators
|
||||
# - avoid_positional_boolean_parameters # not yet tested
|
||||
# - avoid_print # not yet tested
|
||||
# - avoid_private_typedef_functions # we prefer having typedef (discussion in https://github.com/flutter/flutter/pull/16356)
|
||||
- avoid_relative_lib_imports
|
||||
- avoid_renaming_method_parameters
|
||||
|
@ -80,9 +82,12 @@ linter:
|
|||
- avoid_slow_async_io
|
||||
- avoid_types_as_parameter_names
|
||||
# - avoid_types_on_closure_parameters # conflicts with always_specify_types
|
||||
# - avoid_unnecessary_containers # not yet tested
|
||||
- avoid_unused_constructor_parameters
|
||||
- avoid_void_async
|
||||
# - avoid_web_libraries_in_flutter # not yet tested
|
||||
- await_only_futures
|
||||
- camel_case_extensions
|
||||
- camel_case_types
|
||||
- cancel_subscriptions
|
||||
# - cascade_invocations # not yet tested
|
||||
|
@ -110,6 +115,7 @@ linter:
|
|||
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/sdk/issues/34181
|
||||
- no_adjacent_strings_in_list
|
||||
- no_duplicate_case_values
|
||||
# - no_logic_in_create_state # not yet tested
|
||||
- non_constant_identifier_names
|
||||
# - null_closures # not yet tested
|
||||
# - omit_local_variable_types # opposite of always_specify_types
|
||||
|
@ -149,9 +155,11 @@ linter:
|
|||
# - prefer_interpolation_to_compose_strings # not yet tested
|
||||
- prefer_is_empty
|
||||
- prefer_is_not_empty
|
||||
- prefer_is_not_operator
|
||||
- prefer_iterable_whereType
|
||||
# - prefer_mixin # https://github.com/dart-lang/language/issues/32
|
||||
# - prefer_null_aware_operators # disable until NNBD, see https://github.com/flutter/flutter/pull/32711#issuecomment-492930932
|
||||
# - prefer_relative_imports # not yet tested
|
||||
- prefer_single_quotes
|
||||
- prefer_spread_collections
|
||||
- prefer_typing_uninitialized_variables
|
||||
|
@ -172,6 +180,7 @@ linter:
|
|||
# - unnecessary_await_in_return # not yet tested
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_const
|
||||
# - unnecessary_final # conflicts with prefer_final_locals
|
||||
- unnecessary_getters_setters
|
||||
# - unnecessary_lambdas # has false positives: https://github.com/dart-lang/linter/issues/498
|
||||
- unnecessary_new
|
||||
|
|
|
@ -216,7 +216,7 @@ class ForcePressGestureRecognizer extends OneSequenceGestureRecognizer {
|
|||
// If the device has a maximum pressure of less than or equal to 1, it
|
||||
// doesn't have touch pressure sensing capabilities. Do not participate
|
||||
// in the gesture arena.
|
||||
if (!(event is PointerUpEvent) && event.pressureMax <= 1.0) {
|
||||
if (event is! PointerUpEvent && event.pressureMax <= 1.0) {
|
||||
resolve(GestureDisposition.rejected);
|
||||
} else {
|
||||
startTrackingPointer(event.pointer, event.transform);
|
||||
|
|
|
@ -687,8 +687,7 @@ class _MotionEventsDispatcher {
|
|||
return AndroidPointerProperties(id: pointerId, toolType: toolType);
|
||||
}
|
||||
|
||||
bool isSinglePointerAction(PointerEvent event) =>
|
||||
!(event is PointerDownEvent) && !(event is PointerUpEvent);
|
||||
bool isSinglePointerAction(PointerEvent event) => event is! PointerDownEvent && event is! PointerUpEvent;
|
||||
}
|
||||
|
||||
/// A render object for embedding a platform view.
|
||||
|
|
|
@ -148,7 +148,7 @@ void main() {
|
|||
),
|
||||
);
|
||||
ContainerLayer layer = RendererBinding.instance.renderView.debugLayer;
|
||||
while (layer != null && !(layer is OpacityLayer))
|
||||
while (layer != null && layer is! OpacityLayer)
|
||||
layer = layer.firstChild as ContainerLayer;
|
||||
expect(layer, isInstanceOf<OpacityLayer>());
|
||||
final OpacityLayer opacityLayer = layer as OpacityLayer;
|
||||
|
|
|
@ -223,7 +223,7 @@ class AndroidApk extends ApplicationPackage {
|
|||
String actionName = '';
|
||||
String categoryName = '';
|
||||
for (xml.XmlNode node in element.children) {
|
||||
if (!(node is xml.XmlElement)) {
|
||||
if (node is! xml.XmlElement) {
|
||||
continue;
|
||||
}
|
||||
final xml.XmlElement xmlElement = node as xml.XmlElement;
|
||||
|
|
|
@ -201,7 +201,7 @@ class Plugin {
|
|||
static List<String> _validateMultiPlatformYaml(YamlMap yaml) {
|
||||
bool isInvalid(String key, bool Function(YamlMap) validate) {
|
||||
final dynamic value = yaml[key];
|
||||
if (!(value is YamlMap)) {
|
||||
if (value is! YamlMap) {
|
||||
return false;
|
||||
}
|
||||
final YamlMap yamlValue = value as YamlMap;
|
||||
|
|
|
@ -158,7 +158,7 @@ class _BufferedStreamController<T> {
|
|||
StreamController<T> get _streamController {
|
||||
_streamControllerInstance ??= StreamController<T>.broadcast(onListen: () {
|
||||
for (dynamic event in _events) {
|
||||
assert(!(T is List));
|
||||
assert(T is! List);
|
||||
if (event is T) {
|
||||
_streamControllerInstance.add(event);
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue