mirror of
https://github.com/immich-app/immich.git
synced 2025-04-21 15:36:26 +02:00
chore(mobile): lint (#16182)
* lint - convert path to lowercase for finding index * update dcm lint rules --------- Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
This commit is contained in:
parent
f1b98d5f45
commit
70d08a2b2a
2 changed files with 59 additions and 28 deletions
mobile
|
@ -110,51 +110,81 @@ custom_lint:
|
|||
- test/**.dart
|
||||
|
||||
dart_code_metrics:
|
||||
metrics:
|
||||
cyclomatic-complexity: 20
|
||||
number-of-parameters: 4
|
||||
maximum-nesting-level: 5
|
||||
extends:
|
||||
- recommended
|
||||
rules:
|
||||
# Common
|
||||
- avoid-accessing-collections-by-constant-index
|
||||
- arguments-ordering:
|
||||
last:
|
||||
- child
|
||||
- children
|
||||
- avoid-accessing-other-classes-private-members
|
||||
- avoid-cascade-after-if-null
|
||||
- avoid-assigning-to-static-field
|
||||
- avoid-assignments-as-conditions
|
||||
- avoid-async-call-in-sync-function
|
||||
- avoid-collapsible-if
|
||||
- avoid-collection-methods-with-unrelated-types
|
||||
- avoid-double-slash-imports
|
||||
- avoid-duplicate-cascades
|
||||
- avoid-duplicate-patterns
|
||||
- avoid-generics-shadowing
|
||||
- avoid-collection-equality-checks
|
||||
- avoid-complex-loop-conditions
|
||||
- avoid-declaring-call-method
|
||||
- avoid-extensions-on-records
|
||||
- avoid-function-type-in-records
|
||||
- avoid-future-ignore
|
||||
- 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
|
||||
- avoid-unnecessary-continue
|
||||
- avoid-unnecessary-nullable-return-type: false
|
||||
- binary-expression-operand-order
|
||||
- move-variable-outside-iteration
|
||||
- pattern-fields-ordering
|
||||
- prefer-abstract-final-static-class
|
||||
- prefer-commenting-future-delayed
|
||||
- prefer-early-return
|
||||
- prefer-first
|
||||
- prefer-immediate-return
|
||||
- prefer-last
|
||||
- prefer-simpler-boolean-expressions
|
||||
- prefer-switch-expression
|
||||
- prefer-type-over-var
|
||||
- use-existing-destructuring
|
||||
- use-existing-variable
|
||||
# Flutter
|
||||
- add-copy-with:
|
||||
file-name-pattern: '.model.dart'
|
||||
- always-remove-listener
|
||||
- avoid-border-all
|
||||
- avoid-empty-setstate
|
||||
- avoid-complex-arithmetic-expressions
|
||||
- avoid-expanded-as-spacer
|
||||
- avoid-incomplete-copy-with
|
||||
- avoid-if-with-many-branches
|
||||
- avoid-inherited-widget-in-initstate
|
||||
- avoid-late-context
|
||||
- avoid-recursive-widget-calls
|
||||
- avoid-returning-widgets
|
||||
- avoid-shrink-wrap-in-lists
|
||||
- avoid-single-child-column-or-row
|
||||
- avoid-state-constructors
|
||||
- avoid-stateless-widget-initialized-fields
|
||||
- avoid-unnecessary-overrides-in-state
|
||||
- avoid-unnecessary-stateful-widgets
|
||||
- avoid-wrapping-in-padding
|
||||
- dispose-fields
|
||||
- prefer-align-over-container
|
||||
- prefer-const-border-radius
|
||||
- prefer-correct-callback-field-name: false
|
||||
- prefer-correct-edge-insets-constructor
|
||||
- prefer-dedicated-media-query-methods
|
||||
- prefer-define-hero-tag
|
||||
- prefer-extracting-callbacks
|
||||
- prefer-single-widget-per-file:
|
||||
ignore-private-widgets: true
|
||||
- prefer-for-loop-in-children
|
||||
- prefer-match-file-name: false
|
||||
- prefer-sliver-prefix
|
||||
- prefer-spacing
|
||||
- prefer-text-rich
|
||||
- prefer-transform-over-container
|
||||
- prefer-using-list-view
|
||||
- proper-super-calls
|
||||
- use-setstate-synchronously
|
||||
- prefer-widget-private-members:
|
||||
ignore-static: true
|
||||
- use-closest-build-context
|
||||
# riverpod
|
||||
- avoid-calling-notifier-members-inside-build
|
||||
- avoid-notifier-constructors
|
||||
- avoid-ref-read-inside-build
|
||||
- avoid-ref-watch-outside-build
|
||||
- avoid-unnecessary-consumer-widgets
|
||||
- dispose-provided-instances
|
||||
- use-ref-read-synchronously
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import 'package:analyzer/error/listener.dart';
|
||||
import 'package:analyzer/error/error.dart' show ErrorSeverity;
|
||||
import 'package:analyzer/error/listener.dart';
|
||||
import 'package:custom_lint_builder/custom_lint_builder.dart';
|
||||
// ignore: depend_on_referenced_packages
|
||||
import 'package:glob/glob.dart';
|
||||
|
@ -65,7 +65,8 @@ class ImportRule extends DartLintRule {
|
|||
) {
|
||||
if (_rootOffset == -1) {
|
||||
const project = "/immich/mobile/";
|
||||
_rootOffset = resolver.path.indexOf(project) + project.length;
|
||||
_rootOffset =
|
||||
resolver.path.toLowerCase().indexOf(project) + project.length;
|
||||
}
|
||||
final path = resolver.path.substring(_rootOffset);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue