Getting Started
Installation
Analyzer plugins are configured in the root analysis_options.yaml of your package or workspace via the top-level plugins section (not the legacy analyzer.plugins list).
To add pyramid_lint to your project, add the following to your analysis_options.yaml file:
plugins:
pyramid_lint: ^3.0.0 # replace with the latest version
Enable lints
All Pyramid Lint rules are disabled by default. Turn them on under diagnostics:
plugins:
pyramid_lint: ^3.0.0
diagnostics:
specific_lint_rule: true
Configure lints
Some lints accept options under options. See each rule’s documentation for available keys.
plugins:
pyramid_lint: ^3.0.0
diagnostics:
max_lines_for_file: true
options:
max_lines_for_file:
max_lines: 300
Lint preset
The following preset enables all rules marked as recommended in Available Lints. Use it as a starting point and remove rules you do not need.
plugins:
pyramid_lint: ^3.0.0
diagnostics:
# Dart lints
always_put_doc_comments_before_annotations: true
always_specify_parameter_names: true
avoid_dynamic: true
avoid_empty_blocks: true
avoid_mutable_global_variables: true
avoid_positional_fields_in_records: true
avoid_unused_parameters: true
no_duplicate_imports: true
no_self_comparisons: true
prefer_async_await: true
prefer_iterable_any: true
prefer_iterable_every: true
prefer_iterable_first: true
prefer_iterable_last: true
prefer_underscore_for_unused_callback_parameters: true
proper_from_environment: true
unnecessary_nullable_return_type: true
# Flutter lints
avoid_public_members_in_states: true
avoid_single_child_in_flex: true
dispose_controllers: true
prefer_async_callback: true
prefer_border_from_border_side: true
prefer_border_radius_all: true
prefer_dedicated_media_query_functions: true
prefer_text_rich: true
prefer_void_callback: true
proper_edge_insets_constructors: true
proper_expanded_and_flexible: true
proper_super_dispose: true
proper_super_init_state: true
use_spacer: true
