mirror of
https://github.com/flutter/flutter
synced 2024-10-12 11:12:54 +00:00
Sync lints (#126316)
Sync lints with https://github.com/dart-lang/linter/blob/master/example/all.yaml and enable `implicit_reopen` and `type_literal_in_constant_pattern` (which have no violations). Also contains some clean-up work towards enabling `matching_super_parameters`, which is not quite ready yet due to its handling of "private" arguments.
This commit is contained in:
parent
0a63cd70f1
commit
42d9a2b3fa
|
@ -42,7 +42,7 @@ linter:
|
|||
- avoid_bool_literals_in_conditional_expressions
|
||||
# - avoid_catches_without_on_clauses # blocked on https://github.com/dart-lang/linter/issues/3023
|
||||
# - avoid_catching_errors # blocked on https://github.com/dart-lang/linter/issues/3023
|
||||
# avoid_classes_with_only_static_members # # we do this commonly for `abstract final class`es
|
||||
# - avoid_classes_with_only_static_members # we do this commonly for `abstract final class`es
|
||||
- avoid_double_and_int_checks
|
||||
- avoid_dynamic_calls
|
||||
- avoid_empty_else
|
||||
|
@ -93,6 +93,7 @@ linter:
|
|||
- dangling_library_doc_comments
|
||||
- depend_on_referenced_packages
|
||||
- deprecated_consistency
|
||||
# - deprecated_member_use_from_same_package # we allow self-references to deprecated members
|
||||
# - diagnostic_describe_all_properties # enabled only at the framework level (packages/flutter/lib)
|
||||
- directives_ordering
|
||||
# - discarded_futures # too many false positives, similar to unawaited_futures
|
||||
|
@ -107,6 +108,7 @@ linter:
|
|||
- hash_and_equals
|
||||
- implementation_imports
|
||||
- implicit_call_tearoffs
|
||||
- implicit_reopen
|
||||
- invalid_case_patterns
|
||||
- iterable_contains_unrelated_type
|
||||
# - join_return_with_assignment # not required by flutter style
|
||||
|
@ -118,12 +120,14 @@ linter:
|
|||
# - lines_longer_than_80_chars # not required by flutter style
|
||||
- list_remove_unrelated_type
|
||||
# - literal_only_boolean_expressions # too many false positives: https://github.com/dart-lang/linter/issues/453
|
||||
# - matching_super_parameters # blocked on https://github.com/dart-lang/language/issues/2509
|
||||
- missing_whitespace_between_adjacent_strings
|
||||
- no_adjacent_strings_in_list
|
||||
- no_default_cases
|
||||
- no_duplicate_case_values
|
||||
- no_leading_underscores_for_library_prefixes
|
||||
- no_leading_underscores_for_local_identifiers
|
||||
# - no_literal_bool_comparisons # needs quick fix, https://github.com/dart-lang/linter/issues/4333
|
||||
- no_logic_in_create_state
|
||||
# - no_runtimeType_toString # ok in tests; we enable this only in packages/
|
||||
- non_constant_identifier_names
|
||||
|
@ -194,6 +198,7 @@ linter:
|
|||
- tighten_type_of_initializing_formals
|
||||
# - type_annotate_public_apis # subset of always_specify_types
|
||||
- type_init_formals
|
||||
- type_literal_in_constant_pattern
|
||||
# - unawaited_futures # too many false positives, especially with the way AnimationController works
|
||||
- unnecessary_await_in_return
|
||||
- unnecessary_brace_in_string_interps
|
||||
|
|
|
@ -14,7 +14,7 @@ import 'utils.dart';
|
|||
/// Generates the key mapping for Android, based on the information in the key
|
||||
/// data structure given to it.
|
||||
class AndroidCodeGenerator extends PlatformCodeGenerator {
|
||||
AndroidCodeGenerator(super.physicalData, super.logicalData);
|
||||
AndroidCodeGenerator(super.keyData, super.logicalData);
|
||||
|
||||
/// This generates the map of Android key codes to logical keys.
|
||||
String get _androidKeyCodeMap {
|
||||
|
|
|
@ -894,7 +894,7 @@ class _CupertinoEdgeShadowDecoration extends Decoration {
|
|||
class _CupertinoEdgeShadowPainter extends BoxPainter {
|
||||
_CupertinoEdgeShadowPainter(
|
||||
this._decoration,
|
||||
super.onChange,
|
||||
super.onChanged,
|
||||
) : assert(_decoration._colors == null || _decoration._colors!.length > 1);
|
||||
|
||||
final _CupertinoEdgeShadowDecoration _decoration;
|
||||
|
|
|
@ -328,7 +328,7 @@ abstract class MultiDragGestureRecognizer extends GestureRecognizer {
|
|||
}
|
||||
|
||||
class _ImmediatePointerState extends MultiDragPointerState {
|
||||
_ImmediatePointerState(super.initialPosition, super.kind, super.deviceGestureSettings);
|
||||
_ImmediatePointerState(super.initialPosition, super.kind, super.gestureSettings);
|
||||
|
||||
@override
|
||||
void checkForResolutionAfterMove() {
|
||||
|
@ -381,7 +381,7 @@ class ImmediateMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
|
|||
|
||||
|
||||
class _HorizontalPointerState extends MultiDragPointerState {
|
||||
_HorizontalPointerState(super.initialPosition, super.kind, super.deviceGestureSettings);
|
||||
_HorizontalPointerState(super.initialPosition, super.kind, super.gestureSettings);
|
||||
|
||||
@override
|
||||
void checkForResolutionAfterMove() {
|
||||
|
@ -434,7 +434,7 @@ class HorizontalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
|
|||
|
||||
|
||||
class _VerticalPointerState extends MultiDragPointerState {
|
||||
_VerticalPointerState(super.initialPosition, super.kind, super.deviceGestureSettings);
|
||||
_VerticalPointerState(super.initialPosition, super.kind, super.gestureSettings);
|
||||
|
||||
@override
|
||||
void checkForResolutionAfterMove() {
|
||||
|
@ -486,7 +486,7 @@ class VerticalMultiDragGestureRecognizer extends MultiDragGestureRecognizer {
|
|||
}
|
||||
|
||||
class _DelayedPointerState extends MultiDragPointerState {
|
||||
_DelayedPointerState(super.initialPosition, Duration delay, super.kind, super.deviceGestureSettings) {
|
||||
_DelayedPointerState(super.initialPosition, Duration delay, super.kind, super.gestureSettings) {
|
||||
_timer = Timer(delay, _delayPassed);
|
||||
}
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ abstract class SliverChildDelegate {
|
|||
}
|
||||
|
||||
class _SaltedValueKey extends ValueKey<Key> {
|
||||
const _SaltedValueKey(super.key);
|
||||
const _SaltedValueKey(super.value);
|
||||
}
|
||||
|
||||
/// Called to find the new index of a child based on its `key` in case of
|
||||
|
|
|
@ -70,7 +70,7 @@ class FakeImageStreamCompleter extends ImageStreamCompleter {
|
|||
}
|
||||
|
||||
class TestAssetImage extends AssetImage {
|
||||
const TestAssetImage(super.name, this.images);
|
||||
const TestAssetImage(super.assetName, this.images);
|
||||
|
||||
final Map<double, ui.Image> images;
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ class SetFrameSync extends Command {
|
|||
const SetFrameSync(this.enabled, { super.timeout });
|
||||
|
||||
/// Deserializes this command from the value generated by [serialize].
|
||||
SetFrameSync.deserialize(super.params)
|
||||
: enabled = params['enabled']!.toLowerCase() == 'true',
|
||||
SetFrameSync.deserialize(super.json)
|
||||
: enabled = json['enabled']!.toLowerCase() == 'true',
|
||||
super.deserialize();
|
||||
|
||||
/// Whether frameSync should be enabled or disabled.
|
||||
|
|
|
@ -11,8 +11,8 @@ class RequestData extends Command {
|
|||
const RequestData(this.message, { super.timeout });
|
||||
|
||||
/// Deserializes this command from the value generated by [serialize].
|
||||
RequestData.deserialize(super.params)
|
||||
: message = params['message'],
|
||||
RequestData.deserialize(super.json)
|
||||
: message = json['message'],
|
||||
super.deserialize();
|
||||
|
||||
/// The message being sent from the test to the application.
|
||||
|
|
|
@ -10,8 +10,8 @@ class SetSemantics extends Command {
|
|||
const SetSemantics(this.enabled, { super.timeout });
|
||||
|
||||
/// Deserializes this command from the value generated by [serialize].
|
||||
SetSemantics.deserialize(super.params)
|
||||
: enabled = params['enabled']!.toLowerCase() == 'true',
|
||||
SetSemantics.deserialize(super.json)
|
||||
: enabled = json['enabled']!.toLowerCase() == 'true',
|
||||
super.deserialize();
|
||||
|
||||
/// Whether semantics should be enabled (true) or disabled (false).
|
||||
|
|
|
@ -21,7 +21,7 @@ import 'protocol_discovery.dart';
|
|||
/// A partial implementation of Device for desktop-class devices to inherit
|
||||
/// from, containing implementations that are common to all desktop devices.
|
||||
abstract class DesktopDevice extends Device {
|
||||
DesktopDevice(super.identifier, {
|
||||
DesktopDevice(super.id, {
|
||||
required PlatformType super.platformType,
|
||||
required super.ephemeral,
|
||||
required Logger logger,
|
||||
|
|
|
@ -15,7 +15,7 @@ import 'vmservice.dart';
|
|||
const String kFlutterTestOutputsDirEnvName = 'FLUTTER_TEST_OUTPUTS_DIR';
|
||||
class ColdRunner extends ResidentRunner {
|
||||
ColdRunner(
|
||||
super.devices, {
|
||||
super.flutterDevices, {
|
||||
required super.target,
|
||||
required super.debuggingOptions,
|
||||
this.traceStartup = false,
|
||||
|
|
|
@ -79,7 +79,7 @@ class DeviceReloadReport {
|
|||
|
||||
class HotRunner extends ResidentRunner {
|
||||
HotRunner(
|
||||
super.devices, {
|
||||
super.flutterDevices, {
|
||||
required super.target,
|
||||
required super.debuggingOptions,
|
||||
this.benchmarkMode = false,
|
||||
|
|
|
@ -44,7 +44,7 @@ class FlutterTesterApp extends ApplicationPackage {
|
|||
/// also be used as a regular device when `--show-test-device` is provided
|
||||
/// to the flutter command.
|
||||
class FlutterTesterDevice extends Device {
|
||||
FlutterTesterDevice(super.deviceId, {
|
||||
FlutterTesterDevice(super.id, {
|
||||
required ProcessManager processManager,
|
||||
required FlutterVersion flutterVersion,
|
||||
required Logger logger,
|
||||
|
|
|
@ -842,7 +842,7 @@ class NoOpDoctor implements Doctor {
|
|||
}
|
||||
|
||||
class PassingValidator extends DoctorValidator {
|
||||
PassingValidator(super.name);
|
||||
PassingValidator(super.title);
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
|
@ -1082,7 +1082,7 @@ class FakeDoctorValidatorsProvider implements DoctorValidatorsProvider {
|
|||
}
|
||||
|
||||
class PassingGroupedValidator extends DoctorValidator {
|
||||
PassingGroupedValidator(super.name);
|
||||
PassingGroupedValidator(super.title);
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
|
@ -1094,7 +1094,7 @@ class PassingGroupedValidator extends DoctorValidator {
|
|||
}
|
||||
|
||||
class MissingGroupedValidator extends DoctorValidator {
|
||||
MissingGroupedValidator(super.name);
|
||||
MissingGroupedValidator(super.title);
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
|
@ -1106,7 +1106,7 @@ class MissingGroupedValidator extends DoctorValidator {
|
|||
}
|
||||
|
||||
class PartialGroupedValidator extends DoctorValidator {
|
||||
PartialGroupedValidator(super.name);
|
||||
PartialGroupedValidator(super.title);
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
|
@ -1118,7 +1118,7 @@ class PartialGroupedValidator extends DoctorValidator {
|
|||
}
|
||||
|
||||
class PassingGroupedValidatorWithStatus extends DoctorValidator {
|
||||
PassingGroupedValidatorWithStatus(super.name);
|
||||
PassingGroupedValidatorWithStatus(super.title);
|
||||
|
||||
@override
|
||||
Future<ValidationResult> validate() async {
|
||||
|
|
Loading…
Reference in a new issue