107 lines
3.2 KiB
YAML
107 lines
3.2 KiB
YAML
# The following line activates a set of recommended lints for Flutter apps,
|
|
# packages, and plugins designed to encourage good coding practices.
|
|
include: package:flutter_lints/flutter.yaml
|
|
|
|
linter:
|
|
rules:
|
|
- avoid_single_cascade_in_expression_statements: false
|
|
- unawaited_futures
|
|
|
|
analyzer:
|
|
plugins:
|
|
- custom_lint
|
|
exclude:
|
|
- openapi/**
|
|
|
|
dart_code_metrics:
|
|
extends:
|
|
- recommended
|
|
rules:
|
|
# Common
|
|
- arguments-ordering:
|
|
last:
|
|
- child
|
|
- children
|
|
- avoid-accessing-other-classes-private-members
|
|
- avoid-assigning-to-static-field
|
|
- avoid-assignments-as-conditions
|
|
- avoid-async-call-in-sync-function
|
|
- avoid-collapsible-if
|
|
- avoid-collection-equality-checks
|
|
- avoid-collection-mutating-methods
|
|
- avoid-complex-loop-conditions
|
|
- avoid-declaring-call-method
|
|
- avoid-extensions-on-records
|
|
- avoid-function-type-in-records
|
|
- avoid-global-state
|
|
- avoid-inverted-boolean-checks
|
|
- avoid-late-final-reassignment
|
|
- avoid-local-functions
|
|
- avoid-negated-conditions
|
|
- avoid-nested-streams-and-futures
|
|
- avoid-referencing-subclasses
|
|
- binary-expression-operand-order
|
|
- move-variable-outside-iteration
|
|
- prefer-abstract-final-static-class
|
|
- prefer-early-return
|
|
- prefer-first
|
|
- prefer-immediate-return
|
|
- prefer-last
|
|
- prefer-simpler-boolean-expressions
|
|
- prefer-type-over-var
|
|
- use-existing-variable
|
|
# Flutter
|
|
- avoid-border-all
|
|
- avoid-expanded-as-spacer
|
|
- avoid-inherited-widget-in-initstate
|
|
- avoid-late-context
|
|
- avoid-returning-widgets
|
|
- avoid-shrink-wrap-in-lists
|
|
- avoid-single-child-column-or-row
|
|
- avoid-stateless-widget-initialized-fields
|
|
- avoid-wrapping-in-padding
|
|
- prefer-const-border-radius
|
|
- prefer-correct-callback-field-name: false
|
|
- prefer-correct-edge-insets-constructor
|
|
- prefer-define-hero-tag
|
|
- prefer-extracting-callbacks
|
|
- prefer-for-loop-in-children
|
|
- prefer-match-file-name: false
|
|
- prefer-single-widget-per-file:
|
|
ignore-private-widgets: true
|
|
exclude:
|
|
- lib/presentation/**/*.page.dart
|
|
- prefer-sliver-prefix
|
|
- prefer-text-rich
|
|
- prefer-using-list-view
|
|
- prefer-widget-private-members:
|
|
ignore-static: true
|
|
# get-it
|
|
- avoid-functions-in-register-singleton
|
|
# bloc
|
|
- avoid-empty-build-when
|
|
- avoid-passing-bloc-to-bloc
|
|
|
|
custom_lint:
|
|
rules:
|
|
- import_rule_photo_manager:
|
|
message: photo_manager must only be used in MediaRepositories
|
|
restrict: package:photo_manager
|
|
allowed:
|
|
- 'lib/domain/repositories/device_{album,asset}.repository.dart'
|
|
- import_rule_drift:
|
|
message: drift must only be used in entities and repositories
|
|
restrict: package:drift
|
|
allowed:
|
|
- lib/domain/entities/*
|
|
- lib/domain/repositories/*.repository.dart
|
|
- lib/utils/extensions/drift.extension.dart
|
|
|
|
- import_rule_openapi:
|
|
message: openapi must only be used through Api Repositories
|
|
restrict: package:openapi
|
|
allowed:
|
|
- lib/domain/repositories/api/*
|
|
- lib/utils/immich_api_client.dart
|
|
- lib/utils/openapi_patching.dart
|