flutter_flutter/packages/flutter_tools/analysis_options.yaml
Ben Konyi 1709c884aa
[ Tool ] Enable omit_obvious_*_types and specify_nonobvious_*_types lints (#172018)
Sources under `packages/flutter_tools/` aren't accessible to the average
Flutter user by navigating through sources from their projects, so it
doesn't need to be as explicitly verbose with types for readability
purposes. The `always_specify_types` lint results in extremely verbose
code within the tool which adds little value.

This change disables `always_specify_types` in favor of a new set of
lints that aim to reduce verbosity by removing obvious types while also
maintaining readability in cases where variable types otherwise wouldn't
be obvious:

  - `omit_obvious_local_variable_types`
  - `omit_obvious_property_types`
  - `specify_nonobvious_local_variable_types`
  - `specify_nonobvious_property_types`
2025-07-11 19:32:57 +00:00

20 lines
1.1 KiB
YAML

include: ../analysis_options.yaml
linter:
rules:
always_specify_types: false # This isn't necessary for tool code which doesn't have the same explicit readability requirements as the framework.
avoid_catches_without_on_clauses: true
avoid_catching_errors: false # TODO(ianh): we should refactor the tool codebase to avoid relying on this so much
comment_references: true
library_private_types_in_public_api: false # Tool does not have any public API.
no_runtimeType_toString: false # We use runtimeType for debugging in the tool.
omit_obvious_local_variable_types: true # Reduce overall verbosity of tool code.
omit_obvious_property_types: true # Reduce overall verbosity of tool code.
only_throw_errors: true
prefer_relative_imports: true
public_member_api_docs: false # Tool does not have any public API.
specify_nonobvious_local_variable_types: true # Reduce overall verbosity of tool code.
specify_nonobvious_property_types: true # Reduce overall verbosity of tool code.
unawaited_futures: true
unintended_html_in_doc_comment: true